@eeacms/volto-eea-map 4.1.0 → 5.0.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +5 -2
  3. package/src/Arcgis/Editor/Editor.jsx +130 -0
  4. package/src/Arcgis/Editor/EditorContext.jsx +2 -0
  5. package/src/Arcgis/Editor/Fold/Fold.jsx +56 -0
  6. package/src/Arcgis/Editor/Panels/Panel.jsx +8 -0
  7. package/src/Arcgis/Editor/Panels/SettingsGeneralPanel.jsx +217 -0
  8. package/src/Arcgis/Editor/Panels/SettingsLayersPanel.jsx +216 -0
  9. package/src/Arcgis/Editor/Panels/StructureBaseLayerPanel.jsx +60 -0
  10. package/src/Arcgis/Editor/Panels/StructureLayersPanel.jsx +394 -0
  11. package/src/Arcgis/Editor/Panels/StructureWidgetsPanel.jsx +181 -0
  12. package/src/Arcgis/Editor/Panels/index.js +6 -0
  13. package/src/Arcgis/Editor/SidebarGroup.jsx +62 -0
  14. package/src/Arcgis/Layer/Layer.jsx +247 -0
  15. package/src/Arcgis/Map/Map.jsx +287 -0
  16. package/src/Arcgis/Map/MapBuilder.jsx +111 -0
  17. package/src/Arcgis/Map/MapContext.jsx +3 -0
  18. package/src/Arcgis/Widget/Widget.jsx +170 -0
  19. package/src/Arcgis/helpers.js +140 -0
  20. package/src/Blocks/EmbedEEAMap/Edit.jsx +40 -0
  21. package/src/Blocks/EmbedEEAMap/View.jsx +122 -0
  22. package/src/Blocks/EmbedEEAMap/helpers.js +12 -0
  23. package/src/Blocks/EmbedEEAMap/schema.js +126 -0
  24. package/src/{components → Toolbar}/Share.jsx +1 -1
  25. package/src/{components/ExtraViews.jsx → Toolbar/Toolbar.jsx} +14 -16
  26. package/src/{components/visualization → Views}/VisualizationView.jsx +8 -9
  27. package/src/Widgets/ArcgisColorPickerWidget.jsx +95 -0
  28. package/src/Widgets/ArcgisRendererWidget/ArcgisRendererWidget.jsx +106 -0
  29. package/src/Widgets/ArcgisRendererWidget/RendererEditor/ClassBreaks.jsx +8 -0
  30. package/src/Widgets/ArcgisRendererWidget/RendererEditor/Dictionary.jsx +8 -0
  31. package/src/Widgets/ArcgisRendererWidget/RendererEditor/DotDensity.jsx +8 -0
  32. package/src/Widgets/ArcgisRendererWidget/RendererEditor/Heatmap.jsx +8 -0
  33. package/src/Widgets/ArcgisRendererWidget/RendererEditor/PieChart.jsx +8 -0
  34. package/src/Widgets/ArcgisRendererWidget/RendererEditor/Simple.jsx +109 -0
  35. package/src/Widgets/ArcgisRendererWidget/RendererEditor/UniqueValue.jsx +8 -0
  36. package/src/Widgets/ArcgisRendererWidget/RendererEditor/_Editor.jsx +29 -0
  37. package/src/Widgets/ArcgisRendererWidget/RendererEditor/_EditorModal.jsx +88 -0
  38. package/src/Widgets/ArcgisRendererWidget/RendererEditor/_defaults.js +30 -0
  39. package/src/Widgets/ArcgisSliderWidget.jsx +79 -0
  40. package/src/Widgets/ArcgisViewpointWidget.jsx +112 -0
  41. package/src/{components/visualization → Widgets}/VisualizationViewWidget.jsx +9 -10
  42. package/src/Widgets/VisualizationWidget.jsx +200 -0
  43. package/src/arcgis.js +48 -0
  44. package/src/constants.js +225 -7
  45. package/src/hocs/withArcgis.jsx +27 -0
  46. package/src/hooks/useChangedProps.jsx +24 -0
  47. package/src/hooks/useClass.jsx +17 -0
  48. package/src/hooks/useCopyToClipboard.jsx +25 -0
  49. package/src/index.js +16 -16
  50. package/src/jsoneditor.js +72 -0
  51. package/src/styles/editor.less +446 -0
  52. package/src/styles/map.less +3 -0
  53. package/src/components/Blocks/EmbedEEAMap/Edit.jsx +0 -161
  54. package/src/components/Blocks/EmbedEEAMap/Schema.js +0 -161
  55. package/src/components/Blocks/EmbedEEAMap/View.jsx +0 -79
  56. package/src/components/Blocks/EmbedEEAMap/helpers.js +0 -45
  57. package/src/components/LegendView.jsx +0 -150
  58. package/src/components/Webmap.jsx +0 -371
  59. package/src/components/index.js +0 -6
  60. package/src/components/visualization/VisualizationEditorWidget.jsx +0 -122
  61. package/src/components/visualization/panelsSchema.js +0 -229
  62. package/src/components/widgets/DataQueryWidget.jsx +0 -51
  63. package/src/components/widgets/LayerSelectWidget.jsx +0 -463
  64. package/src/components/widgets/LayersPanelWidget.jsx +0 -59
  65. package/src/components/widgets/SimpleColorPickerWidget.jsx +0 -121
  66. package/src/hocs/index.js +0 -3
  67. package/src/hocs/withDeviceSize.jsx +0 -45
  68. package/src/less/global.less +0 -253
  69. package/src/less/variables.less +0 -5
  70. package/src/utils.js +0 -151
  71. /package/src/{components → Toolbar}/FigureNote.jsx +0 -0
  72. /package/src/{components → Toolbar}/MoreInfoLink.jsx +0 -0
  73. /package/src/{components → Toolbar}/Sources.jsx +0 -0
