qwc2 2025.10.9 → 2025.10.14

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 (241) hide show
  1. package/actions/display.js +30 -1
  2. package/actions/editing.js +22 -1
  3. package/actions/layerinfo.js +13 -1
  4. package/actions/layers.js +213 -3
  5. package/actions/localConfig.js +58 -1
  6. package/actions/locale.js +21 -1
  7. package/actions/locate.js +26 -1
  8. package/actions/logging.js +10 -1
  9. package/actions/map.js +105 -2
  10. package/actions/measurement.js +12 -1
  11. package/actions/processNotifications.js +37 -1
  12. package/actions/redlining.js +18 -1
  13. package/actions/redliningPick.js +12 -1
  14. package/actions/search.js +12 -1
  15. package/actions/serviceinfo.js +12 -1
  16. package/actions/task.js +55 -3
  17. package/actions/theme.js +339 -19
  18. package/actions/windows.js +164 -5
  19. package/components/AppMenu.js +435 -3
  20. package/components/AttributeForm.js +928 -32
  21. package/components/AttributeTableWidget.js +1105 -13
  22. package/components/AutoEditForm.js +189 -3
  23. package/components/CoordinateDisplayer.js +78 -2
  24. package/components/EditComboField.js +190 -6
  25. package/components/EditUploadField.js +315 -3
  26. package/components/ExportSelection.js +203 -2
  27. package/components/FullscreenSwitcher.js +90 -3
  28. package/components/Icon.js +81 -2
  29. package/components/IdentifyViewer.js +1161 -6
  30. package/components/ImportLayer.js +718 -20
  31. package/components/LayerInfoWindow.js +145 -2
  32. package/components/LinkFeatureForm.js +246 -5
  33. package/components/MapButton.js +88 -2
  34. package/components/MapSelection.js +287 -8
  35. package/components/MessageBar.js +68 -2
  36. package/components/NumericInputWindow.js +359 -2
  37. package/components/PickFeature.js +266 -2
  38. package/components/PluginsContainer.js +227 -8
  39. package/components/PrintSelection.js +620 -49
  40. package/components/ProcessNotifications.js +104 -2
  41. package/components/QtDesignerForm.js +1137 -18
  42. package/components/ResizeableWindow.js +591 -8
  43. package/components/SearchBox.js +1307 -20
  44. package/components/ServiceInfoWindow.js +107 -2
  45. package/components/SideBar.js +204 -4
  46. package/components/StandardApp.js +381 -20
  47. package/components/Swipeable.js +15 -1
  48. package/components/TaskBar.js +85 -2
  49. package/components/ThemeLayersListWindow.js +216 -4
  50. package/components/ThemeList.js +381 -7
  51. package/components/Toolbar.js +106 -2
  52. package/components/WindowManager.js +178 -2
  53. package/components/map/OlLayer.js +257 -6
  54. package/components/map/OlMap.js +405 -5
  55. package/components/map/layers/BingLayer.js +31 -2
  56. package/components/map/layers/GoogleLayer.js +222 -19
  57. package/components/map/layers/GraticuleLayer.js +21 -1
  58. package/components/map/layers/ImageLayer.js +15 -1
  59. package/components/map/layers/MVTLayer.js +52 -2
  60. package/components/map/layers/OSMLayer.js +24 -2
  61. package/components/map/layers/OverlayLayer.js +55 -3
  62. package/components/map/layers/VectorLayer.js +173 -8
  63. package/components/map/layers/WFSLayer.js +220 -6
  64. package/components/map/layers/WMSLayer.js +180 -6
  65. package/components/map/layers/WMTSLayer.js +67 -3
  66. package/components/map/layers/XYZLayer.js +24 -2
  67. package/components/map/layers/index.js +28 -1
  68. package/components/map3d/EditDataset3D.js +190 -3
  69. package/components/map3d/HeightProfile3D.js +402 -3
  70. package/components/map3d/ImportObjects3D.js +162 -2
  71. package/components/map3d/Map3D.js +1304 -38
  72. package/components/map3d/MapControls3D.js +392 -7
  73. package/components/map3d/SearchField3D.js +183 -11
  74. package/components/map3d/View3DSwitcher.js +98 -2
  75. package/components/map3d/drawtool/CreateTool3D.js +174 -4
  76. package/components/map3d/drawtool/EditTool3D.js +590 -6
  77. package/components/map3d/drawtool/NumericInput3D.js +336 -4
  78. package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
  79. package/components/map3d/layers/VectorLayer3D.js +53 -2
  80. package/components/map3d/layers/WFSLayer3D.js +109 -3
  81. package/components/map3d/layers/WMSLayer3D.js +70 -2
  82. package/components/map3d/layers/WMTSLayer3D.js +27 -3
  83. package/components/map3d/layers/index.js +14 -1
  84. package/components/map3d/utils/FirstPersonControls3D.js +423 -16
  85. package/components/map3d/utils/MiscUtils3D.js +221 -13
  86. package/components/map3d/utils/OrbitControls3D.js +176 -5
  87. package/components/map3d/utils/Tiles3DStyle.js +238 -9
  88. package/components/share/ShareLink.js +54 -2
  89. package/components/share/ShareQRCode.js +62 -2
  90. package/components/share/ShareSocials.js +125 -3
  91. package/components/timeline/FixedTimeline.js +236 -5
  92. package/components/timeline/InfiniteTimeline.js +347 -8
  93. package/components/timeline/TimelineFeaturesSlider.js +439 -5
  94. package/components/widgets/AccordeonWidget.js +96 -2
  95. package/components/widgets/ButtonBar.js +124 -2
  96. package/components/widgets/ColorButton.js +201 -3
  97. package/components/widgets/ComboBox.js +166 -2
  98. package/components/widgets/CopyButton.js +110 -2
  99. package/components/widgets/DateTimeInput.js +100 -3
  100. package/components/widgets/EditableSelect.js +230 -3
  101. package/components/widgets/FileSelector.js +128 -4
  102. package/components/widgets/Input.js +124 -2
  103. package/components/widgets/InputContainer.js +96 -2
  104. package/components/widgets/LayerCatalogWidget.js +219 -3
  105. package/components/widgets/MenuButton.js +157 -1
  106. package/components/widgets/ModalDialog.js +64 -2
  107. package/components/widgets/NavBar.js +119 -2
  108. package/components/widgets/NumberInput.js +226 -4
  109. package/components/widgets/PopupMenu.js +72 -1
  110. package/components/widgets/Primitives.js +6 -1
  111. package/components/widgets/ReCaptchaWidget.js +55 -1
  112. package/components/widgets/SearchWidget.js +255 -2
  113. package/components/widgets/Spinner.js +44 -2
  114. package/components/widgets/SuggestionInput.js +77 -2
  115. package/components/widgets/TextInput.js +308 -2
  116. package/components/widgets/ToggleSwitch.js +85 -2
  117. package/components/widgets/VectorLayerPicker.js +85 -3
  118. package/libs/openlayers.js +225 -5
  119. package/package.json +1 -1
  120. package/plugins/API.js +358 -15
  121. package/plugins/AttributeTable.js +109 -3
  122. package/plugins/Authentication.js +130 -5
  123. package/plugins/BackgroundSwitcher.js +218 -4
  124. package/plugins/Bookmark.js +289 -3
  125. package/plugins/BottomBar.js +298 -4
  126. package/plugins/CookiePopup.js +67 -3
  127. package/plugins/Cyclomedia.js +442 -5
  128. package/plugins/Editing.js +497 -9
  129. package/plugins/FeatureForm.js +366 -4
  130. package/plugins/FeatureSearch.js +458 -3
  131. package/plugins/GeometryDigitizer.js +664 -7
  132. package/plugins/HeightProfile.js +763 -15
  133. package/plugins/Help.js +102 -3
  134. package/plugins/HomeButton.js +80 -3
  135. package/plugins/Identify.js +543 -5
  136. package/plugins/LayerCatalog.js +215 -4
  137. package/plugins/LayerTree.js +1194 -6
  138. package/plugins/LocateButton.js +94 -3
  139. package/plugins/Map.js +320 -16
  140. package/plugins/MapCompare.js +94 -3
  141. package/plugins/MapCopyright.js +127 -5
  142. package/plugins/MapExport.js +613 -20
  143. package/plugins/MapFilter.js +868 -12
  144. package/plugins/MapInfoTooltip.js +277 -3
  145. package/plugins/MapLegend.js +253 -4
  146. package/plugins/MapTip.js +290 -4
  147. package/plugins/Measure.js +220 -4
  148. package/plugins/NewsPopup.js +137 -3
  149. package/plugins/OverviewMap.js +167 -7
  150. package/plugins/Panoramax.js +340 -2
  151. package/plugins/Portal.js +199 -4
  152. package/plugins/Print.js +1231 -15
  153. package/plugins/Redlining.js +750 -6
  154. package/plugins/Reports.js +332 -3
  155. package/plugins/Routing.js +1278 -15
  156. package/plugins/ScratchDrawing.js +173 -5
  157. package/plugins/Settings.js +241 -4
  158. package/plugins/Share.js +198 -3
  159. package/plugins/StartupMarker.js +84 -4
  160. package/plugins/TaskButton.js +88 -3
  161. package/plugins/ThemeSwitcher.js +164 -4
  162. package/plugins/TimeManager.js +971 -10
  163. package/plugins/TopBar.js +300 -7
  164. package/plugins/TourGuide.js +213 -2
  165. package/plugins/ValueTool.js +419 -4
  166. package/plugins/View3D.js +519 -14
  167. package/plugins/ZoomButtons.js +165 -3
  168. package/plugins/map/EditingSupport.js +199 -7
  169. package/plugins/map/LocateSupport.js +260 -4
  170. package/plugins/map/MeasurementSupport.js +216 -8
  171. package/plugins/map/RedliningPickSupport.js +201 -7
  172. package/plugins/map/RedliningSupport.js +726 -17
  173. package/plugins/map/SnapInteraction.js +101 -1
  174. package/plugins/map/SnapSupport.js +210 -2
  175. package/plugins/map/SnappingSupport.js +356 -17
  176. package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
  177. package/plugins/map3d/BottomBar3D.js +118 -3
  178. package/plugins/map3d/Compare3D.js +422 -8
  179. package/plugins/map3d/Draw3D.js +353 -6
  180. package/plugins/map3d/ExportObjects3D.js +393 -18
  181. package/plugins/map3d/HideObjects3D.js +313 -12
  182. package/plugins/map3d/Identify3D.js +283 -12
  183. package/plugins/map3d/LayerTree3D.js +323 -3
  184. package/plugins/map3d/MapCopyright3D.js +128 -5
  185. package/plugins/map3d/MapExport3D.js +590 -10
  186. package/plugins/map3d/MapLight3D.js +553 -6
  187. package/plugins/map3d/Measure3D.js +571 -20
  188. package/plugins/map3d/OverviewMap3D.js +169 -3
  189. package/plugins/map3d/Settings3D.js +73 -3
  190. package/plugins/map3d/TopBar3D.js +207 -9
  191. package/plugins/redlining/RedliningBufferSupport.js +206 -3
  192. package/reducers/display.js +34 -2
  193. package/reducers/editing.js +68 -3
  194. package/reducers/index.js +9 -1
  195. package/reducers/layerinfo.js +26 -2
  196. package/reducers/layers.js +456 -9
  197. package/reducers/localConfig.js +122 -2
  198. package/reducers/locale.js +38 -2
  199. package/reducers/locate.js +40 -2
  200. package/reducers/map.js +176 -5
  201. package/reducers/measurement.js +42 -2
  202. package/reducers/processNotifications.js +49 -2
  203. package/reducers/redlining.js +50 -2
  204. package/reducers/redliningPick.js +27 -2
  205. package/reducers/search.js +20 -1
  206. package/reducers/serviceinfo.js +25 -2
  207. package/reducers/task.js +45 -2
  208. package/reducers/theme.js +51 -2
  209. package/reducers/windows.js +203 -2
  210. package/scripts/dist.sh +1 -1
  211. package/scripts/gen-plugin-docs.js +152 -2
  212. package/scripts/makeIconkit.js +85 -6
  213. package/scripts/themesConfig.js +742 -40
  214. package/scripts/updateTranslations.js +251 -10
  215. package/selectors/searchproviders.js +44 -2
  216. package/stores/StandardStore.js +42 -2
  217. package/utils/ConfigUtils.js +84 -3
  218. package/utils/CoordinatesUtils.js +234 -23
  219. package/utils/DxfUtils.js +237 -11
  220. package/utils/EditingInterface.js +421 -87
  221. package/utils/EditingUtils.js +357 -13
  222. package/utils/ElevationInterface.js +83 -22
  223. package/utils/FeatureStyles.js +429 -5
  224. package/utils/IdentifyUtils.js +443 -7
  225. package/utils/ImageEditor.js +79 -9
  226. package/utils/LayerUtils.js +1516 -50
  227. package/utils/LocaleUtils.js +117 -7
  228. package/utils/MapUtils.js +241 -59
  229. package/utils/MeasureUtils.js +323 -2
  230. package/utils/MiscUtils.js +189 -11
  231. package/utils/PermaLinkUtils.js +429 -6
  232. package/utils/PluginStore.js +27 -1
  233. package/utils/ResourceRegistry.js +15 -1
  234. package/utils/RoutingInterface.js +307 -7
  235. package/utils/SearchProviders.js +722 -19
  236. package/utils/ServiceLayerUtils.js +669 -14
  237. package/utils/Signal.js +32 -2
  238. package/utils/ThemeUtils.js +341 -7
  239. package/utils/VectorLayerUtils.js +589 -15
  240. package/utils/expr_grammar/grammar.js +2239 -2
  241. package/utils/expr_grammar/test.js +65 -3
