qwc2 2025.10.13 → 2025.10.15
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 +768 -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
package/plugins/Print.js
CHANGED
|
@@ -1,23 +1,1239 @@
|
|
|
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 _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function define(t,e,r){return t[e]=r}}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t)})})}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a)},function(t){invoke("throw",t,i,a)}):e.resolve(h).then(function(t){u.value=t,i(u)},function(t){return invoke("throw",t,i,a)})}a(c.arg)}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r)})}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done}}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg)}}}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this}),define(g,"toString",function(){return"[object Generator]"}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t["return"]||t["return"]()}finally{if(u)throw o}}}}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_extends.apply(null,arguments)}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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
4
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
6
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
9
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20
|
+
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); } }
|
|
21
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
22
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
23
|
+
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); }
|
|
24
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
27
|
+
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); }
|
|
28
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
29
|
+
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; }
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
31
|
+
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); }
|
|
32
|
+
/**
|
|
2
33
|
* Copyright 2016-2024 Sourcepole AG
|
|
3
34
|
* All rights reserved.
|
|
4
35
|
*
|
|
5
36
|
* This source code is licensed under the BSD-style license found in the
|
|
6
37
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import { connect } from 'react-redux';
|
|
42
|
+
import axios from 'axios';
|
|
43
|
+
import dayjs from 'dayjs';
|
|
44
|
+
import FileSaver from 'file-saver';
|
|
45
|
+
import formDataEntries from 'formdata-json';
|
|
46
|
+
import JSZip from 'jszip';
|
|
47
|
+
import isEmpty from 'lodash.isempty';
|
|
48
|
+
import PropTypes from 'prop-types';
|
|
49
|
+
import { LayerRole, addLayerFeatures, clearLayer } from '../actions/layers';
|
|
50
|
+
import { setSnappingConfig } from '../actions/map';
|
|
51
|
+
import Icon from '../components/Icon';
|
|
52
|
+
import PickFeature from '../components/PickFeature';
|
|
53
|
+
import PrintSelection from '../components/PrintSelection';
|
|
54
|
+
import ResizeableWindow from '../components/ResizeableWindow';
|
|
55
|
+
import SideBar from '../components/SideBar';
|
|
56
|
+
import EditableSelect from '../components/widgets/EditableSelect';
|
|
57
|
+
import InputContainer from '../components/widgets/InputContainer';
|
|
58
|
+
import NumberInput from '../components/widgets/NumberInput';
|
|
59
|
+
import Spinner from '../components/widgets/Spinner';
|
|
60
|
+
import ToggleSwitch from '../components/widgets/ToggleSwitch';
|
|
61
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
62
|
+
import CoordinatesUtils from '../utils/CoordinatesUtils';
|
|
63
|
+
import LayerUtils from '../utils/LayerUtils';
|
|
64
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
65
|
+
import MapUtils from '../utils/MapUtils';
|
|
66
|
+
import MiscUtils from '../utils/MiscUtils';
|
|
67
|
+
import VectorLayerUtils from '../utils/VectorLayerUtils';
|
|
68
|
+
import './style/Print.css';
|
|
69
|
+
|
|
70
|
+
/**
|
|
8
71
|
* Invokes QGIS Server WMS GetPrint to print the map to PDF.
|
|
9
72
|
*
|
|
10
73
|
* Uses the print layouts defined in the QGIS project.
|
|
11
|
-
*/
|
|
12
|
-
var scale=Math.round(MapUtils.computeForZoom(_this.props.map.scales,_this.props.map.zoom)*_this.props.defaultScaleFactor);if(((_this$props$theme$pri=_this.props.theme.printScales)===null||_this$props$theme$pri===void 0?void 0:_this$props$theme$pri.length)>0){scale=_this.props.theme.printScales.reduce(function(prev,curr){return Math.abs(curr-scale)<Math.abs(prev-scale)?curr:prev})}var bounds=_this.props.map.bbox.bounds;var center=_this.state.center||[0,0];var resetCenter=center[0]<bounds[0]||center[0]>bounds[2]||center[1]<bounds[1]||center[1]>bounds[3];var resetScale=_this.state.scale/scale<0.01||_this.state.scale/scale>10;if(resetCenter||resetScale){_this.setState({center:null,rotation:0,scale:scale})}_this.props.setSnappingConfig(false,false)});_defineProperty(_this,"onHide",function(){_this.setState({minimized:false,printSeriesEnabled:false,atlasFeatures:[]})});_defineProperty(_this,"renderBody",function(){var _this$state$extents$a,_this$props$theme$pri2,_this$state$layout$la,_this$state$layout;if(!_this.state.layout){return/*#__PURE__*/React.createElement("div",{className:"print-body",role:"body"},LocaleUtils.tr("print.nolayouts"))}var haveThemeLayers=_this.props.layers.find(function(layer){return layer.role===LayerRole.THEME})!==undefined;if(!_this.props.theme||!_this.props.printExternalLayers&&!haveThemeLayers){return/*#__PURE__*/React.createElement("div",{className:"print-body",role:"body"},LocaleUtils.tr("print.notheme"))}var mapName=_this.state.layout.map.name;var printLegend=_this.state.layout.legendLayout;var formattedExtent=!isEmpty(_this.state.atlasFeatures)?"":_this.formatExtent((_this$state$extents$a=_this.state.extents.at(0))!==null&&_this$state$extents$a!==void 0?_this$state$extents$a:[0,0,0,0]);var resolutionChooser=null;var resolutionInput=null;if(!isEmpty(_this.props.theme.printResolutions)){if(_this.props.theme.printResolutions.length>1){resolutionChooser=/*#__PURE__*/React.createElement("select",{name:"DPI",onChange:function onChange(ev){return _this.changeResolution(ev.target.value)},value:_this.state.dpi||""},_this.props.theme.printResolutions.map(function(res){return/*#__PURE__*/React.createElement("option",{key:res,value:res},res," dpi")}))}else{resolutionInput=/*#__PURE__*/React.createElement("input",{name:"DPI",readOnly:true,type:"hidden",value:_this.props.theme.printResolutions[0]})}}else{resolutionChooser=/*#__PURE__*/React.createElement(NumberInput,{max:1200,min:50,mobile:true,name:"DPI",onChange:_this.changeResolution,suffix:" dpi",value:_this.state.dpi||""})}var scaleChooser=null;if(((_this$props$theme$pri2=_this.props.theme.printScales)===null||_this$props$theme$pri2===void 0?void 0:_this$props$theme$pri2.length)>0){if(_this.props.restrictToPrintScales){scaleChooser=/*#__PURE__*/React.createElement(InputContainer,null,/*#__PURE__*/React.createElement("span",{role:"prefix"},"1\xA0:\xA0"),/*#__PURE__*/React.createElement("select",{name:mapName+":scale",onChange:function onChange(ev){return _this.changeScale(ev.target.value)},role:"input",value:_this.state.scale},_this.props.theme.printScales.map(function(scale){return/*#__PURE__*/React.createElement("option",{key:scale,value:scale},scale)})))}else{scaleChooser=/*#__PURE__*/React.createElement(InputContainer,null,/*#__PURE__*/React.createElement("span",{role:"prefix"},"1\xA0:\xA0"),/*#__PURE__*/React.createElement(EditableSelect,{name:mapName+":scale",onChange:_this.changeScale,options:_this.props.theme.printScales,role:"input",value:_this.state.scale||""}))}}else{scaleChooser=/*#__PURE__*/React.createElement(NumberInput,{min:1,mobile:true,name:mapName+":scale",onChange:_this.changeScale,prefix:"1 : ",value:_this.state.scale||null})}var formatMap={"application/pdf":"PDF","image/jpeg":"JPEG","image/png":"PNG","image/svg":"SVG"};var allowGeoPdfExport=_this.state.selectedFormat==="application/pdf"&&_this.props.allowGeoPdfExport;return/*#__PURE__*/React.createElement("div",{className:"print-body"},/*#__PURE__*/React.createElement("form",{action:_this.props.theme.printUrl,method:"POST",onSubmit:_this.print,ref:function ref(el){_this.printForm=el}},/*#__PURE__*/React.createElement("input",{name:"TEMPLATE",type:"hidden",value:printLegend&&_this.state.legend?printLegend:_this.state.layout.name}),/*#__PURE__*/React.createElement("table",{className:"options-table"},/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.layout")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:_this.changeLayout,value:_this.state.layout.name},_this.state.layouts.map(function(item){return/*#__PURE__*/React.createElement("option",{key:item.name,value:item.name},_this.translateLayoutName(item.name))})))),_this.props.formats.length>1?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.format")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{disabled:_this.state.printSeriesEnabled,name:"FORMAT",onChange:_this.formatChanged,value:_this.state.selectedFormat},_this.props.formats.map(function(format){return/*#__PURE__*/React.createElement("option",{key:format,value:format},formatMap[format]||format)})))):null,_this.state.layout.atlasCoverageLayer&&!_this.state.printSeriesEnabled?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.atlasfeature")),/*#__PURE__*/React.createElement("td",null,!isEmpty(_this.state.atlasFeatures)?/*#__PURE__*/React.createElement("div",{className:"print-atlas-features"},_this.state.atlasFeatures.map(function(feature){return/*#__PURE__*/React.createElement("span",{key:feature.id},/*#__PURE__*/React.createElement("span",null,feature.properties[feature.displayfield]),/*#__PURE__*/React.createElement(Icon,{icon:"remove",onClick:function onClick(){return _this.deselectAtlasFeature(feature)}}))}),/*#__PURE__*/React.createElement("input",{name:"ATLAS_PK",type:"hidden",value:_this.state.atlasFeatures.map(function(feature){var _feature$properties$_;return(_feature$properties$_=feature.properties[_this.state.layout.atlas_pk])!==null&&_feature$properties$_!==void 0?_feature$properties$_:feature.id}).join(",")})):/*#__PURE__*/React.createElement("input",{disabled:true,placeholder:LocaleUtils.tr("print.pickatlasfeature",_this.state.layout.atlasCoverageLayer),type:"text"}))):null,isEmpty(_this.state.atlasFeatures)?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.scale")),/*#__PURE__*/React.createElement("td",null,scaleChooser)):null,resolutionChooser?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.resolution")),/*#__PURE__*/React.createElement("td",null,resolutionChooser)):null,_this.props.displayRotation?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.rotation")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(InputContainer,null,/*#__PURE__*/React.createElement(NumberInput,{decimals:1,mobile:true,name:mapName+":rotation",onChange:_this.changeRotation,role:"input",value:_this.state.rotation}),/*#__PURE__*/React.createElement("span",{role:"suffix",style:{transform:"rotate(-"+_this.state.rotation+"deg)"}},/*#__PURE__*/React.createElement(Icon,{icon:"arrow-up",onClick:function onClick(){return _this.setState({rotation:0})},title:LocaleUtils.tr("map.resetrotation")}))))):null,!isEmpty(_this.props.theme.printGrid)?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.grid")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:_this.state.grid,onChange:function onChange(newstate){return _this.setState({grid:newstate})}}))):null,printLegend?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.legend")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:_this.state.legend,onChange:function onChange(newstate){return _this.setState({legend:newstate})}}))):null,_this.props.displayPrintSeries?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.series")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:_this.state.printSeriesEnabled,onChange:function onChange(newstate){return _this.setState({printSeriesEnabled:newstate,atlasFeatures:[]})}}))):null,_this.state.printSeriesEnabled?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.overlap")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(InputContainer,null,/*#__PURE__*/React.createElement("input",{max:"20",min:"0",onChange:_this.changeSeriesOverlap,role:"input",type:"range",value:_this.state.printSeriesOverlap}),/*#__PURE__*/React.createElement("span",{role:"suffix"},_this.state.printSeriesOverlap,"\xA0%")))):null,!_this.props.inlinePrintOutput&&_this.state.printSeriesEnabled?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("print.download")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:_this.changeDownloadMode,role:"input",value:_this.state.downloadMode||""},/*#__PURE__*/React.createElement("option",{key:"onepdf",value:"onepdf"},LocaleUtils.tr("print.download_as_onepdf")),/*#__PURE__*/React.createElement("option",{key:"onezip",value:"onezip"},LocaleUtils.tr("print.download_as_onezip")),/*#__PURE__*/React.createElement("option",{key:"single",value:"single"},LocaleUtils.tr("print.download_as_single"))))):null,((_this$state$layout$la=(_this$state$layout=_this.state.layout)===null||_this$state$layout===void 0?void 0:_this$state$layout.labels)!==null&&_this$state$layout$la!==void 0?_this$state$layout$la:[]).map(function(label){var _this$props$theme$pri3;// Omit labels which start with __
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_this
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
74
|
+
*/
|
|
75
|
+
var Print = /*#__PURE__*/function (_React$Component) {
|
|
76
|
+
function Print(props) {
|
|
77
|
+
var _this;
|
|
78
|
+
_classCallCheck(this, Print);
|
|
79
|
+
_this = _callSuper(this, Print, [props]);
|
|
80
|
+
_defineProperty(_this, "state", {
|
|
81
|
+
center: null,
|
|
82
|
+
extents: [],
|
|
83
|
+
layout: null,
|
|
84
|
+
layouts: [],
|
|
85
|
+
rotation: 0,
|
|
86
|
+
scale: 0,
|
|
87
|
+
dpi: 300,
|
|
88
|
+
grid: false,
|
|
89
|
+
legend: false,
|
|
90
|
+
minimized: false,
|
|
91
|
+
printOutputVisible: false,
|
|
92
|
+
outputLoaded: false,
|
|
93
|
+
printing: false,
|
|
94
|
+
atlasFeatures: [],
|
|
95
|
+
geoPdf: false,
|
|
96
|
+
selectedFormat: "",
|
|
97
|
+
printOutputData: undefined,
|
|
98
|
+
pdfData: null,
|
|
99
|
+
pdfDataUrl: null,
|
|
100
|
+
downloadMode: "onepdf",
|
|
101
|
+
printSeriesEnabled: false,
|
|
102
|
+
printSeriesOverlap: 0,
|
|
103
|
+
printSeriesSelected: []
|
|
104
|
+
});
|
|
105
|
+
_defineProperty(_this, "onShow", function () {
|
|
106
|
+
var _this$props$theme$pri;
|
|
107
|
+
// setup initial extent
|
|
108
|
+
var scale = Math.round(MapUtils.computeForZoom(_this.props.map.scales, _this.props.map.zoom) * _this.props.defaultScaleFactor);
|
|
109
|
+
if (((_this$props$theme$pri = _this.props.theme.printScales) === null || _this$props$theme$pri === void 0 ? void 0 : _this$props$theme$pri.length) > 0) {
|
|
110
|
+
scale = _this.props.theme.printScales.reduce(function (prev, curr) {
|
|
111
|
+
return Math.abs(curr - scale) < Math.abs(prev - scale) ? curr : prev;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
var bounds = _this.props.map.bbox.bounds;
|
|
115
|
+
var center = _this.state.center || [0, 0];
|
|
116
|
+
var resetCenter = center[0] < bounds[0] || center[0] > bounds[2] || center[1] < bounds[1] || center[1] > bounds[3];
|
|
117
|
+
var resetScale = _this.state.scale / scale < 0.01 || _this.state.scale / scale > 10;
|
|
118
|
+
if (resetCenter || resetScale) {
|
|
119
|
+
_this.setState({
|
|
120
|
+
center: null,
|
|
121
|
+
rotation: 0,
|
|
122
|
+
scale: scale
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
_this.props.setSnappingConfig(false, false);
|
|
126
|
+
});
|
|
127
|
+
_defineProperty(_this, "onHide", function () {
|
|
128
|
+
_this.setState({
|
|
129
|
+
minimized: false,
|
|
130
|
+
printSeriesEnabled: false,
|
|
131
|
+
atlasFeatures: []
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
_defineProperty(_this, "renderBody", function () {
|
|
135
|
+
var _this$state$extents$a, _this$props$theme$pri2, _this$state$layout$la, _this$state$layout;
|
|
136
|
+
if (!_this.state.layout) {
|
|
137
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "print-body",
|
|
139
|
+
role: "body"
|
|
140
|
+
}, LocaleUtils.tr("print.nolayouts"));
|
|
141
|
+
}
|
|
142
|
+
var haveThemeLayers = _this.props.layers.find(function (layer) {
|
|
143
|
+
return layer.role === LayerRole.THEME;
|
|
144
|
+
}) !== undefined;
|
|
145
|
+
if (!_this.props.theme || !_this.props.printExternalLayers && !haveThemeLayers) {
|
|
146
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: "print-body",
|
|
148
|
+
role: "body"
|
|
149
|
+
}, LocaleUtils.tr("print.notheme"));
|
|
150
|
+
}
|
|
151
|
+
var mapName = _this.state.layout.map.name;
|
|
152
|
+
var printLegend = _this.state.layout.legendLayout;
|
|
153
|
+
var formattedExtent = !isEmpty(_this.state.atlasFeatures) ? "" : _this.formatExtent((_this$state$extents$a = _this.state.extents.at(0)) !== null && _this$state$extents$a !== void 0 ? _this$state$extents$a : [0, 0, 0, 0]);
|
|
154
|
+
var resolutionChooser = null;
|
|
155
|
+
var resolutionInput = null;
|
|
156
|
+
if (!isEmpty(_this.props.theme.printResolutions)) {
|
|
157
|
+
if (_this.props.theme.printResolutions.length > 1) {
|
|
158
|
+
resolutionChooser = /*#__PURE__*/React.createElement("select", {
|
|
159
|
+
name: "DPI",
|
|
160
|
+
onChange: function onChange(ev) {
|
|
161
|
+
return _this.changeResolution(ev.target.value);
|
|
162
|
+
},
|
|
163
|
+
value: _this.state.dpi || ""
|
|
164
|
+
}, _this.props.theme.printResolutions.map(function (res) {
|
|
165
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
166
|
+
key: res,
|
|
167
|
+
value: res
|
|
168
|
+
}, res, " dpi");
|
|
169
|
+
}));
|
|
170
|
+
} else {
|
|
171
|
+
resolutionInput = /*#__PURE__*/React.createElement("input", {
|
|
172
|
+
name: "DPI",
|
|
173
|
+
readOnly: true,
|
|
174
|
+
type: "hidden",
|
|
175
|
+
value: _this.props.theme.printResolutions[0]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
resolutionChooser = /*#__PURE__*/React.createElement(NumberInput, {
|
|
180
|
+
max: 1200,
|
|
181
|
+
min: 50,
|
|
182
|
+
mobile: true,
|
|
183
|
+
name: "DPI",
|
|
184
|
+
onChange: _this.changeResolution,
|
|
185
|
+
suffix: " dpi",
|
|
186
|
+
value: _this.state.dpi || ""
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
var scaleChooser = null;
|
|
190
|
+
if (((_this$props$theme$pri2 = _this.props.theme.printScales) === null || _this$props$theme$pri2 === void 0 ? void 0 : _this$props$theme$pri2.length) > 0) {
|
|
191
|
+
if (_this.props.restrictToPrintScales) {
|
|
192
|
+
scaleChooser = /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
role: "prefix"
|
|
194
|
+
}, "1\xA0:\xA0"), /*#__PURE__*/React.createElement("select", {
|
|
195
|
+
name: mapName + ":scale",
|
|
196
|
+
onChange: function onChange(ev) {
|
|
197
|
+
return _this.changeScale(ev.target.value);
|
|
198
|
+
},
|
|
199
|
+
role: "input",
|
|
200
|
+
value: _this.state.scale
|
|
201
|
+
}, _this.props.theme.printScales.map(function (scale) {
|
|
202
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
203
|
+
key: scale,
|
|
204
|
+
value: scale
|
|
205
|
+
}, scale);
|
|
206
|
+
})));
|
|
207
|
+
} else {
|
|
208
|
+
scaleChooser = /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement("span", {
|
|
209
|
+
role: "prefix"
|
|
210
|
+
}, "1\xA0:\xA0"), /*#__PURE__*/React.createElement(EditableSelect, {
|
|
211
|
+
name: mapName + ":scale",
|
|
212
|
+
onChange: _this.changeScale,
|
|
213
|
+
options: _this.props.theme.printScales,
|
|
214
|
+
role: "input",
|
|
215
|
+
value: _this.state.scale || ""
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
scaleChooser = /*#__PURE__*/React.createElement(NumberInput, {
|
|
220
|
+
min: 1,
|
|
221
|
+
mobile: true,
|
|
222
|
+
name: mapName + ":scale",
|
|
223
|
+
onChange: _this.changeScale,
|
|
224
|
+
prefix: "1 : ",
|
|
225
|
+
value: _this.state.scale || null
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
var formatMap = {
|
|
229
|
+
"application/pdf": "PDF",
|
|
230
|
+
"image/jpeg": "JPEG",
|
|
231
|
+
"image/png": "PNG",
|
|
232
|
+
"image/svg": "SVG"
|
|
233
|
+
};
|
|
234
|
+
var allowGeoPdfExport = _this.state.selectedFormat === "application/pdf" && _this.props.allowGeoPdfExport;
|
|
235
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
236
|
+
className: "print-body"
|
|
237
|
+
}, /*#__PURE__*/React.createElement("form", {
|
|
238
|
+
action: _this.props.theme.printUrl,
|
|
239
|
+
method: "POST",
|
|
240
|
+
onSubmit: _this.print,
|
|
241
|
+
ref: function ref(el) {
|
|
242
|
+
_this.printForm = el;
|
|
243
|
+
}
|
|
244
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
245
|
+
name: "TEMPLATE",
|
|
246
|
+
type: "hidden",
|
|
247
|
+
value: printLegend && _this.state.legend ? printLegend : _this.state.layout.name
|
|
248
|
+
}), /*#__PURE__*/React.createElement("table", {
|
|
249
|
+
className: "options-table"
|
|
250
|
+
}, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.layout")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
|
|
251
|
+
onChange: _this.changeLayout,
|
|
252
|
+
value: _this.state.layout.name
|
|
253
|
+
}, _this.state.layouts.map(function (item) {
|
|
254
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
255
|
+
key: item.name,
|
|
256
|
+
value: item.name
|
|
257
|
+
}, _this.translateLayoutName(item.name));
|
|
258
|
+
})))), _this.props.formats.length > 1 ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.format")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
|
|
259
|
+
disabled: _this.state.printSeriesEnabled,
|
|
260
|
+
name: "FORMAT",
|
|
261
|
+
onChange: _this.formatChanged,
|
|
262
|
+
value: _this.state.selectedFormat
|
|
263
|
+
}, _this.props.formats.map(function (format) {
|
|
264
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
265
|
+
key: format,
|
|
266
|
+
value: format
|
|
267
|
+
}, formatMap[format] || format);
|
|
268
|
+
})))) : null, _this.state.layout.atlasCoverageLayer && !_this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.atlasfeature")), /*#__PURE__*/React.createElement("td", null, !isEmpty(_this.state.atlasFeatures) ? /*#__PURE__*/React.createElement("div", {
|
|
269
|
+
className: "print-atlas-features"
|
|
270
|
+
}, _this.state.atlasFeatures.map(function (feature) {
|
|
271
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
272
|
+
key: feature.id
|
|
273
|
+
}, /*#__PURE__*/React.createElement("span", null, feature.properties[feature.displayfield]), /*#__PURE__*/React.createElement(Icon, {
|
|
274
|
+
icon: "remove",
|
|
275
|
+
onClick: function onClick() {
|
|
276
|
+
return _this.deselectAtlasFeature(feature);
|
|
277
|
+
}
|
|
278
|
+
}));
|
|
279
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
280
|
+
name: "ATLAS_PK",
|
|
281
|
+
type: "hidden",
|
|
282
|
+
value: _this.state.atlasFeatures.map(function (feature) {
|
|
283
|
+
var _feature$properties$_;
|
|
284
|
+
return (_feature$properties$_ = feature.properties[_this.state.layout.atlas_pk]) !== null && _feature$properties$_ !== void 0 ? _feature$properties$_ : feature.id;
|
|
285
|
+
}).join(",")
|
|
286
|
+
})) : /*#__PURE__*/React.createElement("input", {
|
|
287
|
+
disabled: true,
|
|
288
|
+
placeholder: LocaleUtils.tr("print.pickatlasfeature", _this.state.layout.atlasCoverageLayer),
|
|
289
|
+
type: "text"
|
|
290
|
+
}))) : null, isEmpty(_this.state.atlasFeatures) ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.scale")), /*#__PURE__*/React.createElement("td", null, scaleChooser)) : null, resolutionChooser ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.resolution")), /*#__PURE__*/React.createElement("td", null, resolutionChooser)) : null, _this.props.displayRotation ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.rotation")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(NumberInput, {
|
|
291
|
+
decimals: 1,
|
|
292
|
+
mobile: true,
|
|
293
|
+
name: mapName + ":rotation",
|
|
294
|
+
onChange: _this.changeRotation,
|
|
295
|
+
role: "input",
|
|
296
|
+
value: _this.state.rotation
|
|
297
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
298
|
+
role: "suffix",
|
|
299
|
+
style: {
|
|
300
|
+
transform: "rotate(-" + _this.state.rotation + "deg)"
|
|
301
|
+
}
|
|
302
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
303
|
+
icon: "arrow-up",
|
|
304
|
+
onClick: function onClick() {
|
|
305
|
+
return _this.setState({
|
|
306
|
+
rotation: 0
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
title: LocaleUtils.tr("map.resetrotation")
|
|
310
|
+
}))))) : null, !isEmpty(_this.props.theme.printGrid) ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.grid")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
311
|
+
active: _this.state.grid,
|
|
312
|
+
onChange: function onChange(newstate) {
|
|
313
|
+
return _this.setState({
|
|
314
|
+
grid: newstate
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}))) : null, printLegend ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.legend")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
318
|
+
active: _this.state.legend,
|
|
319
|
+
onChange: function onChange(newstate) {
|
|
320
|
+
return _this.setState({
|
|
321
|
+
legend: newstate
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}))) : null, _this.props.displayPrintSeries ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.series")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
325
|
+
active: _this.state.printSeriesEnabled,
|
|
326
|
+
onChange: function onChange(newstate) {
|
|
327
|
+
return _this.setState({
|
|
328
|
+
printSeriesEnabled: newstate,
|
|
329
|
+
atlasFeatures: []
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}))) : null, _this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.overlap")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement("input", {
|
|
333
|
+
max: "20",
|
|
334
|
+
min: "0",
|
|
335
|
+
onChange: _this.changeSeriesOverlap,
|
|
336
|
+
role: "input",
|
|
337
|
+
type: "range",
|
|
338
|
+
value: _this.state.printSeriesOverlap
|
|
339
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
340
|
+
role: "suffix"
|
|
341
|
+
}, _this.state.printSeriesOverlap, "\xA0%")))) : null, !_this.props.inlinePrintOutput && _this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.download")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
|
|
342
|
+
onChange: _this.changeDownloadMode,
|
|
343
|
+
role: "input",
|
|
344
|
+
value: _this.state.downloadMode || ""
|
|
345
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
346
|
+
key: "onepdf",
|
|
347
|
+
value: "onepdf"
|
|
348
|
+
}, LocaleUtils.tr("print.download_as_onepdf")), /*#__PURE__*/React.createElement("option", {
|
|
349
|
+
key: "onezip",
|
|
350
|
+
value: "onezip"
|
|
351
|
+
}, LocaleUtils.tr("print.download_as_onezip")), /*#__PURE__*/React.createElement("option", {
|
|
352
|
+
key: "single",
|
|
353
|
+
value: "single"
|
|
354
|
+
}, LocaleUtils.tr("print.download_as_single"))))) : null, ((_this$state$layout$la = (_this$state$layout = _this.state.layout) === null || _this$state$layout === void 0 ? void 0 : _this$state$layout.labels) !== null && _this$state$layout$la !== void 0 ? _this$state$layout$la : []).map(function (label) {
|
|
355
|
+
var _this$props$theme$pri3;
|
|
356
|
+
// Omit labels which start with __
|
|
357
|
+
if (label.startsWith("__")) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
var opts = _objectSpread({
|
|
361
|
+
rows: 1,
|
|
362
|
+
name: label.toUpperCase()
|
|
363
|
+
}, (_this$props$theme$pri3 = _this.props.theme.printLabelConfig) === null || _this$props$theme$pri3 === void 0 ? void 0 : _this$props$theme$pri3[label]);
|
|
364
|
+
return _this.renderPrintLabelField(label, opts);
|
|
365
|
+
}), allowGeoPdfExport ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "GeoPDF"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
366
|
+
active: _this.state.geoPdf,
|
|
367
|
+
onChange: function onChange(newstate) {
|
|
368
|
+
return _this.setState({
|
|
369
|
+
geoPdf: newstate
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}))) : null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
|
|
373
|
+
name: "csrf_token",
|
|
374
|
+
type: "hidden",
|
|
375
|
+
value: MiscUtils.getCsrfToken()
|
|
376
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
377
|
+
name: mapName + ":extent",
|
|
378
|
+
readOnly: true,
|
|
379
|
+
type: "hidden",
|
|
380
|
+
value: formattedExtent
|
|
381
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
382
|
+
name: "SERVICE",
|
|
383
|
+
readOnly: true,
|
|
384
|
+
type: "hidden",
|
|
385
|
+
value: "WMS"
|
|
386
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
387
|
+
name: "VERSION",
|
|
388
|
+
readOnly: true,
|
|
389
|
+
type: "hidden",
|
|
390
|
+
value: _this.props.theme.version
|
|
391
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
392
|
+
name: "REQUEST",
|
|
393
|
+
readOnly: true,
|
|
394
|
+
type: "hidden",
|
|
395
|
+
value: "GetPrint"
|
|
396
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
397
|
+
name: "FORMAT",
|
|
398
|
+
readOnly: true,
|
|
399
|
+
type: "hidden",
|
|
400
|
+
value: _this.state.selectedFormat
|
|
401
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
402
|
+
name: "TRANSPARENT",
|
|
403
|
+
readOnly: true,
|
|
404
|
+
type: "hidden",
|
|
405
|
+
value: "true"
|
|
406
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
407
|
+
name: "SRS",
|
|
408
|
+
readOnly: true,
|
|
409
|
+
type: "hidden",
|
|
410
|
+
value: _this.props.map.projection
|
|
411
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
412
|
+
name: "CONTENT_DISPOSITION",
|
|
413
|
+
readOnly: true,
|
|
414
|
+
type: "hidden",
|
|
415
|
+
value: _this.props.inlinePrintOutput ? "inline" : "attachment"
|
|
416
|
+
}), allowGeoPdfExport ? /*#__PURE__*/React.createElement("input", {
|
|
417
|
+
name: "FORMAT_OPTIONS",
|
|
418
|
+
readOnly: true,
|
|
419
|
+
type: "hidden",
|
|
420
|
+
value: _this.state.geoPdf ? "WRITE_GEO_PDF:true" : "WRITE_GEO_PDF:false"
|
|
421
|
+
}) : null, resolutionInput), /*#__PURE__*/React.createElement("div", {
|
|
422
|
+
className: "button-bar"
|
|
423
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
424
|
+
className: "button",
|
|
425
|
+
disabled: _this.state.printing,
|
|
426
|
+
type: "submit"
|
|
427
|
+
}, _this.state.printing ? /*#__PURE__*/React.createElement("span", {
|
|
428
|
+
className: "print-wait"
|
|
429
|
+
}, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("print.wait")) : LocaleUtils.tr("print.submit")))));
|
|
430
|
+
});
|
|
431
|
+
_defineProperty(_this, "renderPrintLabelField", function (label, opts) {
|
|
432
|
+
var defaultValue = opts.defaultValue || "";
|
|
433
|
+
var autopopulated = false;
|
|
434
|
+
if (label === _this.props.theme.printLabelForSearchResult) {
|
|
435
|
+
defaultValue = _this.getSearchMarkerLabel();
|
|
436
|
+
autopopulated = true;
|
|
437
|
+
} else if (label === _this.props.theme.printLabelForAttribution) {
|
|
438
|
+
defaultValue = _this.getAttributionLabel();
|
|
439
|
+
autopopulated = true;
|
|
440
|
+
}
|
|
441
|
+
if (autopopulated && _this.props.hideAutopopulatedFields) {
|
|
442
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
443
|
+
key: "label." + label
|
|
444
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
445
|
+
colSpan: "2"
|
|
446
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
447
|
+
defaultValue: defaultValue,
|
|
448
|
+
name: opts.name,
|
|
449
|
+
type: "hidden"
|
|
450
|
+
})));
|
|
451
|
+
} else {
|
|
452
|
+
if (opts.options) {
|
|
453
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
454
|
+
key: "label." + label
|
|
455
|
+
}, /*#__PURE__*/React.createElement("td", null, MiscUtils.capitalizeFirst(label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
|
|
456
|
+
defaultValue: defaultValue,
|
|
457
|
+
name: opts.name
|
|
458
|
+
}, opts.options.map(function (value) {
|
|
459
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
460
|
+
key: value,
|
|
461
|
+
value: value
|
|
462
|
+
}, value);
|
|
463
|
+
}))));
|
|
464
|
+
} else {
|
|
465
|
+
var style = {};
|
|
466
|
+
if (opts.rows || opts.cols) {
|
|
467
|
+
style.resize = 'none';
|
|
468
|
+
}
|
|
469
|
+
if (opts.cols) {
|
|
470
|
+
style.width = 'initial';
|
|
471
|
+
}
|
|
472
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
473
|
+
key: "label." + label
|
|
474
|
+
}, /*#__PURE__*/React.createElement("td", null, MiscUtils.capitalizeFirst(label)), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("textarea", _extends({}, opts, {
|
|
475
|
+
defaultValue: defaultValue,
|
|
476
|
+
readOnly: autopopulated,
|
|
477
|
+
style: style
|
|
478
|
+
}))));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
_defineProperty(_this, "getSearchMarkerLabel", function () {
|
|
483
|
+
var _feature$properties;
|
|
484
|
+
var searchsellayer = _this.props.layers.find(function (layer) {
|
|
485
|
+
return layer.id === "searchselection";
|
|
486
|
+
});
|
|
487
|
+
var feature = ((searchsellayer === null || searchsellayer === void 0 ? void 0 : searchsellayer.features) || []).find(function (f) {
|
|
488
|
+
return f.id === "searchmarker";
|
|
489
|
+
});
|
|
490
|
+
return (feature === null || feature === void 0 || (_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.label) || "";
|
|
491
|
+
});
|
|
492
|
+
_defineProperty(_this, "getAttributionLabel", function () {
|
|
493
|
+
var copyrights = _this.props.layers.reduce(function (res, layer) {
|
|
494
|
+
return _objectSpread(_objectSpread({}, res), LayerUtils.getAttribution(layer, _this.props.map));
|
|
495
|
+
}, {});
|
|
496
|
+
var el = document.createElement("span");
|
|
497
|
+
return Object.entries(copyrights).map(function (_ref) {
|
|
498
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
499
|
+
key = _ref2[0],
|
|
500
|
+
value = _ref2[1];
|
|
501
|
+
if (value.title) {
|
|
502
|
+
el.innerHTML = value.title;
|
|
503
|
+
return el.innerText;
|
|
504
|
+
} else {
|
|
505
|
+
el.innerHTML = key;
|
|
506
|
+
return el.innerText;
|
|
507
|
+
}
|
|
508
|
+
}).join(" | ");
|
|
509
|
+
});
|
|
510
|
+
_defineProperty(_this, "renderPrintSelection", function () {
|
|
511
|
+
var printSelection = null;
|
|
512
|
+
if (_this.state.layout && isEmpty(_this.state.atlasFeatures)) {
|
|
513
|
+
var frame = {
|
|
514
|
+
width: _this.state.layout.map.width,
|
|
515
|
+
height: _this.state.layout.map.height
|
|
516
|
+
};
|
|
517
|
+
printSelection = /*#__PURE__*/React.createElement(PrintSelection, {
|
|
518
|
+
allowRotation: _this.props.displayRotation && (!_this.state.printSeriesEnabled || _this.props.movePrintSeries),
|
|
519
|
+
allowScaling: !_this.state.printSeriesEnabled || _this.props.movePrintSeries,
|
|
520
|
+
allowTranslation: !_this.state.printSeriesEnabled || _this.props.movePrintSeries,
|
|
521
|
+
center: _this.state.center || _this.props.map.center,
|
|
522
|
+
fixedFrame: frame,
|
|
523
|
+
geometryChanged: _this.geometryChanged,
|
|
524
|
+
key: "PrintSelection",
|
|
525
|
+
printSeriesChanged: _this.printSeriesChanged,
|
|
526
|
+
printSeriesEnabled: _this.props.displayPrintSeries && _this.state.printSeriesEnabled,
|
|
527
|
+
printSeriesOverlap: _this.state.printSeriesOverlap / 100,
|
|
528
|
+
printSeriesSelected: _this.state.printSeriesSelected,
|
|
529
|
+
rotation: _this.state.rotation,
|
|
530
|
+
scale: _this.state.scale
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
return printSelection;
|
|
534
|
+
});
|
|
535
|
+
_defineProperty(_this, "formatExtent", function (extent) {
|
|
536
|
+
var mapCrs = _this.props.map.projection;
|
|
537
|
+
var version = _this.props.theme.version;
|
|
538
|
+
if (CoordinatesUtils.getAxisOrder(mapCrs).substring(0, 2) === 'ne' && version === '1.3.0') {
|
|
539
|
+
return extent[1] + "," + extent[0] + "," + extent[3] + "," + extent[2];
|
|
540
|
+
}
|
|
541
|
+
return extent.join(',');
|
|
542
|
+
});
|
|
543
|
+
_defineProperty(_this, "geometryChanged", function (center, extents, rotation, scale) {
|
|
544
|
+
var _this$props$theme$pri4;
|
|
545
|
+
if (_this.props.restrictToPrintScales && ((_this$props$theme$pri4 = _this.props.theme.printScales) === null || _this$props$theme$pri4 === void 0 ? void 0 : _this$props$theme$pri4.length) > 0) {
|
|
546
|
+
scale = _this.props.theme.printScales.reduce(function (prev, curr) {
|
|
547
|
+
return Math.abs(curr - scale) < Math.abs(prev - scale) ? curr : prev;
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
_this.setState({
|
|
551
|
+
center: center,
|
|
552
|
+
extents: extents,
|
|
553
|
+
rotation: rotation,
|
|
554
|
+
scale: scale
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
_defineProperty(_this, "printSeriesChanged", function (selected) {
|
|
558
|
+
_this.setState({
|
|
559
|
+
printSeriesSelected: selected
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
_defineProperty(_this, "renderPrintOutputWindow", function () {
|
|
563
|
+
var extraControls = [{
|
|
564
|
+
icon: 'save',
|
|
565
|
+
title: LocaleUtils.tr('print.save'),
|
|
566
|
+
callback: _this.savePrintOutput
|
|
567
|
+
}];
|
|
568
|
+
return /*#__PURE__*/React.createElement(ResizeableWindow, {
|
|
569
|
+
extraControls: extraControls,
|
|
570
|
+
icon: "print",
|
|
571
|
+
initialHeight: 0.75 * window.innerHeight,
|
|
572
|
+
initialWidth: 0.5 * window.innerWidth,
|
|
573
|
+
key: "PrintOutputWindow",
|
|
574
|
+
onClose: function onClose() {
|
|
575
|
+
return _this.setState({
|
|
576
|
+
printOutputVisible: false,
|
|
577
|
+
outputLoaded: false,
|
|
578
|
+
pdfData: null,
|
|
579
|
+
pdfDataUrl: null
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
title: LocaleUtils.tr("print.output"),
|
|
583
|
+
visible: _this.state.printOutputVisible
|
|
584
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
585
|
+
className: "print-output-window-body",
|
|
586
|
+
role: "body"
|
|
587
|
+
}, !_this.state.outputLoaded ? /*#__PURE__*/React.createElement("span", {
|
|
588
|
+
className: "print-output-window-wait"
|
|
589
|
+
}, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("print.wait")) : null, /*#__PURE__*/React.createElement("iframe", {
|
|
590
|
+
name: "print-output-window",
|
|
591
|
+
src: _this.state.pdfDataUrl
|
|
592
|
+
})));
|
|
593
|
+
});
|
|
594
|
+
_defineProperty(_this, "savePrintOutput", function () {
|
|
595
|
+
FileSaver.saveAs(_this.state.pdfData.content, _this.state.pdfData.fileName);
|
|
596
|
+
});
|
|
597
|
+
_defineProperty(_this, "selectAtlasFeature", function (layer, feature) {
|
|
598
|
+
if (!feature) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
_this.setState(function (state) {
|
|
602
|
+
var index = state.atlasFeatures.findIndex(function (f) {
|
|
603
|
+
return f.id === feature.id;
|
|
604
|
+
});
|
|
605
|
+
if (index >= 0) {
|
|
606
|
+
var newAtlasFeatures = state.atlasFeatures.slice(0);
|
|
607
|
+
newAtlasFeatures.splice(index, 1);
|
|
608
|
+
return {
|
|
609
|
+
atlasFeatures: newAtlasFeatures
|
|
610
|
+
};
|
|
611
|
+
} else {
|
|
612
|
+
return {
|
|
613
|
+
atlasFeatures: [].concat(_toConsumableArray(state.atlasFeatures), [feature])
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
_defineProperty(_this, "deselectAtlasFeature", function (feature) {
|
|
619
|
+
_this.setState(function (state) {
|
|
620
|
+
var index = state.atlasFeatures.find(function (f) {
|
|
621
|
+
return f.id === feature.id;
|
|
622
|
+
});
|
|
623
|
+
var newAtlasFeatures = state.atlasFeatures.slice(0);
|
|
624
|
+
newAtlasFeatures.splice(index, 1);
|
|
625
|
+
return {
|
|
626
|
+
atlasFeatures: newAtlasFeatures
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
_defineProperty(_this, "changeLayout", function (ev) {
|
|
631
|
+
var layout = _this.props.theme.print.find(function (item) {
|
|
632
|
+
return item.name === ev.target.value;
|
|
633
|
+
});
|
|
634
|
+
_this.setState({
|
|
635
|
+
layout: layout,
|
|
636
|
+
atlasFeature: null
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
_defineProperty(_this, "changeScale", function (value) {
|
|
640
|
+
_this.setState({
|
|
641
|
+
scale: Math.max(1, parseInt(value, 10) || 0)
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
_defineProperty(_this, "changeResolution", function (value) {
|
|
645
|
+
_this.setState({
|
|
646
|
+
dpi: value || 300
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
_defineProperty(_this, "changeRotation", function (value) {
|
|
650
|
+
var angle = value || 0;
|
|
651
|
+
_this.setState({
|
|
652
|
+
rotation: (angle % 360 + 360) % 360
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
_defineProperty(_this, "changeSeriesOverlap", function (ev) {
|
|
656
|
+
_this.setState({
|
|
657
|
+
printSeriesOverlap: parseInt(ev.target.value, 10) || 0
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
_defineProperty(_this, "changeDownloadMode", function (ev) {
|
|
661
|
+
_this.setState({
|
|
662
|
+
downloadMode: ev.target.value
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
_defineProperty(_this, "formatChanged", function (ev) {
|
|
666
|
+
_this.setState({
|
|
667
|
+
selectedFormat: ev.target.value
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
_defineProperty(_this, "print", function (ev) {
|
|
671
|
+
ev.preventDefault();
|
|
672
|
+
_this.setState({
|
|
673
|
+
printing: true
|
|
674
|
+
});
|
|
675
|
+
if (_this.props.inlinePrintOutput) {
|
|
676
|
+
_this.setState({
|
|
677
|
+
printOutputVisible: true,
|
|
678
|
+
outputLoaded: false,
|
|
679
|
+
pdfDataUrl: null,
|
|
680
|
+
pdfData: null
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
var formData = formDataEntries(new FormData(_this.printForm));
|
|
684
|
+
var mapCrs = _this.props.map.projection;
|
|
685
|
+
var mapName = _this.state.layout.map.name;
|
|
686
|
+
|
|
687
|
+
// Add base print params
|
|
688
|
+
var printParams = LayerUtils.collectPrintParams(_this.props.layers, _this.props.theme, _this.state.scale, mapCrs, _this.props.printExternalLayers);
|
|
689
|
+
Object.entries(printParams).forEach(function (_ref3) {
|
|
690
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
691
|
+
key = _ref4[0],
|
|
692
|
+
value = _ref4[1];
|
|
693
|
+
formData[key] = value;
|
|
694
|
+
});
|
|
695
|
+
formData[mapName + ":LAYERS"] = printParams.LAYERS;
|
|
696
|
+
formData[mapName + ":STYLES"] = printParams.STYLES;
|
|
697
|
+
formData[mapName + ":FILTER"] = printParams.FILTER;
|
|
698
|
+
formData[mapName + ":FILTER_GEOM"] = printParams.FILTER_GEOM;
|
|
699
|
+
|
|
700
|
+
// Add highlight params
|
|
701
|
+
var printDpi = parseInt(_this.state.dpi, 10) || 0;
|
|
702
|
+
if (_this.props.printMapHighlights) {
|
|
703
|
+
var highlightParams = VectorLayerUtils.createPrintHighlighParams(_this.props.layers, mapCrs, _this.state.scale, printDpi, _this.props.scaleFactor);
|
|
704
|
+
formData[mapName + ":HIGHLIGHT_GEOM"] = highlightParams.geoms.join(";");
|
|
705
|
+
formData[mapName + ":HIGHLIGHT_SYMBOL"] = highlightParams.styles.join(";");
|
|
706
|
+
formData[mapName + ":HIGHLIGHT_LABELSTRING"] = highlightParams.labels.join(";");
|
|
707
|
+
formData[mapName + ":HIGHLIGHT_LABELCOLOR"] = highlightParams.labelFillColors.join(";");
|
|
708
|
+
formData[mapName + ":HIGHLIGHT_LABELBUFFERCOLOR"] = highlightParams.labelOutlineColors.join(";");
|
|
709
|
+
formData[mapName + ":HIGHLIGHT_LABELBUFFERSIZE"] = highlightParams.labelOutlineSizes.join(";");
|
|
710
|
+
formData[mapName + ":HIGHLIGHT_LABELSIZE"] = highlightParams.labelSizes.join(";");
|
|
711
|
+
formData[mapName + ":HIGHLIGHT_LABEL_DISTANCE"] = highlightParams.labelDist.join(";");
|
|
712
|
+
formData[mapName + ":HIGHLIGHT_LABEL_ROTATION"] = highlightParams.labelRotations.join(";");
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// Add grid params
|
|
716
|
+
var printGrid = _this.props.theme.printGrid;
|
|
717
|
+
if (!isEmpty(printGrid)) {
|
|
718
|
+
if (_this.state.grid) {
|
|
719
|
+
var cur = 0;
|
|
720
|
+
while (cur < printGrid.length - 1 && _this.state.scale < printGrid[cur].s) {
|
|
721
|
+
cur += 1;
|
|
722
|
+
}
|
|
723
|
+
formData[mapName + ":GRID_INTERVAL_X"] = printGrid[cur].x;
|
|
724
|
+
formData[mapName + ":GRID_INTERVAL_Y"] = printGrid[cur].y;
|
|
725
|
+
} else {
|
|
726
|
+
formData[mapName + ":GRID_INTERVAL_X"] = 0;
|
|
727
|
+
formData[mapName + ":GRID_INTERVAL_Y"] = 0;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// Add dimension values
|
|
732
|
+
_this.props.layers.forEach(function (layer) {
|
|
733
|
+
if (layer.role === LayerRole.THEME) {
|
|
734
|
+
Object.entries(layer.dimensionValues || {}).forEach(function (_ref5) {
|
|
735
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
736
|
+
key = _ref6[0],
|
|
737
|
+
value = _ref6[1];
|
|
738
|
+
if (value !== undefined) {
|
|
739
|
+
formData[key] = value;
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// Add extra print parameters
|
|
746
|
+
var extraOptions = Object.fromEntries((_this.props.theme.extraPrintParameters || "").split("&").filter(Boolean).map(function (entry) {
|
|
747
|
+
return entry.split("=");
|
|
748
|
+
}));
|
|
749
|
+
Object.entries(extraOptions).forEach(function (_ref7) {
|
|
750
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
751
|
+
key = _ref8[0],
|
|
752
|
+
value = _ref8[1];
|
|
753
|
+
formData[key] = value;
|
|
754
|
+
});
|
|
755
|
+
var pages = [formData];
|
|
756
|
+
if (_this.state.printSeriesEnabled) {
|
|
757
|
+
pages = _this.state.extents.map(function (extent, index) {
|
|
758
|
+
var fd = structuredClone(formData);
|
|
759
|
+
fd.name = (index + 1).toString().padStart(2, '0');
|
|
760
|
+
fd[_this.state.layout.map.name + ':extent'] = _this.formatExtent(extent);
|
|
761
|
+
return fd;
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
var timestamp = dayjs(new Date()).format("YYYYMMDD_HHmmss");
|
|
765
|
+
var fileName = _this.props.fileNameTemplate.replace("{layout}", _this.state.layout.name).replace("{username}", ConfigUtils.getConfigProp("username", null, "")).replace("{tenant}", ConfigUtils.getConfigProp("tenant", null, "")).replace("{theme}", _this.props.theme.id).replace("{themeTitle}", _this.props.theme.title || "").replace("{timestamp}", timestamp);
|
|
766
|
+
|
|
767
|
+
// batch print all pages
|
|
768
|
+
_this.batchPrint(pages, fileName)["catch"](function (e) {
|
|
769
|
+
_this.setState({
|
|
770
|
+
outputLoaded: true,
|
|
771
|
+
printOutputVisible: false
|
|
772
|
+
});
|
|
773
|
+
if (e.response) {
|
|
774
|
+
/* eslint-disable-next-line */
|
|
775
|
+
console.warn(new TextDecoder().decode(e.response.data));
|
|
776
|
+
}
|
|
777
|
+
/* eslint-disable-next-line */
|
|
778
|
+
alert('Print failed');
|
|
779
|
+
})["finally"](function () {
|
|
780
|
+
_this.setState({
|
|
781
|
+
printing: false
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
});
|
|
785
|
+
_defineProperty(_this, "translateLayoutName", function (name) {
|
|
786
|
+
var _this$props$theme$tra, _this$props$theme$tra2;
|
|
787
|
+
return (_this$props$theme$tra = (_this$props$theme$tra2 = _this.props.theme.translations) === null || _this$props$theme$tra2 === void 0 || (_this$props$theme$tra2 = _this$props$theme$tra2.layouts) === null || _this$props$theme$tra2 === void 0 ? void 0 : _this$props$theme$tra2[name]) !== null && _this$props$theme$tra !== void 0 ? _this$props$theme$tra : name;
|
|
788
|
+
});
|
|
789
|
+
_this.printForm = null;
|
|
790
|
+
_this.state.grid = props.gridInitiallyEnabled;
|
|
791
|
+
_this.state.dpi = props.defaultDpi;
|
|
792
|
+
_this.state.selectedFormat = props.formats[0];
|
|
793
|
+
return _this;
|
|
794
|
+
}
|
|
795
|
+
_inherits(Print, _React$Component);
|
|
796
|
+
return _createClass(Print, [{
|
|
797
|
+
key: "componentDidUpdate",
|
|
798
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
799
|
+
var _this2 = this;
|
|
800
|
+
if (prevProps.theme !== this.props.theme) {
|
|
801
|
+
if (this.props.theme && !isEmpty(this.props.theme.print)) {
|
|
802
|
+
var sortDir = this.props.layoutSortOrder === "desc" ? -1 : 1;
|
|
803
|
+
var layouts = this.props.theme.print.filter(function (l) {
|
|
804
|
+
return l.map && !l.name.split('/').pop().startsWith(_this2.props.layoutHidePrefix);
|
|
805
|
+
}).sort(function (a, b) {
|
|
806
|
+
return sortDir * a.name.split('/').pop().localeCompare(b.name.split('/').pop(), undefined, {
|
|
807
|
+
numeric: true
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
var layout = layouts.find(function (l) {
|
|
811
|
+
return l["default"];
|
|
812
|
+
}) || layouts[0];
|
|
813
|
+
this.setState({
|
|
814
|
+
layouts: layouts,
|
|
815
|
+
layout: layout,
|
|
816
|
+
atlasFeatures: []
|
|
817
|
+
});
|
|
818
|
+
} else {
|
|
819
|
+
this.setState({
|
|
820
|
+
layouts: [],
|
|
821
|
+
layout: null,
|
|
822
|
+
atlasFeatures: []
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if (this.state.atlasFeatures !== prevState.atlasFeatures) {
|
|
827
|
+
if (!isEmpty(this.state.atlasFeatures)) {
|
|
828
|
+
var layer = {
|
|
829
|
+
id: "print-pick-selection",
|
|
830
|
+
role: LayerRole.SELECTION,
|
|
831
|
+
skipPrint: true
|
|
832
|
+
};
|
|
833
|
+
this.props.addLayerFeatures(layer, this.state.atlasFeatures, true);
|
|
834
|
+
} else if (!isEmpty(prevState.atlasFeatures)) {
|
|
835
|
+
this.props.clearLayer("print-pick-selection");
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (this.state.printSeriesEnabled && this.state.selectedFormat !== 'application/pdf') {
|
|
839
|
+
this.setState({
|
|
840
|
+
selectedFormat: 'application/pdf'
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}, {
|
|
845
|
+
key: "render",
|
|
846
|
+
value: function render() {
|
|
847
|
+
var _this3 = this;
|
|
848
|
+
var minMaxTooltip = this.state.minimized ? LocaleUtils.tr("print.maximize") : LocaleUtils.tr("print.minimize");
|
|
849
|
+
var extraTitlebarContent = /*#__PURE__*/React.createElement(Icon, {
|
|
850
|
+
className: "print-minimize-maximize",
|
|
851
|
+
icon: this.state.minimized ? 'chevron-down' : 'chevron-up',
|
|
852
|
+
onClick: function onClick() {
|
|
853
|
+
return _this3.setState(function (state) {
|
|
854
|
+
return {
|
|
855
|
+
minimized: !state.minimized
|
|
856
|
+
};
|
|
857
|
+
});
|
|
858
|
+
},
|
|
859
|
+
title: minMaxTooltip
|
|
860
|
+
});
|
|
861
|
+
var themeLayer = this.props.layers.find(function (layer) {
|
|
862
|
+
return layer.role === LayerRole.THEME;
|
|
863
|
+
});
|
|
864
|
+
return [/*#__PURE__*/React.createElement(SideBar, {
|
|
865
|
+
extraTitlebarContent: extraTitlebarContent,
|
|
866
|
+
icon: "print",
|
|
867
|
+
id: "Print",
|
|
868
|
+
key: "Print",
|
|
869
|
+
onHide: this.onHide,
|
|
870
|
+
onShow: this.onShow,
|
|
871
|
+
side: this.props.side,
|
|
872
|
+
title: LocaleUtils.tr("appmenu.items.Print"),
|
|
873
|
+
width: "20em"
|
|
874
|
+
}, function () {
|
|
875
|
+
return {
|
|
876
|
+
body: _this3.state.minimized ? null : _this3.renderBody(),
|
|
877
|
+
extra: [_this3.renderPrintSelection()]
|
|
878
|
+
};
|
|
879
|
+
}), this.renderPrintOutputWindow(), this.props.active && this.state.layout && this.state.layout.atlasCoverageLayer && !this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement(PickFeature, {
|
|
880
|
+
featurePicked: this.selectAtlasFeature,
|
|
881
|
+
key: "FeaturePicker",
|
|
882
|
+
layerFilter: {
|
|
883
|
+
url: themeLayer === null || themeLayer === void 0 ? void 0 : themeLayer.url,
|
|
884
|
+
name: this.state.layout.atlasCoverageLayer
|
|
885
|
+
}
|
|
886
|
+
}) : null];
|
|
887
|
+
}
|
|
888
|
+
}, {
|
|
889
|
+
key: "batchPrint",
|
|
890
|
+
value: function () {
|
|
891
|
+
var _batchPrint = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(pages, fileName) {
|
|
892
|
+
var _this4 = this;
|
|
893
|
+
var promises, docs, files, file, fileURL, _iterator, _step, _file;
|
|
894
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
895
|
+
while (1) switch (_context.prev = _context.next) {
|
|
896
|
+
case 0:
|
|
897
|
+
// Print pages on server
|
|
898
|
+
promises = pages.map(function (formData) {
|
|
899
|
+
return _this4.printRequest(formData);
|
|
900
|
+
}); // Collect printing results
|
|
901
|
+
_context.next = 3;
|
|
902
|
+
return Promise.all(promises);
|
|
903
|
+
case 3:
|
|
904
|
+
docs = _context.sent;
|
|
905
|
+
_context.next = 6;
|
|
906
|
+
return this.collectFiles(docs, fileName);
|
|
907
|
+
case 6:
|
|
908
|
+
files = _context.sent;
|
|
909
|
+
// Download or display files
|
|
910
|
+
if (this.props.inlinePrintOutput && files.length === 1) {
|
|
911
|
+
file = files.pop();
|
|
912
|
+
fileURL = URL.createObjectURL(file.content);
|
|
913
|
+
this.setState({
|
|
914
|
+
pdfData: file,
|
|
915
|
+
pdfDataUrl: fileURL,
|
|
916
|
+
outputLoaded: true
|
|
917
|
+
});
|
|
918
|
+
} else {
|
|
919
|
+
_iterator = _createForOfIteratorHelper(files);
|
|
920
|
+
try {
|
|
921
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
922
|
+
_file = _step.value;
|
|
923
|
+
FileSaver.saveAs(_file.content, _file.fileName);
|
|
924
|
+
}
|
|
925
|
+
} catch (err) {
|
|
926
|
+
_iterator.e(err);
|
|
927
|
+
} finally {
|
|
928
|
+
_iterator.f();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
case 8:
|
|
932
|
+
case "end":
|
|
933
|
+
return _context.stop();
|
|
934
|
+
}
|
|
935
|
+
}, _callee, this);
|
|
936
|
+
}));
|
|
937
|
+
function batchPrint(_x, _x2) {
|
|
938
|
+
return _batchPrint.apply(this, arguments);
|
|
939
|
+
}
|
|
940
|
+
return batchPrint;
|
|
941
|
+
}()
|
|
942
|
+
}, {
|
|
943
|
+
key: "printRequest",
|
|
944
|
+
value: function () {
|
|
945
|
+
var _printRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(formData) {
|
|
946
|
+
var data, config, response, contentType;
|
|
947
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
948
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
949
|
+
case 0:
|
|
950
|
+
data = Object.entries(formData).map(function (pair) {
|
|
951
|
+
return pair.map(function (entry) {
|
|
952
|
+
return encodeURIComponent(entry).replace(/%20/g, '+');
|
|
953
|
+
}).join("=");
|
|
954
|
+
}).join('&');
|
|
955
|
+
config = {
|
|
956
|
+
headers: {
|
|
957
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
958
|
+
},
|
|
959
|
+
responseType: 'arraybuffer'
|
|
960
|
+
};
|
|
961
|
+
_context2.next = 4;
|
|
962
|
+
return axios.post(this.props.theme.printUrl, data, config);
|
|
963
|
+
case 4:
|
|
964
|
+
response = _context2.sent;
|
|
965
|
+
contentType = response.headers['content-type'];
|
|
966
|
+
return _context2.abrupt("return", {
|
|
967
|
+
name: formData.name,
|
|
968
|
+
data: response.data,
|
|
969
|
+
contentType: contentType
|
|
970
|
+
});
|
|
971
|
+
case 7:
|
|
972
|
+
case "end":
|
|
973
|
+
return _context2.stop();
|
|
974
|
+
}
|
|
975
|
+
}, _callee2, this);
|
|
976
|
+
}));
|
|
977
|
+
function printRequest(_x3) {
|
|
978
|
+
return _printRequest.apply(this, arguments);
|
|
979
|
+
}
|
|
980
|
+
return printRequest;
|
|
981
|
+
}()
|
|
982
|
+
}, {
|
|
983
|
+
key: "collectFiles",
|
|
984
|
+
value: function () {
|
|
985
|
+
var _collectFiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(docs, fileName) {
|
|
986
|
+
var _this5 = this;
|
|
987
|
+
var data, content, _data, _content;
|
|
988
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
989
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
990
|
+
case 0:
|
|
991
|
+
if (!(docs.length > 1 && this.state.downloadMode === 'onepdf')) {
|
|
992
|
+
_context3.next = 6;
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
_context3.next = 3;
|
|
996
|
+
return this.collectOnePdf(docs);
|
|
997
|
+
case 3:
|
|
998
|
+
data = _context3.sent;
|
|
999
|
+
content = new Blob([data], {
|
|
1000
|
+
type: 'application/pdf'
|
|
1001
|
+
});
|
|
1002
|
+
return _context3.abrupt("return", [{
|
|
1003
|
+
content: content,
|
|
1004
|
+
fileName: fileName + '.pdf'
|
|
1005
|
+
}]);
|
|
1006
|
+
case 6:
|
|
1007
|
+
if (!(docs.length > 1 && this.state.downloadMode === 'onezip')) {
|
|
1008
|
+
_context3.next = 12;
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
_context3.next = 9;
|
|
1012
|
+
return this.collectOneZip(docs, fileName);
|
|
1013
|
+
case 9:
|
|
1014
|
+
_data = _context3.sent;
|
|
1015
|
+
_content = new Blob([_data], {
|
|
1016
|
+
type: 'application/zip'
|
|
1017
|
+
});
|
|
1018
|
+
return _context3.abrupt("return", [{
|
|
1019
|
+
content: _content,
|
|
1020
|
+
fileName: fileName + '.zip'
|
|
1021
|
+
}]);
|
|
1022
|
+
case 12:
|
|
1023
|
+
return _context3.abrupt("return", docs.map(function (doc) {
|
|
1024
|
+
var content = new Blob([doc.data], {
|
|
1025
|
+
type: doc.contentType
|
|
1026
|
+
});
|
|
1027
|
+
var ext = _this5.state.selectedFormat.split(";")[0].split("/").pop();
|
|
1028
|
+
var appendix = doc.name ? '_' + doc.name : '';
|
|
1029
|
+
return {
|
|
1030
|
+
content: content,
|
|
1031
|
+
fileName: fileName + appendix + '.' + ext
|
|
1032
|
+
};
|
|
1033
|
+
}));
|
|
1034
|
+
case 13:
|
|
1035
|
+
case "end":
|
|
1036
|
+
return _context3.stop();
|
|
1037
|
+
}
|
|
1038
|
+
}, _callee3, this);
|
|
1039
|
+
}));
|
|
1040
|
+
function collectFiles(_x4, _x5) {
|
|
1041
|
+
return _collectFiles.apply(this, arguments);
|
|
1042
|
+
}
|
|
1043
|
+
return collectFiles;
|
|
1044
|
+
}()
|
|
1045
|
+
}, {
|
|
1046
|
+
key: "collectOnePdf",
|
|
1047
|
+
value: function () {
|
|
1048
|
+
var _collectOnePdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(docs) {
|
|
1049
|
+
var _yield$import, PDFDocument, mergedDoc, _iterator2, _step2, doc, pdfBytes, copiedPages, _iterator3, _step3, page;
|
|
1050
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1051
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1052
|
+
case 0:
|
|
1053
|
+
_context4.next = 2;
|
|
1054
|
+
return import('pdf-lib');
|
|
1055
|
+
case 2:
|
|
1056
|
+
_yield$import = _context4.sent;
|
|
1057
|
+
PDFDocument = _yield$import.PDFDocument;
|
|
1058
|
+
_context4.next = 6;
|
|
1059
|
+
return PDFDocument.create();
|
|
1060
|
+
case 6:
|
|
1061
|
+
mergedDoc = _context4.sent;
|
|
1062
|
+
_iterator2 = _createForOfIteratorHelper(docs);
|
|
1063
|
+
_context4.prev = 8;
|
|
1064
|
+
_iterator2.s();
|
|
1065
|
+
case 10:
|
|
1066
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
1067
|
+
_context4.next = 22;
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
1070
|
+
doc = _step2.value;
|
|
1071
|
+
_context4.next = 14;
|
|
1072
|
+
return PDFDocument.load(doc.data);
|
|
1073
|
+
case 14:
|
|
1074
|
+
pdfBytes = _context4.sent;
|
|
1075
|
+
_context4.next = 17;
|
|
1076
|
+
return mergedDoc.copyPages(pdfBytes, pdfBytes.getPageIndices());
|
|
1077
|
+
case 17:
|
|
1078
|
+
copiedPages = _context4.sent;
|
|
1079
|
+
_iterator3 = _createForOfIteratorHelper(copiedPages);
|
|
1080
|
+
try {
|
|
1081
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1082
|
+
page = _step3.value;
|
|
1083
|
+
mergedDoc.addPage(page);
|
|
1084
|
+
}
|
|
1085
|
+
} catch (err) {
|
|
1086
|
+
_iterator3.e(err);
|
|
1087
|
+
} finally {
|
|
1088
|
+
_iterator3.f();
|
|
1089
|
+
}
|
|
1090
|
+
case 20:
|
|
1091
|
+
_context4.next = 10;
|
|
1092
|
+
break;
|
|
1093
|
+
case 22:
|
|
1094
|
+
_context4.next = 27;
|
|
1095
|
+
break;
|
|
1096
|
+
case 24:
|
|
1097
|
+
_context4.prev = 24;
|
|
1098
|
+
_context4.t0 = _context4["catch"](8);
|
|
1099
|
+
_iterator2.e(_context4.t0);
|
|
1100
|
+
case 27:
|
|
1101
|
+
_context4.prev = 27;
|
|
1102
|
+
_iterator2.f();
|
|
1103
|
+
return _context4.finish(27);
|
|
1104
|
+
case 30:
|
|
1105
|
+
_context4.next = 32;
|
|
1106
|
+
return mergedDoc.save();
|
|
1107
|
+
case 32:
|
|
1108
|
+
return _context4.abrupt("return", _context4.sent);
|
|
1109
|
+
case 33:
|
|
1110
|
+
case "end":
|
|
1111
|
+
return _context4.stop();
|
|
1112
|
+
}
|
|
1113
|
+
}, _callee4, null, [[8, 24, 27, 30]]);
|
|
1114
|
+
}));
|
|
1115
|
+
function collectOnePdf(_x6) {
|
|
1116
|
+
return _collectOnePdf.apply(this, arguments);
|
|
1117
|
+
}
|
|
1118
|
+
return collectOnePdf;
|
|
1119
|
+
}()
|
|
1120
|
+
}, {
|
|
1121
|
+
key: "collectOneZip",
|
|
1122
|
+
value: function () {
|
|
1123
|
+
var _collectOneZip = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(docs, fileName) {
|
|
1124
|
+
var mergedDoc, _iterator4, _step4, doc, file, ext, appendix;
|
|
1125
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1126
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1127
|
+
case 0:
|
|
1128
|
+
mergedDoc = new JSZip();
|
|
1129
|
+
_iterator4 = _createForOfIteratorHelper(docs);
|
|
1130
|
+
try {
|
|
1131
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1132
|
+
doc = _step4.value;
|
|
1133
|
+
file = new Blob([doc.data], {
|
|
1134
|
+
type: doc.contentType
|
|
1135
|
+
});
|
|
1136
|
+
ext = this.state.selectedFormat.split(";")[0].split("/").pop();
|
|
1137
|
+
appendix = doc.name ? '_' + doc.name : '';
|
|
1138
|
+
mergedDoc.file(fileName + appendix + '.' + ext, file);
|
|
1139
|
+
}
|
|
1140
|
+
} catch (err) {
|
|
1141
|
+
_iterator4.e(err);
|
|
1142
|
+
} finally {
|
|
1143
|
+
_iterator4.f();
|
|
1144
|
+
}
|
|
1145
|
+
_context5.next = 5;
|
|
1146
|
+
return mergedDoc.generateAsync({
|
|
1147
|
+
type: 'arraybuffer'
|
|
1148
|
+
});
|
|
1149
|
+
case 5:
|
|
1150
|
+
return _context5.abrupt("return", _context5.sent);
|
|
1151
|
+
case 6:
|
|
1152
|
+
case "end":
|
|
1153
|
+
return _context5.stop();
|
|
1154
|
+
}
|
|
1155
|
+
}, _callee5, this);
|
|
1156
|
+
}));
|
|
1157
|
+
function collectOneZip(_x7, _x8) {
|
|
1158
|
+
return _collectOneZip.apply(this, arguments);
|
|
1159
|
+
}
|
|
1160
|
+
return collectOneZip;
|
|
1161
|
+
}()
|
|
1162
|
+
}]);
|
|
1163
|
+
}(React.Component);
|
|
1164
|
+
_defineProperty(Print, "propTypes", {
|
|
1165
|
+
active: PropTypes.bool,
|
|
1166
|
+
addLayerFeatures: PropTypes.func,
|
|
1167
|
+
/** Whether to allow GeoPDF export. Requires QGIS Server 3.32 or newer. */
|
|
1168
|
+
allowGeoPdfExport: PropTypes.bool,
|
|
1169
|
+
clearLayer: PropTypes.func,
|
|
1170
|
+
/** The default print dpi. */
|
|
1171
|
+
defaultDpi: PropTypes.number,
|
|
1172
|
+
/** The factor to apply to the map scale to determine the initial print map scale. */
|
|
1173
|
+
defaultScaleFactor: PropTypes.number,
|
|
1174
|
+
/** Show an option to print a series of extents. */
|
|
1175
|
+
displayPrintSeries: PropTypes.bool,
|
|
1176
|
+
/** Whether to display the printing rotation control. */
|
|
1177
|
+
displayRotation: PropTypes.bool,
|
|
1178
|
+
/** Template for the name of the generated files when downloading. Can contain the placeholders `{layout}`, `{username}`, `{tenant}`, `{theme}`, `{themeTitle}`, `{timestamp}`. */
|
|
1179
|
+
fileNameTemplate: PropTypes.string,
|
|
1180
|
+
/** Export layout format mimetypes. If format is not supported by QGIS Server, print will fail. */
|
|
1181
|
+
formats: PropTypes.arrayOf(PropTypes.string),
|
|
1182
|
+
/** Whether the grid is enabled by default. */
|
|
1183
|
+
gridInitiallyEnabled: PropTypes.bool,
|
|
1184
|
+
/** Whether to hide form fields which contain autopopulated values (i.e. search result label). */
|
|
1185
|
+
hideAutopopulatedFields: PropTypes.bool,
|
|
1186
|
+
/** Whether to display the print output in an inline dialog instead triggering a download. */
|
|
1187
|
+
inlinePrintOutput: PropTypes.bool,
|
|
1188
|
+
layers: PropTypes.array,
|
|
1189
|
+
/** Hide layouts which begin with this prefix. */
|
|
1190
|
+
layoutHidePrefix: PropTypes.string,
|
|
1191
|
+
/** Layout sort order, asc or desc. */
|
|
1192
|
+
layoutSortOrder: PropTypes.string,
|
|
1193
|
+
map: PropTypes.object,
|
|
1194
|
+
/** Whether to allow moving the extent while selecting the print series. */
|
|
1195
|
+
movePrintSeries: PropTypes.bool,
|
|
1196
|
+
/** Whether to print external layers. Requires QGIS Server 3.x! */
|
|
1197
|
+
printExternalLayers: PropTypes.bool,
|
|
1198
|
+
/** Whether to print highlights on the map, e.g. selected features or redlining. */
|
|
1199
|
+
printMapHighlights: PropTypes.bool,
|
|
1200
|
+
/** Restrict print scale to list of predefine print scales, if any. */
|
|
1201
|
+
restrictToPrintScales: PropTypes.bool,
|
|
1202
|
+
/** Scale factor to apply to line widths, font sizes, ... of redlining drawings passed to GetPrint. */
|
|
1203
|
+
scaleFactor: PropTypes.number,
|
|
1204
|
+
setIdentifyEnabled: PropTypes.func,
|
|
1205
|
+
setSnappingConfig: PropTypes.func,
|
|
1206
|
+
/** The side of the application on which to display the sidebar. */
|
|
1207
|
+
side: PropTypes.string,
|
|
1208
|
+
theme: PropTypes.object
|
|
1209
|
+
});
|
|
1210
|
+
_defineProperty(Print, "defaultProps", {
|
|
1211
|
+
defaultDpi: 300,
|
|
1212
|
+
defaultScaleFactor: 0.5,
|
|
1213
|
+
displayPrintSeries: false,
|
|
1214
|
+
displayRotation: true,
|
|
1215
|
+
fileNameTemplate: '{theme}_{timestamp}',
|
|
1216
|
+
gridInitiallyEnabled: false,
|
|
1217
|
+
layoutSortOrder: 'asc',
|
|
1218
|
+
movePrintSeries: false,
|
|
1219
|
+
formats: ['application/pdf', 'image/jpeg', 'image/png', 'image/svg'],
|
|
1220
|
+
inlinePrintOutput: false,
|
|
1221
|
+
printExternalLayers: true,
|
|
1222
|
+
printMapHighlights: true,
|
|
1223
|
+
scaleFactor: 1.9,
|
|
1224
|
+
// Experimentally determined...
|
|
1225
|
+
side: 'right'
|
|
1226
|
+
});
|
|
1227
|
+
var selector = function selector(state) {
|
|
1228
|
+
return {
|
|
1229
|
+
active: state.task.id === 'Print',
|
|
1230
|
+
theme: state.theme.current,
|
|
1231
|
+
map: state.map,
|
|
1232
|
+
layers: state.layers.flat
|
|
1233
|
+
};
|
|
1234
|
+
};
|
|
1235
|
+
export default connect(selector, {
|
|
1236
|
+
addLayerFeatures: addLayerFeatures,
|
|
1237
|
+
clearLayer: clearLayer,
|
|
1238
|
+
setSnappingConfig: setSnappingConfig
|
|
1239
|
+
})(Print);
|