qwc2 2026.5.26 → 2026.5.28
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/actions/theme.js +4 -8
- package/components/ImportLayer.js +2 -3
- package/components/StandardApp.js +1 -8
- package/components/map3d/Map3D.js +2 -2
- package/components/map3d/utils/Tiles3DStyle.js +7 -0
- package/package.json +1 -1
- package/plugins/Bookmark.js +266 -57
- package/plugins/BottomBar.js +5 -49
- package/plugins/FeatureSearch.js +19 -1
- package/plugins/MapExport.js +1 -1
- package/plugins/Portal.js +2 -2
- package/plugins/Print.js +6 -6
- package/plugins/Redlining.js +1 -1
- package/plugins/Settings.js +48 -27
- package/plugins/redlining/RedliningFeatureLabelSupport.js +11 -5
- package/reducers/locale.js +2 -1
- package/scripts/themesConfig.js +1 -0
- package/scripts/themesConfig.py +1 -0
- package/static/translations/bg-BG.json +1 -15
- package/static/translations/ca-ES.json +1 -15
- package/static/translations/cs-CZ.json +1 -15
- package/static/translations/de-CH.json +1 -15
- package/static/translations/de-DE.json +1 -15
- package/static/translations/en-US.json +1 -15
- package/static/translations/es-ES.json +1 -15
- package/static/translations/fi-FI.json +1 -15
- package/static/translations/fr-FR.json +1 -15
- package/static/translations/hu-HU.json +1 -15
- package/static/translations/it-IT.json +1 -15
- package/static/translations/ja-JP.json +1 -15
- package/static/translations/nl-NL.json +1 -15
- package/static/translations/no-NO.json +1 -15
- package/static/translations/pl-PL.json +1 -15
- package/static/translations/pt-BR.json +1 -15
- package/static/translations/pt-PT.json +1 -15
- package/static/translations/ro-RO.json +1 -15
- package/static/translations/ru-RU.json +1 -15
- package/static/translations/sv-SE.json +1 -15
- package/static/translations/tr-TR.json +1 -15
- package/static/translations/tsconfig.json +1 -13
- package/static/translations/uk-UA.json +1 -15
- package/utils/FeatureStyles.js +4 -3
- package/utils/MiscUtils.js +15 -5
- package/utils/PermaLinkUtils.js +22 -31
- package/utils/ThemeUtils.js +1 -1
- package/actions/bookmark.js +0 -40
- package/components/BookmarkPanel.js +0 -307
- package/components/widgets/GroupSelect.js +0 -94
- package/plugins/VisibilityPreset.js +0 -127
- package/reducers/bookmark.js +0 -39
- /package/{components/style/BookmarkPanel.css → plugins/style/Bookmark.css} +0 -0
package/actions/theme.js
CHANGED
|
@@ -33,7 +33,7 @@ import MapUtils from '../utils/MapUtils';
|
|
|
33
33
|
import { UrlParams } from '../utils/PermaLinkUtils';
|
|
34
34
|
import ServiceLayerUtils from '../utils/ServiceLayerUtils';
|
|
35
35
|
import ThemeUtils from '../utils/ThemeUtils';
|
|
36
|
-
import { LayerRole, addLayer, removeLayer, removeAllLayers, replacePlaceholderLayer, setSwipe
|
|
36
|
+
import { LayerRole, addLayer, removeLayer, removeAllLayers, replacePlaceholderLayer, setSwipe } from './layers';
|
|
37
37
|
import { configureMap } from './map';
|
|
38
38
|
import { showNotification, NotificationType } from './windows';
|
|
39
39
|
export var THEMES_LOADED = 'THEMES_LOADED';
|
|
@@ -51,7 +51,7 @@ export function setThemeLayersList(theme) {
|
|
|
51
51
|
themelist: theme
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
export function finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask
|
|
54
|
+
export function finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask) {
|
|
55
55
|
var _theme$config$section, _theme$config, _theme$config2;
|
|
56
56
|
// Create layer
|
|
57
57
|
var themeLayer = ThemeUtils.createThemeLayer(theme, themes);
|
|
@@ -143,9 +143,6 @@ export function finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPo
|
|
|
143
143
|
type: SET_CURRENT_THEME,
|
|
144
144
|
theme: theme
|
|
145
145
|
});
|
|
146
|
-
if (initialVisibilityPreset) {
|
|
147
|
-
dispatch(setThemeLayersVisibilityPreset(initialVisibilityPreset));
|
|
148
|
-
}
|
|
149
146
|
var section = ConfigUtils.isMobile() ? "mobile" : "desktop";
|
|
150
147
|
var task = initialTask || ((_theme$config$section = theme === null || theme === void 0 || (_theme$config = theme.config) === null || _theme$config === void 0 || (_theme$config = _theme$config[section]) === null || _theme$config === void 0 ? void 0 : _theme$config.startupTask) !== null && _theme$config$section !== void 0 ? _theme$config$section : theme === null || theme === void 0 || (_theme$config2 = theme.config) === null || _theme$config2 === void 0 ? void 0 : _theme$config2.startupTask) || (initialTheme ? ConfigUtils.getConfigProp("startupTask") : null);
|
|
151
148
|
if (task) {
|
|
@@ -162,7 +159,6 @@ export function setCurrentTheme(theme, themes) {
|
|
|
162
159
|
var themeLayerRestorer = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
163
160
|
var externalLayerRestorer = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
164
161
|
var initialTask = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
165
|
-
var initialVisibilityPreset = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
|
|
166
162
|
return function (dispatch, getState) {
|
|
167
163
|
var _getState$layers, _ref, _theme$mapTips;
|
|
168
164
|
var curLayers = ((_getState$layers = getState().layers) === null || _getState$layers === void 0 ? void 0 : _getState$layers.flat) || [];
|
|
@@ -311,13 +307,13 @@ export function setCurrentTheme(theme, themes) {
|
|
|
311
307
|
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", diff.join(", ")), NotificationType.WARN, true));
|
|
312
308
|
}
|
|
313
309
|
}
|
|
314
|
-
finishThemeSetup(dispatch, newTheme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask
|
|
310
|
+
finishThemeSetup(dispatch, newTheme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask);
|
|
315
311
|
});
|
|
316
312
|
} else {
|
|
317
313
|
if (!isEmpty(missingThemeLayers)) {
|
|
318
314
|
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", Object.keys(missingThemeLayers).join(", ")), NotificationType.WARN, true));
|
|
319
315
|
}
|
|
320
|
-
finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask
|
|
316
|
+
finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask);
|
|
321
317
|
}
|
|
322
318
|
};
|
|
323
319
|
}
|
|
@@ -38,7 +38,6 @@ import React from 'react';
|
|
|
38
38
|
import { connect } from 'react-redux';
|
|
39
39
|
import axios from 'axios';
|
|
40
40
|
import isEmpty from 'lodash.isempty';
|
|
41
|
-
import { WorkerMessageHandler } from "pdfjs-dist/build/pdf.worker";
|
|
42
41
|
import Proj4js from 'proj4';
|
|
43
42
|
import PropTypes from 'prop-types';
|
|
44
43
|
import { addLayer, addLayerFeatures } from '../actions/layers';
|
|
@@ -439,8 +438,8 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
439
438
|
var tr = computeCorner(idxTR);
|
|
440
439
|
var geoextent = [bl.coo[0], bl.coo[1], tr.coo[0], tr.coo[1]];
|
|
441
440
|
var imgextent = [bl.pixel[0], bl.pixel[1], tr.pixel[0], tr.pixel[1]];
|
|
442
|
-
import('pdfjs-dist
|
|
443
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
|
441
|
+
import('pdfjs-dist').then(function (pdfjsLib) {
|
|
442
|
+
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
444
443
|
pdfjsLib.getDocument(ev.target.result).promise.then(function (pdf) {
|
|
445
444
|
pdf.getPage(1).then(function (page) {
|
|
446
445
|
var pageViewport = page.getViewport({
|
|
@@ -40,7 +40,6 @@ import deepmerge from 'deepmerge';
|
|
|
40
40
|
import { register as olProj4Register } from 'ol/proj/proj4';
|
|
41
41
|
import Proj4js from 'proj4';
|
|
42
42
|
import PropTypes from 'prop-types';
|
|
43
|
-
import { refreshBookmarks, refreshVisibilityPresets } from '../actions/bookmark';
|
|
44
43
|
import { localConfigLoaded, setStartupParameters, setColorScheme } from '../actions/localConfig';
|
|
45
44
|
import { changeLocale } from '../actions/locale';
|
|
46
45
|
import { setCurrentTask } from '../actions/task';
|
|
@@ -164,7 +163,7 @@ var AppContainerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
164
163
|
layerParams.reverse();
|
|
165
164
|
}
|
|
166
165
|
var initialTaskParam = params.task ? JSON.parse(decodeURIComponent(params.task)) : null;
|
|
167
|
-
_this.props.setCurrentTheme(theme, themes, false, initialExtent, layerParams, (_params$bl = params.bl) !== null && _params$bl !== void 0 ? _params$bl : null, state.layers, _this.props.appConfig.themeLayerRestorer, _this.props.appConfig.externalLayerRestorer, initialTaskParam
|
|
166
|
+
_this.props.setCurrentTheme(theme, themes, false, initialExtent, layerParams, (_params$bl = params.bl) !== null && _params$bl !== void 0 ? _params$bl : null, state.layers, _this.props.appConfig.themeLayerRestorer, _this.props.appConfig.externalLayerRestorer, initialTaskParam);
|
|
168
167
|
} else if (!ConfigUtils.havePlugin("Portal")) {
|
|
169
168
|
_this.props.showNotification("missingdefaulttheme", LocaleUtils.tr("app.missingdefaulttheme", params.t), NotificationType.WARN, true);
|
|
170
169
|
}
|
|
@@ -205,7 +204,6 @@ var AppContainerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
205
204
|
}(React.Component);
|
|
206
205
|
_defineProperty(AppContainerComponent, "propTypes", {
|
|
207
206
|
appConfig: PropTypes.object,
|
|
208
|
-
currentTheme: PropTypes.object,
|
|
209
207
|
defaultUrlParams: PropTypes.string,
|
|
210
208
|
haveMapSize: PropTypes.bool,
|
|
211
209
|
localConfig: PropTypes.object,
|
|
@@ -213,7 +211,6 @@ _defineProperty(AppContainerComponent, "propTypes", {
|
|
|
213
211
|
setBottombarHeight: PropTypes.func,
|
|
214
212
|
setCurrentTask: PropTypes.func,
|
|
215
213
|
setCurrentTheme: PropTypes.func,
|
|
216
|
-
setThemeLayersVisibilityPreset: PropTypes.func,
|
|
217
214
|
setTopbarHeight: PropTypes.func,
|
|
218
215
|
showNotification: PropTypes.func,
|
|
219
216
|
startupConfig: PropTypes.object,
|
|
@@ -334,10 +331,6 @@ var StandardApp = /*#__PURE__*/function (_React$Component2) {
|
|
|
334
331
|
var colorScheme = initialParams.style || storedColorScheme || ConfigUtils.getConfigProp("defaultColorScheme");
|
|
335
332
|
StandardApp.store.dispatch(setColorScheme(colorScheme));
|
|
336
333
|
|
|
337
|
-
// Load all bookmarks & visiblity presets
|
|
338
|
-
StandardApp.store.dispatch(refreshBookmarks());
|
|
339
|
-
StandardApp.store.dispatch(refreshVisibilityPresets());
|
|
340
|
-
|
|
341
334
|
// Resolve permalink and restore settings
|
|
342
335
|
resolvePermaLink(initialParams, function (params, state, success) {
|
|
343
336
|
StandardApp.store.dispatch(setStartupParameters(params, state));
|
|
@@ -766,9 +766,9 @@ var Map3D = /*#__PURE__*/function (_React$Component2) {
|
|
|
766
766
|
var center = extent.center();
|
|
767
767
|
if (center.crs.isGeographic()) {
|
|
768
768
|
var position = Ellipsoid.WGS84.toCartesian(center.latitude, center.longitude, center.altitude);
|
|
769
|
-
_this2.instance.view.camera.position.set(position.x, position.y, 0.5 * (extent.
|
|
769
|
+
_this2.instance.view.camera.position.set(position.x, position.y, 0.5 * (extent.maxX - extent.minX));
|
|
770
770
|
} else {
|
|
771
|
-
_this2.instance.view.camera.position.set(center.x, center.y, 0.5 * (extent.
|
|
771
|
+
_this2.instance.view.camera.position.set(center.x, center.y, 0.5 * (extent.maxX - extent.minX));
|
|
772
772
|
}
|
|
773
773
|
|
|
774
774
|
// Skybox
|
|
@@ -98,6 +98,13 @@ var Tiles3DStyle = {
|
|
|
98
98
|
var featureLabelCache = {};
|
|
99
99
|
var labels = {};
|
|
100
100
|
var idAttr = (_config$idAttr = config.idAttr) !== null && _config$idAttr !== void 0 ? _config$idAttr : "id";
|
|
101
|
+
if (!["tilesetStyle", "colorAttr", "alphaAttr", "labelAttr", "baseColor"].some(function (k) {
|
|
102
|
+
var _config$k;
|
|
103
|
+
return ((_config$k = config[k]) !== null && _config$k !== void 0 ? _config$k : null) !== null;
|
|
104
|
+
})) {
|
|
105
|
+
// No styling information is present
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
101
108
|
var context = {
|
|
102
109
|
colorExpressions: [],
|
|
103
110
|
featureStyles: (_config$tilesetStyle = config.tilesetStyle) === null || _config$tilesetStyle === void 0 ? void 0 : _config$tilesetStyle.featureStyles,
|
package/package.json
CHANGED
package/plugins/Bookmark.js
CHANGED
|
@@ -12,23 +12,37 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
12
12
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
/**
|
|
16
|
+
* Copyright 2021 Oslandia SAS <infos+qwc2@oslandia.com>
|
|
17
|
+
* All rights reserved.
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the BSD-style license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
|
|
15
23
|
import React from 'react';
|
|
16
24
|
import { connect } from 'react-redux';
|
|
25
|
+
import classnames from 'classnames';
|
|
26
|
+
import isEmpty from 'lodash.isempty';
|
|
17
27
|
import PropTypes from 'prop-types';
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import BookmarkPanel from '../components/BookmarkPanel';
|
|
28
|
+
import { zoomToExtent, zoomToPoint } from '../actions/map';
|
|
29
|
+
import Icon from '../components/Icon';
|
|
21
30
|
import SideBar from '../components/SideBar';
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
31
|
+
import InputContainer from '../components/widgets/InputContainer';
|
|
32
|
+
import TextInput from '../components/widgets/TextInput';
|
|
33
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
34
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
35
|
+
import MapUtils from '../utils/MapUtils';
|
|
36
|
+
import MiscUtils from '../utils/MiscUtils';
|
|
37
|
+
import { createBookmark, getBookmarks, removeBookmark, renameBookmark, resolveBookmark, updateBookmark } from '../utils/PermaLinkUtils';
|
|
38
|
+
import './style/Bookmark.css';
|
|
25
39
|
|
|
26
|
-
/**
|
|
27
|
-
* Allows managing user bookmarks
|
|
28
|
-
*
|
|
29
|
-
* Bookmarks are only allowed for authenticated users.
|
|
30
|
-
*
|
|
31
|
-
* Requires `permalinkServiceUrl` to point to a `qwc-permalink-service`.
|
|
40
|
+
/**
|
|
41
|
+
* Allows managing user bookmarks.
|
|
42
|
+
*
|
|
43
|
+
* Bookmarks are only allowed for authenticated users.
|
|
44
|
+
*
|
|
45
|
+
* Requires `permalinkServiceUrl` to point to a `qwc-permalink-service`.
|
|
32
46
|
*/
|
|
33
47
|
var Bookmark = /*#__PURE__*/function (_React$Component) {
|
|
34
48
|
function Bookmark() {
|
|
@@ -38,46 +52,57 @@ var Bookmark = /*#__PURE__*/function (_React$Component) {
|
|
|
38
52
|
args[_key] = arguments[_key];
|
|
39
53
|
}
|
|
40
54
|
_this = _callSuper(this, Bookmark, [].concat(args));
|
|
41
|
-
_defineProperty(_this, "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
_defineProperty(_this, "state", {
|
|
56
|
+
bookmarks: [],
|
|
57
|
+
renameBookmark: null,
|
|
58
|
+
currentBookmark: null,
|
|
59
|
+
description: "",
|
|
60
|
+
busy: false
|
|
61
|
+
});
|
|
62
|
+
_defineProperty(_this, "bookmarkClicked", function (ev, bookmark) {
|
|
63
|
+
if (_this.state.renameBookmark) {
|
|
64
|
+
// pass
|
|
65
|
+
} else if (_this.props.openOnClick) {
|
|
66
|
+
_this.open(bookmark.key, ev.button === 1);
|
|
67
|
+
} else if (_this.state.currentBookmark === bookmark.key) {
|
|
68
|
+
_this.setState({
|
|
69
|
+
currentBookmark: null,
|
|
70
|
+
description: ""
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
_this.setState({
|
|
74
|
+
currentBookmark: bookmark.key,
|
|
75
|
+
description: bookmark.description
|
|
76
|
+
});
|
|
77
|
+
}
|
|
55
78
|
});
|
|
56
|
-
_defineProperty(_this, "
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
_defineProperty(_this, "updateBookmarkName", function (text) {
|
|
80
|
+
_this.setState({
|
|
81
|
+
busy: true
|
|
82
|
+
});
|
|
83
|
+
renameBookmark(_this.state.renameBookmark, text, function (success) {
|
|
84
|
+
if (!success) {
|
|
85
|
+
/* eslint-disable-next-line */
|
|
86
|
+
alert(LocaleUtils.tr("bookmark.savefailed"));
|
|
87
|
+
}
|
|
88
|
+
_this.refresh(function () {
|
|
89
|
+
return _this.setState({
|
|
90
|
+
renameBookmark: null,
|
|
91
|
+
busy: false
|
|
92
|
+
});
|
|
93
|
+
});
|
|
69
94
|
});
|
|
70
95
|
});
|
|
71
|
-
_defineProperty(_this, "
|
|
72
|
-
var url = location.href.split("?")[0] + '?bk=' +
|
|
96
|
+
_defineProperty(_this, "open", function (bookmarkkey, newtab) {
|
|
97
|
+
var url = location.href.split("?")[0] + '?bk=' + bookmarkkey;
|
|
73
98
|
if (newtab) {
|
|
74
99
|
window.open(url, '_blank');
|
|
75
100
|
} else {
|
|
76
101
|
location.href = url;
|
|
77
102
|
}
|
|
78
103
|
});
|
|
79
|
-
_defineProperty(_this, "zoomToBookmarkExtent", function (
|
|
80
|
-
resolveBookmark(
|
|
104
|
+
_defineProperty(_this, "zoomToBookmarkExtent", function (bookmarkkey) {
|
|
105
|
+
resolveBookmark(bookmarkkey, function (params) {
|
|
81
106
|
if ('c' in params && 's' in params) {
|
|
82
107
|
var _params$crs;
|
|
83
108
|
var scale = parseFloat(params.s);
|
|
@@ -95,53 +120,237 @@ var Bookmark = /*#__PURE__*/function (_React$Component) {
|
|
|
95
120
|
}
|
|
96
121
|
});
|
|
97
122
|
});
|
|
123
|
+
_defineProperty(_this, "addBookmark", function () {
|
|
124
|
+
_this.setState({
|
|
125
|
+
busy: true
|
|
126
|
+
});
|
|
127
|
+
createBookmark(LocaleUtils.tr("bookmark.newbookmark"), function (success, key) {
|
|
128
|
+
if (!success) {
|
|
129
|
+
/* eslint-disable-next-line */
|
|
130
|
+
alert(LocaleUtils.tr("bookmark.addfailed"));
|
|
131
|
+
} else {
|
|
132
|
+
_this.refresh(function () {
|
|
133
|
+
return _this.setState({
|
|
134
|
+
renameBookmark: key,
|
|
135
|
+
busy: false
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
_this.setState({
|
|
141
|
+
description: "",
|
|
142
|
+
currentBookmark: null
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
_defineProperty(_this, "updateBookmark", function (key) {
|
|
146
|
+
_this.setState({
|
|
147
|
+
busy: true
|
|
148
|
+
});
|
|
149
|
+
var description = _this.state.bookmarks.find(function (bk) {
|
|
150
|
+
return bk.key === key;
|
|
151
|
+
}).description;
|
|
152
|
+
updateBookmark(key, description, function (success) {
|
|
153
|
+
if (!success) {
|
|
154
|
+
/* eslint-disable-next-line */
|
|
155
|
+
alert(LocaleUtils.tr("bookmark.savefailed"));
|
|
156
|
+
}
|
|
157
|
+
_this.refresh(function () {
|
|
158
|
+
return _this.setState({
|
|
159
|
+
busy: false,
|
|
160
|
+
currentBookmark: null
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
_defineProperty(_this, "removeBookmark", function (key) {
|
|
166
|
+
_this.setState({
|
|
167
|
+
busy: true
|
|
168
|
+
});
|
|
169
|
+
removeBookmark(key, function (success) {
|
|
170
|
+
if (!success) {
|
|
171
|
+
/* eslint-disable-next-line */
|
|
172
|
+
alert(LocaleUtils.tr("bookmark.removefailed"));
|
|
173
|
+
}
|
|
174
|
+
_this.refresh(function () {
|
|
175
|
+
return _this.setState({
|
|
176
|
+
busy: false
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
_defineProperty(_this, "refresh", function () {
|
|
182
|
+
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
183
|
+
if (ConfigUtils.getConfigProp("username")) {
|
|
184
|
+
getBookmarks(function (bookmarks) {
|
|
185
|
+
_this.setState({
|
|
186
|
+
bookmarks: bookmarks
|
|
187
|
+
});
|
|
188
|
+
callback === null || callback === void 0 || callback(bookmarks);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
98
192
|
return _this;
|
|
99
193
|
}
|
|
100
194
|
_inherits(Bookmark, _React$Component);
|
|
101
195
|
return _createClass(Bookmark, [{
|
|
196
|
+
key: "componentDidMount",
|
|
197
|
+
value: function componentDidMount() {
|
|
198
|
+
this.refresh();
|
|
199
|
+
}
|
|
200
|
+
}, {
|
|
102
201
|
key: "render",
|
|
103
202
|
value: function render() {
|
|
104
203
|
var _this2 = this;
|
|
204
|
+
var openTitle = LocaleUtils.tr("bookmark.open");
|
|
205
|
+
var openTabTitle = LocaleUtils.tr("bookmark.openTab");
|
|
206
|
+
var zoomTitle = LocaleUtils.tr("bookmark.zoomToExtent");
|
|
207
|
+
var username = ConfigUtils.getConfigProp("username");
|
|
208
|
+
var updateTitle = LocaleUtils.tr("bookmark.update");
|
|
209
|
+
var lastUpdateTitle = LocaleUtils.tr("bookmark.lastUpdate");
|
|
210
|
+
var currentBookmark = this.state.currentBookmark;
|
|
211
|
+
var buttonsDisabled = !currentBookmark || this.state.busy;
|
|
105
212
|
return /*#__PURE__*/React.createElement(SideBar, {
|
|
106
213
|
icon: "bookmark",
|
|
107
214
|
id: "Bookmark",
|
|
215
|
+
onShow: this.refresh,
|
|
108
216
|
side: this.props.side,
|
|
109
217
|
title: LocaleUtils.tr("appmenu.items.Bookmark"),
|
|
110
218
|
width: "20em"
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
219
|
+
}, !username ? /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: "bookmark-body",
|
|
221
|
+
role: "body"
|
|
222
|
+
}, LocaleUtils.tr("bookmark.notloggedin")) : /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "bookmark-body",
|
|
224
|
+
role: "body"
|
|
225
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
226
|
+
className: "bookmark-header"
|
|
227
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("bookmark.manage")), /*#__PURE__*/React.createElement("button", {
|
|
228
|
+
className: "button",
|
|
229
|
+
onClick: this.addBookmark,
|
|
230
|
+
title: LocaleUtils.tr("bookmark.add")
|
|
231
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
232
|
+
icon: "plus"
|
|
233
|
+
}))), !this.props.openOnClick ? /*#__PURE__*/React.createElement("div", {
|
|
234
|
+
className: "bookmark-actions controlgroup"
|
|
235
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
236
|
+
className: "button",
|
|
237
|
+
disabled: buttonsDisabled,
|
|
238
|
+
onClick: function onClick() {
|
|
239
|
+
return _this2.open(currentBookmark, false);
|
|
240
|
+
},
|
|
241
|
+
title: openTitle
|
|
242
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
243
|
+
icon: "folder-open"
|
|
244
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
245
|
+
className: "button",
|
|
246
|
+
disabled: buttonsDisabled,
|
|
247
|
+
onClick: function onClick() {
|
|
248
|
+
return _this2.open(currentBookmark, true);
|
|
249
|
+
},
|
|
250
|
+
title: openTabTitle
|
|
251
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
252
|
+
icon: "open_link"
|
|
253
|
+
})), this.props.mapCrs && this.props.mapScales ? /*#__PURE__*/React.createElement("button", {
|
|
254
|
+
className: "button",
|
|
255
|
+
disabled: buttonsDisabled,
|
|
256
|
+
onClick: function onClick() {
|
|
257
|
+
return _this2.zoomToBookmarkExtent(currentBookmark);
|
|
258
|
+
},
|
|
259
|
+
title: zoomTitle
|
|
260
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
261
|
+
icon: "zoom"
|
|
262
|
+
})) : null, /*#__PURE__*/React.createElement("button", {
|
|
263
|
+
className: "button",
|
|
264
|
+
disabled: buttonsDisabled,
|
|
265
|
+
onClick: function onClick() {
|
|
266
|
+
return _this2.updateBookmark(currentBookmark);
|
|
267
|
+
},
|
|
268
|
+
title: updateTitle
|
|
269
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
270
|
+
icon: "save"
|
|
271
|
+
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
272
|
+
className: "bookmark-list"
|
|
273
|
+
}, this.state.bookmarks.map(function (bookmark) {
|
|
274
|
+
var itemclasses = classnames({
|
|
275
|
+
"bookmark-list-item": true,
|
|
276
|
+
"bookmark-list-item-active": currentBookmark === bookmark.key
|
|
277
|
+
});
|
|
278
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
279
|
+
className: itemclasses,
|
|
280
|
+
key: bookmark.key,
|
|
281
|
+
onAuxClick: function onAuxClick(ev) {
|
|
282
|
+
return _this2.bookmarkClicked(ev, bookmark);
|
|
283
|
+
},
|
|
284
|
+
onClick: function onClick(ev) {
|
|
285
|
+
return _this2.bookmarkClicked(ev, bookmark);
|
|
286
|
+
},
|
|
287
|
+
onDoubleClick: function onDoubleClick() {
|
|
288
|
+
return _this2.open(bookmark.key, false);
|
|
289
|
+
},
|
|
290
|
+
title: lastUpdateTitle + ": " + bookmark.date
|
|
291
|
+
}, _this2.state.renameBookmark === bookmark.key ? /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(TextInput, {
|
|
292
|
+
focusOnRef: true,
|
|
293
|
+
onChange: _this2.updateBookmarkName,
|
|
294
|
+
onNoChange: function onNoChange() {
|
|
295
|
+
return _this2.setState({
|
|
296
|
+
renameBookmark: null
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
role: "input",
|
|
300
|
+
showClear: false,
|
|
301
|
+
value: bookmark.description
|
|
302
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
303
|
+
icon: "ok",
|
|
304
|
+
onClick: MiscUtils.killEvent,
|
|
305
|
+
role: "suffix"
|
|
306
|
+
})) : /*#__PURE__*/React.createElement("span", null, bookmark.description), _this2.state.renameBookmark !== bookmark.key ? /*#__PURE__*/React.createElement(Icon, {
|
|
307
|
+
icon: "draw",
|
|
308
|
+
onClick: function onClick(ev) {
|
|
309
|
+
_this2.setState({
|
|
310
|
+
renameBookmark: bookmark.key,
|
|
311
|
+
currentBookmark: null
|
|
312
|
+
});
|
|
313
|
+
MiscUtils.killEvent(ev);
|
|
314
|
+
},
|
|
315
|
+
title: LocaleUtils.tr("common.rename")
|
|
316
|
+
}) : null, _this2.state.renameBookmark !== bookmark.key ? /*#__PURE__*/React.createElement(Icon, {
|
|
317
|
+
disabled: _this2.state.busy,
|
|
318
|
+
icon: "trash",
|
|
319
|
+
onClick: function onClick(ev) {
|
|
320
|
+
_this2.removeBookmark(bookmark.key);
|
|
321
|
+
MiscUtils.killEvent(ev);
|
|
322
|
+
},
|
|
323
|
+
title: LocaleUtils.tr("common.delete")
|
|
324
|
+
}) : null);
|
|
325
|
+
}), isEmpty(this.state.bookmarks) ? /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
className: "bookmark-list-item-empty"
|
|
327
|
+
}, LocaleUtils.tr("bookmark.nobookmarks")) : null)));
|
|
116
328
|
}
|
|
117
329
|
}]);
|
|
118
330
|
}(React.Component);
|
|
119
331
|
_defineProperty(Bookmark, "availableIn3D", true);
|
|
120
332
|
_defineProperty(Bookmark, "propTypes", {
|
|
121
|
-
bookmarks: PropTypes.array,
|
|
122
333
|
mapCrs: PropTypes.string,
|
|
123
334
|
mapScales: PropTypes.array,
|
|
124
335
|
/** Whether to directly open the bookmark on click / middle click, instead of showing dedicated open buttons. */
|
|
125
336
|
openOnClick: PropTypes.bool,
|
|
126
|
-
refreshBookmarks: PropTypes.func,
|
|
127
337
|
/** The side of the application on which to display the sidebar. */
|
|
128
338
|
side: PropTypes.string,
|
|
339
|
+
theme: PropTypes.object,
|
|
129
340
|
zoomToExtent: PropTypes.func,
|
|
130
341
|
zoomToPoint: PropTypes.func
|
|
131
342
|
});
|
|
132
343
|
_defineProperty(Bookmark, "defaultProps", {
|
|
133
344
|
side: 'right'
|
|
134
345
|
});
|
|
135
|
-
|
|
136
|
-
var _state$
|
|
346
|
+
export default connect(function (state) {
|
|
347
|
+
var _state$map, _state$map2;
|
|
137
348
|
return {
|
|
138
|
-
bookmarks: (_state$bookmark = state.bookmark) === null || _state$bookmark === void 0 ? void 0 : _state$bookmark.bookmarks,
|
|
139
349
|
mapCrs: (_state$map = state.map) === null || _state$map === void 0 ? void 0 : _state$map.projection,
|
|
140
|
-
mapScales: (_state$map2 = state.map) === null || _state$map2 === void 0 ? void 0 : _state$map2.scales
|
|
350
|
+
mapScales: (_state$map2 = state.map) === null || _state$map2 === void 0 ? void 0 : _state$map2.scales,
|
|
351
|
+
theme: state.theme.current
|
|
141
352
|
};
|
|
142
|
-
}
|
|
143
|
-
export default connect(selector, {
|
|
144
|
-
refreshBookmarks: refreshBookmarks,
|
|
353
|
+
}, {
|
|
145
354
|
zoomToExtent: zoomToExtent,
|
|
146
355
|
zoomToPoint: zoomToPoint
|
|
147
356
|
})(Bookmark);
|