package/plugins/TopBar.js CHANGED
@@ -1,13 +1,306 @@
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)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}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)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}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)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}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)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}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}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}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)}/**
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
+ 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); } }
6
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ 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); }
9
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
10
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
12
+ 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); }
13
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
14
+ 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; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
+ 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); }
17
+ /**
2
18
  * Copyright 2016-2024 Sourcepole AG
3
19
  * All rights reserved.
4
20
  *
5
21
  * This source code is licensed under the BSD-style license found in the
6
22
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import{connect}from"react-redux";import classnames from"classnames";import{remove as removeDiacritics}from"diacritics";import PropTypes from"prop-types";import{toggleFullscreen}from"../actions/display";import{openExternalUrl,setTopbarHeight}from"../actions/windows";import{Swipeable}from"../components/Swipeable";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import{registerSearchProvider,SearchResultType,unregisterSearchProvider}from"../utils/SearchProviders";import ThemeUtils from"../utils/ThemeUtils";import"./style/TopBar.css";/**
23
+ */
24
+
25
+ import React from 'react';
26
+ import { connect } from 'react-redux';
27
+ import classnames from 'classnames';
28
+ import { remove as removeDiacritics } from 'diacritics';
29
+ import PropTypes from 'prop-types';
30
+ import { toggleFullscreen } from '../actions/display';
31
+ import { openExternalUrl, setTopbarHeight } from '../actions/windows';
32
+ import { Swipeable } from '../components/Swipeable';
33
+ import ConfigUtils from '../utils/ConfigUtils';
34
+ import LocaleUtils from '../utils/LocaleUtils';
35
+ import { registerSearchProvider, SearchResultType, unregisterSearchProvider } from '../utils/SearchProviders';
36
+ import ThemeUtils from '../utils/ThemeUtils';
37
+ import './style/TopBar.css';
38
+
39
+ /**
8
40
  * Top bar, containing the logo, searchbar, task buttons and app menu.
9
- */var TopBar=/*#__PURE__*/function(_React$Component){function TopBar(){var _this;_classCallCheck(this,TopBar);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,TopBar,[].concat(args));_defineProperty(_this,"state",{allowedMenuItems:[],allowedToolbarItems:[]});_defineProperty(_this,"openUrl",function(url,target,title,icon){if(target==="iframe"){target=":iframedialog:externallinkiframe"}_this.props.openExternalUrl(url,target,{title:title,icon:icon})});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setTopbarHeight(el.clientHeight)}});_defineProperty(_this,"searchTasks",function(text,searchParams,callback){var filter=new RegExp(removeDiacritics(text).replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),"i");var results=[];_this.searchTaskGroup(results,filter,_this.state.allowedMenuItems);if(results.length>0){callback({results:[{id:"tasks",title:LocaleUtils.tr("search.tasks"),type:SearchResultType.TASK,items:results}]})}else{callback({results:[]})}});_defineProperty(_this,"searchTaskGroup",function(results,filter,group){group.forEach(function(item){if(item.subitems){_this.searchTaskGroup(results,filter,item.subitems)}else{var label=item.title?LocaleUtils.tr(item.title):LocaleUtils.tr("appmenu.items."+item.key+(item.mode||""));if(removeDiacritics(label).match(filter)){results.push({id:"tasks:"+results.length,text:label,task:item})}}})});return _this}_inherits(TopBar,_React$Component);return _createClass(TopBar,[{key:"componentDidMount",value:function componentDidMount(){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)});if(this.props.registerTaskSearchProvider){registerSearchProvider("tasksearch",{label:LocaleUtils.tr("search.tasks"),onSearch:this.searchTasks})}}},{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.props.registerTaskSearchProvider){unregisterSearchProvider("tasksearch")}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.currentTheme!==prevProps.currentTheme){this.setState({allowedToolbarItems:ThemeUtils.allowedItems(this.props.toolbarItems,this.props.currentTheme),allowedMenuItems:ThemeUtils.allowedItems(this.props.menuItems,this.props.currentTheme)})}}},{key:"render",value:function render(){var _this2=this;var logo;var assetsPath=ConfigUtils.getAssetsPath();var isMobile=ConfigUtils.isMobile();if(isMobile){logo=assetsPath+"/img/logo-mobile."+this.props.logoFormat}else{logo=assetsPath+"/img/logo."+this.props.logoFormat}var classes=classnames({TopBar:true,mobile:isMobile,fullscreen:this.props.fullscreen});var logoEl=/*#__PURE__*/React.createElement("img",{className:"topbar-logo",src:this.props.logoSrc||logo});if(this.props.logoUrl){logoEl=/*#__PURE__*/React.createElement("a",{href:this.props.logoUrl,rel:"noreferrer",target:"_blank"},logoEl)}// Convert legacy minScale option to minScaleDenom
10
- var searchOptions=_objectSpread(_objectSpread({},TopBar.defaultProps.searchOptions),this.props.searchOptions);searchOptions.minScaleDenom=searchOptions.minScaleDenom||searchOptions.minScale;delete searchOptions.minScale;// Menu compact only available for desktop client
11
- var menuCompact=!isMobile?this.props.appMenuCompact:false;// Keep menu open when appMenu is in compact mode (Visible on Hover)
12
- var keepMenuOpen=menuCompact;// Menu should be visible on startup when appMenu is in compact mode (Visible on Hover)
13
- var showOnStartup=this.props.appMenuVisibleOnStartup||menuCompact;var style={marginLeft:this.props.mapMargins.outerLeft+"px",marginRight:this.props.mapMargins.outerRight+"px"};return/*#__PURE__*/React.createElement(Swipeable,{onSwipedDown:function onSwipedDown(){return _this2.props.toggleFullscreen(false)},onSwipedUp:function onSwipedUp(){return _this2.props.toggleFullscreen(true)}},/*#__PURE__*/React.createElement("div",{className:classes,ref:this.storeHeight,style:style},logoEl,/*#__PURE__*/React.createElement("div",{className:"topbar-center-span"},this.props.components.Search?/*#__PURE__*/React.createElement("div",{className:"topbar-search-container"},/*#__PURE__*/React.createElement(this.props.components.Search,{searchOptions:searchOptions})):null,this.props.components.Toolbar?/*#__PURE__*/React.createElement(this.props.components.Toolbar,{openExternalUrl:this.openUrl,toolbarItems:this.state.allowedToolbarItems,toolbarItemsShortcutPrefix:this.props.toolbarItemsShortcutPrefix}):null),this.props.components.AppMenu&&!this.props.appMenuHidden?/*#__PURE__*/React.createElement(this.props.components.AppMenu,{appMenuClearsTask:this.props.appMenuClearsTask,appMenuShortcut:this.props.appMenuShortcut,buttonLabel:LocaleUtils.tr("appmenu.menulabel"),keepMenuOpen:keepMenuOpen,menuCompact:menuCompact,menuItems:this.state.allowedMenuItems,openExternalUrl:this.openUrl,showFilterField:this.props.appMenuFilterField,showOnStartup:showOnStartup}):null,this.props.components.FullscreenSwitcher?/*#__PURE__*/React.createElement(this.props.components.FullscreenSwitcher,null):null))}}])}(React.Component);_defineProperty(TopBar,"propTypes",{/** Whether opening the app menu clears the active task. */appMenuClearsTask:PropTypes.bool,/** Whether show an appMenu compact (menu visible on icons hover) - Only available for desktop client. */appMenuCompact:PropTypes.bool,/** Whether to display the filter field in the app menu. */appMenuFilterField:PropTypes.bool,/** Whether to hide the app menu (useful primarely as a theme specific setting). */appMenuHidden:PropTypes.bool,/** The shortcut for tiggering the app menu, i.e. alt+shift+m. */appMenuShortcut:PropTypes.string,/** Whether to open the app menu on application startup. */appMenuVisibleOnStartup:PropTypes.bool,components:PropTypes.object,currentTheme:PropTypes.object,fullscreen:PropTypes.bool,/** The logo file format. */logoFormat:PropTypes.string,/** The logo image URL if a different source than the default `assets/img/logo.<ext>` and `assets/img/logo-mobile.<ext>` is desired. */logoSrc:PropTypes.string,/** The hyperlink to open when the logo is clicked. */logoUrl:PropTypes.string,mapMargins:PropTypes.object,/** The menu items. Refer to the corresponding chapter of the viewer documentation and the sample config.json. */menuItems:PropTypes.array,openExternalUrl:PropTypes.func,/** Whether to register a search provider which allows searching menu tasks through the global search field. */registerTaskSearchProvider:PropTypes.bool,/** Options passed down to the search component. */searchOptions:PropTypes.shape({/** Whether to show the search filter widget. */allowSearchFilters:PropTypes.bool,/** Whether to hide the result labels on the map. */hideResultLabels:PropTypes.bool,/** The style used for highlighting search result geometries. */highlightStyle:PropTypes.shape({/* Stroke color rgba array, i.e. [255, 0, 0, 0.5] */strokeColor:PropTypes.array,/* Stroke width */strokeWidth:PropTypes.number,/* Stroke dash/gap pattern array. Empty for solid line. */strokeDash:PropTypes.array,/* Fill color rgba array, i.e. [255, 0, 0, 0.33] */fillColor:PropTypes.array}),/** Minimum scale denominator when zooming to search result. */minScaleDenom:PropTypes.number,/** Result count limit which is passed to the search provider. */resultLimit:PropTypes.number,/** Whether to collapse search sections by default. */sectionsDefaultCollapsed:PropTypes.bool,/** Whether to show a highlight marker in the center of the search result geometry. */showHighlightMarker:PropTypes.bool,/** Whether to show the layer tree after selecting a theme result. */showLayerAfterChangeTheme:PropTypes.bool,/** Whether to show layer results before pkaces in the result menu. */showLayerResultsBeforePlaces:PropTypes.bool,/** Whether to replace the search text with the selected search result text. */showResultInSearchText:PropTypes.bool,/** Whether to zoom to layer search results. */zoomToLayers:PropTypes.bool}),setTopbarHeight:PropTypes.func,toggleFullscreen:PropTypes.func,/** The toolbar. Refer to the corresponding chapter of the viewer documentation and the sample config.json. */toolbarItems:PropTypes.array,/** The keyboard shortcut prefix for triggering toolbar tasks. I.e. alt+shift. The task are then triggered by <prefix>+{1,2,3,...} for the 1st, 2nd, 3rd... toolbar icon. */toolbarItemsShortcutPrefix:PropTypes.string});_defineProperty(TopBar,"defaultProps",{searchOptions:{showHighlightMarker:true,showResultInSearchText:true,minScaleDenom:1000},menuItems:[],toolbarItems:[],logoFormat:"svg"});export default(function(components){return connect(function(state){return{fullscreen:state.display.fullscreen,components:components,currentTheme:state.theme.current,mapMargins:state.windows.mapMargins}},{toggleFullscreen:toggleFullscreen,openExternalUrl:openExternalUrl,setTopbarHeight:setTopbarHeight})(TopBar)});
41
+ */
42
+ var TopBar = /*#__PURE__*/function (_React$Component) {
43
+ function TopBar() {
44
+ var _this;
45
+ _classCallCheck(this, TopBar);
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
48
+ }
49
+ _this = _callSuper(this, TopBar, [].concat(args));
50
+ _defineProperty(_this, "state", {
51
+ allowedMenuItems: [],
52
+ allowedToolbarItems: []
53
+ });
54
+ _defineProperty(_this, "openUrl", function (url, target, title, icon) {
55
+ if (target === "iframe") {
56
+ target = ":iframedialog:externallinkiframe";
57
+ }
58
+ _this.props.openExternalUrl(url, target, {
59
+ title: title,
60
+ icon: icon
61
+ });
62
+ });
63
+ _defineProperty(_this, "storeHeight", function (el) {
64
+ if (el) {
65
+ _this.props.setTopbarHeight(el.clientHeight);
66
+ }
67
+ });
68
+ _defineProperty(_this, "searchTasks", function (text, searchParams, callback) {
69
+ var filter = new RegExp(removeDiacritics(text).replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"), "i");
70
+ var results = [];
71
+ _this.searchTaskGroup(results, filter, _this.state.allowedMenuItems);
72
+ if (results.length > 0) {
73
+ callback({
74
+ results: [{
75
+ id: "tasks",
76
+ title: LocaleUtils.tr("search.tasks"),
77
+ type: SearchResultType.TASK,
78
+ items: results
79
+ }]
80
+ });
81
+ } else {
82
+ callback({
83
+ results: []
84
+ });
85
+ }
86
+ });
87
+ _defineProperty(_this, "searchTaskGroup", function (results, filter, group) {
88
+ group.forEach(function (item) {
89
+ if (item.subitems) {
90
+ _this.searchTaskGroup(results, filter, item.subitems);
91
+ } else {
92
+ var label = item.title ? LocaleUtils.tr(item.title) : LocaleUtils.tr("appmenu.items." + item.key + (item.mode || ""));
93
+ if (removeDiacritics(label).match(filter)) {
94
+ results.push({
95
+ id: "tasks:" + results.length,
96
+ text: label,
97
+ task: item
98
+ });
99
+ }
100
+ }
101
+ });
102
+ });
103
+ return _this;
104
+ }
105
+ _inherits(TopBar, _React$Component);
106
+ return _createClass(TopBar, [{
107
+ key: "componentDidMount",
108
+ value: function componentDidMount() {
109
+ this.setState({
110
+ allowedToolbarItems: ThemeUtils.allowedItems(this.props.toolbarItems, this.props.currentTheme),
111
+ allowedMenuItems: ThemeUtils.allowedItems(this.props.menuItems, this.props.currentTheme)
112
+ });
113
+ if (this.props.registerTaskSearchProvider) {
114
+ registerSearchProvider("tasksearch", {
115
+ label: LocaleUtils.tr("search.tasks"),
116
+ onSearch: this.searchTasks
117
+ });
118
+ }
119
+ }
120
+ }, {
121
+ key: "componentWillUnmount",
122
+ value: function componentWillUnmount() {
123
+ if (this.props.registerTaskSearchProvider) {
124
+ unregisterSearchProvider("tasksearch");
125
+ }
126
+ }
127
+ }, {
128
+ key: "componentDidUpdate",
129
+ value: function componentDidUpdate(prevProps) {
130
+ if (this.props.currentTheme !== prevProps.currentTheme) {
131
+ this.setState({
132
+ allowedToolbarItems: ThemeUtils.allowedItems(this.props.toolbarItems, this.props.currentTheme),
133
+ allowedMenuItems: ThemeUtils.allowedItems(this.props.menuItems, this.props.currentTheme)
134
+ });
135
+ }
136
+ }
137
+ }, {
138
+ key: "render",
139
+ value: function render() {
140
+ var _this2 = this;
141
+ var logo;
142
+ var assetsPath = ConfigUtils.getAssetsPath();
143
+ var isMobile = ConfigUtils.isMobile();
144
+ if (isMobile) {
145
+ logo = assetsPath + "/img/logo-mobile." + this.props.logoFormat;
146
+ } else {
147
+ logo = assetsPath + "/img/logo." + this.props.logoFormat;
148
+ }
149
+ var classes = classnames({
150
+ TopBar: true,
151
+ mobile: isMobile,
152
+ fullscreen: this.props.fullscreen
153
+ });
154
+ var logoEl = /*#__PURE__*/React.createElement("img", {
155
+ className: "topbar-logo",
156
+ src: this.props.logoSrc || logo
157
+ });
158
+ if (this.props.logoUrl) {
159
+ logoEl = /*#__PURE__*/React.createElement("a", {
160
+ href: this.props.logoUrl,
161
+ rel: "noreferrer",
162
+ target: "_blank"
163
+ }, logoEl);
164
+ }
165
+ // Convert legacy minScale option to minScaleDenom
166
+ var searchOptions = _objectSpread(_objectSpread({}, TopBar.defaultProps.searchOptions), this.props.searchOptions);
167
+ searchOptions.minScaleDenom = searchOptions.minScaleDenom || searchOptions.minScale;
168
+ delete searchOptions.minScale;
169
+ // Menu compact only available for desktop client
170
+ var menuCompact = !isMobile ? this.props.appMenuCompact : false;
171
+ // Keep menu open when appMenu is in compact mode (Visible on Hover)
172
+ var keepMenuOpen = menuCompact;
173
+ // Menu should be visible on startup when appMenu is in compact mode (Visible on Hover)
174
+ var showOnStartup = this.props.appMenuVisibleOnStartup || menuCompact;
175
+ var style = {
176
+ marginLeft: this.props.mapMargins.outerLeft + 'px',
177
+ marginRight: this.props.mapMargins.outerRight + 'px'
178
+ };
179
+ return /*#__PURE__*/React.createElement(Swipeable, {
180
+ onSwipedDown: function onSwipedDown() {
181
+ return _this2.props.toggleFullscreen(false);
182
+ },
183
+ onSwipedUp: function onSwipedUp() {
184
+ return _this2.props.toggleFullscreen(true);
185
+ }
186
+ }, /*#__PURE__*/React.createElement("div", {
187
+ className: classes,
188
+ ref: this.storeHeight,
189
+ style: style
190
+ }, logoEl, /*#__PURE__*/React.createElement("div", {
191
+ className: "topbar-center-span"
192
+ }, this.props.components.Search ? /*#__PURE__*/React.createElement("div", {
193
+ className: "topbar-search-container"
194
+ }, /*#__PURE__*/React.createElement(this.props.components.Search, {
195
+ searchOptions: searchOptions
196
+ })) : null, this.props.components.Toolbar ? /*#__PURE__*/React.createElement(this.props.components.Toolbar, {
197
+ openExternalUrl: this.openUrl,
198
+ toolbarItems: this.state.allowedToolbarItems,
199
+ toolbarItemsShortcutPrefix: this.props.toolbarItemsShortcutPrefix
200
+ }) : null), this.props.components.AppMenu && !this.props.appMenuHidden ? /*#__PURE__*/React.createElement(this.props.components.AppMenu, {
201
+ appMenuClearsTask: this.props.appMenuClearsTask,
202
+ appMenuShortcut: this.props.appMenuShortcut,
203
+ buttonLabel: LocaleUtils.tr("appmenu.menulabel"),
204
+ keepMenuOpen: keepMenuOpen,
205
+ menuCompact: menuCompact,
206
+ menuItems: this.state.allowedMenuItems,
207
+ openExternalUrl: this.openUrl,
208
+ showFilterField: this.props.appMenuFilterField,
209
+ showOnStartup: showOnStartup
210
+ }) : null, this.props.components.FullscreenSwitcher ? /*#__PURE__*/React.createElement(this.props.components.FullscreenSwitcher, null) : null));
211
+ }
212
+ }]);
213
+ }(React.Component);
214
+ _defineProperty(TopBar, "propTypes", {
215
+ /** Whether opening the app menu clears the active task. */
216
+ appMenuClearsTask: PropTypes.bool,
217
+ /** Whether show an appMenu compact (menu visible on icons hover) - Only available for desktop client. */
218
+ appMenuCompact: PropTypes.bool,
219
+ /** Whether to display the filter field in the app menu. */
220
+ appMenuFilterField: PropTypes.bool,
221
+ /** Whether to hide the app menu (useful primarely as a theme specific setting). */
222
+ appMenuHidden: PropTypes.bool,
223
+ /** The shortcut for tiggering the app menu, i.e. alt+shift+m. */
224
+ appMenuShortcut: PropTypes.string,
225
+ /** Whether to open the app menu on application startup. */
226
+ appMenuVisibleOnStartup: PropTypes.bool,
227
+ components: PropTypes.object,
228
+ currentTheme: PropTypes.object,
229
+ fullscreen: PropTypes.bool,
230
+ /** The logo file format. */
231
+ logoFormat: PropTypes.string,
232
+ /** The logo image URL if a different source than the default `assets/img/logo.<ext>` and `assets/img/logo-mobile.<ext>` is desired. */
233
+ logoSrc: PropTypes.string,
234
+ /** The hyperlink to open when the logo is clicked. */
235
+ logoUrl: PropTypes.string,
236
+ mapMargins: PropTypes.object,
237
+ /** The menu items. Refer to the corresponding chapter of the viewer documentation and the sample config.json. */
238
+ menuItems: PropTypes.array,
239
+ openExternalUrl: PropTypes.func,
240
+ /** Whether to register a search provider which allows searching menu tasks through the global search field. */
241
+ registerTaskSearchProvider: PropTypes.bool,
242
+ /** Options passed down to the search component. */
243
+ searchOptions: PropTypes.shape({
244
+ /** Whether to show the search filter widget. */
245
+ allowSearchFilters: PropTypes.bool,
246
+ /** Whether to hide the result labels on the map. */
247
+ hideResultLabels: PropTypes.bool,
248
+ /** The style used for highlighting search result geometries. */
249
+ highlightStyle: PropTypes.shape({
250
+ /* Stroke color rgba array, i.e. [255, 0, 0, 0.5] */
251
+ strokeColor: PropTypes.array,
252
+ /* Stroke width */
253
+ strokeWidth: PropTypes.number,
254
+ /* Stroke dash/gap pattern array. Empty for solid line. */
255
+ strokeDash: PropTypes.array,
256
+ /* Fill color rgba array, i.e. [255, 0, 0, 0.33] */
257
+ fillColor: PropTypes.array
258
+ }),
259
+ /** Minimum scale denominator when zooming to search result. */
260
+ minScaleDenom: PropTypes.number,
261
+ /** Result count limit which is passed to the search provider. */
262
+ resultLimit: PropTypes.number,
263
+ /** Whether to collapse search sections by default. */
264
+ sectionsDefaultCollapsed: PropTypes.bool,
265
+ /** Whether to show a highlight marker in the center of the search result geometry. */
266
+ showHighlightMarker: PropTypes.bool,
267
+ /** Whether to show the layer tree after selecting a theme result. */
268
+ showLayerAfterChangeTheme: PropTypes.bool,
269
+ /** Whether to show layer results before pkaces in the result menu. */
270
+ showLayerResultsBeforePlaces: PropTypes.bool,
271
+ /** Whether to replace the search text with the selected search result text. */
272
+ showResultInSearchText: PropTypes.bool,
273
+ /** Whether to zoom to layer search results. */
274
+ zoomToLayers: PropTypes.bool
275
+ }),
276
+ setTopbarHeight: PropTypes.func,
277
+ toggleFullscreen: PropTypes.func,
278
+ /** The toolbar. Refer to the corresponding chapter of the viewer documentation and the sample config.json. */
279
+ toolbarItems: PropTypes.array,
280
+ /** The keyboard shortcut prefix for triggering toolbar tasks. I.e. alt+shift. The task are then triggered by <prefix>+{1,2,3,...} for the 1st, 2nd, 3rd... toolbar icon. */
281
+ toolbarItemsShortcutPrefix: PropTypes.string
282
+ });
283
+ _defineProperty(TopBar, "defaultProps", {
284
+ searchOptions: {
285
+ showHighlightMarker: true,
286
+ showResultInSearchText: true,
287
+ minScaleDenom: 1000
288
+ },
289
+ menuItems: [],
290
+ toolbarItems: [],
291
+ logoFormat: "svg"
292
+ });
293
+ export default (function (components) {
294
+ return connect(function (state) {
295
+ return {
296
+ fullscreen: state.display.fullscreen,
297
+ components: components,
298
+ currentTheme: state.theme.current,
299
+ mapMargins: state.windows.mapMargins
300
+ };
301
+ }, {
302
+ toggleFullscreen: toggleFullscreen,
303
+ openExternalUrl: openExternalUrl,
304
+ setTopbarHeight: setTopbarHeight
305
+ })(TopBar);
306
+ });
@@ -1,3 +1,214 @@
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)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}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)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}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)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}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)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}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}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}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)}import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import{setCurrentTask}from"../actions/task";import LocaleUtils from"../utils/LocaleUtils";import MiscUtils from"../utils/MiscUtils";/**
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
+ import React from "react";
16
+ import { connect } from "react-redux";
17
+ import PropTypes from "prop-types";
18
+ import { setCurrentTask } from "../actions/task";
19
+ import LocaleUtils from '../utils/LocaleUtils';
20
+ import MiscUtils from "../utils/MiscUtils";
21
+
22
+ /**
2
23
  * Launches a tour guide of the application, as configured by a configuration file.
3
- */var TourGuide=/*#__PURE__*/function(_React$Component){function TourGuide(){var _this;_classCallCheck(this,TourGuide);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,TourGuide,[].concat(args));_defineProperty(_this,"state",{tourSteps:[],driverObj:null,currentStepIndex:0,rawStepData:[]});_defineProperty(_this,"handleClick",function(driverObj,direction){var _this$state=_this.state,currentStepIndex=_this$state.currentStepIndex,rawStepData=_this$state.rawStepData;var currentRawStep=rawStepData[currentStepIndex];var actionNames=direction==="next"?currentRawStep===null||currentRawStep===void 0?void 0:currentRawStep.onNextClick:currentRawStep===null||currentRawStep===void 0?void 0:currentRawStep.onPrevClick;if(Array.isArray(actionNames)){actionNames.forEach(function(actionName){return _this.runCustomAction(actionName)})}else if(actionNames){_this.runCustomAction(actionNames)}_this.setState(function(prevState){return{currentStepIndex:direction==="next"?prevState.currentStepIndex+1:Math.max(prevState.currentStepIndex-1,0)}},function(){direction==="next"?driverObj.moveNext():driverObj.movePrevious()})});_defineProperty(_this,"runCustomAction",function(actionName){var _document$querySelect,_document$querySelect2;if(actionName.startsWith("setTask:")){_this.props.setCurrentTask(actionName.replace("setTask:","").trim());return}if(actionName.startsWith("openSubMenu:")){var submenuName=actionName.replace("openSubMenu:","").trim();var submenu=Array.from(document.querySelectorAll(".appmenu-submenu")).find(function(el){return el.querySelector("span.icon-".concat(submenuName))});if(submenu){submenu.classList.add("appmenu-submenu-expanded")}else{/* eslint-disable-next-line */console.warn("Submenu with icon-".concat(submenuName," not found."))}return}if(actionName.startsWith("closeSubMenu:")){var _submenuName=actionName.replace("closeSubMenu:","").trim();var _submenu=Array.from(document.querySelectorAll(".appmenu-submenu")).find(function(el){return el.querySelector("span.icon-".concat(_submenuName))});if(_submenu){_submenu.classList.remove("appmenu-submenu-expanded")}else{/* eslint-disable-next-line */console.warn("Submenu with icon-".concat(_submenuName," not found."))}return}switch(actionName){case"openMenu":(_document$querySelect=document.querySelector(".AppMenu"))===null||_document$querySelect===void 0||_document$querySelect.classList.add("appmenu-visible");break;case"closeMenu":(_document$querySelect2=document.querySelector(".AppMenu"))===null||_document$querySelect2===void 0||_document$querySelect2.classList.remove("appmenu-visible");break;default:/* eslint-disable-next-line */console.warn("Unknown action:",actionName)}});_defineProperty(_this,"startTour",function(){var _this$state$driverObj;(_this$state$driverObj=_this.state.driverObj)===null||_this$state$driverObj===void 0||_this$state$driverObj.drive()});return _this}_inherits(TourGuide,_React$Component);return _createClass(TourGuide,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;if(!this.props.tourGuideUrl){return}fetch(MiscUtils.resolveAssetsPath(this.props.tourGuideUrl)).then(function(response){return response.json()}).then(function(data){var steps=data.map(function(step){return{element:step.selector,popover:{title:step.title,description:step.content,side:step.side,align:step.align},disableActiveInteraction:step.disableActiveInteraction}});_this2.setState({tourSteps:steps,rawStepData:data})})["catch"](function(err){/* eslint-disable-next-line */console.error("Failed to fetch tour guide data:",err)})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var _this3=this;if(this.props.active&&!prevProps.active&&this.state.tourSteps){var tourSteps=this.state.tourSteps;import("driver.js/dist/driver.css");import("./style/TourGuide.css");import("driver.js").then(function(module){var driver=module.driver;var driverObj=driver({popoverClass:"driverjs-theme",nextBtnText:LocaleUtils.tr("tourguide.next")+" \u2192",prevBtnText:"\u2190 "+LocaleUtils.tr("tourguide.previous"),doneBtnText:LocaleUtils.tr("tourguide.done"),progressText:"{{current}} / {{total}}",showProgress:true,steps:tourSteps,onNextClick:function onNextClick(){return _this3.handleClick(driverObj,"next")},onPrevClick:function onPrevClick(){return _this3.handleClick(driverObj,"prev")},onDestroyed:function onDestroyed(){var _document$querySelect3;document.querySelectorAll(".AppMenu .appmenu-submenu").forEach(function(submenu){return submenu.classList.remove("appmenu-submenu-expanded")});(_document$querySelect3=document.querySelector(".AppMenu"))===null||_document$querySelect3===void 0||_document$querySelect3.classList.remove("appmenu-visible");_this3.props.setCurrentTask(null)},onHighlightStarted:function onHighlightStarted(_,step){var index=tourSteps.findIndex(function(s){return s.element===step.element});_this3.setState({currentStepIndex:index})}});_this3.setState({driverObj:driverObj},function(){_this3.startTour();_this3.props.setCurrentTask(null)})})["catch"](function(err){/* eslint-disable-next-line */console.error("Failed to load Driver.js:",err)})}}},{key:"render",value:function render(){return null}}])}(React.Component);_defineProperty(TourGuide,"propTypes",{active:PropTypes.bool,setCurrentTask:PropTypes.func,/** Url of the Tourguide JSON configuration. */tourGuideUrl:PropTypes.string});export default connect(function(state){return{active:state.task.id==="TourGuide"}},{setCurrentTask:setCurrentTask})(TourGuide);
24
+ */
25
+ var TourGuide = /*#__PURE__*/function (_React$Component) {
26
+ function TourGuide() {
27
+ var _this;
28
+ _classCallCheck(this, TourGuide);
29
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
+ args[_key] = arguments[_key];
31
+ }
32
+ _this = _callSuper(this, TourGuide, [].concat(args));
33
+ _defineProperty(_this, "state", {
34
+ tourSteps: [],
35
+ driverObj: null,
36
+ currentStepIndex: 0,
37
+ rawStepData: []
38
+ });
39
+ _defineProperty(_this, "handleClick", function (driverObj, direction) {
40
+ var _this$state = _this.state,
41
+ currentStepIndex = _this$state.currentStepIndex,
42
+ rawStepData = _this$state.rawStepData;
43
+ var currentRawStep = rawStepData[currentStepIndex];
44
+ var actionNames = direction === "next" ? currentRawStep === null || currentRawStep === void 0 ? void 0 : currentRawStep.onNextClick : currentRawStep === null || currentRawStep === void 0 ? void 0 : currentRawStep.onPrevClick;
45
+ if (Array.isArray(actionNames)) {
46
+ actionNames.forEach(function (actionName) {
47
+ return _this.runCustomAction(actionName);
48
+ });
49
+ } else if (actionNames) {
50
+ _this.runCustomAction(actionNames);
51
+ }
52
+ _this.setState(function (prevState) {
53
+ return {
54
+ currentStepIndex: direction === "next" ? prevState.currentStepIndex + 1 : Math.max(prevState.currentStepIndex - 1, 0)
55
+ };
56
+ }, function () {
57
+ direction === "next" ? driverObj.moveNext() : driverObj.movePrevious();
58
+ });
59
+ });
60
+ _defineProperty(_this, "runCustomAction", function (actionName) {
61
+ var _document$querySelect, _document$querySelect2;
62
+ if (actionName.startsWith("setTask:")) {
63
+ _this.props.setCurrentTask(actionName.replace("setTask:", "").trim());
64
+ return;
65
+ }
66
+ if (actionName.startsWith("openSubMenu:")) {
67
+ var submenuName = actionName.replace("openSubMenu:", "").trim();
68
+ var submenu = Array.from(document.querySelectorAll(".appmenu-submenu")).find(function (el) {
69
+ return el.querySelector("span.icon-".concat(submenuName));
70
+ });
71
+ if (submenu) {
72
+ submenu.classList.add("appmenu-submenu-expanded");
73
+ } else {
74
+ /* eslint-disable-next-line */
75
+ console.warn("Submenu with icon-".concat(submenuName, " not found."));
76
+ }
77
+ return;
78
+ }
79
+ if (actionName.startsWith("closeSubMenu:")) {
80
+ var _submenuName = actionName.replace("closeSubMenu:", "").trim();
81
+ var _submenu = Array.from(document.querySelectorAll(".appmenu-submenu")).find(function (el) {
82
+ return el.querySelector("span.icon-".concat(_submenuName));
83
+ });
84
+ if (_submenu) {
85
+ _submenu.classList.remove("appmenu-submenu-expanded");
86
+ } else {
87
+ /* eslint-disable-next-line */
88
+ console.warn("Submenu with icon-".concat(_submenuName, " not found."));
89
+ }
90
+ return;
91
+ }
92
+ switch (actionName) {
93
+ case "openMenu":
94
+ (_document$querySelect = document.querySelector(".AppMenu")) === null || _document$querySelect === void 0 || _document$querySelect.classList.add("appmenu-visible");
95
+ break;
96
+ case "closeMenu":
97
+ (_document$querySelect2 = document.querySelector(".AppMenu")) === null || _document$querySelect2 === void 0 || _document$querySelect2.classList.remove("appmenu-visible");
98
+ break;
99
+ default:
100
+ /* eslint-disable-next-line */
101
+ console.warn("Unknown action:", actionName);
102
+ }
103
+ });
104
+ _defineProperty(_this, "startTour", function () {
105
+ var _this$state$driverObj;
106
+ (_this$state$driverObj = _this.state.driverObj) === null || _this$state$driverObj === void 0 || _this$state$driverObj.drive();
107
+ });
108
+ return _this;
109
+ }
110
+ _inherits(TourGuide, _React$Component);
111
+ return _createClass(TourGuide, [{
112
+ key: "componentDidMount",
113
+ value: function componentDidMount() {
114
+ var _this2 = this;
115
+ if (!this.props.tourGuideUrl) {
116
+ return;
117
+ }
118
+ fetch(MiscUtils.resolveAssetsPath(this.props.tourGuideUrl)).then(function (response) {
119
+ return response.json();
120
+ }).then(function (data) {
121
+ var steps = data.map(function (step) {
122
+ return {
123
+ element: step.selector,
124
+ popover: {
125
+ title: step.title,
126
+ description: step.content,
127
+ side: step.side,
128
+ align: step.align
129
+ },
130
+ disableActiveInteraction: step.disableActiveInteraction
131
+ };
132
+ });
133
+ _this2.setState({
134
+ tourSteps: steps,
135
+ rawStepData: data
136
+ });
137
+ })["catch"](function (err) {
138
+ /* eslint-disable-next-line */
139
+ console.error("Failed to fetch tour guide data:", err);
140
+ });
141
+ }
142
+ }, {
143
+ key: "componentDidUpdate",
144
+ value: function componentDidUpdate(prevProps) {
145
+ var _this3 = this;
146
+ if (this.props.active && !prevProps.active && this.state.tourSteps) {
147
+ var tourSteps = this.state.tourSteps;
148
+ import("driver.js/dist/driver.css");
149
+ import("./style/TourGuide.css");
150
+ import("driver.js").then(function (module) {
151
+ var driver = module.driver;
152
+ var driverObj = driver({
153
+ popoverClass: 'driverjs-theme',
154
+ nextBtnText: LocaleUtils.tr("tourguide.next") + ' →',
155
+ prevBtnText: '← ' + LocaleUtils.tr("tourguide.previous"),
156
+ doneBtnText: LocaleUtils.tr("tourguide.done"),
157
+ progressText: "{{current}} / {{total}}",
158
+ showProgress: true,
159
+ steps: tourSteps,
160
+ onNextClick: function onNextClick() {
161
+ return _this3.handleClick(driverObj, "next");
162
+ },
163
+ onPrevClick: function onPrevClick() {
164
+ return _this3.handleClick(driverObj, "prev");
165
+ },
166
+ onDestroyed: function onDestroyed() {
167
+ var _document$querySelect3;
168
+ document.querySelectorAll(".AppMenu .appmenu-submenu").forEach(function (submenu) {
169
+ return submenu.classList.remove("appmenu-submenu-expanded");
170
+ });
171
+ (_document$querySelect3 = document.querySelector(".AppMenu")) === null || _document$querySelect3 === void 0 || _document$querySelect3.classList.remove("appmenu-visible");
172
+ _this3.props.setCurrentTask(null);
173
+ },
174
+ onHighlightStarted: function onHighlightStarted(_, step) {
175
+ var index = tourSteps.findIndex(function (s) {
176
+ return s.element === step.element;
177
+ });
178
+ _this3.setState({
179
+ currentStepIndex: index
180
+ });
181
+ }
182
+ });
183
+ _this3.setState({
184
+ driverObj: driverObj
185
+ }, function () {
186
+ _this3.startTour();
187
+ _this3.props.setCurrentTask(null);
188
+ });
189
+ })["catch"](function (err) {
190
+ /* eslint-disable-next-line */
191
+ console.error("Failed to load Driver.js:", err);
192
+ });
193
+ }
194
+ }
195
+ }, {
196
+ key: "render",
197
+ value: function render() {
198
+ return null;
199
+ }
200
+ }]);
201
+ }(React.Component);
202
+ _defineProperty(TourGuide, "propTypes", {
203
+ active: PropTypes.bool,
204
+ setCurrentTask: PropTypes.func,
205
+ /** Url of the Tourguide JSON configuration. */
206
+ tourGuideUrl: PropTypes.string
207
+ });
208
+ export default connect(function (state) {
209
+ return {
210
+ active: state.task.id === "TourGuide"
211
+ };
212
+ }, {
213
+ setCurrentTask: setCurrentTask
214
+ })(TourGuide);