@eeacms/volto-eea-map 4.0.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.
- package/CHANGELOG.md +36 -1
- package/package.json +6 -3
- 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 +9 -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 -365
- 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 -456
- 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
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,42 @@ 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
|
-
### [
|
|
7
|
+
### [5.0.0](https://github.com/eea/volto-eea-map/compare/4.1.0...5.0.0) - 25 July 2024
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: Automated code fix [eea-jenkins - [`aadf771`](https://github.com/eea/volto-eea-map/commit/aadf771b40e0a190c29de42d99466d2e6ef440e7)]
|
|
12
|
+
- style: Automated code fix [eea-jenkins - [`edfae3b`](https://github.com/eea/volto-eea-map/commit/edfae3b8ab4cdef23ae23ed7ea008043601dd783)]
|
|
13
|
+
- style: Automated code fix [eea-jenkins - [`fd6c49f`](https://github.com/eea/volto-eea-map/commit/fd6c49f6d0d5081a230f9b4427844eace0321361)]
|
|
14
|
+
- style: Automated code fix [eea-jenkins - [`5bcee12`](https://github.com/eea/volto-eea-map/commit/5bcee12ab667ad89096baae214ade24fa1c98fd1)]
|
|
15
|
+
- style: Automated code fix [eea-jenkins - [`9bf0079`](https://github.com/eea/volto-eea-map/commit/9bf0079694c16fa20c857f896e303850cf67da43)]
|
|
16
|
+
- style: Automated code fix [eea-jenkins - [`3d9adb6`](https://github.com/eea/volto-eea-map/commit/3d9adb6cee7ff1c45ae88d816e7f17de4bbaba37)]
|
|
17
|
+
- style: Automated code fix [eea-jenkins - [`f310427`](https://github.com/eea/volto-eea-map/commit/f3104279ad719b16a149a357c0eab2f8b7fd8ef7)]
|
|
18
|
+
- style: Automated code fix [eea-jenkins - [`fcf5adf`](https://github.com/eea/volto-eea-map/commit/fcf5adf32a73d388d97597dd9c88c3da362f90b8)]
|
|
19
|
+
|
|
20
|
+
#### :hammer_and_wrench: Others
|
|
21
|
+
|
|
22
|
+
- remove uneeded logo [Miu Razvan - [`759a07b`](https://github.com/eea/volto-eea-map/commit/759a07b587b8298d88800346a230fd55304aadf9)]
|
|
23
|
+
- fix bugs [Miu Razvan - [`ccccc8a`](https://github.com/eea/volto-eea-map/commit/ccccc8a1fac321d3968ffdc0843ff87138748476)]
|
|
24
|
+
- fix infinite rerenders [Miu Razvan - [`8dbb501`](https://github.com/eea/volto-eea-map/commit/8dbb5016741f2518668cfe1d40abe1484b53bfc3)]
|
|
25
|
+
- lint fix [Miu Razvan - [`56c2138`](https://github.com/eea/volto-eea-map/commit/56c2138099d7425e21a566cb13fee814acdaea68)]
|
|
26
|
+
- merge origin/develop into revamp branch [Miu Razvan - [`01ea06c`](https://github.com/eea/volto-eea-map/commit/01ea06ccad2b337a28f4e5847116a41bdda749e3)]
|
|
27
|
+
- fix zoom to layer extent [Miu Razvan - [`28bc084`](https://github.com/eea/volto-eea-map/commit/28bc08456fbaa66938e8d0bf5f25ceaff753fae3)]
|
|
28
|
+
- finalize eea-map refactoring [Miu Razvan - [`3c6abf9`](https://github.com/eea/volto-eea-map/commit/3c6abf998e3fdca55b1e81a0553749ee90bfbcd6)]
|
|
29
|
+
- update [Miu Razvan - [`65205bc`](https://github.com/eea/volto-eea-map/commit/65205bc494f1d3c1b381ed6f9af01ed022e87c75)]
|
|
30
|
+
- Update [Miu Razvan - [`13468a3`](https://github.com/eea/volto-eea-map/commit/13468a3c6738e612115535813e64b0a6af4c97d7)]
|
|
31
|
+
- wip [Miu Razvan - [`901fcc3`](https://github.com/eea/volto-eea-map/commit/901fcc318c618c0307a64081002ab4a048be70a7)]
|
|
32
|
+
- Update [Miu Razvan - [`d70dcf2`](https://github.com/eea/volto-eea-map/commit/d70dcf293b1395741ccbc524fa19145c829f72a9)]
|
|
33
|
+
- Update [Miu Razvan - [`a35b941`](https://github.com/eea/volto-eea-map/commit/a35b941700d985c6f3b53247cb60ecc103c4f339)]
|
|
34
|
+
- Widget component + other [Miu Razvan - [`291f5ad`](https://github.com/eea/volto-eea-map/commit/291f5ad97945cacb1bc4c6d12d177f232b907184)]
|
|
35
|
+
- update [Miu Razvan - [`b073166`](https://github.com/eea/volto-eea-map/commit/b073166de8be0b709e5b2ec397ba9d768c8c2fc8)]
|
|
36
|
+
### [4.1.0](https://github.com/eea/volto-eea-map/compare/4.0.0...4.1.0) - 7 June 2024
|
|
37
|
+
|
|
38
|
+
#### :hammer_and_wrench: Others
|
|
39
|
+
|
|
40
|
+
- Update package.json [ichim-david - [`52e141a`](https://github.com/eea/volto-eea-map/commit/52e141a3fab57904c4acb5e7e412c079f78fb0e0)]
|
|
41
|
+
- bump cypress version to 13.1.0 which is what is used by volto 17 [David Ichim - [`01abef9`](https://github.com/eea/volto-eea-map/commit/01abef9089385ee0b672e09aa37c1bf89d9f21b6)]
|
|
42
|
+
## [4.0.0](https://github.com/eea/volto-eea-map/compare/3.3.1...4.0.0) - 22 April 2024
|
|
8
43
|
|
|
9
44
|
#### :rocket: New Features
|
|
10
45
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-map",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
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",
|
|
@@ -21,20 +21,23 @@
|
|
|
21
21
|
"@eeacms/volto-object-widget"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@arcgis/core": "4.29.10",
|
|
24
25
|
"@eeacms/volto-embed": "*",
|
|
25
26
|
"@eeacms/volto-object-widget": "*",
|
|
26
27
|
"@plone/scripts": "*",
|
|
27
28
|
"esri-loader": "3.6.0",
|
|
29
|
+
"jsoneditor": "10.1.0",
|
|
28
30
|
"lodash": "4.17.21",
|
|
29
31
|
"razzle-plugin-scss": "4.2.18",
|
|
30
32
|
"react-color": "~2.19.3",
|
|
31
|
-
"react-querybuilder": "
|
|
33
|
+
"react-querybuilder": "6.5.5"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
36
|
+
"@babel/preset-env": "7.24.6",
|
|
34
37
|
"@cypress/code-coverage": "^3.10.0",
|
|
35
38
|
"@plone/scripts": "*",
|
|
36
39
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
37
|
-
"cypress": "
|
|
40
|
+
"cypress": "13.1.0",
|
|
38
41
|
"cypress-fail-fast": "^5.0.1",
|
|
39
42
|
"dotenv": "^16.3.2",
|
|
40
43
|
"husky": "^8.0.3",
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { memo, useRef, useState, useMemo } from 'react';
|
|
2
|
+
import { isNil } from 'lodash';
|
|
3
|
+
|
|
4
|
+
import SidebarGroup from './SidebarGroup';
|
|
5
|
+
|
|
6
|
+
import _MapBuilder from '../Map/MapBuilder';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
StructureBaseLayerPanel,
|
|
10
|
+
StructureLayersPanel,
|
|
11
|
+
StructureWidgetsPanel,
|
|
12
|
+
SettingsGeneralPanel,
|
|
13
|
+
SettingsLayersPanel,
|
|
14
|
+
} from './Panels';
|
|
15
|
+
|
|
16
|
+
import EditorContext from './EditorContext';
|
|
17
|
+
|
|
18
|
+
import 'react-querybuilder/dist/query-builder.css';
|
|
19
|
+
import 'jsoneditor/dist/jsoneditor.min.css';
|
|
20
|
+
|
|
21
|
+
const MapBuilder = memo(_MapBuilder);
|
|
22
|
+
|
|
23
|
+
const panels = {
|
|
24
|
+
structure: [
|
|
25
|
+
{
|
|
26
|
+
title: 'Base layer',
|
|
27
|
+
Panel: StructureBaseLayerPanel,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: 'Layers',
|
|
31
|
+
Panel: StructureLayersPanel,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Widgets',
|
|
35
|
+
Panel: StructureWidgetsPanel,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
settings: [
|
|
39
|
+
{ title: 'General', Panel: SettingsGeneralPanel },
|
|
40
|
+
{ title: 'Layers', Panel: SettingsLayersPanel },
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function useApi() {
|
|
45
|
+
const [data, setData] = useState({});
|
|
46
|
+
const [loading, setLoading] = useState({});
|
|
47
|
+
const [loaded, setLoaded] = useState({});
|
|
48
|
+
const [error, setError] = useState({});
|
|
49
|
+
|
|
50
|
+
const load = async (url, opts) => {
|
|
51
|
+
if (data[url]) return data[url];
|
|
52
|
+
let response, result;
|
|
53
|
+
setLoading((prev) => ({ ...prev, [url]: true }));
|
|
54
|
+
try {
|
|
55
|
+
response = await fetch(`${url}?f=json`, opts);
|
|
56
|
+
} catch {
|
|
57
|
+
response = { ok: false, statusText: 'Unexpected error' };
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
result = await response.json();
|
|
61
|
+
} catch {
|
|
62
|
+
result = response.ok
|
|
63
|
+
? {
|
|
64
|
+
code: 500,
|
|
65
|
+
message: 'Unexpected error',
|
|
66
|
+
}
|
|
67
|
+
: {
|
|
68
|
+
code: response.status,
|
|
69
|
+
message: response.statusText,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!response.ok || (!isNil(result.code) && result.code !== 200)) {
|
|
74
|
+
setData((prev) => ({ ...prev, [url]: null }));
|
|
75
|
+
setError((prev) => ({ ...prev, [url]: result }));
|
|
76
|
+
setLoading((prev) => ({ ...prev, [url]: false }));
|
|
77
|
+
setLoaded((prev) => ({ ...prev, [url]: false }));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setData((prev) => ({ ...prev, [url]: result }));
|
|
81
|
+
setError((prev) => ({ ...prev, [url]: null }));
|
|
82
|
+
setLoading((prev) => ({ ...prev, [url]: false }));
|
|
83
|
+
setLoaded((prev) => ({ ...prev, [url]: true }));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return { data, loading, loaded, error, load };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default function Editor({ value, properties, onChangeValue }) {
|
|
90
|
+
const $map = useRef(null);
|
|
91
|
+
const [active, setActive] = useState({
|
|
92
|
+
sidebar: 'structure',
|
|
93
|
+
panel: panels.structure[0],
|
|
94
|
+
});
|
|
95
|
+
const servicesApi = useApi();
|
|
96
|
+
const layersApi = useApi();
|
|
97
|
+
|
|
98
|
+
const Panel = useMemo(() => active.panel.Panel, [active]);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<EditorContext.Provider value={{ servicesApi, layersApi }}>
|
|
102
|
+
<div className="arcgis-map__editor">
|
|
103
|
+
<div className="arcgis-map__controls">
|
|
104
|
+
<div className="arcgis-map__sidebar">
|
|
105
|
+
{Object.keys(panels).map((panel) => (
|
|
106
|
+
<SidebarGroup
|
|
107
|
+
key={panel}
|
|
108
|
+
title={panel}
|
|
109
|
+
items={panels[panel]}
|
|
110
|
+
active={active}
|
|
111
|
+
setActive={setActive}
|
|
112
|
+
/>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
<div className="arcgis-map__panel">
|
|
116
|
+
<Panel
|
|
117
|
+
$map={$map}
|
|
118
|
+
value={value}
|
|
119
|
+
properties={properties}
|
|
120
|
+
onChangeValue={onChangeValue}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
<div className="arcgis-map__view">
|
|
125
|
+
<MapBuilder data={value} ref={$map} />
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</EditorContext.Provider>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Icon } from '@plone/volto/components';
|
|
5
|
+
|
|
6
|
+
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
7
|
+
import upKeySVG from '@plone/volto/icons/up-key.svg';
|
|
8
|
+
|
|
9
|
+
export default function Fold({
|
|
10
|
+
children,
|
|
11
|
+
title,
|
|
12
|
+
icon,
|
|
13
|
+
foldable,
|
|
14
|
+
deletable,
|
|
15
|
+
onDelete,
|
|
16
|
+
}) {
|
|
17
|
+
const [fold, setFold] = useState(false);
|
|
18
|
+
|
|
19
|
+
const isfolded = foldable && fold;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={cx('fold', { fold__open: !isfolded, foldable })}>
|
|
23
|
+
<div
|
|
24
|
+
className="fold--top"
|
|
25
|
+
{...(foldable
|
|
26
|
+
? {
|
|
27
|
+
role: 'button',
|
|
28
|
+
tabIndex: 0,
|
|
29
|
+
onClick: () => setFold(!fold),
|
|
30
|
+
onKeyDown: () => {},
|
|
31
|
+
}
|
|
32
|
+
: {})}
|
|
33
|
+
>
|
|
34
|
+
<div className="fold--top__content">
|
|
35
|
+
{foldable && (
|
|
36
|
+
<Icon name={upKeySVG} className="fold--top__fold" size="16px" />
|
|
37
|
+
)}
|
|
38
|
+
{!!icon && <Icon name={icon} size="16px" />}
|
|
39
|
+
{!!title && <div className="fold--top__title">{title}</div>}
|
|
40
|
+
</div>
|
|
41
|
+
{deletable && (
|
|
42
|
+
<Icon
|
|
43
|
+
name={clearSVG}
|
|
44
|
+
className="fold--top__delete"
|
|
45
|
+
size="16px"
|
|
46
|
+
onClick={(e) => {
|
|
47
|
+
onDelete(e);
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
{!isfolded && <div className="fold--content">{children}</div>}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { toNumber } from 'lodash';
|
|
2
|
+
import { InlineForm } from '@plone/volto/components';
|
|
3
|
+
import Panel from './Panel';
|
|
4
|
+
import Fold from '../Fold/Fold';
|
|
5
|
+
import { getDefaultWidgets } from '@eeacms/volto-eea-map/constants';
|
|
6
|
+
|
|
7
|
+
const mapSchema = {
|
|
8
|
+
title: '',
|
|
9
|
+
fieldsets: [
|
|
10
|
+
{
|
|
11
|
+
id: 'default',
|
|
12
|
+
title: 'Default',
|
|
13
|
+
fields: ['dimension'],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
properties: {
|
|
17
|
+
dimension: {
|
|
18
|
+
title: 'Dimension',
|
|
19
|
+
choices: [
|
|
20
|
+
['2d', '2D'],
|
|
21
|
+
['3d', '3D'],
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: [],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const getViewConstraintsSchema = ({ $map }) => {
|
|
29
|
+
return {
|
|
30
|
+
title: 'Map View',
|
|
31
|
+
fieldsets: [
|
|
32
|
+
{
|
|
33
|
+
id: 'default',
|
|
34
|
+
title: 'Default',
|
|
35
|
+
fields: ['initialExtent'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'constraints',
|
|
39
|
+
title: 'Constraints',
|
|
40
|
+
fields: [
|
|
41
|
+
'minScale',
|
|
42
|
+
'maxScale',
|
|
43
|
+
'minZoom',
|
|
44
|
+
'maxZoom',
|
|
45
|
+
'rotationEnabled',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
properties: {
|
|
50
|
+
initialExtent: {
|
|
51
|
+
title: 'Initial viewpoint',
|
|
52
|
+
widget: 'arcgis_viewpoint',
|
|
53
|
+
$map,
|
|
54
|
+
},
|
|
55
|
+
minScale: {
|
|
56
|
+
title: 'Min scale',
|
|
57
|
+
type: 'number',
|
|
58
|
+
minimum: 0,
|
|
59
|
+
},
|
|
60
|
+
maxScale: {
|
|
61
|
+
title: 'Max scale',
|
|
62
|
+
type: 'number',
|
|
63
|
+
minimum: 0,
|
|
64
|
+
},
|
|
65
|
+
minZoom: {
|
|
66
|
+
title: 'Min zoom',
|
|
67
|
+
type: 'number',
|
|
68
|
+
minimum: 0,
|
|
69
|
+
},
|
|
70
|
+
maxZoom: {
|
|
71
|
+
title: 'Max zoom',
|
|
72
|
+
type: 'number',
|
|
73
|
+
minimum: 0,
|
|
74
|
+
},
|
|
75
|
+
rotationEnabled: {
|
|
76
|
+
title: 'Rotation enabled',
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
required: [],
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default function SettingsGeneralPanel({ $map, value, onChangeValue }) {
|
|
85
|
+
const viewConstraints = value.settings?.view?.constraints || {};
|
|
86
|
+
const dimension = value.settings?.map?.dimension || '2d';
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Panel
|
|
90
|
+
content={
|
|
91
|
+
<>
|
|
92
|
+
<Fold
|
|
93
|
+
title={
|
|
94
|
+
<>
|
|
95
|
+
<a
|
|
96
|
+
href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html"
|
|
97
|
+
onClick={(e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
}}
|
|
100
|
+
style={{ color: '#fff' }}
|
|
101
|
+
target="_blank"
|
|
102
|
+
rel="noopener noreferrer"
|
|
103
|
+
>
|
|
104
|
+
Map
|
|
105
|
+
</a>
|
|
106
|
+
</>
|
|
107
|
+
}
|
|
108
|
+
foldable
|
|
109
|
+
>
|
|
110
|
+
<InlineForm
|
|
111
|
+
schema={mapSchema}
|
|
112
|
+
formData={{
|
|
113
|
+
...(value.settings?.map || {}),
|
|
114
|
+
dimension: value.settings?.map?.dimension || '2d',
|
|
115
|
+
}}
|
|
116
|
+
onChangeField={(id, fieldValue) => {
|
|
117
|
+
let $fieldValue = fieldValue;
|
|
118
|
+
|
|
119
|
+
onChangeValue({
|
|
120
|
+
...value,
|
|
121
|
+
...(id === 'dimension'
|
|
122
|
+
? {
|
|
123
|
+
widgets: getDefaultWidgets($fieldValue),
|
|
124
|
+
}
|
|
125
|
+
: {}),
|
|
126
|
+
settings: {
|
|
127
|
+
...(value.settings || {}),
|
|
128
|
+
map: {
|
|
129
|
+
...(value.settings?.map || {}),
|
|
130
|
+
[id]: $fieldValue,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
</Fold>
|
|
137
|
+
{dimension === '2d' && (
|
|
138
|
+
<Fold
|
|
139
|
+
title={
|
|
140
|
+
<>
|
|
141
|
+
<a
|
|
142
|
+
href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
|
143
|
+
onClick={(e) => {
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
}}
|
|
146
|
+
style={{ color: '#fff' }}
|
|
147
|
+
target="_blank"
|
|
148
|
+
rel="noopener noreferrer"
|
|
149
|
+
>
|
|
150
|
+
View
|
|
151
|
+
</a>
|
|
152
|
+
</>
|
|
153
|
+
}
|
|
154
|
+
foldable
|
|
155
|
+
>
|
|
156
|
+
<InlineForm
|
|
157
|
+
schema={getViewConstraintsSchema({ $map })}
|
|
158
|
+
formData={{
|
|
159
|
+
initialExtent: {
|
|
160
|
+
longitude: value.settings?.view?.center?.[0],
|
|
161
|
+
latitude: value.settings?.view?.center?.[1],
|
|
162
|
+
zoom: value.settings?.view?.zoom,
|
|
163
|
+
},
|
|
164
|
+
...viewConstraints,
|
|
165
|
+
}}
|
|
166
|
+
onChangeField={(id, fieldValue) => {
|
|
167
|
+
let $fieldValue = fieldValue;
|
|
168
|
+
|
|
169
|
+
if (
|
|
170
|
+
['minScale', 'maxScale', 'minZoom', 'maxZoom'].includes(id)
|
|
171
|
+
) {
|
|
172
|
+
$fieldValue = Math.max(toNumber(fieldValue) || 0, 0);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (id === 'initialExtent') {
|
|
176
|
+
const center = [
|
|
177
|
+
$fieldValue.longitude || 0,
|
|
178
|
+
$fieldValue.latitude || 0,
|
|
179
|
+
];
|
|
180
|
+
const zoom = $fieldValue.zoom;
|
|
181
|
+
|
|
182
|
+
onChangeValue({
|
|
183
|
+
...value,
|
|
184
|
+
settings: {
|
|
185
|
+
...(value.settings || {}),
|
|
186
|
+
view: {
|
|
187
|
+
...(value.settings?.view || {}),
|
|
188
|
+
center,
|
|
189
|
+
zoom,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
onChangeValue({
|
|
197
|
+
...value,
|
|
198
|
+
settings: {
|
|
199
|
+
...(value.settings || {}),
|
|
200
|
+
view: {
|
|
201
|
+
...(value.settings?.view || {}),
|
|
202
|
+
constraints: {
|
|
203
|
+
...(value.settings?.view?.constraints || {}),
|
|
204
|
+
[id]: $fieldValue,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
</Fold>
|
|
212
|
+
)}
|
|
213
|
+
</>
|
|
214
|
+
}
|
|
215
|
+
/>
|
|
216
|
+
);
|
|
217
|
+
}
|