@@ -1,253 +0,0 @@
1
- @import (multiple, reference, optional) '../../theme.config';
2
-
3
- /* Enables customization of addons */
4
- .loadAddonOverrides() {
5
- @import (optional)
6
- '@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.overrides';
7
- }
8
-
9
- /* Helper to load variables */
10
- .loadAddonVariables() {
11
- @import (optional) '@{addonelement}.variables';
12
- @import (optional)
13
- '@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.variables';
14
- }
15
-
16
- @import './variables.less';
17
-
18
- .esri-map-wrapper {
19
- margin-bottom: 1rem;
20
- }
21
-
22
- // TODO: pull out colors and dimensions into variables
23
- .map-edit-container {
24
- display: flex;
25
- }
26
-
27
- .map-modal-trigger-button {
28
- margin-bottom: 10px !important;
29
- }
30
-
31
- #map-editor-modal {
32
- top: auto;
33
- left: auto !important;
34
- width: 95% !important;
35
- }
36
-
37
- #map-widget-toggle {
38
- color: blue !important;
39
- }
40
-
41
- .map-text-view {
42
- display: flex;
43
- padding: 1rem 0;
44
- }
45
-
46
- .map-editor-modal {
47
- width: '95% !important';
48
- }
49
-
50
- .webmap-container {
51
- position: sticky;
52
- top: 10px;
53
- }
54
-
55
- .map-edit-actions-container {
56
- padding: 5px 0;
57
- margin-right: 10px;
58
- margin-left: auto;
59
- }
60
-
61
- .layer-reset-button {
62
- margin-top: 5px !important;
63
- animation: fadeDown 0.2s ease-in;
64
- }
65
-
66
- .layer-check-button {
67
- margin-top: 5px !important;
68
- margin-left: auto !important;
69
- animation: fadeDown 0.2s ease-in;
70
- }
71
-
72
- .layer-submit-button {
73
- margin-top: 5px !important;
74
- margin-left: auto !important;
75
- animation: fadeDown 0.2s ease-in;
76
- }
77
-
78
- .ruleGroup {
79
- border: 1px solid lightgray !important;
80
- margin: 10px 0;
81
- background-color: transparent !important;
82
- }
83
-
84
- .ruleGroup-addRule {
85
- padding: 7px 10px !important;
86
- border-radius: 5px;
87
- background-color: darkgray !important;
88
- color: white;
89
- cursor: pointer;
90
- font-size: 12px;
91
- font-weight: bold;
92
- }
93
-
94
- .ruleGroup-addGroup {
95
- padding: 7px 10px !important;
96
- border-radius: 5px;
97
- background-color: darkgray !important;
98
- color: white;
99
- cursor: pointer;
100
- font-size: 12px;
101
- font-weight: bold;
102
- }
103
-
104
- .ruleGroup-combinators {
105
- padding: 0.3em 0 !important;
106
- }
107
-
108
- .rule-operators {
109
- padding: 0.3em 0 !important;
110
- }
111
-
112
- .rule-value {
113
- padding: 0.3em 0 !important;
114
- }
115
-
116
- .rule-fields {
117
- padding: 0.3em 0 !important;
118
- }
119
-
120
- .rule-remove {
121
- padding: 1px 6px !important;
122
- border: 2px solid #d02144 !important;
123
- border-radius: 50px;
124
- color: #d02144;
125
- cursor: pointer;
126
- }
127
-
128
- .map_source_title {
129
- font-weight: bold;
130
- }
131
-
132
- .map_source_description {
133
- margin-left: 5px;
134
- }
135
-
136
- .data-query-widget-field {
137
- margin: 10px 0;
138
- }
139
-
140
- .spaced-row {
141
- width: 100%;
142
- /* border-bottom: 1px solid lightgray; */
143
-
144
- padding-bottom: 10px;
145
- }
146
-
147
- .legend-title {
148
- display: flex;
149
- width: fit-content;
150
- align-items: center;
151
- margin: 0 !important;
152
- }
153
-
154
- .data-param-title {
155
- padding-bottom: 15px;
156
- border-bottom: 1px solid lightgray;
157
- font-size: 16px;
158
- }
159
-
160
- .data-param-values {
161
- padding-bottom: 15px;
162
- border-bottom: 1px solid lightgray;
163
- }
164
-
165
- .map-layer-description-field {
166
- width: 100%;
167
- }
168
-
169
- .map-layer-description-field
170
- > .slate_wysiwyg
171
- > .grid
172
- > .stretched.row
173
- > .four.wide.column {
174
- display: none !important;
175
- }
176
-
177
- .map-layer-description-field
178
- > .slate_wysiwyg
179
- > .grid
180
- > .stretched.row
181
- > .eight.wide.column {
182
- width: 100% !important;
183
- padding: 10px 0 !important;
184
- }
185
-
186
- .legend-container {
187
- display: flex;
188
- flex-direction: column;
189
- }
190
-
191
- .map_source_param_container {
192
- display: flex;
193
- }
194
-
195
- .extra-view-external-icon {
196
- color: inherit;
197
- font-size: 10px;
198
- }
199
-
200
- .extra-view-external-button {
201
- padding: 2px 15px !important;
202
- }
203
-
204
- .map-number-input {
205
- padding: 5px !important;
206
- }
207
-
208
- .map-range-input {
209
- width: 100%;
210
- margin: 7px 0;
211
- color: green;
212
- }
213
-
214
- .eea-map-info {
215
- display: flex;
216
- flex-direction: row;
217
-
218
- > * {
219
- padding: 0 0.5rem;
220
- border-collapse: collapse;
221
- }
222
-
223
- > *:first-child {
224
- padding-left: 0;
225
- }
226
-
227
- > *:last-child {
228
- padding-right: 0;
229
- }
230
-
231
- > *:not(:last-child) {
232
- border-right: 1px solid @textColor;
233
- }
234
- }
235
-
236
- @keyframes fadeDown {
237
- from {
238
- opacity: 0;
239
- transform: translate3d(0, -20%, 0);
240
- }
241
-
242
- to {
243
- opacity: 1;
244
- transform: translate3d(0, 0, 0);
245
- }
246
- }
247
-
248
- @media print {
249
- .layer-legend-item-color {
250
- max-width: 0.2cm;
251
- height: 0.2cm;
252
- }
253
- }
@@ -1,5 +0,0 @@
1
- @type: extra;
2
-
3
- @element: custom;
4
-
5
- @grey-1: #f9f9f9;
package/src/utils.js DELETED
@@ -1,151 +0,0 @@
1
- /* eslint-disable no-throw-literal */
2
- import React from 'react';
3
- import { getBaseUrl } from '@plone/volto/helpers';
4
-
5
- const setLegendColumns = (legendsNo, device) => {
6
- switch (device) {
7
- case 'widescreen':
8
- return legendsNo ? legendsNo : 1;
9
- case 'large':
10
- return legendsNo ? legendsNo : 1;
11
- case 'computer':
12
- return legendsNo ? legendsNo : 1;
13
- case 'tablet':
14
- return 1;
15
- case 'mobile':
16
- return 1;
17
- default:
18
- return 1;
19
- }
20
- };
21
-
22
- const fetchArcGISData = async (url) => {
23
- const res = await fetch(`${getBaseUrl('')}/cors-proxy/${url}?f=json`);
24
- if (res.status !== 200) {
25
- const error = await res.json();
26
- throw { message: error.message, status: error.cod };
27
- }
28
- const data = await res.json();
29
- if (data.error && data.error.code === 400) {
30
- throw { message: data.error.message.message, status: data.status };
31
- }
32
- return data;
33
- };
34
-
35
- const applyQueriesToMapLayers = (
36
- map_visualization,
37
- block_data_query_params,
38
- enable_queries,
39
- ) => {
40
- //break reference to the original map_visualization object
41
- //so i safely manipulate data
42
- var altMapData = map_visualization
43
- ? JSON.parse(JSON.stringify(map_visualization))
44
- : '';
45
-
46
- var rules = [];
47
- if (
48
- enable_queries &&
49
- block_data_query_params &&
50
- block_data_query_params.length > 0 &&
51
- altMapData.layers &&
52
- altMapData.layers.map_layers &&
53
- altMapData.layers.map_layers.length > 0
54
- ) {
55
- altMapData.layers.map_layers.forEach((l, j) => {
56
- block_data_query_params.forEach((param, i) => {
57
- const matchingFields =
58
- l.map_layer && l.map_layer.fields && l.map_layer.fields.length > 0
59
- ? l.map_layer.fields.filter(
60
- (field, k) =>
61
- field.name === param.alias || field.name === param.i,
62
- )
63
- : [];
64
- matchingFields.forEach((m, i) => {
65
- const newRules = param.v
66
- ? param.v.map((paramVal, i) => {
67
- return {
68
- field: m.name,
69
- operator: '=',
70
- value: paramVal,
71
- };
72
- })
73
- : [];
74
- const concatRules = rules.concat(newRules);
75
- const filteredRules = concatRules.filter(
76
- (v, i, a) =>
77
- a.findLastIndex(
78
- (v2) => v2.field === v.field && v2.value === v.value,
79
- ) === i,
80
- );
81
- rules = filteredRules;
82
- });
83
- });
84
- let autoQuery = {
85
- combinator: 'or',
86
- rules,
87
- };
88
- altMapData.layers.map_layers[j].map_layer.query = autoQuery;
89
- });
90
- }
91
- return altMapData;
92
- };
93
-
94
- const updateBlockQueryFromPageQuery = (data_query, data_query_params) => {
95
- var pageDataQuery = JSON.parse(JSON.stringify(data_query));
96
- var blockDataQuery = data_query_params
97
- ? JSON.parse(JSON.stringify(data_query_params))
98
- : '';
99
- var newDataQuery = pageDataQuery.map((parameter, index) => {
100
- //check if the parameter exists in data and has value
101
- // then get its alias value and update it
102
- //check if data_query param value is changed
103
- //and change it in block data
104
- if (
105
- blockDataQuery &&
106
- blockDataQuery[index] &&
107
- parameter.i &&
108
- blockDataQuery[index].i &&
109
- parameter.i === blockDataQuery[index].i
110
- ) {
111
- return {
112
- ...parameter,
113
- alias: blockDataQuery[index]?.alias ? blockDataQuery[index]?.alias : '',
114
- v: parameter?.v ? parameter?.v : '',
115
- };
116
- }
117
-
118
- return parameter;
119
- });
120
- return newDataQuery;
121
- };
122
-
123
- const useCopyToClipboard = (text) => {
124
- const [copyStatus, setCopyStatus] = React.useState('inactive');
125
- const copy = React.useCallback(() => {
126
- navigator.clipboard.writeText(text).then(
127
- () => setCopyStatus('copied'),
128
- () => setCopyStatus('failed'),
129
- );
130
- }, [text]);
131
-
132
- React.useEffect(() => {
133
- if (copyStatus === 'inactive') {
134
- return;
135
- }
136
-
137
- const timeout = setTimeout(() => setCopyStatus('inactive'), 3000);
138
-
139
- return () => clearTimeout(timeout);
140
- }, [copyStatus]);
141
-
142
- return [copyStatus, copy];
143
- };
144
-
145
- export {
146
- setLegendColumns,
147
- fetchArcGISData,
148
- applyQueriesToMapLayers,
149
- updateBlockQueryFromPageQuery,
150
- useCopyToClipboard,
151
- };
File without changes
File without changes
File without changes