qwc2 2025.10.9 → 2025.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/actions/display.js +30 -1
  2. package/actions/editing.js +22 -1
  3. package/actions/layerinfo.js +13 -1
  4. package/actions/layers.js +213 -3
  5. package/actions/localConfig.js +58 -1
  6. package/actions/locale.js +21 -1
  7. package/actions/locate.js +26 -1
  8. package/actions/logging.js +10 -1
  9. package/actions/map.js +105 -2
  10. package/actions/measurement.js +12 -1
  11. package/actions/processNotifications.js +37 -1
  12. package/actions/redlining.js +18 -1
  13. package/actions/redliningPick.js +12 -1
  14. package/actions/search.js +12 -1
  15. package/actions/serviceinfo.js +12 -1
  16. package/actions/task.js +55 -3
  17. package/actions/theme.js +339 -19
  18. package/actions/windows.js +164 -5
  19. package/components/AppMenu.js +435 -3
  20. package/components/AttributeForm.js +928 -32
  21. package/components/AttributeTableWidget.js +1105 -13
  22. package/components/AutoEditForm.js +189 -3
  23. package/components/CoordinateDisplayer.js +78 -2
  24. package/components/EditComboField.js +190 -6
  25. package/components/EditUploadField.js +315 -3
  26. package/components/ExportSelection.js +203 -2
  27. package/components/FullscreenSwitcher.js +90 -3
  28. package/components/Icon.js +81 -2
  29. package/components/IdentifyViewer.js +1161 -6
  30. package/components/ImportLayer.js +718 -20
  31. package/components/LayerInfoWindow.js +145 -2
  32. package/components/LinkFeatureForm.js +246 -5
  33. package/components/MapButton.js +88 -2
  34. package/components/MapSelection.js +287 -8
  35. package/components/MessageBar.js +68 -2
  36. package/components/NumericInputWindow.js +359 -2
  37. package/components/PickFeature.js +266 -2
  38. package/components/PluginsContainer.js +227 -8
  39. package/components/PrintSelection.js +620 -49
  40. package/components/ProcessNotifications.js +104 -2
  41. package/components/QtDesignerForm.js +1137 -18
  42. package/components/ResizeableWindow.js +591 -8
  43. package/components/SearchBox.js +1307 -20
  44. package/components/ServiceInfoWindow.js +107 -2
  45. package/components/SideBar.js +204 -4
  46. package/components/StandardApp.js +381 -20
  47. package/components/Swipeable.js +15 -1
  48. package/components/TaskBar.js +85 -2
  49. package/components/ThemeLayersListWindow.js +216 -4
  50. package/components/ThemeList.js +381 -7
  51. package/components/Toolbar.js +106 -2
  52. package/components/WindowManager.js +178 -2
  53. package/components/map/OlLayer.js +257 -6
  54. package/components/map/OlMap.js +405 -5
  55. package/components/map/layers/BingLayer.js +31 -2
  56. package/components/map/layers/GoogleLayer.js +222 -19
  57. package/components/map/layers/GraticuleLayer.js +21 -1
  58. package/components/map/layers/ImageLayer.js +15 -1
  59. package/components/map/layers/MVTLayer.js +52 -2
  60. package/components/map/layers/OSMLayer.js +24 -2
  61. package/components/map/layers/OverlayLayer.js +55 -3
  62. package/components/map/layers/VectorLayer.js +173 -8
  63. package/components/map/layers/WFSLayer.js +220 -6
  64. package/components/map/layers/WMSLayer.js +180 -6
  65. package/components/map/layers/WMTSLayer.js +67 -3
  66. package/components/map/layers/XYZLayer.js +24 -2
  67. package/components/map/layers/index.js +28 -1
  68. package/components/map3d/EditDataset3D.js +190 -3
  69. package/components/map3d/HeightProfile3D.js +402 -3
  70. package/components/map3d/ImportObjects3D.js +162 -2
  71. package/components/map3d/Map3D.js +1304 -38
  72. package/components/map3d/MapControls3D.js +392 -7
  73. package/components/map3d/SearchField3D.js +183 -11
  74. package/components/map3d/View3DSwitcher.js +98 -2
  75. package/components/map3d/drawtool/CreateTool3D.js +174 -4
  76. package/components/map3d/drawtool/EditTool3D.js +590 -6
  77. package/components/map3d/drawtool/NumericInput3D.js +336 -4
  78. package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
  79. package/components/map3d/layers/VectorLayer3D.js +53 -2
  80. package/components/map3d/layers/WFSLayer3D.js +109 -3
  81. package/components/map3d/layers/WMSLayer3D.js +70 -2
  82. package/components/map3d/layers/WMTSLayer3D.js +27 -3
  83. package/components/map3d/layers/index.js +14 -1
  84. package/components/map3d/utils/FirstPersonControls3D.js +423 -16
  85. package/components/map3d/utils/MiscUtils3D.js +221 -13
  86. package/components/map3d/utils/OrbitControls3D.js +176 -5
  87. package/components/map3d/utils/Tiles3DStyle.js +238 -9
  88. package/components/share/ShareLink.js +54 -2
  89. package/components/share/ShareQRCode.js +62 -2
  90. package/components/share/ShareSocials.js +125 -3
  91. package/components/timeline/FixedTimeline.js +236 -5
  92. package/components/timeline/InfiniteTimeline.js +347 -8
  93. package/components/timeline/TimelineFeaturesSlider.js +439 -5
  94. package/components/widgets/AccordeonWidget.js +96 -2
  95. package/components/widgets/ButtonBar.js +124 -2
  96. package/components/widgets/ColorButton.js +201 -3
  97. package/components/widgets/ComboBox.js +166 -2
  98. package/components/widgets/CopyButton.js +110 -2
  99. package/components/widgets/DateTimeInput.js +100 -3
  100. package/components/widgets/EditableSelect.js +230 -3
  101. package/components/widgets/FileSelector.js +128 -4
  102. package/components/widgets/Input.js +124 -2
  103. package/components/widgets/InputContainer.js +96 -2
  104. package/components/widgets/LayerCatalogWidget.js +219 -3
  105. package/components/widgets/MenuButton.js +157 -1
  106. package/components/widgets/ModalDialog.js +64 -2
  107. package/components/widgets/NavBar.js +119 -2
  108. package/components/widgets/NumberInput.js +226 -4
  109. package/components/widgets/PopupMenu.js +72 -1
  110. package/components/widgets/Primitives.js +6 -1
  111. package/components/widgets/ReCaptchaWidget.js +55 -1
  112. package/components/widgets/SearchWidget.js +255 -2
  113. package/components/widgets/Spinner.js +44 -2
  114. package/components/widgets/SuggestionInput.js +77 -2
  115. package/components/widgets/TextInput.js +308 -2
  116. package/components/widgets/ToggleSwitch.js +85 -2
  117. package/components/widgets/VectorLayerPicker.js +85 -3
  118. package/libs/openlayers.js +225 -5
  119. package/package.json +1 -1
  120. package/plugins/API.js +358 -15
  121. package/plugins/AttributeTable.js +109 -3
  122. package/plugins/Authentication.js +130 -5
  123. package/plugins/BackgroundSwitcher.js +218 -4
  124. package/plugins/Bookmark.js +289 -3
  125. package/plugins/BottomBar.js +298 -4
  126. package/plugins/CookiePopup.js +67 -3
  127. package/plugins/Cyclomedia.js +442 -5
  128. package/plugins/Editing.js +497 -9
  129. package/plugins/FeatureForm.js +366 -4
  130. package/plugins/FeatureSearch.js +458 -3
  131. package/plugins/GeometryDigitizer.js +664 -7
  132. package/plugins/HeightProfile.js +763 -15
  133. package/plugins/Help.js +102 -3
  134. package/plugins/HomeButton.js +80 -3
  135. package/plugins/Identify.js +543 -5
  136. package/plugins/LayerCatalog.js +215 -4
  137. package/plugins/LayerTree.js +1194 -6
  138. package/plugins/LocateButton.js +94 -3
  139. package/plugins/Map.js +320 -16
  140. package/plugins/MapCompare.js +94 -3
  141. package/plugins/MapCopyright.js +127 -5
  142. package/plugins/MapExport.js +613 -20
  143. package/plugins/MapFilter.js +868 -12
  144. package/plugins/MapInfoTooltip.js +277 -3
  145. package/plugins/MapLegend.js +253 -4
  146. package/plugins/MapTip.js +290 -4
  147. package/plugins/Measure.js +220 -4
  148. package/plugins/NewsPopup.js +137 -3
  149. package/plugins/OverviewMap.js +167 -7
  150. package/plugins/Panoramax.js +340 -2
  151. package/plugins/Portal.js +199 -4
  152. package/plugins/Print.js +1231 -15
  153. package/plugins/Redlining.js +750 -6
  154. package/plugins/Reports.js +332 -3
  155. package/plugins/Routing.js +1278 -15
  156. package/plugins/ScratchDrawing.js +173 -5
  157. package/plugins/Settings.js +241 -4
  158. package/plugins/Share.js +198 -3
  159. package/plugins/StartupMarker.js +84 -4
  160. package/plugins/TaskButton.js +88 -3
  161. package/plugins/ThemeSwitcher.js +164 -4
  162. package/plugins/TimeManager.js +971 -10
  163. package/plugins/TopBar.js +300 -7
  164. package/plugins/TourGuide.js +213 -2
  165. package/plugins/ValueTool.js +419 -4
  166. package/plugins/View3D.js +519 -14
  167. package/plugins/ZoomButtons.js +165 -3
  168. package/plugins/map/EditingSupport.js +199 -7
  169. package/plugins/map/LocateSupport.js +260 -4
  170. package/plugins/map/MeasurementSupport.js +216 -8
  171. package/plugins/map/RedliningPickSupport.js +201 -7
  172. package/plugins/map/RedliningSupport.js +726 -17
  173. package/plugins/map/SnapInteraction.js +101 -1
  174. package/plugins/map/SnapSupport.js +210 -2
  175. package/plugins/map/SnappingSupport.js +356 -17
  176. package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
  177. package/plugins/map3d/BottomBar3D.js +118 -3
  178. package/plugins/map3d/Compare3D.js +422 -8
  179. package/plugins/map3d/Draw3D.js +353 -6
  180. package/plugins/map3d/ExportObjects3D.js +393 -18
  181. package/plugins/map3d/HideObjects3D.js +313 -12
  182. package/plugins/map3d/Identify3D.js +283 -12
  183. package/plugins/map3d/LayerTree3D.js +323 -3
  184. package/plugins/map3d/MapCopyright3D.js +128 -5
  185. package/plugins/map3d/MapExport3D.js +590 -10
  186. package/plugins/map3d/MapLight3D.js +553 -6
  187. package/plugins/map3d/Measure3D.js +571 -20
  188. package/plugins/map3d/OverviewMap3D.js +169 -3
  189. package/plugins/map3d/Settings3D.js +73 -3
  190. package/plugins/map3d/TopBar3D.js +207 -9
  191. package/plugins/redlining/RedliningBufferSupport.js +206 -3
  192. package/reducers/display.js +34 -2
  193. package/reducers/editing.js +68 -3
  194. package/reducers/index.js +9 -1
  195. package/reducers/layerinfo.js +26 -2
  196. package/reducers/layers.js +456 -9
  197. package/reducers/localConfig.js +122 -2
  198. package/reducers/locale.js +38 -2
  199. package/reducers/locate.js +40 -2
  200. package/reducers/map.js +176 -5
  201. package/reducers/measurement.js +42 -2
  202. package/reducers/processNotifications.js +49 -2
  203. package/reducers/redlining.js +50 -2
  204. package/reducers/redliningPick.js +27 -2
  205. package/reducers/search.js +20 -1
  206. package/reducers/serviceinfo.js +25 -2
  207. package/reducers/task.js +45 -2
  208. package/reducers/theme.js +51 -2
  209. package/reducers/windows.js +203 -2
  210. package/scripts/dist.sh +1 -1
  211. package/scripts/gen-plugin-docs.js +152 -2
  212. package/scripts/makeIconkit.js +85 -6
  213. package/scripts/themesConfig.js +742 -40
  214. package/scripts/updateTranslations.js +251 -10
  215. package/selectors/searchproviders.js +44 -2
  216. package/stores/StandardStore.js +42 -2
  217. package/utils/ConfigUtils.js +84 -3
  218. package/utils/CoordinatesUtils.js +234 -23
  219. package/utils/DxfUtils.js +237 -11
  220. package/utils/EditingInterface.js +421 -87
  221. package/utils/EditingUtils.js +357 -13
  222. package/utils/ElevationInterface.js +83 -22
  223. package/utils/FeatureStyles.js +429 -5
  224. package/utils/IdentifyUtils.js +443 -7
  225. package/utils/ImageEditor.js +79 -9
  226. package/utils/LayerUtils.js +1516 -50
  227. package/utils/LocaleUtils.js +117 -7
  228. package/utils/MapUtils.js +241 -59
  229. package/utils/MeasureUtils.js +323 -2
  230. package/utils/MiscUtils.js +189 -11
  231. package/utils/PermaLinkUtils.js +429 -6
  232. package/utils/PluginStore.js +27 -1
  233. package/utils/ResourceRegistry.js +15 -1
  234. package/utils/RoutingInterface.js +307 -7
  235. package/utils/SearchProviders.js +722 -19
  236. package/utils/ServiceLayerUtils.js +669 -14
  237. package/utils/Signal.js +32 -2
  238. package/utils/ThemeUtils.js +341 -7
  239. package/utils/VectorLayerUtils.js +589 -15
  240. package/utils/expr_grammar/grammar.js +2239 -2
  241. package/utils/expr_grammar/test.js +65 -3
