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.
- package/actions/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
|
@@ -1,13 +1,596 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){
|
|
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 2017-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 ReactDOM from"react-dom";import{connect}from"react-redux";import*as portals from"react-reverse-portal";import{Rnd}from"react-rnd";import classnames from"classnames";import PropTypes from"prop-types";import{v4 as uuidv4}from"uuid";import{raiseWindow,registerWindow,unregisterWindow,setSplitScreen}from"../actions/windows";import ConfigUtils from"../utils/ConfigUtils";import LocaleUtils from"../utils/LocaleUtils";import MiscUtils from"../utils/MiscUtils";import Icon from"./Icon";import Spinner from"./widgets/Spinner";import"./style/ResizeableWindow.css";var WINDOW_GEOMETRIES={};var ResizeableWindow=/*#__PURE__*/function(_React$Component){function ResizeableWindow(props){var _this;_classCallCheck(this,ResizeableWindow);_this=_callSuper(this,ResizeableWindow,[props]);_defineProperty(_this,"state",{geometry:null});_defineProperty(_this,"renderRole",function(role){return React.Children.toArray(_this.props.children).find(function(child){return child.props.role===role})});_defineProperty(_this,"onClose",function(ev){if(_this.state.externalWindow){_this.state.externalWindow.removeEventListener("beforeunload",_this.props.onClose)}_this.props.onClose();ev.stopPropagation()});_defineProperty(_this,"renderTitleBar",function(){if(_this.props.fullscreen){return null}var maximized=_this.state.geometry.maximized?true:false;var minimized=_this.state.geometry.minimized?true:false;var docked=_this.state.geometry.docked;var dockSide=_this.props.dockable===true?"left":_this.props.dockable;var dockable=_this.props.dockable&&!_this.state.externalWindow;if(ConfigUtils.getConfigProp("globallyDisableDockableDialogs")){dockable=false}var maximizeable=_this.props.maximizeable&&!_this.state.externalWindow&&!_this.props.fitHeight;if(ConfigUtils.getConfigProp("globallyDisableMaximizeableDialogs")){maximizeable=false}var minimizeable=_this.props.minimizeable&&!_this.state.externalWindow;var icon=null;if(_this.props.busyIcon){icon=/*#__PURE__*/React.createElement(Spinner,null)}else if(_this.props.icon){icon=/*#__PURE__*/React.createElement(Icon,{className:"resizeable-window-titlebar-icon",icon:_this.props.icon,size:"large"})}var dockIcon=docked?"undock":"dock";dockIcon=dockIcon+"_"+dockSide;var iconClasses=classnames({"resizeable-window-titlebar-control":true,"resizeable-window-nodrag":true});var detachIcons=null;if(!ConfigUtils.isMobile()&&!ConfigUtils.getConfigProp("globallyDisableDetachableDialogs")&&_this.props.detachable!==false){detachIcons=_this.state.externalWindow?/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:"embed",onClick:_this.moveToInternalWindow,title:LocaleUtils.tr("window.embed")}):/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:"detach",onClick:_this.moveToExternalWindow,title:LocaleUtils.tr("window.detach")})}return/*#__PURE__*/React.createElement("div",{className:"resizeable-window-titlebar",onDoubleClick:_this.state.externalWindow?null:_this.toggleMaximize},icon,/*#__PURE__*/React.createElement("span",{className:"resizeable-window-titlebar-title"},_this.props.title),(_this.props.extraControls||[]).map(function(entry){var extraIconClasses=classnames({"resizeable-window-titlebar-extra-control":true,"resizeable-window-titlebar-extra-control-active":entry.active,"resizeable-window-nodrag":true});return/*#__PURE__*/React.createElement(Icon,{className:extraIconClasses,icon:entry.icon,key:entry.icon,onClick:entry.callback,title:entry.title})}),!maximized&&dockable?/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:dockIcon,onClick:_this.toggleDock,title:_this.state.geometry.docked?LocaleUtils.tr("window.undock"):LocaleUtils.tr("window.dock")}):null,minimizeable?/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:minimized?"unminimize":"minimize",onClick:_this.toggleMinimize,title:minimized?LocaleUtils.tr("window.unminimize"):LocaleUtils.tr("window.minimize")}):null,maximizeable?/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:maximized?"unmaximize":"maximize",onClick:_this.toggleMaximize,title:maximized?LocaleUtils.tr("window.unmaximize"):LocaleUtils.tr("window.maximize")}):null,detachIcons,_this.props.onClose?/*#__PURE__*/React.createElement(Icon,{className:iconClasses,icon:"remove",onClick:_this.onClose,title:LocaleUtils.tr("window.close")}):null)});_defineProperty(_this,"renderInternalWindowContainer",function(){var _this$state$geometry$,_this$state$geometry,_this$state$geometry$2,_this$state$geometry2;var docked=(_this$state$geometry$=(_this$state$geometry=_this.state.geometry)===null||_this$state$geometry===void 0?void 0:_this$state$geometry.docked)!==null&&_this$state$geometry$!==void 0?_this$state$geometry$:_this.props.initiallyDocked;var maximized=(_this$state$geometry$2=(_this$state$geometry2=_this.state.geometry)===null||_this$state$geometry2===void 0?void 0:_this$state$geometry2.maximized)!==null&&_this$state$geometry$2!==void 0?_this$state$geometry$2:false;var splitTopAndBottomBar=_this.props.splitTopAndBottomBar&&_this.props.splitScreenWhenDocked&&(docked||maximized);var marginLeft=0;var marginRight=0;if(!splitTopAndBottomBar){marginLeft=_this.props.mapMargins.outerLeft+_this.props.menuMargins.left;marginRight=_this.props.mapMargins.outerRight+_this.props.menuMargins.right}var containerStyle={left:marginLeft+"px",right:marginRight+"px",top:splitTopAndBottomBar?0:_this.props.topbarHeight+"px",bottom:splitTopAndBottomBar?0:_this.props.bottombarHeight+"px",zIndex:splitTopAndBottomBar?110:_this.props.baseZIndex+_this.props.windowStacking.findIndex(function(item){return item===_this.id})};return/*#__PURE__*/React.createElement("div",{className:"resizeable-window-container",key:"InternalWindow",ref:_this.setInitialSize,style:containerStyle},_this.props.visible&&_this.state.geometry?_this.renderInternalWindow():null)});_defineProperty(_this,"renderInternalWindow",function(){var maximized=_this.state.geometry.maximized||_this.props.fullscreen?true:false;var minimized=_this.state.geometry.minimized?true:false;var dockSide=_this.props.dockable===true?"left":_this.props.dockable;var bodyclasses=classnames({"resizeable-window-body":true,"resizeable-window-body-scrollable":_this.props.scrollable,"resizeable-window-body-nonscrollable":!_this.props.scrollable,"resizeable-window-nodrag":true});var windowclasses=classnames({"resizeable-window":true,"resizeable-window-maximized":maximized,"resizeable-window-minimized":minimized,"resizeable-window-fit-height":_this.props.fitHeight,"resizeable-window-docked-left":!_this.props.splitScreenWhenDocked&&_this.state.geometry.docked&&dockSide==="left"&&!maximized,"resizeable-window-docked-right":!_this.props.splitScreenWhenDocked&&_this.state.geometry.docked&&dockSide==="right"&&!maximized,"resizeable-window-split-left":_this.props.splitScreenWhenDocked&&_this.state.geometry.docked&&dockSide==="left"&&!maximized,"resizeable-window-split-right":_this.props.splitScreenWhenDocked&&_this.state.geometry.docked&&dockSide==="right"&&!maximized,"resizeable-window-docked-top":_this.state.geometry.docked&&dockSide==="top"&&!maximized,"resizeable-window-docked-bottom":_this.state.geometry.docked&&dockSide==="bottom"&&!maximized});var resizeMode={left:true,right:true,top:true,bottom:true,bottomLeft:true,bottomRight:true,topLeft:true,topRight:true};if(maximized||minimized){resizeMode=false}else if(_this.state.geometry.docked){resizeMode={left:dockSide==="right",right:dockSide==="left",top:dockSide==="bottom",bottom:dockSide!=="bottom"&&!_this.props.splitScreenWhenDocked||_this.props.splitScreenWhenDocked&&dockSide==="top"}}if(_this.props.fitHeight){resizeMode.top=false;resizeMode.bottom=false;resizeMode.bottomLeft=true;resizeMode.bottomRight=true;resizeMode.topLeft=true;resizeMode.topRight=true}return/*#__PURE__*/React.createElement(Rnd,{bounds:"parent",cancel:".resizeable-window-nodrag",className:windowclasses,"default":_this.state.geometry,disableDragging:maximized||_this.state.geometry.docked,enableResizing:resizeMode,maxHeight:_this.props.maxHeight||"100%",maxWidth:_this.props.maxWidth||"100%",minHeight:_this.props.minHeight,minWidth:_this.props.minWidth,onDragStart:_this.onDragStart,onDragStop:_this.onDragStop,onMouseDown:function onMouseDown(){return _this.props.raiseWindow(_this.id)},onResizeStop:_this.onResizeStop,ref:_this.initRnd},/*#__PURE__*/React.createElement("div",{className:"resizeable-window-contents"},_this.renderTitleBar(),/*#__PURE__*/React.createElement("div",{className:bodyclasses,onMouseDown:function onMouseDown(){return _this.props.raiseWindow(_this.id)}},/*#__PURE__*/React.createElement("div",{className:"resizeable-window-drag-shield",ref:function ref(el){_this.dragShield=el}}),_this.portalNode?/*#__PURE__*/React.createElement("div",{className:"resizeable-window-portal-container"},/*#__PURE__*/React.createElement(portals.OutPortal,{node:_this.portalNode})):_this.renderRole("body"))))});_defineProperty(_this,"setInitialSize",function(container){if(!container){return}var width=Math.min(_this.props.initialWidth,container.offsetWidth);var height=Math.min(_this.props.initialHeight,container.offsetHeight);var geometry=null;if(WINDOW_GEOMETRIES[_this.props.title]){geometry=WINDOW_GEOMETRIES[_this.props.title]}else{geometry={x:_this.props.initialX!==null?_this.computeInitialX(container,_this.props.initialX):Math.max(0,Math.round(0.5*(container.offsetWidth-width))),y:_this.props.initialY!==null?_this.computeInitialY(container,_this.props.initialY):Math.max(0,Math.round(0.5*(container.offsetHeight-height))),width:width,height:height,docked:_this.props.initiallyDocked,detached:false}}if(_this.props.splitScreenWhenDocked&&geometry.docked){var dockSide=_this.props.dockable===true?"left":_this.props.dockable;var dockSize=["left","right"].includes(dockSide)?geometry.width:geometry.height;_this.props.setSplitScreen(_this.id,dockSide,dockSize,_this.props.splitTopAndBottomBar)}_this.setState({geometry:geometry})});_defineProperty(_this,"computeInitialX",function(container,x){return x>0||Object.is(x,0)?x:container.offsetWidth-_this.props.initialWidth-Math.abs(x)});_defineProperty(_this,"computeInitialY",function(container,y){return y>0||Object.is(y,0)?y:container.offsetHeight-_this.props.initialHeight-Math.abs(y)});_defineProperty(_this,"renderExternalWindow",function(){return/*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div",{className:"resizeable-window-contents"},_this.renderTitleBar(),/*#__PURE__*/React.createElement("div",{className:"resizeable-window-body"},_this.portalNode?/*#__PURE__*/React.createElement("div",{className:"resizeable-window-portal-container"},/*#__PURE__*/React.createElement(portals.OutPortal,{node:_this.portalNode})):_this.renderRole("body"))),_this.state.externalWindow.document.body)});_defineProperty(_this,"initRnd",function(el){if(el){_this.rnd=el;_this.rnd.updatePosition(_this.state.geometry)}});_defineProperty(_this,"onDragStart",function(){if(_this.dragShield){_this.dragShield.style.display="initial"}});_defineProperty(_this,"onDragStop",function(ev,data){_this.setState(function(state){return{geometry:_objectSpread(_objectSpread({},state.geometry),{},{x:data.x,y:data.y})}});if(_this.dragShield){_this.dragShield.style.display="none"}});_defineProperty(_this,"onResizeStop",function(ev,dir,ref,delta,position){// Delay one event loop cycle else clientWidth / clientHeight may not yet be up-to-date
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import ReactDOM from 'react-dom';
|
|
27
|
+
import { connect } from 'react-redux';
|
|
28
|
+
import * as portals from 'react-reverse-portal';
|
|
29
|
+
import { Rnd } from 'react-rnd';
|
|
30
|
+
import classnames from 'classnames';
|
|
31
|
+
import PropTypes from 'prop-types';
|
|
32
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
33
|
+
import { raiseWindow, registerWindow, unregisterWindow, setSplitScreen } from '../actions/windows';
|
|
34
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
35
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
36
|
+
import MiscUtils from '../utils/MiscUtils';
|
|
37
|
+
import Icon from './Icon';
|
|
38
|
+
import Spinner from './widgets/Spinner';
|
|
39
|
+
import './style/ResizeableWindow.css';
|
|
40
|
+
var WINDOW_GEOMETRIES = {};
|
|
41
|
+
var ResizeableWindow = /*#__PURE__*/function (_React$Component) {
|
|
42
|
+
function ResizeableWindow(props) {
|
|
43
|
+
var _this;
|
|
44
|
+
_classCallCheck(this, ResizeableWindow);
|
|
45
|
+
_this = _callSuper(this, ResizeableWindow, [props]);
|
|
46
|
+
_defineProperty(_this, "state", {
|
|
47
|
+
geometry: null
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(_this, "renderRole", function (role) {
|
|
50
|
+
return React.Children.toArray(_this.props.children).find(function (child) {
|
|
51
|
+
return child.props.role === role;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(_this, "onClose", function (ev) {
|
|
55
|
+
if (_this.state.externalWindow) {
|
|
56
|
+
_this.state.externalWindow.removeEventListener('beforeunload', _this.props.onClose);
|
|
57
|
+
}
|
|
58
|
+
_this.props.onClose();
|
|
59
|
+
ev.stopPropagation();
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(_this, "renderTitleBar", function () {
|
|
62
|
+
if (_this.props.fullscreen) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
var maximized = _this.state.geometry.maximized ? true : false;
|
|
66
|
+
var minimized = _this.state.geometry.minimized ? true : false;
|
|
67
|
+
var docked = _this.state.geometry.docked;
|
|
68
|
+
var dockSide = _this.props.dockable === true ? "left" : _this.props.dockable;
|
|
69
|
+
var dockable = _this.props.dockable && !_this.state.externalWindow;
|
|
70
|
+
if (ConfigUtils.getConfigProp("globallyDisableDockableDialogs")) {
|
|
71
|
+
dockable = false;
|
|
72
|
+
}
|
|
73
|
+
var maximizeable = _this.props.maximizeable && !_this.state.externalWindow && !_this.props.fitHeight;
|
|
74
|
+
if (ConfigUtils.getConfigProp("globallyDisableMaximizeableDialogs")) {
|
|
75
|
+
maximizeable = false;
|
|
76
|
+
}
|
|
77
|
+
var minimizeable = _this.props.minimizeable && !_this.state.externalWindow;
|
|
78
|
+
var icon = null;
|
|
79
|
+
if (_this.props.busyIcon) {
|
|
80
|
+
icon = /*#__PURE__*/React.createElement(Spinner, null);
|
|
81
|
+
} else if (_this.props.icon) {
|
|
82
|
+
icon = /*#__PURE__*/React.createElement(Icon, {
|
|
83
|
+
className: "resizeable-window-titlebar-icon",
|
|
84
|
+
icon: _this.props.icon,
|
|
85
|
+
size: "large"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var dockIcon = docked ? 'undock' : 'dock';
|
|
89
|
+
dockIcon = dockIcon + "_" + dockSide;
|
|
90
|
+
var iconClasses = classnames({
|
|
91
|
+
"resizeable-window-titlebar-control": true,
|
|
92
|
+
"resizeable-window-nodrag": true
|
|
93
|
+
});
|
|
94
|
+
var detachIcons = null;
|
|
95
|
+
if (!ConfigUtils.isMobile() && !ConfigUtils.getConfigProp("globallyDisableDetachableDialogs") && _this.props.detachable !== false) {
|
|
96
|
+
detachIcons = _this.state.externalWindow ? /*#__PURE__*/React.createElement(Icon, {
|
|
97
|
+
className: iconClasses,
|
|
98
|
+
icon: "embed",
|
|
99
|
+
onClick: _this.moveToInternalWindow,
|
|
100
|
+
title: LocaleUtils.tr("window.embed")
|
|
101
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
102
|
+
className: iconClasses,
|
|
103
|
+
icon: "detach",
|
|
104
|
+
onClick: _this.moveToExternalWindow,
|
|
105
|
+
title: LocaleUtils.tr("window.detach")
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "resizeable-window-titlebar",
|
|
110
|
+
onDoubleClick: _this.state.externalWindow ? null : _this.toggleMaximize
|
|
111
|
+
}, icon, /*#__PURE__*/React.createElement("span", {
|
|
112
|
+
className: "resizeable-window-titlebar-title"
|
|
113
|
+
}, _this.props.title), (_this.props.extraControls || []).map(function (entry) {
|
|
114
|
+
var extraIconClasses = classnames({
|
|
115
|
+
"resizeable-window-titlebar-extra-control": true,
|
|
116
|
+
"resizeable-window-titlebar-extra-control-active": entry.active,
|
|
117
|
+
"resizeable-window-nodrag": true
|
|
118
|
+
});
|
|
119
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
120
|
+
className: extraIconClasses,
|
|
121
|
+
icon: entry.icon,
|
|
122
|
+
key: entry.icon,
|
|
123
|
+
onClick: entry.callback,
|
|
124
|
+
title: entry.title
|
|
125
|
+
});
|
|
126
|
+
}), !maximized && dockable ? /*#__PURE__*/React.createElement(Icon, {
|
|
127
|
+
className: iconClasses,
|
|
128
|
+
icon: dockIcon,
|
|
129
|
+
onClick: _this.toggleDock,
|
|
130
|
+
title: _this.state.geometry.docked ? LocaleUtils.tr("window.undock") : LocaleUtils.tr("window.dock")
|
|
131
|
+
}) : null, minimizeable ? /*#__PURE__*/React.createElement(Icon, {
|
|
132
|
+
className: iconClasses,
|
|
133
|
+
icon: minimized ? "unminimize" : "minimize",
|
|
134
|
+
onClick: _this.toggleMinimize,
|
|
135
|
+
title: minimized ? LocaleUtils.tr("window.unminimize") : LocaleUtils.tr("window.minimize")
|
|
136
|
+
}) : null, maximizeable ? /*#__PURE__*/React.createElement(Icon, {
|
|
137
|
+
className: iconClasses,
|
|
138
|
+
icon: maximized ? "unmaximize" : "maximize",
|
|
139
|
+
onClick: _this.toggleMaximize,
|
|
140
|
+
title: maximized ? LocaleUtils.tr("window.unmaximize") : LocaleUtils.tr("window.maximize")
|
|
141
|
+
}) : null, detachIcons, _this.props.onClose ? /*#__PURE__*/React.createElement(Icon, {
|
|
142
|
+
className: iconClasses,
|
|
143
|
+
icon: "remove",
|
|
144
|
+
onClick: _this.onClose,
|
|
145
|
+
title: LocaleUtils.tr("window.close")
|
|
146
|
+
}) : null);
|
|
147
|
+
});
|
|
148
|
+
_defineProperty(_this, "renderInternalWindowContainer", function () {
|
|
149
|
+
var _this$state$geometry$, _this$state$geometry, _this$state$geometry$2, _this$state$geometry2;
|
|
150
|
+
var docked = (_this$state$geometry$ = (_this$state$geometry = _this.state.geometry) === null || _this$state$geometry === void 0 ? void 0 : _this$state$geometry.docked) !== null && _this$state$geometry$ !== void 0 ? _this$state$geometry$ : _this.props.initiallyDocked;
|
|
151
|
+
var maximized = (_this$state$geometry$2 = (_this$state$geometry2 = _this.state.geometry) === null || _this$state$geometry2 === void 0 ? void 0 : _this$state$geometry2.maximized) !== null && _this$state$geometry$2 !== void 0 ? _this$state$geometry$2 : false;
|
|
152
|
+
var splitTopAndBottomBar = _this.props.splitTopAndBottomBar && _this.props.splitScreenWhenDocked && (docked || maximized);
|
|
153
|
+
var marginLeft = 0;
|
|
154
|
+
var marginRight = 0;
|
|
155
|
+
if (!splitTopAndBottomBar) {
|
|
156
|
+
marginLeft = _this.props.mapMargins.outerLeft + _this.props.menuMargins.left;
|
|
157
|
+
marginRight = _this.props.mapMargins.outerRight + _this.props.menuMargins.right;
|
|
158
|
+
}
|
|
159
|
+
var containerStyle = {
|
|
160
|
+
left: marginLeft + 'px',
|
|
161
|
+
right: marginRight + 'px',
|
|
162
|
+
top: splitTopAndBottomBar ? 0 : _this.props.topbarHeight + 'px',
|
|
163
|
+
bottom: splitTopAndBottomBar ? 0 : _this.props.bottombarHeight + 'px',
|
|
164
|
+
zIndex: splitTopAndBottomBar ? 110 : _this.props.baseZIndex + _this.props.windowStacking.findIndex(function (item) {
|
|
165
|
+
return item === _this.id;
|
|
166
|
+
})
|
|
167
|
+
};
|
|
168
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "resizeable-window-container",
|
|
170
|
+
key: "InternalWindow",
|
|
171
|
+
ref: _this.setInitialSize,
|
|
172
|
+
style: containerStyle
|
|
173
|
+
}, _this.props.visible && _this.state.geometry ? _this.renderInternalWindow() : null);
|
|
174
|
+
});
|
|
175
|
+
_defineProperty(_this, "renderInternalWindow", function () {
|
|
176
|
+
var maximized = _this.state.geometry.maximized || _this.props.fullscreen ? true : false;
|
|
177
|
+
var minimized = _this.state.geometry.minimized ? true : false;
|
|
178
|
+
var dockSide = _this.props.dockable === true ? "left" : _this.props.dockable;
|
|
179
|
+
var bodyclasses = classnames({
|
|
180
|
+
"resizeable-window-body": true,
|
|
181
|
+
"resizeable-window-body-scrollable": _this.props.scrollable,
|
|
182
|
+
"resizeable-window-body-nonscrollable": !_this.props.scrollable,
|
|
183
|
+
"resizeable-window-nodrag": true
|
|
184
|
+
});
|
|
185
|
+
var windowclasses = classnames({
|
|
186
|
+
"resizeable-window": true,
|
|
187
|
+
"resizeable-window-maximized": maximized,
|
|
188
|
+
"resizeable-window-minimized": minimized,
|
|
189
|
+
"resizeable-window-fit-height": _this.props.fitHeight,
|
|
190
|
+
"resizeable-window-docked-left": !_this.props.splitScreenWhenDocked && _this.state.geometry.docked && dockSide === "left" && !maximized,
|
|
191
|
+
"resizeable-window-docked-right": !_this.props.splitScreenWhenDocked && _this.state.geometry.docked && dockSide === "right" && !maximized,
|
|
192
|
+
"resizeable-window-split-left": _this.props.splitScreenWhenDocked && _this.state.geometry.docked && dockSide === "left" && !maximized,
|
|
193
|
+
"resizeable-window-split-right": _this.props.splitScreenWhenDocked && _this.state.geometry.docked && dockSide === "right" && !maximized,
|
|
194
|
+
"resizeable-window-docked-top": _this.state.geometry.docked && dockSide === "top" && !maximized,
|
|
195
|
+
"resizeable-window-docked-bottom": _this.state.geometry.docked && dockSide === "bottom" && !maximized
|
|
196
|
+
});
|
|
197
|
+
var resizeMode = {
|
|
198
|
+
left: true,
|
|
199
|
+
right: true,
|
|
200
|
+
top: true,
|
|
201
|
+
bottom: true,
|
|
202
|
+
bottomLeft: true,
|
|
203
|
+
bottomRight: true,
|
|
204
|
+
topLeft: true,
|
|
205
|
+
topRight: true
|
|
206
|
+
};
|
|
207
|
+
if (maximized || minimized) {
|
|
208
|
+
resizeMode = false;
|
|
209
|
+
} else if (_this.state.geometry.docked) {
|
|
210
|
+
resizeMode = {
|
|
211
|
+
left: dockSide === "right",
|
|
212
|
+
right: dockSide === "left",
|
|
213
|
+
top: dockSide === "bottom",
|
|
214
|
+
bottom: dockSide !== "bottom" && !_this.props.splitScreenWhenDocked || _this.props.splitScreenWhenDocked && dockSide === "top"
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (_this.props.fitHeight) {
|
|
218
|
+
resizeMode.top = false;
|
|
219
|
+
resizeMode.bottom = false;
|
|
220
|
+
resizeMode.bottomLeft = true;
|
|
221
|
+
resizeMode.bottomRight = true;
|
|
222
|
+
resizeMode.topLeft = true;
|
|
223
|
+
resizeMode.topRight = true;
|
|
224
|
+
}
|
|
225
|
+
return /*#__PURE__*/React.createElement(Rnd, {
|
|
226
|
+
bounds: "parent",
|
|
227
|
+
cancel: ".resizeable-window-nodrag",
|
|
228
|
+
className: windowclasses,
|
|
229
|
+
"default": _this.state.geometry,
|
|
230
|
+
disableDragging: maximized || _this.state.geometry.docked,
|
|
231
|
+
enableResizing: resizeMode,
|
|
232
|
+
maxHeight: _this.props.maxHeight || "100%",
|
|
233
|
+
maxWidth: _this.props.maxWidth || "100%",
|
|
234
|
+
minHeight: _this.props.minHeight,
|
|
235
|
+
minWidth: _this.props.minWidth,
|
|
236
|
+
onDragStart: _this.onDragStart,
|
|
237
|
+
onDragStop: _this.onDragStop,
|
|
238
|
+
onMouseDown: function onMouseDown() {
|
|
239
|
+
return _this.props.raiseWindow(_this.id);
|
|
240
|
+
},
|
|
241
|
+
onResizeStop: _this.onResizeStop,
|
|
242
|
+
ref: _this.initRnd
|
|
243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: "resizeable-window-contents"
|
|
245
|
+
}, _this.renderTitleBar(), /*#__PURE__*/React.createElement("div", {
|
|
246
|
+
className: bodyclasses,
|
|
247
|
+
onMouseDown: function onMouseDown() {
|
|
248
|
+
return _this.props.raiseWindow(_this.id);
|
|
249
|
+
}
|
|
250
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
251
|
+
className: "resizeable-window-drag-shield",
|
|
252
|
+
ref: function ref(el) {
|
|
253
|
+
_this.dragShield = el;
|
|
254
|
+
}
|
|
255
|
+
}), _this.portalNode ? /*#__PURE__*/React.createElement("div", {
|
|
256
|
+
className: "resizeable-window-portal-container"
|
|
257
|
+
}, /*#__PURE__*/React.createElement(portals.OutPortal, {
|
|
258
|
+
node: _this.portalNode
|
|
259
|
+
})) : _this.renderRole("body"))));
|
|
260
|
+
});
|
|
261
|
+
_defineProperty(_this, "setInitialSize", function (container) {
|
|
262
|
+
if (!container) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
var width = Math.min(_this.props.initialWidth, container.offsetWidth);
|
|
266
|
+
var height = Math.min(_this.props.initialHeight, container.offsetHeight);
|
|
267
|
+
var geometry = null;
|
|
268
|
+
if (WINDOW_GEOMETRIES[_this.props.title]) {
|
|
269
|
+
geometry = WINDOW_GEOMETRIES[_this.props.title];
|
|
270
|
+
} else {
|
|
271
|
+
geometry = {
|
|
272
|
+
x: _this.props.initialX !== null ? _this.computeInitialX(container, _this.props.initialX) : Math.max(0, Math.round(0.5 * (container.offsetWidth - width))),
|
|
273
|
+
y: _this.props.initialY !== null ? _this.computeInitialY(container, _this.props.initialY) : Math.max(0, Math.round(0.5 * (container.offsetHeight - height))),
|
|
274
|
+
width: width,
|
|
275
|
+
height: height,
|
|
276
|
+
docked: _this.props.initiallyDocked,
|
|
277
|
+
detached: false
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
if (_this.props.splitScreenWhenDocked && geometry.docked) {
|
|
281
|
+
var dockSide = _this.props.dockable === true ? "left" : _this.props.dockable;
|
|
282
|
+
var dockSize = ["left", "right"].includes(dockSide) ? geometry.width : geometry.height;
|
|
283
|
+
_this.props.setSplitScreen(_this.id, dockSide, dockSize, _this.props.splitTopAndBottomBar);
|
|
284
|
+
}
|
|
285
|
+
_this.setState({
|
|
286
|
+
geometry: geometry
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
_defineProperty(_this, "computeInitialX", function (container, x) {
|
|
290
|
+
return x > 0 || Object.is(x, 0) ? x : container.offsetWidth - _this.props.initialWidth - Math.abs(x);
|
|
291
|
+
});
|
|
292
|
+
_defineProperty(_this, "computeInitialY", function (container, y) {
|
|
293
|
+
return y > 0 || Object.is(y, 0) ? y : container.offsetHeight - _this.props.initialHeight - Math.abs(y);
|
|
294
|
+
});
|
|
295
|
+
_defineProperty(_this, "renderExternalWindow", function () {
|
|
296
|
+
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: "resizeable-window-contents"
|
|
298
|
+
}, _this.renderTitleBar(), /*#__PURE__*/React.createElement("div", {
|
|
299
|
+
className: "resizeable-window-body"
|
|
300
|
+
}, _this.portalNode ? /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: "resizeable-window-portal-container"
|
|
302
|
+
}, /*#__PURE__*/React.createElement(portals.OutPortal, {
|
|
303
|
+
node: _this.portalNode
|
|
304
|
+
})) : _this.renderRole("body"))), _this.state.externalWindow.document.body);
|
|
305
|
+
});
|
|
306
|
+
_defineProperty(_this, "initRnd", function (el) {
|
|
307
|
+
if (el) {
|
|
308
|
+
_this.rnd = el;
|
|
309
|
+
_this.rnd.updatePosition(_this.state.geometry);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
_defineProperty(_this, "onDragStart", function () {
|
|
313
|
+
if (_this.dragShield) {
|
|
314
|
+
_this.dragShield.style.display = 'initial';
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
_defineProperty(_this, "onDragStop", function (ev, data) {
|
|
318
|
+
_this.setState(function (state) {
|
|
319
|
+
return {
|
|
320
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
321
|
+
x: data.x,
|
|
322
|
+
y: data.y
|
|
323
|
+
})
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
if (_this.dragShield) {
|
|
327
|
+
_this.dragShield.style.display = 'none';
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
_defineProperty(_this, "onResizeStop", function (ev, dir, ref, delta, position) {
|
|
331
|
+
// Delay one event loop cycle else clientWidth / clientHeight may not yet be up-to-date
|
|
332
|
+
setTimeout(function () {
|
|
333
|
+
_this.setState(function (state) {
|
|
334
|
+
return {
|
|
335
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
336
|
+
x: position.x,
|
|
337
|
+
y: position.y,
|
|
338
|
+
width: ref.clientWidth,
|
|
339
|
+
height: ref.clientHeight
|
|
340
|
+
})
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
}, 0);
|
|
344
|
+
});
|
|
345
|
+
_defineProperty(_this, "toggleDock", function () {
|
|
346
|
+
_this.setState(function (state) {
|
|
347
|
+
return {
|
|
348
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
349
|
+
docked: !state.geometry.docked
|
|
350
|
+
})
|
|
351
|
+
};
|
|
352
|
+
});
|
|
353
|
+
_this.rnd.updatePosition(_this.state.geometry);
|
|
354
|
+
});
|
|
355
|
+
_defineProperty(_this, "toggleMinimize", function () {
|
|
356
|
+
_this.setState(function (state) {
|
|
357
|
+
return {
|
|
358
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
359
|
+
minimized: !state.geometry.minimized
|
|
360
|
+
})
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
_defineProperty(_this, "toggleMaximize", function () {
|
|
365
|
+
_this.setState(function (state) {
|
|
366
|
+
return {
|
|
367
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
368
|
+
maximized: !state.geometry.maximized,
|
|
369
|
+
minimized: false
|
|
370
|
+
})
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
_defineProperty(_this, "moveToExternalWindow", function () {
|
|
375
|
+
var title = _this.props.title;
|
|
376
|
+
var windowOptions = ["popup=true", "toolbar=no", "locationbar=no", "location=no", "directories=no", "status=no", "menubar=no", "scrollbars=yes", "resizable=yes", "width=" + _this.state.geometry.width, "height=" + _this.state.geometry.height].join(", ");
|
|
377
|
+
var externalWindow = window.open('about:blank', "_blank", windowOptions);
|
|
378
|
+
externalWindow.addEventListener('resize', _this.props.onExternalWindowResized, false);
|
|
379
|
+
var loadInterval = setInterval(function () {
|
|
380
|
+
if (externalWindow.document.readyState !== 'complete') {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
clearInterval(loadInterval);
|
|
384
|
+
externalWindow.addEventListener('beforeunload', _this.props.onClose, {
|
|
385
|
+
capture: false,
|
|
386
|
+
once: true
|
|
387
|
+
});
|
|
388
|
+
var titleEl = externalWindow.document.createElement('title');
|
|
389
|
+
titleEl.appendChild(externalWindow.document.createTextNode(title));
|
|
390
|
+
externalWindow.document.head.appendChild(titleEl);
|
|
391
|
+
var icon = MiscUtils.getFaviconFromIcon(_this.props.icon, 48);
|
|
392
|
+
if (icon) {
|
|
393
|
+
var iconEl = externalWindow.document.createElement('link');
|
|
394
|
+
iconEl.rel = "icon";
|
|
395
|
+
iconEl.href = icon;
|
|
396
|
+
iconEl.sizes = "48x48";
|
|
397
|
+
externalWindow.document.head.appendChild(iconEl);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// Inherit styles
|
|
401
|
+
Array.from(document.styleSheets).forEach(function (styleSheet) {
|
|
402
|
+
if (styleSheet.href) {
|
|
403
|
+
// External styles
|
|
404
|
+
var linkElement = externalWindow.document.createElement('link');
|
|
405
|
+
linkElement.rel = 'stylesheet';
|
|
406
|
+
linkElement.href = styleSheet.href;
|
|
407
|
+
externalWindow.document.head.appendChild(linkElement);
|
|
408
|
+
} else if (styleSheet.cssRules) {
|
|
409
|
+
// Inline styles
|
|
410
|
+
var styleElement = externalWindow.document.createElement('style');
|
|
411
|
+
var cssText = Array.from(styleSheet.cssRules).map(function (rule) {
|
|
412
|
+
return rule.cssText;
|
|
413
|
+
}).join("\n");
|
|
414
|
+
styleElement.appendChild(externalWindow.document.createTextNode(cssText));
|
|
415
|
+
externalWindow.document.head.appendChild(styleElement);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
externalWindow.document.querySelector(':root').style.setProperty('--topbar-height', document.querySelector(':root').style.getPropertyValue('--topbar-height'));
|
|
419
|
+
externalWindow.document.querySelector(':root').style.setProperty('--bottombar-height', document.querySelector(':root').style.getPropertyValue('--bottombar-height'));
|
|
420
|
+
// Inherit API
|
|
421
|
+
externalWindow.qwc2 = window.qwc2;
|
|
422
|
+
_this.setState(function (state) {
|
|
423
|
+
return {
|
|
424
|
+
externalWindow: externalWindow,
|
|
425
|
+
geometry: _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
426
|
+
detached: true
|
|
427
|
+
})
|
|
428
|
+
};
|
|
429
|
+
});
|
|
430
|
+
}, 50);
|
|
431
|
+
});
|
|
432
|
+
_defineProperty(_this, "moveToInternalWindow", function () {
|
|
433
|
+
if (_this.state.externalWindow) {
|
|
434
|
+
_this.state.externalWindow.removeEventListener('beforeunload', _this.props.onClose);
|
|
435
|
+
_this.state.externalWindow.removeEventListener('resize', _this.props.onExternalWindowResized, false);
|
|
436
|
+
_this.state.externalWindow.close();
|
|
437
|
+
_this.setState(function (state) {
|
|
438
|
+
var newGeometry = _objectSpread(_objectSpread({}, state.geometry), {}, {
|
|
439
|
+
detached: false
|
|
440
|
+
});
|
|
441
|
+
WINDOW_GEOMETRIES[_this.props.title] = newGeometry;
|
|
442
|
+
return {
|
|
443
|
+
externalWindow: null,
|
|
444
|
+
geometry: newGeometry
|
|
445
|
+
};
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
_defineProperty(_this, "closeExternalWindow", function () {
|
|
450
|
+
if (_this.state.externalWindow) {
|
|
451
|
+
_this.state.externalWindow.close();
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
_this.rnd = null;
|
|
455
|
+
_this.dragShield = null;
|
|
456
|
+
_this.id = uuidv4();
|
|
457
|
+
_this.portalNode = props.usePortal ? portals.createHtmlPortalNode() : null;
|
|
458
|
+
return _this;
|
|
459
|
+
}
|
|
460
|
+
_inherits(ResizeableWindow, _React$Component);
|
|
461
|
+
return _createClass(ResizeableWindow, [{
|
|
462
|
+
key: "componentDidMount",
|
|
463
|
+
value: function componentDidMount() {
|
|
464
|
+
this.props.registerWindow(this.id);
|
|
465
|
+
window.addEventListener('beforeunload', this.closeExternalWindow, {
|
|
466
|
+
once: true
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}, {
|
|
470
|
+
key: "componentWillUnmount",
|
|
471
|
+
value: function componentWillUnmount() {
|
|
472
|
+
this.props.unregisterWindow(this.id);
|
|
473
|
+
if (this.props.splitScreenWhenDocked) {
|
|
474
|
+
this.props.setSplitScreen(this.id, null, null, false);
|
|
475
|
+
}
|
|
476
|
+
if (this.state.externalWindow) {
|
|
477
|
+
this.state.externalWindow.close();
|
|
478
|
+
}
|
|
479
|
+
window.removeEventListener('beforeunload', this.closeExternalWindow);
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "componentDidUpdate",
|
|
483
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
484
|
+
if (!this.state.geometry || !prevState.geometry) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (this.rnd && this.props.visible && this.props.visible !== prevProps.visible) {
|
|
488
|
+
this.props.onGeometryChanged(this.state.geometry);
|
|
489
|
+
this.rnd.updatePosition(this.state.geometry);
|
|
490
|
+
}
|
|
491
|
+
if (this.state.geometry !== prevState.geometry) {
|
|
492
|
+
this.props.onGeometryChanged(this.state.geometry);
|
|
493
|
+
WINDOW_GEOMETRIES[this.props.title] = this.state.geometry;
|
|
494
|
+
}
|
|
495
|
+
if (this.props.splitScreenWhenDocked && (this.props.visible !== prevProps.visible || this.state.geometry !== prevState.geometry || this.state.externalWindow !== prevState.externalWindow)) {
|
|
496
|
+
if (!this.props.visible && prevProps.visible || this.state.geometry.docked === false && prevState.geometry.docked !== false || this.state.geometry.maximized === true && prevState.geometry.maximized !== true || this.state.externalWindow && !prevState.externalWindow) {
|
|
497
|
+
this.props.setSplitScreen(this.id, null, null, false);
|
|
498
|
+
} else if (this.props.visible && this.state.geometry.docked && !this.state.externalWindow && !this.state.geometry.maximized) {
|
|
499
|
+
var dockSide = this.props.dockable === true ? "left" : this.props.dockable;
|
|
500
|
+
var dockSize = ["left", "right"].includes(dockSide) ? this.state.geometry.width : this.state.geometry.height;
|
|
501
|
+
this.props.setSplitScreen(this.id, dockSide, dockSize, this.props.splitTopAndBottomBar);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (!this.props.visible && prevProps.visible && this.state.externalWindow) {
|
|
505
|
+
// Cannot hide an external window
|
|
506
|
+
this.moveToInternalWindow();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}, {
|
|
510
|
+
key: "render",
|
|
511
|
+
value: function render() {
|
|
512
|
+
return [this.portalNode ? /*#__PURE__*/React.createElement(portals.InPortal, {
|
|
513
|
+
key: "InPortal",
|
|
514
|
+
node: this.portalNode
|
|
515
|
+
}, this.renderRole("body")) : null, this.state.externalWindow ? this.renderExternalWindow() : this.renderInternalWindowContainer()];
|
|
516
|
+
}
|
|
517
|
+
}]);
|
|
518
|
+
}(React.Component);
|
|
519
|
+
_defineProperty(ResizeableWindow, "propTypes", {
|
|
520
|
+
baseZIndex: PropTypes.number,
|
|
521
|
+
bottombarHeight: PropTypes.number,
|
|
522
|
+
busyIcon: PropTypes.bool,
|
|
523
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
524
|
+
detachable: PropTypes.bool,
|
|
525
|
+
dockable: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
526
|
+
extraControls: PropTypes.arrayOf(PropTypes.shape({
|
|
527
|
+
active: PropTypes.bool,
|
|
528
|
+
icon: PropTypes.string.isRequired,
|
|
529
|
+
callback: PropTypes.func.isRequired,
|
|
530
|
+
title: PropTypes.string
|
|
531
|
+
})),
|
|
532
|
+
fitHeight: PropTypes.bool,
|
|
533
|
+
fullscreen: PropTypes.bool,
|
|
534
|
+
icon: PropTypes.string,
|
|
535
|
+
initialHeight: PropTypes.number,
|
|
536
|
+
initialWidth: PropTypes.number,
|
|
537
|
+
initialX: PropTypes.number,
|
|
538
|
+
initialY: PropTypes.number,
|
|
539
|
+
initiallyDocked: PropTypes.bool,
|
|
540
|
+
mapMargins: PropTypes.object,
|
|
541
|
+
maxHeight: PropTypes.number,
|
|
542
|
+
maxWidth: PropTypes.number,
|
|
543
|
+
maximizeable: PropTypes.bool,
|
|
544
|
+
menuMargins: PropTypes.object,
|
|
545
|
+
minHeight: PropTypes.number,
|
|
546
|
+
minWidth: PropTypes.number,
|
|
547
|
+
minimizeable: PropTypes.bool,
|
|
548
|
+
onClose: PropTypes.func,
|
|
549
|
+
onExternalWindowResized: PropTypes.func,
|
|
550
|
+
onGeometryChanged: PropTypes.func,
|
|
551
|
+
raiseWindow: PropTypes.func,
|
|
552
|
+
registerWindow: PropTypes.func,
|
|
553
|
+
scrollable: PropTypes.bool,
|
|
554
|
+
setSplitScreen: PropTypes.func,
|
|
555
|
+
splitScreenWhenDocked: PropTypes.bool,
|
|
556
|
+
splitTopAndBottomBar: PropTypes.bool,
|
|
557
|
+
title: PropTypes.string,
|
|
558
|
+
topbarHeight: PropTypes.number,
|
|
559
|
+
unregisterWindow: PropTypes.func,
|
|
560
|
+
usePortal: PropTypes.bool,
|
|
561
|
+
visible: PropTypes.bool,
|
|
562
|
+
windowStacking: PropTypes.array
|
|
563
|
+
});
|
|
564
|
+
_defineProperty(ResizeableWindow, "defaultProps", {
|
|
565
|
+
baseZIndex: 10,
|
|
566
|
+
initialX: null,
|
|
567
|
+
initialY: null,
|
|
568
|
+
initialWidth: 240,
|
|
569
|
+
initialHeight: 320,
|
|
570
|
+
minWidth: 50,
|
|
571
|
+
minHeight: 50,
|
|
572
|
+
maxWidth: null,
|
|
573
|
+
maxHeight: null,
|
|
574
|
+
maximizeable: true,
|
|
575
|
+
minimizeable: false,
|
|
576
|
+
visible: true,
|
|
577
|
+
dockable: true,
|
|
578
|
+
onExternalWindowResized: function onExternalWindowResized() {},
|
|
579
|
+
onGeometryChanged: function onGeometryChanged() {},
|
|
580
|
+
externalWindow: null,
|
|
581
|
+
usePortal: true
|
|
582
|
+
});
|
|
583
|
+
export default connect(function (state) {
|
|
584
|
+
return {
|
|
585
|
+
windowStacking: state.windows.stacking,
|
|
586
|
+
topbarHeight: state.windows.topbarHeight,
|
|
587
|
+
bottombarHeight: state.windows.bottombarHeight,
|
|
588
|
+
mapMargins: state.windows.mapMargins,
|
|
589
|
+
menuMargins: state.windows.menuMargins
|
|
590
|
+
};
|
|
591
|
+
}, {
|
|
592
|
+
raiseWindow: raiseWindow,
|
|
593
|
+
registerWindow: registerWindow,
|
|
594
|
+
setSplitScreen: setSplitScreen,
|
|
595
|
+
unregisterWindow: unregisterWindow
|
|
596
|
+
})(ResizeableWindow);
|