qwc2 2026.5.25 → 2026.5.26
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/bookmark.js +40 -0
- package/actions/theme.js +8 -4
- package/components/BookmarkPanel.js +307 -0
- package/components/StandardApp.js +8 -1
- package/components/widgets/GroupSelect.js +94 -0
- package/package.json +1 -1
- package/plugins/Bookmark.js +57 -266
- package/plugins/BottomBar.js +49 -5
- package/plugins/Editing.js +5 -24
- package/plugins/Portal.js +2 -2
- package/plugins/Print.js +3 -2
- package/plugins/Settings.js +27 -48
- package/plugins/VisibilityPreset.js +127 -0
- package/plugins/map/RedliningSupport.js +4 -2
- package/reducers/bookmark.js +39 -0
- package/static/translations/bg-BG.json +15 -1
- package/static/translations/ca-ES.json +15 -1
- package/static/translations/cs-CZ.json +15 -1
- package/static/translations/de-CH.json +15 -1
- package/static/translations/de-DE.json +15 -1
- package/static/translations/en-US.json +15 -1
- package/static/translations/es-ES.json +15 -1
- package/static/translations/fi-FI.json +15 -1
- package/static/translations/fr-FR.json +15 -1
- package/static/translations/hu-HU.json +15 -1
- package/static/translations/it-IT.json +15 -1
- package/static/translations/ja-JP.json +15 -1
- package/static/translations/nl-NL.json +15 -1
- package/static/translations/no-NO.json +15 -1
- package/static/translations/pl-PL.json +15 -1
- package/static/translations/pt-BR.json +15 -1
- package/static/translations/pt-PT.json +15 -1
- package/static/translations/ro-RO.json +15 -1
- package/static/translations/ru-RU.json +15 -1
- package/static/translations/sv-SE.json +15 -1
- package/static/translations/tr-TR.json +15 -1
- package/static/translations/tsconfig.json +13 -1
- package/static/translations/uk-UA.json +15 -1
- package/utils/CoordinatesUtils.js +1 -1
- package/utils/PermaLinkUtils.js +31 -22
- package/utils/VectorLayerUtils.js +21 -22
- /package/{plugins/style/Bookmark.css → components/style/BookmarkPanel.css} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Stadtwerke München GmbH
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import bookmarkReducer from '../reducers/bookmark';
|
|
10
|
+
import ReducerIndex from '../reducers/index';
|
|
11
|
+
import { getBookmarks, getVisibilityPresets } from '../utils/PermaLinkUtils';
|
|
12
|
+
ReducerIndex.register("bookmark", bookmarkReducer);
|
|
13
|
+
export var SET_BOOKMARKS = 'SET_BOOKMARKS';
|
|
14
|
+
export var SET_VISIBILITY_PRESETS = 'SET_VISIBILITY_PRESETS';
|
|
15
|
+
export function setBookmarks(bookmarks) {
|
|
16
|
+
return {
|
|
17
|
+
type: SET_BOOKMARKS,
|
|
18
|
+
bookmarks: bookmarks
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function setVisibilityPresets(visibilityPresets) {
|
|
22
|
+
return {
|
|
23
|
+
type: SET_VISIBILITY_PRESETS,
|
|
24
|
+
visibilityPresets: visibilityPresets
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function refreshBookmarks() {
|
|
28
|
+
return function (dispatch) {
|
|
29
|
+
getBookmarks(function (bookmarks) {
|
|
30
|
+
return dispatch(setBookmarks(bookmarks));
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function refreshVisibilityPresets() {
|
|
35
|
+
return function (dispatch) {
|
|
36
|
+
getVisibilityPresets(function (presets) {
|
|
37
|
+
return dispatch(setVisibilityPresets(presets));
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
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 } from './layers';
|
|
36
|
+
import { LayerRole, addLayer, removeLayer, removeAllLayers, replacePlaceholderLayer, setSwipe, setThemeLayersVisibilityPreset } 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, initialVisibilityPreset) {
|
|
55
55
|
var _theme$config$section, _theme$config, _theme$config2;
|
|
56
56
|
// Create layer
|
|
57
57
|
var themeLayer = ThemeUtils.createThemeLayer(theme, themes);
|
|
@@ -143,6 +143,9 @@ 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
|
+
}
|
|
146
149
|
var section = ConfigUtils.isMobile() ? "mobile" : "desktop";
|
|
147
150
|
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);
|
|
148
151
|
if (task) {
|
|
@@ -159,6 +162,7 @@ export function setCurrentTheme(theme, themes) {
|
|
|
159
162
|
var themeLayerRestorer = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
160
163
|
var externalLayerRestorer = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
161
164
|
var initialTask = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
165
|
+
var initialVisibilityPreset = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
|
|
162
166
|
return function (dispatch, getState) {
|
|
163
167
|
var _getState$layers, _ref, _theme$mapTips;
|
|
164
168
|
var curLayers = ((_getState$layers = getState().layers) === null || _getState$layers === void 0 ? void 0 : _getState$layers.flat) || [];
|
|
@@ -307,13 +311,13 @@ export function setCurrentTheme(theme, themes) {
|
|
|
307
311
|
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", diff.join(", ")), NotificationType.WARN, true));
|
|
308
312
|
}
|
|
309
313
|
}
|
|
310
|
-
finishThemeSetup(dispatch, newTheme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask);
|
|
314
|
+
finishThemeSetup(dispatch, newTheme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask, initialVisibilityPreset);
|
|
311
315
|
});
|
|
312
316
|
} else {
|
|
313
317
|
if (!isEmpty(missingThemeLayers)) {
|
|
314
318
|
dispatch(showNotification("missinglayers", LocaleUtils.tr("app.missinglayers", Object.keys(missingThemeLayers).join(", ")), NotificationType.WARN, true));
|
|
315
319
|
}
|
|
316
|
-
finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask);
|
|
320
|
+
finishThemeSetup(dispatch, theme, themes, layerConfigs, insertPos, permalinkLayers, externalLayerRestorer, visibleBgLayer, initialTheme, initialTask, initialVisibilityPreset);
|
|
317
321
|
}
|
|
318
322
|
};
|
|
319
323
|
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
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
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import classnames from 'classnames';
|
|
25
|
+
import isEmpty from 'lodash.isempty';
|
|
26
|
+
import PropTypes from 'prop-types';
|
|
27
|
+
import Icon from '../components/Icon';
|
|
28
|
+
import InputContainer from '../components/widgets/InputContainer';
|
|
29
|
+
import TextInput from '../components/widgets/TextInput';
|
|
30
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
31
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
32
|
+
import MiscUtils from '../utils/MiscUtils';
|
|
33
|
+
import './style/BookmarkPanel.css';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Allows managing user bookmarks.
|
|
37
|
+
* or user visibility presets if `visibilityPresetsMode` is true.
|
|
38
|
+
*
|
|
39
|
+
* Bookmarks are only allowed for authenticated users.
|
|
40
|
+
*
|
|
41
|
+
* Requires `permalinkServiceUrl` to point to a `qwc-permalink-service`.
|
|
42
|
+
*/
|
|
43
|
+
var BookmarkPanel = /*#__PURE__*/function (_React$Component) {
|
|
44
|
+
function BookmarkPanel() {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, BookmarkPanel);
|
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
_this = _callSuper(this, BookmarkPanel, [].concat(args));
|
|
51
|
+
_defineProperty(_this, "state", {
|
|
52
|
+
renameBookmark: null,
|
|
53
|
+
currentBookmark: null,
|
|
54
|
+
busy: false
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(_this, "bookmarkClicked", function (ev, bookmark) {
|
|
57
|
+
if (_this.state.renameBookmark) {
|
|
58
|
+
// pass
|
|
59
|
+
} else if (_this.props.openOnClick) {
|
|
60
|
+
_this.props.onOpen(bookmark.key, ev.button === 1);
|
|
61
|
+
} else if (_this.state.currentBookmark === bookmark.key) {
|
|
62
|
+
_this.setState({
|
|
63
|
+
currentBookmark: null,
|
|
64
|
+
description: ""
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
_this.setState({
|
|
68
|
+
currentBookmark: bookmark.key,
|
|
69
|
+
description: bookmark.description
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
_defineProperty(_this, "updateBookmarkName", function (text) {
|
|
74
|
+
_this.setState({
|
|
75
|
+
busy: true
|
|
76
|
+
});
|
|
77
|
+
_this.props.onRename(_this.state.renameBookmark, text, function (success) {
|
|
78
|
+
if (!success) {
|
|
79
|
+
var _this$props$translati;
|
|
80
|
+
/* eslint-disable-next-line */
|
|
81
|
+
alert((_this$props$translati = _this.props.translations) === null || _this$props$translati === void 0 ? void 0 : _this$props$translati.savefailed);
|
|
82
|
+
}
|
|
83
|
+
_this.props.onRefresh();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
_defineProperty(_this, "addBookmark", function () {
|
|
87
|
+
var _this$props$translati2;
|
|
88
|
+
_this.setState({
|
|
89
|
+
busy: true
|
|
90
|
+
});
|
|
91
|
+
_this.props.onAdd((_this$props$translati2 = _this.props.translations) === null || _this$props$translati2 === void 0 ? void 0 : _this$props$translati2.newbookmark, function (success, key) {
|
|
92
|
+
if (!success) {
|
|
93
|
+
var _this$props$translati3;
|
|
94
|
+
/* eslint-disable-next-line */
|
|
95
|
+
alert((_this$props$translati3 = _this.props.translations) === null || _this$props$translati3 === void 0 ? void 0 : _this$props$translati3.addfailed);
|
|
96
|
+
}
|
|
97
|
+
_this.props.onRefresh();
|
|
98
|
+
});
|
|
99
|
+
_this.setState({
|
|
100
|
+
description: "",
|
|
101
|
+
currentBookmark: null
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
_defineProperty(_this, "updateBookmark", function (key) {
|
|
105
|
+
_this.setState({
|
|
106
|
+
busy: true
|
|
107
|
+
});
|
|
108
|
+
var description = _this.props.bookmarks.find(function (bk) {
|
|
109
|
+
return bk.key === key;
|
|
110
|
+
}).description;
|
|
111
|
+
_this.props.onUpdate(key, description, function (success) {
|
|
112
|
+
if (!success) {
|
|
113
|
+
var _this$props$translati4;
|
|
114
|
+
/* eslint-disable-next-line */
|
|
115
|
+
alert((_this$props$translati4 = _this.props.translations) === null || _this$props$translati4 === void 0 ? void 0 : _this$props$translati4.savefailed);
|
|
116
|
+
}
|
|
117
|
+
_this.props.onRefresh();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
_defineProperty(_this, "removeBookmark", function (key) {
|
|
121
|
+
_this.setState({
|
|
122
|
+
busy: true
|
|
123
|
+
});
|
|
124
|
+
_this.props.onRemove(key, function (success) {
|
|
125
|
+
if (!success) {
|
|
126
|
+
var _this$props$translati5;
|
|
127
|
+
/* eslint-disable-next-line */
|
|
128
|
+
alert((_this$props$translati5 = _this.props.translations) === null || _this$props$translati5 === void 0 ? void 0 : _this$props$translati5.removefailed);
|
|
129
|
+
}
|
|
130
|
+
_this.props.onRefresh();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
return _this;
|
|
134
|
+
}
|
|
135
|
+
_inherits(BookmarkPanel, _React$Component);
|
|
136
|
+
return _createClass(BookmarkPanel, [{
|
|
137
|
+
key: "componentDidUpdate",
|
|
138
|
+
value: function componentDidUpdate(prevProps) {
|
|
139
|
+
// Check exact identity of bookmarks array to reset busy state in all cases
|
|
140
|
+
if (prevProps.bookmarks !== this.props.bookmarks) {
|
|
141
|
+
this.setState({
|
|
142
|
+
renameBookmark: null,
|
|
143
|
+
busy: false
|
|
144
|
+
});
|
|
145
|
+
// Select a recently added bookmark
|
|
146
|
+
var addedBookmark = this.props.bookmarks.find(function (bookmark) {
|
|
147
|
+
return !prevProps.bookmarks.some(function (prevBookmark) {
|
|
148
|
+
return prevBookmark.key === bookmark.key;
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
if (addedBookmark) {
|
|
152
|
+
this.setState({
|
|
153
|
+
renameBookmark: addedBookmark.key,
|
|
154
|
+
currentBookmark: null
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "render",
|
|
161
|
+
value: function render() {
|
|
162
|
+
var _this$props$translati6,
|
|
163
|
+
_this$props$translati7,
|
|
164
|
+
_this$props$translati8,
|
|
165
|
+
_this2 = this,
|
|
166
|
+
_this$props$translati9,
|
|
167
|
+
_this$props$translati0,
|
|
168
|
+
_this$props$translati1,
|
|
169
|
+
_this$props$translati10,
|
|
170
|
+
_this$props$translati11;
|
|
171
|
+
var username = ConfigUtils.getConfigProp("username");
|
|
172
|
+
var currentBookmark = this.state.currentBookmark;
|
|
173
|
+
var buttonsDisabled = !currentBookmark || this.state.busy;
|
|
174
|
+
return !username ? /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
className: "bookmark-body",
|
|
176
|
+
role: "body"
|
|
177
|
+
}, " ", (_this$props$translati6 = this.props.translations) === null || _this$props$translati6 === void 0 ? void 0 : _this$props$translati6.notloggedin) : /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: "bookmark-body",
|
|
179
|
+
role: "body"
|
|
180
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
181
|
+
className: "bookmark-header"
|
|
182
|
+
}, /*#__PURE__*/React.createElement("span", null, (_this$props$translati7 = this.props.translations) === null || _this$props$translati7 === void 0 ? void 0 : _this$props$translati7.manage), /*#__PURE__*/React.createElement("button", {
|
|
183
|
+
className: "button",
|
|
184
|
+
onClick: this.addBookmark,
|
|
185
|
+
title: (_this$props$translati8 = this.props.translations) === null || _this$props$translati8 === void 0 ? void 0 : _this$props$translati8.add
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
187
|
+
icon: "plus"
|
|
188
|
+
}))), !this.props.openOnClick ? /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "bookmark-actions controlgroup"
|
|
190
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
191
|
+
className: "button",
|
|
192
|
+
disabled: buttonsDisabled,
|
|
193
|
+
onClick: function onClick() {
|
|
194
|
+
return _this2.props.onOpen(currentBookmark, false);
|
|
195
|
+
},
|
|
196
|
+
title: (_this$props$translati9 = this.props.translations) === null || _this$props$translati9 === void 0 ? void 0 : _this$props$translati9.open
|
|
197
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
198
|
+
icon: "folder-open"
|
|
199
|
+
})), this.props.showOpenTab ? /*#__PURE__*/React.createElement("button", {
|
|
200
|
+
className: "button",
|
|
201
|
+
disabled: buttonsDisabled,
|
|
202
|
+
onClick: function onClick() {
|
|
203
|
+
return _this2.props.onOpen(currentBookmark, true);
|
|
204
|
+
},
|
|
205
|
+
title: (_this$props$translati0 = this.props.translations) === null || _this$props$translati0 === void 0 ? void 0 : _this$props$translati0.openTab
|
|
206
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
207
|
+
icon: "open_link"
|
|
208
|
+
})) : null, this.props.showZoomToExtent ? /*#__PURE__*/React.createElement("button", {
|
|
209
|
+
className: "button",
|
|
210
|
+
disabled: buttonsDisabled,
|
|
211
|
+
onClick: function onClick() {
|
|
212
|
+
return _this2.props.onZoomToExtent(currentBookmark);
|
|
213
|
+
},
|
|
214
|
+
title: (_this$props$translati1 = this.props.translations) === null || _this$props$translati1 === void 0 ? void 0 : _this$props$translati1.zoomToExtent
|
|
215
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
216
|
+
icon: "zoom"
|
|
217
|
+
})) : null, /*#__PURE__*/React.createElement("button", {
|
|
218
|
+
className: "button",
|
|
219
|
+
disabled: buttonsDisabled,
|
|
220
|
+
onClick: function onClick() {
|
|
221
|
+
return _this2.updateBookmark(currentBookmark);
|
|
222
|
+
},
|
|
223
|
+
title: (_this$props$translati10 = this.props.translations) === null || _this$props$translati10 === void 0 ? void 0 : _this$props$translati10.update
|
|
224
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
225
|
+
icon: "save"
|
|
226
|
+
}))) : null, /*#__PURE__*/React.createElement("div", {
|
|
227
|
+
className: "bookmark-list"
|
|
228
|
+
}, this.props.bookmarks.map(function (bookmark) {
|
|
229
|
+
var _this2$props$translat;
|
|
230
|
+
var itemclasses = classnames({
|
|
231
|
+
"bookmark-list-item": true,
|
|
232
|
+
"bookmark-list-item-active": currentBookmark === bookmark.key
|
|
233
|
+
});
|
|
234
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
className: itemclasses,
|
|
236
|
+
key: bookmark.key,
|
|
237
|
+
onAuxClick: function onAuxClick(ev) {
|
|
238
|
+
return _this2.bookmarkClicked(ev, bookmark);
|
|
239
|
+
},
|
|
240
|
+
onClick: function onClick(ev) {
|
|
241
|
+
return _this2.bookmarkClicked(ev, bookmark);
|
|
242
|
+
},
|
|
243
|
+
onDoubleClick: function onDoubleClick() {
|
|
244
|
+
return _this2.props.onOpen(bookmark.key, false);
|
|
245
|
+
},
|
|
246
|
+
title: ((_this2$props$translat = _this2.props.translations) === null || _this2$props$translat === void 0 ? void 0 : _this2$props$translat.lastUpdate) + ": " + bookmark.date
|
|
247
|
+
}, _this2.state.renameBookmark === bookmark.key ? /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(TextInput, {
|
|
248
|
+
focusOnRef: true,
|
|
249
|
+
onChange: _this2.updateBookmarkName,
|
|
250
|
+
onNoChange: function onNoChange() {
|
|
251
|
+
return _this2.setState({
|
|
252
|
+
renameBookmark: null
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
role: "input",
|
|
256
|
+
showClear: false,
|
|
257
|
+
value: bookmark.description
|
|
258
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
259
|
+
icon: "ok",
|
|
260
|
+
onClick: MiscUtils.killEvent,
|
|
261
|
+
role: "suffix"
|
|
262
|
+
})) : /*#__PURE__*/React.createElement("span", null, bookmark.description), _this2.state.renameBookmark !== bookmark.key ? /*#__PURE__*/React.createElement(Icon, {
|
|
263
|
+
icon: "draw",
|
|
264
|
+
onClick: function onClick(ev) {
|
|
265
|
+
_this2.setState({
|
|
266
|
+
renameBookmark: bookmark.key,
|
|
267
|
+
currentBookmark: null
|
|
268
|
+
});
|
|
269
|
+
MiscUtils.killEvent(ev);
|
|
270
|
+
},
|
|
271
|
+
title: LocaleUtils.tr("common.rename")
|
|
272
|
+
}) : null, _this2.state.renameBookmark !== bookmark.key ? /*#__PURE__*/React.createElement(Icon, {
|
|
273
|
+
disabled: _this2.state.busy,
|
|
274
|
+
icon: "trash",
|
|
275
|
+
onClick: function onClick(ev) {
|
|
276
|
+
_this2.removeBookmark(bookmark.key);
|
|
277
|
+
MiscUtils.killEvent(ev);
|
|
278
|
+
},
|
|
279
|
+
title: LocaleUtils.tr("common.delete")
|
|
280
|
+
}) : null);
|
|
281
|
+
}), isEmpty(this.props.bookmarks) ? /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: "bookmark-list-item-empty"
|
|
283
|
+
}, (_this$props$translati11 = this.props.translations) === null || _this$props$translati11 === void 0 ? void 0 : _this$props$translati11.nobookmarks) : null));
|
|
284
|
+
}
|
|
285
|
+
}]);
|
|
286
|
+
}(React.Component);
|
|
287
|
+
_defineProperty(BookmarkPanel, "availableIn3D", true);
|
|
288
|
+
_defineProperty(BookmarkPanel, "propTypes", {
|
|
289
|
+
bookmarks: PropTypes.array,
|
|
290
|
+
onAdd: PropTypes.func,
|
|
291
|
+
onOpen: PropTypes.func,
|
|
292
|
+
onRefresh: PropTypes.func,
|
|
293
|
+
onRemove: PropTypes.func,
|
|
294
|
+
onRename: PropTypes.func,
|
|
295
|
+
onUpdate: PropTypes.func,
|
|
296
|
+
onZoomToExtent: PropTypes.func,
|
|
297
|
+
/** Whether to directly open the bookmark on click / middle click, instead of showing dedicated open buttons. */
|
|
298
|
+
openOnClick: PropTypes.bool,
|
|
299
|
+
showOpenTab: PropTypes.bool,
|
|
300
|
+
showZoomToExtent: PropTypes.bool,
|
|
301
|
+
translations: PropTypes.objectOf(PropTypes.string)
|
|
302
|
+
});
|
|
303
|
+
_defineProperty(BookmarkPanel, "defaultProps", {
|
|
304
|
+
showOpenTab: true,
|
|
305
|
+
showZoomToExtent: false
|
|
306
|
+
});
|
|
307
|
+
export default BookmarkPanel;
|
|
@@ -40,6 +40,7 @@ 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';
|
|
43
44
|
import { localConfigLoaded, setStartupParameters, setColorScheme } from '../actions/localConfig';
|
|
44
45
|
import { changeLocale } from '../actions/locale';
|
|
45
46
|
import { setCurrentTask } from '../actions/task';
|
|
@@ -163,7 +164,7 @@ var AppContainerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
163
164
|
layerParams.reverse();
|
|
164
165
|
}
|
|
165
166
|
var initialTaskParam = params.task ? JSON.parse(decodeURIComponent(params.task)) : null;
|
|
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);
|
|
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, state.visibilityPreset);
|
|
167
168
|
} else if (!ConfigUtils.havePlugin("Portal")) {
|
|
168
169
|
_this.props.showNotification("missingdefaulttheme", LocaleUtils.tr("app.missingdefaulttheme", params.t), NotificationType.WARN, true);
|
|
169
170
|
}
|
|
@@ -204,6 +205,7 @@ var AppContainerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
204
205
|
}(React.Component);
|
|
205
206
|
_defineProperty(AppContainerComponent, "propTypes", {
|
|
206
207
|
appConfig: PropTypes.object,
|
|
208
|
+
currentTheme: PropTypes.object,
|
|
207
209
|
defaultUrlParams: PropTypes.string,
|
|
208
210
|
haveMapSize: PropTypes.bool,
|
|
209
211
|
localConfig: PropTypes.object,
|
|
@@ -211,6 +213,7 @@ _defineProperty(AppContainerComponent, "propTypes", {
|
|
|
211
213
|
setBottombarHeight: PropTypes.func,
|
|
212
214
|
setCurrentTask: PropTypes.func,
|
|
213
215
|
setCurrentTheme: PropTypes.func,
|
|
216
|
+
setThemeLayersVisibilityPreset: PropTypes.func,
|
|
214
217
|
setTopbarHeight: PropTypes.func,
|
|
215
218
|
showNotification: PropTypes.func,
|
|
216
219
|
startupConfig: PropTypes.object,
|
|
@@ -331,6 +334,10 @@ var StandardApp = /*#__PURE__*/function (_React$Component2) {
|
|
|
331
334
|
var colorScheme = initialParams.style || storedColorScheme || ConfigUtils.getConfigProp("defaultColorScheme");
|
|
332
335
|
StandardApp.store.dispatch(setColorScheme(colorScheme));
|
|
333
336
|
|
|
337
|
+
// Load all bookmarks & visiblity presets
|
|
338
|
+
StandardApp.store.dispatch(refreshBookmarks());
|
|
339
|
+
StandardApp.store.dispatch(refreshVisibilityPresets());
|
|
340
|
+
|
|
334
341
|
// Resolve permalink and restore settings
|
|
335
342
|
resolvePermaLink(initialParams, function (params, state, success) {
|
|
336
343
|
StandardApp.store.dispatch(setStartupParameters(params, state));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
13
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
16
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
17
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18
|
+
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; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
+
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); }
|
|
21
|
+
/**
|
|
22
|
+
* Copyright 2025 Stadtwerke München GmbH
|
|
23
|
+
* All rights reserved.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the BSD-style license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import React, { Component } from 'react';
|
|
30
|
+
import PropTypes from 'prop-types';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Dropdown for selecting options grouped under sections.
|
|
34
|
+
*/
|
|
35
|
+
var GroupSelect = /*#__PURE__*/function (_Component) {
|
|
36
|
+
function GroupSelect() {
|
|
37
|
+
var _this;
|
|
38
|
+
_classCallCheck(this, GroupSelect);
|
|
39
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
|
+
args[_key] = arguments[_key];
|
|
41
|
+
}
|
|
42
|
+
_this = _callSuper(this, GroupSelect, [].concat(args));
|
|
43
|
+
_defineProperty(_this, "onChange", function (e) {
|
|
44
|
+
_this.props.onChange(e.target.value);
|
|
45
|
+
});
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
_inherits(GroupSelect, _Component);
|
|
49
|
+
return _createClass(GroupSelect, [{
|
|
50
|
+
key: "render",
|
|
51
|
+
value: function render() {
|
|
52
|
+
return /*#__PURE__*/React.createElement("select", {
|
|
53
|
+
onChange: this.onChange,
|
|
54
|
+
role: "input",
|
|
55
|
+
value: this.props.value
|
|
56
|
+
}, this.props.placeholder !== null ? /*#__PURE__*/React.createElement("option", {
|
|
57
|
+
disabled: true,
|
|
58
|
+
hidden: true,
|
|
59
|
+
selected: true
|
|
60
|
+
}, this.props.placeholder) : null, this.props.defaultOption !== null ? /*#__PURE__*/React.createElement("option", {
|
|
61
|
+
key: this.props.defaultOption[0],
|
|
62
|
+
value: this.props.defaultOption[0]
|
|
63
|
+
}, this.props.defaultOption[1]) : null, Object.entries(this.props.options || {}).map(function (_ref, index) {
|
|
64
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
65
|
+
title = _ref2[0],
|
|
66
|
+
options = _ref2[1];
|
|
67
|
+
return options && options.length > 0 ? /*#__PURE__*/React.createElement("optgroup", {
|
|
68
|
+
key: "optgroup-" + index,
|
|
69
|
+
label: title
|
|
70
|
+
}, options.map(function (_ref3) {
|
|
71
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
72
|
+
value = _ref4[0],
|
|
73
|
+
description = _ref4[1];
|
|
74
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
75
|
+
key: value,
|
|
76
|
+
value: value
|
|
77
|
+
}, description);
|
|
78
|
+
})) : null;
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
}(Component);
|
|
83
|
+
_defineProperty(GroupSelect, "propTypes", {
|
|
84
|
+
defaultOption: PropTypes.array,
|
|
85
|
+
onChange: PropTypes.func,
|
|
86
|
+
options: PropTypes.object,
|
|
87
|
+
placeholder: PropTypes.string,
|
|
88
|
+
value: PropTypes.string
|
|
89
|
+
});
|
|
90
|
+
_defineProperty(GroupSelect, "defaultProps", {
|
|
91
|
+
defaultOption: null,
|
|
92
|
+
placeholder: null
|
|
93
|
+
});
|
|
94
|
+
export { GroupSelect as default };
|