@@ -1,7 +1,260 @@
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 _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 _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 _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 _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 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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3
+ 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."); }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
+ 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); } }
12
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
+ 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); }
15
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
16
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
17
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
18
+ 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); }
19
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
20
+ 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; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ 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); }
23
+ /**
2
24
  * Copyright 2024 Sourcepole AG
3
25
  * All rights reserved.
4
26
  *
5
27
  * This source code is licensed under the BSD-style license found in the
6
28
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import axios from"axios";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{v4 as uuidv4}from"uuid";import LocaleUtils from"../../utils/LocaleUtils";import MiscUtils from"../../utils/MiscUtils";import{SearchResultType}from"../../utils/SearchProviders";import VectorLayerUtils from"../../utils/VectorLayerUtils";import Icon from"../Icon";import InputContainer from"./InputContainer";import Spinner from"./Spinner";import"./style/SearchWidget.css";var SearchWidget=/*#__PURE__*/function(_React$Component){function SearchWidget(props){var _this;_classCallCheck(this,SearchWidget);_this=_callSuper(this,SearchWidget,[props]);_defineProperty(_this,"state",{text:"",reqId:null,results:[],pending:0,active:false});_defineProperty(_this,"renderResults",function(){return/*#__PURE__*/React.createElement("div",{className:"search-widget-results",onMouseDown:_this.setPreventBlur},_this.state.results.filter(function(group){var _group$type;return _this.props.resultTypeFilter.includes((_group$type=group.type)!==null&&_group$type!==void 0?_group$type:SearchResultType.PLACE)}).map(function(group){var _group$title;return/*#__PURE__*/React.createElement("div",{className:"search-widget-results-group",key:group.id,onMouseDown:MiscUtils.killEvent},/*#__PURE__*/React.createElement("div",{className:"search-widget-results-group-title"},/*#__PURE__*/React.createElement("span",null,(_group$title=group.title)!==null&&_group$title!==void 0?_group$title:LocaleUtils.tr(group.titlemsgid))),group.items.map(function(item){item.text=(item.label!==undefined?item.label:item.text||"").replace(/<\/?\w+\s*\/?>/g,"");return/*#__PURE__*/React.createElement("div",{className:"search-widget-results-group-item",key:item.id,onClick:function onClick(){return _this.resultSelected(group,item)},title:item.text},item.text)}))}))});_defineProperty(_this,"setPreventBlur",function(){_this.preventBlur=true;setTimeout(function(){_this.preventBlur=false;return false},100)});_defineProperty(_this,"textChanged",function(ev){_this.setState({text:ev.target.value,reqId:null,results:[],pending:0});clearTimeout(_this.searchTimeout);if(!ev.target.value){_this.props.resultSelected(null)}else{_this.searchTimeout=setTimeout(_this.startSearch,250)}});_defineProperty(_this,"onBlur",function(){if(!_this.preventBlur){clearTimeout(_this.searchTimeout);_this.props.onBlur();_this.setState({active:false})}});_defineProperty(_this,"onFocus",function(ev){ev.target.select();_this.props.onFocus();_this.setState({active:true})});_defineProperty(_this,"onKeyDown",function(ev){if(ev.key==="Enter"){_this.startSearch()}else if(ev.key==="Escape"){ev.target.blur()}});_defineProperty(_this,"startSearch",function(){clearTimeout(_this.searchTimeout);var reqId=uuidv4();_this.setState({reqId:reqId,results:[],pending:_this.props.searchProviders.length});_this.props.searchProviders.forEach(function(provider){var searchParams=_objectSpread(_objectSpread({lang:LocaleUtils.lang(),cfgParams:provider.cfgParams},provider.params),_this.props.searchParams);provider.onSearch(_this.state.text,searchParams,function(response){_this.setState(function(state){if(state.reqId!==reqId){return{}}return{results:[].concat(_toConsumableArray(state.results),_toConsumableArray(response.results.map(function(group){return _objectSpread(_objectSpread({},group),{},{provider:provider})}))),pending:state.pending-1}})},axios)})});_defineProperty(_this,"resultSelected",function(group,item){if(!item.geometry&&group.provider.getResultGeometry){group.provider.getResultGeometry(item,function(response){var _item$x,_response$center,_item$y,_response$center2,_item$crs;_this.props.resultSelected(_objectSpread(_objectSpread({},item),{},{feature:response?VectorLayerUtils.reprojectFeature(response.feature,response.crs,item.crs):null,x:(_item$x=item.x)!==null&&_item$x!==void 0?_item$x:response===null||response===void 0||(_response$center=response.center)===null||_response$center===void 0?void 0:_response$center[0],y:(_item$y=item.y)!==null&&_item$y!==void 0?_item$y:response===null||response===void 0||(_response$center2=response.center)===null||_response$center2===void 0?void 0:_response$center2[1],crs:(_item$crs=item.crs)!==null&&_item$crs!==void 0?_item$crs:response===null||response===void 0?void 0:response.crs}))})}else{_this.props.resultSelected(_objectSpread(_objectSpread({},item),{},{feature:item.geometry?{type:"Feature",geometry:item.geometry}:null}))}if(_this.input){_this.input.blur()}});_defineProperty(_this,"clear",function(){_this.setState({results:[],text:""});_this.props.resultSelected(null)});_this.searchTimeout=null;_this.preventBlur=false;_this.state.text=props.value;_this.input=null;return _this}_inherits(SearchWidget,_React$Component);return _createClass(SearchWidget,[{key:"componentDidMount",value:function componentDidMount(){this.componentDidUpdate({})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.value!==prevProps.value){this.setState({text:this.props.value})}}},{key:"render",value:function render(){var _this$props$placehold,_this2=this;return/*#__PURE__*/React.createElement("div",{className:"search-widget-container"},/*#__PURE__*/React.createElement(InputContainer,null,/*#__PURE__*/React.createElement("input",{onBlur:this.onBlur,onChange:this.textChanged,onFocus:this.onFocus,onKeyDown:this.onKeyDown,placeholder:(_this$props$placehold=this.props.placeholder)!==null&&_this$props$placehold!==void 0?_this$props$placehold:LocaleUtils.tr("search.search"),ref:function ref(el){_this2.input=el},role:"input",type:"text",value:this.state.text}),this.state.pending>0?/*#__PURE__*/React.createElement(Spinner,{role:"suffix"}):/*#__PURE__*/React.createElement(Icon,{icon:"clear",onClick:this.clear,role:"suffix"})),(!isEmpty(this.state.results)||this.state.pending>0)&&this.state.active?this.renderResults():null)}}])}(React.Component);_defineProperty(SearchWidget,"propTypes",{className:PropTypes.string,onBlur:PropTypes.func,onFocus:PropTypes.func,placeholder:PropTypes.string,queryGeometries:PropTypes.bool,resultSelected:PropTypes.func.isRequired,resultTypeFilter:PropTypes.array,searchParams:PropTypes.shape({mapcrs:PropTypes.string.isRequired,displaycrs:PropTypes.string.isRequired}),searchProviders:PropTypes.array,value:PropTypes.string});_defineProperty(SearchWidget,"defaultProps",{onBlur:function onBlur(){},onFocus:function onFocus(){},resultTypeFilter:[SearchResultType.PLACE],searchParams:{},searchProviders:[]});export{SearchWidget as default};
29
+ */
30
+
31
+ import React from 'react';
32
+ import axios from 'axios';
33
+ import isEmpty from 'lodash.isempty';
34
+ import PropTypes from 'prop-types';
35
+ import { v4 as uuidv4 } from 'uuid';
36
+ import LocaleUtils from '../../utils/LocaleUtils';
37
+ import MiscUtils from '../../utils/MiscUtils';
38
+ import { SearchResultType } from '../../utils/SearchProviders';
39
+ import VectorLayerUtils from '../../utils/VectorLayerUtils';
40
+ import Icon from '../Icon';
41
+ import InputContainer from './InputContainer';
42
+ import Spinner from './Spinner';
43
+ import './style/SearchWidget.css';
44
+ var SearchWidget = /*#__PURE__*/function (_React$Component) {
45
+ function SearchWidget(props) {
46
+ var _this;
47
+ _classCallCheck(this, SearchWidget);
48
+ _this = _callSuper(this, SearchWidget, [props]);
49
+ _defineProperty(_this, "state", {
50
+ text: '',
51
+ reqId: null,
52
+ results: [],
53
+ pending: 0,
54
+ active: false
55
+ });
56
+ _defineProperty(_this, "renderResults", function () {
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ className: "search-widget-results",
59
+ onMouseDown: _this.setPreventBlur
60
+ }, _this.state.results.filter(function (group) {
61
+ var _group$type;
62
+ return _this.props.resultTypeFilter.includes((_group$type = group.type) !== null && _group$type !== void 0 ? _group$type : SearchResultType.PLACE);
63
+ }).map(function (group) {
64
+ var _group$title;
65
+ return /*#__PURE__*/React.createElement("div", {
66
+ className: "search-widget-results-group",
67
+ key: group.id,
68
+ onMouseDown: MiscUtils.killEvent
69
+ }, /*#__PURE__*/React.createElement("div", {
70
+ className: "search-widget-results-group-title"
71
+ }, /*#__PURE__*/React.createElement("span", null, (_group$title = group.title) !== null && _group$title !== void 0 ? _group$title : LocaleUtils.tr(group.titlemsgid))), group.items.map(function (item) {
72
+ item.text = (item.label !== undefined ? item.label : item.text || '').replace(/<\/?\w+\s*\/?>/g, '');
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ className: "search-widget-results-group-item",
75
+ key: item.id,
76
+ onClick: function onClick() {
77
+ return _this.resultSelected(group, item);
78
+ },
79
+ title: item.text
80
+ }, item.text);
81
+ }));
82
+ }));
83
+ });
84
+ _defineProperty(_this, "setPreventBlur", function () {
85
+ _this.preventBlur = true;
86
+ setTimeout(function () {
87
+ _this.preventBlur = false;
88
+ return false;
89
+ }, 100);
90
+ });
91
+ _defineProperty(_this, "textChanged", function (ev) {
92
+ _this.setState({
93
+ text: ev.target.value,
94
+ reqId: null,
95
+ results: [],
96
+ pending: 0
97
+ });
98
+ clearTimeout(_this.searchTimeout);
99
+ if (!ev.target.value) {
100
+ _this.props.resultSelected(null);
101
+ } else {
102
+ _this.searchTimeout = setTimeout(_this.startSearch, 250);
103
+ }
104
+ });
105
+ _defineProperty(_this, "onBlur", function () {
106
+ if (!_this.preventBlur) {
107
+ clearTimeout(_this.searchTimeout);
108
+ _this.props.onBlur();
109
+ _this.setState({
110
+ active: false
111
+ });
112
+ }
113
+ });
114
+ _defineProperty(_this, "onFocus", function (ev) {
115
+ ev.target.select();
116
+ _this.props.onFocus();
117
+ _this.setState({
118
+ active: true
119
+ });
120
+ });
121
+ _defineProperty(_this, "onKeyDown", function (ev) {
122
+ if (ev.key === 'Enter') {
123
+ _this.startSearch();
124
+ } else if (ev.key === 'Escape') {
125
+ ev.target.blur();
126
+ }
127
+ });
128
+ _defineProperty(_this, "startSearch", function () {
129
+ clearTimeout(_this.searchTimeout);
130
+ var reqId = uuidv4();
131
+ _this.setState({
132
+ reqId: reqId,
133
+ results: [],
134
+ pending: _this.props.searchProviders.length
135
+ });
136
+ _this.props.searchProviders.forEach(function (provider) {
137
+ var searchParams = _objectSpread(_objectSpread({
138
+ lang: LocaleUtils.lang(),
139
+ cfgParams: provider.cfgParams
140
+ }, provider.params), _this.props.searchParams);
141
+ provider.onSearch(_this.state.text, searchParams, function (response) {
142
+ _this.setState(function (state) {
143
+ if (state.reqId !== reqId) {
144
+ return {};
145
+ }
146
+ return {
147
+ results: [].concat(_toConsumableArray(state.results), _toConsumableArray(response.results.map(function (group) {
148
+ return _objectSpread(_objectSpread({}, group), {}, {
149
+ provider: provider
150
+ });
151
+ }))),
152
+ pending: state.pending - 1
153
+ };
154
+ });
155
+ }, axios);
156
+ });
157
+ });
158
+ _defineProperty(_this, "resultSelected", function (group, item) {
159
+ if (!item.geometry && group.provider.getResultGeometry) {
160
+ group.provider.getResultGeometry(item, function (response) {
161
+ var _item$x, _response$center, _item$y, _response$center2, _item$crs;
162
+ _this.props.resultSelected(_objectSpread(_objectSpread({}, item), {}, {
163
+ feature: response ? VectorLayerUtils.reprojectFeature(response.feature, response.crs, item.crs) : null,
164
+ x: (_item$x = item.x) !== null && _item$x !== void 0 ? _item$x : response === null || response === void 0 || (_response$center = response.center) === null || _response$center === void 0 ? void 0 : _response$center[0],
165
+ y: (_item$y = item.y) !== null && _item$y !== void 0 ? _item$y : response === null || response === void 0 || (_response$center2 = response.center) === null || _response$center2 === void 0 ? void 0 : _response$center2[1],
166
+ crs: (_item$crs = item.crs) !== null && _item$crs !== void 0 ? _item$crs : response === null || response === void 0 ? void 0 : response.crs
167
+ }));
168
+ });
169
+ } else {
170
+ _this.props.resultSelected(_objectSpread(_objectSpread({}, item), {}, {
171
+ feature: item.geometry ? {
172
+ type: "Feature",
173
+ geometry: item.geometry
174
+ } : null
175
+ }));
176
+ }
177
+ if (_this.input) {
178
+ _this.input.blur();
179
+ }
180
+ });
181
+ _defineProperty(_this, "clear", function () {
182
+ _this.setState({
183
+ results: [],
184
+ text: ""
185
+ });
186
+ _this.props.resultSelected(null);
187
+ });
188
+ _this.searchTimeout = null;
189
+ _this.preventBlur = false;
190
+ _this.state.text = props.value;
191
+ _this.input = null;
192
+ return _this;
193
+ }
194
+ _inherits(SearchWidget, _React$Component);
195
+ return _createClass(SearchWidget, [{
196
+ key: "componentDidMount",
197
+ value: function componentDidMount() {
198
+ this.componentDidUpdate({});
199
+ }
200
+ }, {
201
+ key: "componentDidUpdate",
202
+ value: function componentDidUpdate(prevProps) {
203
+ if (this.props.value !== prevProps.value) {
204
+ this.setState({
205
+ text: this.props.value
206
+ });
207
+ }
208
+ }
209
+ }, {
210
+ key: "render",
211
+ value: function render() {
212
+ var _this$props$placehold,
213
+ _this2 = this;
214
+ return /*#__PURE__*/React.createElement("div", {
215
+ className: "search-widget-container"
216
+ }, /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement("input", {
217
+ onBlur: this.onBlur,
218
+ onChange: this.textChanged,
219
+ onFocus: this.onFocus,
220
+ onKeyDown: this.onKeyDown,
221
+ placeholder: (_this$props$placehold = this.props.placeholder) !== null && _this$props$placehold !== void 0 ? _this$props$placehold : LocaleUtils.tr("search.search"),
222
+ ref: function ref(el) {
223
+ _this2.input = el;
224
+ },
225
+ role: "input",
226
+ type: "text",
227
+ value: this.state.text
228
+ }), this.state.pending > 0 ? /*#__PURE__*/React.createElement(Spinner, {
229
+ role: "suffix"
230
+ }) : /*#__PURE__*/React.createElement(Icon, {
231
+ icon: "clear",
232
+ onClick: this.clear,
233
+ role: "suffix"
234
+ })), (!isEmpty(this.state.results) || this.state.pending > 0) && this.state.active ? this.renderResults() : null);
235
+ }
236
+ }]);
237
+ }(React.Component);
238
+ _defineProperty(SearchWidget, "propTypes", {
239
+ className: PropTypes.string,
240
+ onBlur: PropTypes.func,
241
+ onFocus: PropTypes.func,
242
+ placeholder: PropTypes.string,
243
+ queryGeometries: PropTypes.bool,
244
+ resultSelected: PropTypes.func.isRequired,
245
+ resultTypeFilter: PropTypes.array,
246
+ searchParams: PropTypes.shape({
247
+ mapcrs: PropTypes.string.isRequired,
248
+ displaycrs: PropTypes.string.isRequired
249
+ }),
250
+ searchProviders: PropTypes.array,
251
+ value: PropTypes.string
252
+ });
253
+ _defineProperty(SearchWidget, "defaultProps", {
254
+ onBlur: function onBlur() {},
255
+ onFocus: function onFocus() {},
256
+ resultTypeFilter: [SearchResultType.PLACE],
257
+ searchParams: {},
258
+ searchProviders: []
259
+ });
260
+ export { SearchWidget as default };
@@ -1,6 +1,48 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _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)}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)}/*
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ 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); }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
9
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
10
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
12
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
13
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
14
+ /*
2
15
  * Copyright (c) 2017 Cheng Lou. All rights reserved.
3
16
 
4
17
  * This work is licensed under the terms of the MIT license.
5
18
  * For a copy, see <https://opensource.org/licenses/MIT>.
6
- */import React from"react";import"./style/Spinner.css";var Spinner=/*#__PURE__*/function(_React$Component){function Spinner(){_classCallCheck(this,Spinner);return _callSuper(this,Spinner,arguments)}_inherits(Spinner,_React$Component);return _createClass(Spinner,[{key:"render",value:function render(){var bars=[];for(var i=0;i<12;++i){var barStyle={};barStyle.WebkitAnimationDelay=barStyle.animationDelay=(i-12)/10+"s";barStyle.WebkitTransform=barStyle.transform="rotate("+i*30+"deg) translate(146%)";bars.push(/*#__PURE__*/React.createElement("div",{key:i,style:barStyle}))}return/*#__PURE__*/React.createElement("div",{className:"spinner"},bars)}}])}(React.Component);export{Spinner as default};
19
+ */
20
+
21
+ import React from 'react';
22
+ import './style/Spinner.css';
23
+ var Spinner = /*#__PURE__*/function (_React$Component) {
24
+ function Spinner() {
25
+ _classCallCheck(this, Spinner);
26
+ return _callSuper(this, Spinner, arguments);
27
+ }
28
+ _inherits(Spinner, _React$Component);
29
+ return _createClass(Spinner, [{
30
+ key: "render",
31
+ value: function render() {
32
+ var bars = [];
33
+ for (var i = 0; i < 12; ++i) {
34
+ var barStyle = {};
35
+ barStyle.WebkitAnimationDelay = barStyle.animationDelay = (i - 12) / 10 + 's';
36
+ barStyle.WebkitTransform = barStyle.transform = 'rotate(' + i * 30 + 'deg) translate(146%)';
37
+ bars.push(/*#__PURE__*/React.createElement("div", {
38
+ key: i,
39
+ style: barStyle
40
+ }));
41
+ }
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: "spinner"
44
+ }, bars);
45
+ }
46
+ }]);
47
+ }(React.Component);
48
+ export { Spinner as default };
@@ -1,7 +1,82 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
7
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
11
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ /**
2
16
  * Copyright 2019-2024 Sourcepole AG
3
17
  * All rights reserved.
4
18
  *
5
19
  * This source code is licensed under the BSD-style license found in the
6
20
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import PropTypes from"prop-types";import{v4 as uuidv4}from"uuid";import"./style/SuggestionInput.css";var SuggestionInput=/*#__PURE__*/function(_React$Component){function SuggestionInput(props){var _this;_classCallCheck(this,SuggestionInput);_this=_callSuper(this,SuggestionInput,[props]);_defineProperty(_this,"state",{suggestions:[]});_defineProperty(_this,"onFocus",function(){_this.props.loadSuggestions(function(result){_this.setState({suggestions:result})})});_defineProperty(_this,"onBlur",function(ev){_this.setState({suggestions:[]});_this.props.onBlur(ev)});_this.datalistid=uuidv4();return _this}_inherits(SuggestionInput,_React$Component);return _createClass(SuggestionInput,[{key:"render",value:function render(){return/*#__PURE__*/React.createElement("span",{className:"suggestion-input "+(this.props.className||"")},/*#__PURE__*/React.createElement("input",{list:this.datalistid,onBlur:this.onBlur,onChange:this.props.onChange,onFocus:this.onFocus,type:"text",value:this.props.value}),/*#__PURE__*/React.createElement("datalist",{id:this.datalistid},this.state.suggestions.map(function(entry,idx){return/*#__PURE__*/React.createElement("option",{key:"e"+idx,value:entry})})))}}])}(React.Component);_defineProperty(SuggestionInput,"propTypes",{className:PropTypes.string,loadSuggestions:PropTypes.func,onBlur:PropTypes.func,onChange:PropTypes.func,value:PropTypes.string});export{SuggestionInput as default};
21
+ */
22
+
23
+ import React from 'react';
24
+ import PropTypes from 'prop-types';
25
+ import { v4 as uuidv4 } from 'uuid';
26
+ import './style/SuggestionInput.css';
27
+ var SuggestionInput = /*#__PURE__*/function (_React$Component) {
28
+ function SuggestionInput(props) {
29
+ var _this;
30
+ _classCallCheck(this, SuggestionInput);
31
+ _this = _callSuper(this, SuggestionInput, [props]);
32
+ _defineProperty(_this, "state", {
33
+ suggestions: []
34
+ });
35
+ _defineProperty(_this, "onFocus", function () {
36
+ _this.props.loadSuggestions(function (result) {
37
+ _this.setState({
38
+ suggestions: result
39
+ });
40
+ });
41
+ });
42
+ _defineProperty(_this, "onBlur", function (ev) {
43
+ _this.setState({
44
+ suggestions: []
45
+ });
46
+ _this.props.onBlur(ev);
47
+ });
48
+ _this.datalistid = uuidv4();
49
+ return _this;
50
+ }
51
+ _inherits(SuggestionInput, _React$Component);
52
+ return _createClass(SuggestionInput, [{
53
+ key: "render",
54
+ value: function render() {
55
+ return /*#__PURE__*/React.createElement("span", {
56
+ className: "suggestion-input " + (this.props.className || "")
57
+ }, /*#__PURE__*/React.createElement("input", {
58
+ list: this.datalistid,
59
+ onBlur: this.onBlur,
60
+ onChange: this.props.onChange,
61
+ onFocus: this.onFocus,
62
+ type: "text",
63
+ value: this.props.value
64
+ }), /*#__PURE__*/React.createElement("datalist", {
65
+ id: this.datalistid
66
+ }, this.state.suggestions.map(function (entry, idx) {
67
+ return /*#__PURE__*/React.createElement("option", {
68
+ key: "e" + idx,
69
+ value: entry
70
+ });
71
+ })));
72
+ }
73
+ }]);
74
+ }(React.Component);
75
+ _defineProperty(SuggestionInput, "propTypes", {
76
+ className: PropTypes.string,
77
+ loadSuggestions: PropTypes.func,
78
+ onBlur: PropTypes.func,
79
+ onChange: PropTypes.func,
80
+ value: PropTypes.string
81
+ });
82
+ export { SuggestionInput as default };