@nocobase/plugin-map 2.1.0-beta.47 → 2.1.0-beta.48
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/dist/client/components/GoogleMaps/Map.d.ts +2 -1
- package/dist/client/googleMapsDrawingManager.d.ts +34 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/641.ef67f0b66b92ff21.js +10 -0
- package/dist/client-v2/fields/circle.d.ts +26 -0
- package/dist/client-v2/fields/index.d.ts +14 -0
- package/dist/client-v2/fields/lineString.d.ts +26 -0
- package/dist/client-v2/fields/point.d.ts +26 -0
- package/dist/client-v2/fields/polygon.d.ts +26 -0
- package/dist/client-v2/fields/schema.d.ts +27 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/models/components/GoogleMaps/Map.d.ts +40 -2
- package/dist/externalVersion.js +7 -7
- package/package.json +2 -2
- package/dist/client-v2/641.a19dd82baa053f9e.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).push([["641"],{302:function(e){"use strict";e.exports=function(){function e(e){var t,l,a=[];return e.AMapUI&&a.push((t=e.AMapUI,new Promise(function(e,l){var a=[];if(t.plugins)for(var c=0;c<t.plugins.length;c+=1)-1==r.AMapUI.plugins.indexOf(t.plugins[c])&&a.push(t.plugins[c]);if(o.AMapUI===n.failed)l("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,r.AMapUI.version=t.version||r.AMapUI.version,c=r.AMapUI.version;var u=document.body||document.head,s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/ui/"+c+"/main.js",s.onerror=function(e){o.AMapUI=n.failed,l("请求 AMapUI 失败")},s.onload=function(){if(o.AMapUI=n.loaded,a.length)window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()});else for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()},u.appendChild(s)}else o.AMapUI===n.loaded?t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e():t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):i.AMapUI.push(function(t){t?l(t):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e()})}))),e.Loca&&a.push((l=e.Loca,new Promise(function(e,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,r.Loca.version=l.version||r.Loca.version;var a=r.Loca.version,c=r.AMap.version.startsWith("2"),u=a.startsWith("2");if(c&&!u||!c&&u)t("JSAPI 与 Loca 版本不对应!!");else{c=r.key,u=document.body||document.head;var s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/loca?v="+a+"&key="+c,s.onerror=function(e){o.Loca=n.failed,t("请求 AMapUI 失败")},s.onload=function(){for(o.Loca=n.loaded,e();i.Loca.length;)i.Loca.splice(0,1)[0]()},u.appendChild(s)}}else o.Loca===n.loaded?l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):e():l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):i.Loca.push(function(e){e?t(e):t()})}))),Promise.all(a)}if(!window)throw Error("AMap JSAPI can only be used in Browser.");(t=n||(n={})).notload="notload",t.loading="loading",t.loaded="loaded",t.failed="failed";var t,n,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]},l=[],a=function(e){"function"==typeof e&&(o.AMap===n.loaded?e(window.AMap):l.push(e))};return{load:function(t){return new Promise(function(i,c){if(o.AMap==n.failed)c("");else if(o.AMap==n.notload){var u=t.key,s=t.version,f=t.plugins;u?(window.AMap&&"lbs.amap.com"!==location.host&&c("禁止多种API加载方式混用"),r.key=u,r.AMap.version=s||r.AMap.version,r.AMap.plugins=f||r.AMap.plugins,o.AMap=n.loading,s=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,c(r);else for(o.AMap=n.loaded,e(t).then(function(){i(window.AMap)}).catch(c);l.length;)l.splice(0,1)[0]()},(f=document.createElement("script")).type="text/javascript",f.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+r.AMap.version+"&key="+u+"&plugin="+r.AMap.plugins.join(","),f.onerror=function(e){o.AMap=n.failed,c(e)},s.appendChild(f)):c("请填写key")}else if(o.AMap==n.loaded)if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{if(u=[],t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&u.push(t.plugins[s]);u.length?window.AMap.plugin(u,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)}else if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{var p=[];if(t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&p.push(t.plugins[s]);a(function(){p.length?window.AMap.plugin(p,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]}}}}()},119:function(e){e.exports={}},899:function(e,t,n){"use strict";n.d(t,{K0:function(){return i},S4:function(){return l},cV:function(){return u}});var r=n(694),o=n(155),i="map-configuration",l=function(e){return"NOCOBASE_PLUGIN_MAP_CONFIGURATION_".concat(e)};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c=function(e){var t=sessionStorage.getItem(l(e));try{return t?JSON.parse(t):null}catch(e){return null}},u=function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],u=(0,r.useFlowContext)().api,s=(0,o.useMemo)(function(){return l(e)},[e]),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(function(){return n?c(e):null}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return a(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],d=f[1];return(0,o.useEffect)(function(){n?d(c(e)):d(null)},[e,n]),(0,o.useEffect)(function(){if(!(n&&c(e))){var t=!1;return u.resource(i).get({isRaw:!n,type:e}).then(function(e){if(!t){var r,o=null==(r=e.data)?void 0:r.data;if(n){var i=sessionStorage.getItem(s);i&&i===JSON.stringify(o)||sessionStorage.setItem(s,JSON.stringify(o))}d(o)}}).catch(function(){}),function(){t=!0}}},[u,e,n,s]),p}},285:function(e,t,n){"use strict";n.d(t,{r:function(){return S},h:function(){return j}});var r=n(375),o=n(625),i=n(59),l=n(155),a=n.n(l),c=n(970),u=n(802),s=n(294),f=n(488),p=n(302),d=n.n(p);n(119);var g=n(694),h=n(899);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=function(e){var t,n=e.aMap,r=e.toCenter,c=(0,f.kj)(),u=(0,l.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,l.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return y(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=s[0],d=s[1];(0,l.useEffect)(function(){null==n||n.plugin("AMap.PlaceSearch",function(){n&&(u.current=new n.PlaceSearch({city:"全国",pageSize:30}))})},[n]);var g=(0,o.useDebounceFn)(function(e){u.current&&u.current.search(e||" ",function(e,t){if("complete"===e)d(t.poiList.pois.map(function(e){var t,n;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(e.name,"-").concat(e.address),value:e.id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}));else{if("no_data"===e)return void d([]);i.message.error(c("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}).run;return a().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},a().createElement(i.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:c("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=p.find(function(t){return t.value===e});(null==t?void 0:t.location)&&r(t.location)},options:p,popupMatchSelectWidth:!1}))};function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){b(e,t,n[t])})}return e}function O(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var M={point:{mouseTool:"marker",propertyKey:"position",overlay:"Marker"},polygon:{mouseTool:"polygon",editor:"PolygonEditor",propertyKey:"path",overlay:"Polygon"},lineString:{mouseTool:"polyline",editor:"PolylineEditor",propertyKey:"path",overlay:"Polyline"},circle:{mouseTool:"circle",editor:"CircleEditor",transformOptions:function(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},S=a().forwardRef(function(e,t){var n=(0,h.cV)(e.mapType)||{},c=n.accessKey,p=n.securityJsCode,y=e.value,m=e.onChange,S=e.block,P=void 0!==S&&S,E=e.readonly,k=e.disabled,C=void 0===k?P:k,I=e.zoom,j=e.overlayCommonOptions,L=e.height,x=e.type,D=(0,f.kj)(),U=(0,l.useRef)(),T=(0,l.useRef)(),_=(0,l.useRef)(),z=A((0,l.useState)([]),2),F=z[0],R=z[1],B=A((0,l.useState)(""),2),K=B[0],$=B[1],G="Something went wrong, please refresh the page and try again",N=(0,g.useFlowContext)(),J=(0,l.useRef)(),Z=(0,l.useRef)(null),V=N.router.navigate,W=(0,l.useRef)("nocobase-map-".concat(x||"","-").concat(Date.now().toString(32))),q=i.App.useApp().modal,X=A((0,l.useState)(w({strokeWeight:5,strokeColor:u.A,fillColor:u.A,strokeOpacity:1},j)),1)[0];(0,l.useEffect)(function(){T.current&&!P&&setTimeout(function(){var e;null==(e=T.current)||e.setZoom(I)},500)},[I,T.current,P]);var H=(0,o.useMemoizedFn)(function(){J.current&&J.current.remove()}),Y=(0,o.useMemoizedFn)(function(){(!C||P)&&"point"!==x&&Z.current&&(Z.current.setTarget(J.current),Z.current.open())}),Q=(0,o.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===x){var r=e.getPosition(),o=r.lat;n=[r.lng,o]}else if("polygon"===x||"lineString"===x){if((n=e.getPath().map(function(e){return[e.lng,e.lat]})).length<2)return}else if("circle"===x){var i=e.getCenter(),l=e.getRadius();n=[i.lng,i.lat,l]}t||(H(),J.current=e,Y()),null==m||m(n)}),ee=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x,t=M[e];if(t&&"editor"in t&&!Z.current)return Z.current=new U.current[t.editor](T.current,null,{createOptions:X,editOptions:X,controlPoint:O(w({},X),{strokeWeight:3}),midControlPoint:O(w({},X),{strokeWeight:2,fillColor:"#fff"})}),Z.current.on("adjust",function(e){Q(e.target,!0)}),Z.current.on("move",function(e){Q(e.target,!0)}),Z.current}),et=(0,o.useMemoizedFn)(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;if(!(!_.current||(null==(e=Z.current)?void 0:e.getTarget()))){var n=M[t];n&&_.current[n.mouseTool](w({},X))}}),en=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;_.current||(_.current=new U.current.MouseTool(T.current),_.current.on("draw",function(e){Q(e.obj)}),et(e))}),er=(0,l.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y,n=arguments.length>2?arguments[2]:void 0,r=M[e];if(r){var o=w({},X,n);return"transformOptions"in r?Object.assign(o,r.transformOptions(t)):"propertyKey"in r&&(o[r.propertyKey]=t),new U.current[r.overlay](o)}},[X]),eo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y,n=arguments.length>2?arguments[2]:void 0;if(U.current){var r=er(e,t,n);if(r)return r.setMap(T.current),r}};return((0,l.useEffect)(function(){if(U.current&&y&&(E||!J.current)){var e=eo();T.current.setFitView([e]),J.current=e,C||(ee(),Y())}},[y,F,x,X,C,E]),(0,l.useEffect)(function(){var e,t,n;_.current&&(C?(null==(e=_.current)||e.close(),null==(t=Z.current)||t.close()):(et(),null==(n=Z.current)||n.open()))},[C]),(0,l.useEffect)(function(){U.current&&x&&!C&&(en(),ee())},[C,F,x]),(0,l.useEffect)(function(){if(!y&&(_.current||Z.current)&&(H(),Z.current&&(Z.current.setTarget(),Z.current.close()),null==m||m(null)),_.current&&Z.current){var e,t;Z.current.getTarget()?null==(e=(t=_.current).close)||e.call(t):et()}},[x,y]),(0,l.useEffect)(function(){if(c&&!T.current){p&&(window._AMapSecurityConfig=b({},p.endsWith("_AMapService")?"serviceHOST":"securityJsCode",p));var e=window.define;return(window.define=void 0,window.AMap)?void(0,s.zd)(function(){try{T.current=new window.AMap.Map(W.current,{resizeEnable:!0,zoom:I}),U.current=AMap,$(""),R([])}catch(e){$((0,s.DP)(e,G))}finally{window.define=e}}):(d().load({key:c,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(function(t){if(t)return window.define=e,(0,s.zd)(function(){try{T.current=new t.Map(W.current,{resizeEnable:!0,zoom:I}),U.current=t,$(""),R([])}catch(e){$((0,s.DP)(e,G))}})}).catch(function(t){window.define=e;var n=(0,s.DP)(t,G);n.includes("多个不一致的 key")?$(D("The AccessKey is incorrect, please check it")):t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"type"in t&&"error"===t.type?$(G):$(n)}),function(){var e;null==(e=T.current)||e.destroy(),U.current=null,T.current=null,_.current=null,Z.current=null,d().reset()})}},[c,x,p]),(0,l.useImperativeHandle)(t,function(){return{setOverlay:eo,getOverlay:er,createMouseTool:en,createEditor:ee,executeMouseTool:et,aMap:U.current,map:T.current,overlay:J.current,mouseTool:function(){return _.current},editor:function(){return Z.current},errMessage:K}}),!c||K)?a().createElement(i.Alert,{action:a().createElement(i.Button,{type:"primary",onClick:function(){var e,t;null==(t=N.view)||null==(e=t.close)||e.call(t),V("/admin/settings/map")}},D("Go to the configuration page")),message:K||D("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):a().createElement("div",{style:w({position:"relative",height:L||500},null==e?void 0:e.style),id:W.current},!U.current&&a().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},a().createElement(i.Spin,null)),C?null:a().createElement(a().Fragment,null,a().createElement(v,{toCenter:function(e,t){T.current&&T.current.setZoomAndCenter(18,e,t)},aMap:U.current}),a().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},a().createElement(i.Button,{onClick:function(){J.current&&T.current.setFitView([J.current])},disabled:!J.current,type:"primary",shape:"round",size:"large",icon:a().createElement(r.SyncOutlined,null)})),"point"!==x?a().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},a().createElement(i.Alert,{message:D("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,a().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},a().createElement(i.Button,{disabled:!y,style:{height:"40px"},onClick:function(){var e=function(){H(),Z.current&&(Z.current.setTarget(),Z.current.close()),null==m||m(null)};q.confirm({title:D("Clear the canvas"),content:D("Are you sure to clear the canvas?"),okText:D("Confirm"),cancelText:D("Cancel"),getContainer:function(){return document.getElementById(W.current)},onOk:function(){e()}})},type:"primary",danger:!0},D("Clear")))))});function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||I(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||I(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){if(e){if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}}S.displayName="AMapCom";var j=function(e){var t,n,p,d,g,h,y=e.collectionField,v=e.marker,m=e.dataSource,b=e.fixedBlock,w=e.zoom,O=e.setSelectedRecordKeys,A=e.lineSort,M=e.fields,P=e.name,I=e.primaryKey,j=e.mapField,L=e.associationCollectionField,x=e.onOpenView,D=k((0,l.useState)(!1),2),U=D[0],T=D[1],_=(0,l.useRef)(),z=null==(d=_.current)||null==(p=d.aMap)?void 0:p.GeometryUtil,F=k((0,l.useState)(""),2),R=F[0],B=F[1],K=(0,f.kj)(),$=(0,l.useRef)(R);$.current=R;var G=null==(g=M.find(function(e){return e.name===v}))?void 0:g.uiSchema,N=y.interface||y.type,J=function(e,t){var n=e.getExtData(),r=void 0===t?n.selected:!t;n.selected=!r,"setIcon"in e&&e.setIcon(new _.current.aMap.Icon({imageSize:[19,32],image:r?c.X:c.F})),e.setOptions(E({extData:n},r?{strokeColor:u.A,fillColor:u.A}:{strokeColor:u.v,fillColor:u.v}))},Z=function(){var e,t,n;_.current&&(null==(e=_.current)||e.mouseTool().close(!0),null==(t=_.current)||t.editor().setTarget(null),null==(n=_.current)||n.editor().close())};(0,l.useEffect)(function(){var e,t,n,r;if("selection"===R)return(null==(e=_.current)?void 0:e.editor())?null==(r=_.current)||r.executeMouseTool("polygon"):(null==(t=_.current)||t.createEditor("polygon"),null==(n=_.current)||n.createMouseTool("polygon")),function(){Z()}},[R]),(0,l.useEffect)(function(){if(R)return function(){if(!$.current){var e;null==(e=_.current)||e.map.getAllOverlays().forEach(function(e){J(e,!1)})}}},[R]);var V=(0,o.useMemoizedFn)(function(){var e,t,n,r=null==(e=_.current)?void 0:e.editor().getTarget(),o=null==(t=_.current)?void 0:t.map.getAllOverlays(),i=null==o?void 0:o.filter(function(e){if(e!==r&&void 0!==e.getExtData().id)return"getPosition"in e?z.isPointInRing(e.getPosition(),null==r?void 0:r.getPath()):z.doesRingRingIntersect(e.getPath(),null==r?void 0:r.getPath())});O(null==i?void 0:i.map(function(e){return J(e,!0),e.getExtData().id})),null==r||r.remove(),null==(n=_.current)||n.editor().close()});return(0,l.useEffect)(function(){if(y&&_.current&&m){var e=m.map(function(e){var t,n=null==(t=(0,s.el)(e,j,null==L?void 0:L.interface))?void 0:t.filter(Boolean),r=(0,s.PB)(G,e[v]);return(null==n?void 0:n.length)?n.map(function(t){var n;return null==(n=_.current)?void 0:n.setOverlay(N,t,{strokeColor:u.A,fillColor:u.A,cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:v?(0,s.Gq)(r,K):void 0},extData:{id:e[I]}})}):[]}).flat().filter(Boolean);1===e.length&&"point"===N?(null==(r=_.current)||null==(n=r.map)||n.setFitView(e),null==(i=_.current)||null==(o=i.map)||o.setZoom(w||13)):null==(a=_.current)||null==(l=a.map)||l.setFitView(e);var t=e.map(function(e){var t=function(e){var t=e.target,n=t.getExtData();if(n){if($.current){"click"===$.current&&(O(function(e){return n.selected?e.filter(function(e){return e!==n.id}):C(e).concat([n.id])}),J(t));return}var r=m.find(function(e){return n.id===e[I]});r&&x(r)}};return e.on("click",t),function(){return e.off("click",t)}});if("point"===N&&(null==A?void 0:A.length)&&(null==e?void 0:e.length)>1){var n,r,o,i,l,a,c,f=e.map(function(e){return e.getPosition()});e[0].setzIndex(13),e[e.length-1].setzIndex(13);var p=function(){var e,t,n=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=_.current)?void 0:e.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:n?K("Start point"):K("End point")},position:f[n?0:f.length-1],map:null==(t=_.current)?void 0:t.map})};e.push.apply(e,C([null==(c=_.current)?void 0:c.setOverlay("lineString",f,{strokeColor:u.A,fillColor:u.A,strokeWeight:2,cursor:"pointer"}),p(),p(!1)].filter(Boolean)))}return function(){e.forEach(function(e){e.remove()}),t.forEach(function(e){return e()})}}},[m,U,j,v,P,I,N,!1,A]),(0,l.useEffect)(function(){setTimeout(function(){O([])})},[m]),a().createElement("div",{style:{position:"relative",height:"100%"}},a().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},!U||(null==(h=_.current)?void 0:h.errMessage)?null:a().createElement(i.Space,{direction:"vertical"},a().createElement(i.Button,{style:{color:R?void 0:u.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("")},icon:a().createElement(r.EnvironmentOutlined,null)}),a().createElement(i.Button,{style:{color:"selection"===R?u.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("selection")},icon:a().createElement(r.ExpandOutlined,null)}),"selection"===R?a().createElement(i.Button,{type:"primary",icon:a().createElement(r.CheckOutlined,null),title:K("Confirm selection"),onClick:V}):null)),a().createElement(S,(t=E({},e),n=n={ref:function(e){_.current=e,T(!!(null==e?void 0:e.map)&&!e.errMessage)},style:b?{height:"100%"}:void 0,zoom:w,type:N,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:u.v,fillColor:u.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},348:function(e,t,n){"use strict";n.d(t,{Y6:function(){return D},G$:function(){return K}});var r,o,i=n(375),l=n(625),a=n(59),c=n(155),u=n.n(c),s=n(970),f=n(802),p=n(294),d=n(488),g=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var r,o,i,l=i[o];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n};let h="__googleMapsScriptId";(r=o||(o={}))[r.INITIALIZED=0]="INITIALIZED",r[r.LOADING=1]="LOADING",r[r.SUCCESS=2]="SUCCESS",r[r.FAILURE=3]="FAILURE";class y{constructor({apiKey:e,authReferrerPolicy:t,channel:n,client:r,id:o=h,language:i,libraries:l=[],mapIds:a,nonce:c,region:u,retries:s=3,url:f="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=n,this.client=r,this.id=o||h,this.language=i,this.libraries=l,this.mapIds=a,this.nonce=c,this.region=u,this.retries=s,this.url=f,this.version=p,y.instance){if(!g(this.options,y.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(y.instance.options)}`);return y.instance}y.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?o.FAILURE:this.done?o.SUCCESS:this.loading?o.LOADING:o.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(n=>{n?t(n.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;let n,r,o,i,l,a,c,u,s,f,p;if(document.getElementById(this.id))return void this.callback();let d={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(d).forEach(e=>!d[e]&&delete d[e]),(null==(t=null==(e=null==window?void 0:window.google)?void 0:e.maps)?void 0:t.importLibrary)||(i="google",l="importLibrary",a=document,u=(c=(c=window)[i]||(c[i]={})).maps||(c.maps={}),s=new Set,f=new URLSearchParams,p=()=>n||(n=new Promise((e,t)=>{var l,c,p,g;return l=this,c=void 0,p=void 0,g=function*(){var l;for(o in yield r=a.createElement("script"),r.id=this.id,f.set("libraries",[...s]+""),d)f.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),d[o]);f.set("callback",i+".maps.__ib__"),r.src=this.url+"?"+f,u.__ib__=e,r.onerror=()=>n=t(Error("The Google Maps JavaScript API could not load.")),r.nonce=this.nonce||(null==(l=a.querySelector("script[nonce]"))?void 0:l.nonce)||"",a.head.append(r)},new(p||(p=Promise))(function(e,t){function n(e){try{o(g.next(e))}catch(e){t(e)}}function r(e){try{o(g.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):((o=t.value)instanceof p?o:new p(function(e){e(o)})).then(n,r)}o((g=g.apply(l,c||[])).next())})})),u[l]?console.warn("The Google Maps JavaScript API only loads once. Ignoring:",d):u[l]=(e,...t)=>s.add(e)&&p().then(()=>u[l](e,...t)));let g=this.libraries.map(e=>this.importLibrary(e));g.length||g.push(this.importLibrary("core")),Promise.all(g).then(()=>this.callback(),e=>{let t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){let e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}var v=n(694),m=n(899);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var w=function(e){var t,n=e.toCenter,r=e.mapRef,o=(0,d.kj)(),i=(0,c.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return b(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1];(0,c.useEffect)(function(){google.maps.importLibrary("places").then(function(e){i.current=new e.AutocompleteService}).catch(function(){a.message.error("Please configure the Google API Key correctly")})},[r]);var g=(0,l.useDebounceFn)(function(e){i.current&&i.current.getPlacePredictions({input:e||" "},function(e,t){t!==google.maps.places.PlacesServiceStatus.OK?p([]):p(e.map(function(e){var t,n,r=e.structured_formatting;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(r.main_text).concat(r.secondary_text?" "+r.secondary_text:""),value:e.place_id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}))})},{wait:300}).run;return u().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},u().createElement(a.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:o("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=f.find(function(t){return t.value===e});new google.maps.places.PlacesService(r.current).getDetails({placeId:t.place_id,fields:["geometry"]},function(e,t){t===google.maps.places.PlacesServiceStatus.OK&&n(e.geometry.location)})},options:f}))},O=function(e){return{url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(9.5,42)}};function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){S(e,t,n[t])})}return e}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||j(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}}var L={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions:function(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},x=function(){var e;function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");S(this,"listeners",new Set),S(this,"mapListeners",[]),S(this,"options",void 0),S(this,"drawingMode",null),S(this,"draftOverlay",null),S(this,"draftPath",[]),S(this,"circleCenter",null),this.options=e,this.setDrawingMode(e.drawingMode||null)}return e=[{key:"addListener",value:function(e,t){var n=this;return"overlaycomplete"===e&&this.listeners.add(t),{remove:function(){n.listeners.delete(t)}}}},{key:"setDrawingMode",value:function(e){this.drawingMode=e,this.resetDraft(),this.bindMapEvents()}},{key:"unbindAll",value:function(){this.listeners.clear(),this.clearMapEvents(),this.resetDraft(),this.drawingMode=null}},{key:"bindMapEvents",value:function(){var e=this;this.clearMapEvents(),this.options.map&&this.drawingMode&&this.mapListeners.push(this.options.map.addListener("click",function(t){t.latLng&&e.handleClick(t.latLng)}),this.options.map.addListener("dblclick",function(){e.completePathOverlay()}),this.options.map.addListener("mousemove",function(t){t.latLng&&e.updatePreview(t.latLng)}))}},{key:"clearMapEvents",value:function(){this.mapListeners.forEach(function(e){var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),this.mapListeners.length=0}},{key:"resetDraft",value:function(){var e;null==(e=this.draftOverlay)||e.setMap(null),this.draftOverlay=null,this.draftPath=[],this.circleCenter=null}},{key:"handleClick",value:function(e){"marker"===this.drawingMode?this.emitComplete("marker",new google.maps.Marker(k(E({},this.options),{icon:O(s.X),position:e}))):"circle"===this.drawingMode?this.handleCircleClick(e):("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.handlePathClick(e)}},{key:"handlePathClick",value:function(e){if("polygon"===this.drawingMode||"polyline"===this.drawingMode){if(this.draftPath.push(e),!this.draftOverlay){this.draftOverlay="polygon"===this.drawingMode?new google.maps.Polygon(k(E({},this.options),{paths:this.draftPath})):new google.maps.Polyline(k(E({},this.options),{path:this.draftPath}));return}this.updatePath(this.draftPath)}}},{key:"handleCircleClick",value:function(e){if(!this.circleCenter){this.circleCenter=e,this.draftOverlay=new google.maps.Circle(k(E({},this.options),{center:e,radius:0}));return}this.updateCircle(e),this.completeCircleOverlay()}},{key:"updatePreview",value:function(e){"circle"===this.drawingMode&&this.circleCenter?this.updateCircle(e):("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&this.updatePath(I(this.draftPath).concat([e]))}},{key:"updatePath",value:function(e){P(this.draftOverlay,google.maps.Polygon)?this.draftOverlay.setPath(e):P(this.draftOverlay,google.maps.Polyline)&&this.draftOverlay.setPath(e)}},{key:"updateCircle",value:function(e){P(this.draftOverlay,google.maps.Circle)&&this.circleCenter&&this.draftOverlay.setRadius(google.maps.geometry.spherical.computeDistanceBetween(this.circleCenter,e))}},{key:"completePathOverlay",value:function(){if(("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&("polygon"!==this.drawingMode||!(this.draftPath.length<3))&&("polyline"!==this.drawingMode||!(this.draftPath.length<2))){var e=this.draftOverlay,t=this.drawingMode;this.updatePath(this.draftPath),this.draftOverlay=null,this.draftPath=[],this.emitComplete(t,e)}}},{key:"completeCircleOverlay",value:function(){if(P(this.draftOverlay,google.maps.Circle)){var e=this.draftOverlay;this.draftOverlay=null,this.circleCenter=null,this.emitComplete("circle",e)}}},{key:"emitComplete",value:function(e,t){this.listeners.forEach(function(n){n({type:e,overlay:t})})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}(),D=u().forwardRef(function(e,t){var n=e.value,r=e.onChange,o=e.block,p=void 0!==o&&o,g=e.readonly,h=e.disabled,b=void 0===h?p:h,A=e.zoom,S=void 0===A?13:A,j=e.overlayCommonOptions,D=e.height,U=e.type,T=((0,m.cV)(e.mapType)||{}).accessKey,_=(0,d.kj)(),z=(0,v.useFlowContext)(),F=(0,l.useMemoizedFn)(function(){return _("Load google maps failed, Please check the Api key and refresh the page")}),R=(0,c.useRef)(),B=(0,c.useRef)(),K=(0,c.useRef)(),$=C((0,c.useState)([]),2),G=$[0],N=$[1],J=C((0,c.useState)(""),2),Z=J[0],V=J[1],W=a.App.useApp().modal;(0,c.useEffect)(function(){if(B.current&&!p){var e;null==(e=B.current)||e.setZoom(S)}},[S,p]);var q=(0,c.useRef)("point"===U?"marker":"lineString"===U?"polyline":U),X=C((0,c.useState)(E({strokeWeight:5,strokeColor:f.A,fillColor:f.A,strokeOpacity:1,editable:!b,draggable:!b},j)),1)[0],H=z.router.navigate,Y=(0,c.useRef)(),Q=(0,c.useRef)(new Set),ee=(0,l.useMemoizedFn)(function(e){if(Q.current.forEach(function(e){Q.current.delete(e)}),"getPath"in e){var t=e.getPath();["insert_at","remove_at","set_at"].forEach(function(n){Q.current.add(t.addListener(n,function(){ei(e,!0)}).remove)})}else P(e,google.maps.Circle)&&["center_changed","radius_changed"].forEach(function(t){Q.current.add(e.addListener(t,function(){ei(e,!0)}).remove)})}),et=(0,l.useMemoizedFn)(function(){if(K.current&&(K.current.unbindAll(),K.current.setMap(null)),"point"!==U){var e;null==(e=R.current)||e.setDrawingMode(null)}}),en=(0,l.useMemoizedFn)(function(e){if(B.current&&e){var t,n;null==(t=B.current)||t.setCenter(e),null==(n=B.current)||n.setZoom(S)}}),er=(0,l.useMemoizedFn)(function(e){et(),ee(e),K.current=e}),eo=(0,l.useMemoizedFn)(function(e){if(null==e?void 0:e.length){if(1===e.length&&P(e[0],google.maps.Marker)){null==(o=B.current)||null==(r=o.setCenter)||r.call(o,e[0].getPosition()),null==(l=B.current)||null==(i=l.setZoom)||i.call(l,S||13);return}var t,n,r,o,i,l,a=new google.maps.LatLngBounds;e.forEach(function(e){if(P(e,google.maps.Marker))a.extend(e.getPosition());else if(P(e,google.maps.Polyline)||P(e,google.maps.Polygon))for(var t=e.getPath(),n=0;n<t.getLength();n++)a.extend(t.getAt(n));else P(e,google.maps.Circle)&&a.union(e.getBounds())}),null==(n=B.current)||null==(t=n.fitBounds)||t.call(n,a)}}),ei=(0,l.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===U){var o=e.getPosition(),i=o.lat;n=[(0,o.lng)(),i()]}else if("polygon"===U||"lineString"===U){if((n=e.getPath().getArray().map(function(e){return[e.lng(),e.lat()]})).length<2)return}else if("circle"===U){var l=e.getCenter(),a=e.getRadius();n=[l.lng(),l.lat(),a]}t||er(e),null==r||r(n)}),el=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=k(E({},X,t),{map:B.current});return R.current=new x(k(E({drawingMode:q.current},n),{icon:O(s.X)})),e||R.current.addListener("overlaycomplete",function(e){ei(e.overlay)}),R.current}),ea=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0,o=L[e];if(o){var i=E(k(E({},X),{icon:O(s.X)}),r);return"transformOptions"in o?Object.assign(i,o.transformOptions(t)):"propertyKey"in o&&(i[o.propertyKey]=Array.isArray(t[0])?t.map(function(e){return new google.maps.LatLng(e[1],e[0])}):new google.maps.LatLng(t[1],t[0])),new google.maps[o.overlay](i)}}),ec=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0;if(B.current)return ea(e,t,k(E({},r),{map:B.current}))});(0,c.useEffect)(function(){if(!n&&B.current){var e,t;et(),null==R||null==(t=R.current)||null==(e=t.setDrawingMode)||e.call(t,q.current),null==r||r(null)}if(B.current&&n&&(g||!K.current)){var o=ec();er(o),eo([o])}},[n,G,U,b,g,ec,eo,er,r,et]),(0,c.useEffect)(function(){if(T&&!B.current&&Y.current){var e,t=!1;try{e=new y({apiKey:T,version:"weekly",language:z.api.auth.getLocale()})}catch(e){V(F());return}var n=console.error;return console.error=function(e){for(var t,r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];(null==e||null==(t=e.includes)?void 0:t.call(e,"InvalidKeyMapError"))&&V(F()),n.apply(void 0,[e].concat(I(o)))},Promise.all([e.importLibrary("maps"),e.importLibrary("marker"),e.importLibrary("core"),e.importLibrary("geometry")]).then(function(e){var n;return(n=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){var t=function(){e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var n=t.coords;e({lat:n.latitude,lng:n.longitude})},function(){t()},{timeout:2e3,maximumAge:0}):t()})];case 1:return e=r.sent(),[4,new Promise(function(e){return requestAnimationFrame(e)})];case 2:if(r.sent(),n=Y.current,t||!P(n,HTMLElement))return[2];return B.current=new google.maps.Map(n,{zoom:S,center:e,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),google.maps.event.trigger(B.current,"resize"),V(""),N([]),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function l(e){M(i,r,o,l,a,"next",e)}function a(e){M(i,r,o,l,a,"throw",e)}l(void 0)})})()}).catch(function(e){if(P(e,Error))return void V(e.message)}),function(){var e,n;t=!0,null==(e=B.current)||e.unbindAll(),B.current=null,null==(n=R.current)||n.unbindAll()}}},[T,z.api.auth,F,S]),(0,c.useEffect)(function(){B.current&&U&&!b&&!R.current&&el()},[el,b,G,U]),(0,c.useImperativeHandle)(t,function(){return{setOverlay:ec,getOverlay:ea,setFitView:eo,createDraw:el,map:B.current,overlay:K.current,drawingManager:R.current,errMessage:Z}});var eu=(0,l.useMemoizedFn)(function(){var e=function(){et(),R.current.setDrawingMode(q.current),null==r||r(null)};W.confirm({title:_("Clear the canvas"),content:_("Are you sure to clear the canvas?"),okText:_("Confirm"),cancelText:_("Cancel"),getContainer:function(){return Y.current},onOk:function(){e()}})});return!T||Z?u().createElement(a.Alert,{action:u().createElement(a.Button,{type:"primary",onClick:function(){var e,t;null==(t=z.view)||null==(e=t.close)||e.call(t),H("/admin/settings/map?tab=google")}},_("Go to the configuration page")),message:Z||_("Please configure the Api key first"),type:"error"}):u().createElement("div",{style:{position:"relative",height:D||500}},!B.current&&u().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},u().createElement(a.Spin,null)),b?null:u().createElement(u().Fragment,null,B.current&&u().createElement(w,{toCenter:en,mapRef:B}),u().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},u().createElement(a.Button,{onClick:function(){K.current&&eo([K.current])},disabled:!K.current,type:"primary",shape:"round",size:"large",icon:u().createElement(i.SyncOutlined,null)})),"lineString"===U||"polygon"===U?u().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},u().createElement(a.Alert,{message:_("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,u().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},u().createElement(a.Button,{disabled:!n,style:{height:"40px"},onClick:eu,type:"primary",danger:!0},_("Clear")))),u().createElement("div",{ref:Y,style:E({width:"100%",height:"100%"},null==e?void 0:e.style)}))});function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||F(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(e,t)}}D.displayName="GoogleMapsCom";var R="google-maps-overlay-id",B="google-maps-overlay-selected",K=function(e){var t,n,r,o=e.collectionField,g=e.marker,h=e.dataSource,y=e.fixedBlock,v=e.zoom,m=e.setSelectedRecordKeys,b=e.lineSort,w=e.fields,A=(e.name,e.primaryKey),M=e.mapField,S=e.associationCollectionField,P=e.onOpenView,E=z((0,c.useState)(!1),2),k=E[0],C=E[1],I=(0,c.useRef)(),j=z((0,c.useState)(""),2),L=j[0],x=j[1],K=(0,d.kj)(),$=(z((0,c.useState)(null),2)[1],(0,c.useRef)(L)),G=(0,c.useRef)(null),N=(0,c.useRef)([]);$.current=L;var J=null==(r=w.find(function(e){return e.name===g}))?void 0:r.uiSchema,Z=o.interface||o.type,V=function(e,t){var n=void 0!==t?!t:e.get(B);e.set(B,!n),e.setOptions(_({},n?{icon:O(s.X),strokeColor:f.A,fillColor:f.A}:{icon:O(s.F),strokeColor:f.v,fillColor:f.v}))};(0,c.useEffect)(function(){if("selection"===L){!I.current||(null==(e=I.current)?void 0:e.drawingManager)||(I.current.drawingManager=null==(r=I.current)?void 0:r.createDraw(!0,{editable:!0,draggable:!0}));var e,t,n,r,o=new Set;return null==(t=I.current)||t.drawingManager.setDrawingMode("polygon"),null==(n=I.current)||n.drawingManager.addListener("overlaycomplete",function(e){var t,n=e.overlay;null==(t=I.current)||t.drawingManager.setDrawingMode(null),G.current=n;var r=n.getPath();["insert_at","remove_at","set_at"].forEach(function(e){o.add(r.addListener(e,function(){}).remove)})}),function(){var e,t,n,r;o.forEach(function(e){e()}),I.current&&(null==(e=G.current)||e.unbindAll(),null==(t=G.current)||t.setMap(null),G.current=null,null==(n=I.current)||n.drawingManager.setDrawingMode(null),null==(r=I.current)||r.drawingManager.unbindAll())}}},[L]),(0,c.useEffect)(function(){if(L)return function(){$.current||N.current.forEach(function(e){V(e,!1)})}},[L]);var W=(0,l.useMemoizedFn)(function(){var e,t=G.current,n=N.current,r=google.maps.geometry.poly,o=n.filter(function(e){if(e!==t&&void 0!==e.get(R))if(T(e,google.maps.Marker))return r.containsLocation(e.getPosition(),t);else if(T(e,google.maps.Circle))return r.containsLocation(e.getCenter(),t);else return e.getPath().getArray().some(function(e){return r.containsLocation(e,t)})}).map(function(e){return V(e,!0),e.get(R)});m(function(e){return o.concat(e)}),null==t||t.unbindAll(),null==t||t.setMap(null),null==(e=I.current)||e.drawingManager.setDrawingMode("polygon")});return(0,c.useEffect)(function(){if(o&&(null==h?void 0:h.length)&&(null==(r=I.current)?void 0:r.map)){var e=h.map(function(e){var t,n=null==(t=(0,p.el)(e,M,null==S?void 0:S.interface))?void 0:t.filter(Boolean),r=(0,p.PB)(J,e[g]);return(null==n?void 0:n.length)?null==n?void 0:n.filter(Boolean).map(function(t){if(n){var o,i=null==(o=I.current)?void 0:o.setOverlay(Z,t,{strokeColor:f.A,fillColor:f.A,cursor:"pointer",label:{className:"nb-map-google-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:g?(0,p.Gq)(r,K):void 0}});return null==i||i.set(R,e[A]),i}}):[]}).flat().filter(Boolean);N.current=e;var t=e.map(function(e){return e.addListener("click",function(t){var n=e.get(R);if(n){var r=null==h?void 0:h.find(function(e){return n===e[A]});r&&P(r)}}),function(){return e.unbindAll()}});if("point"===Z&&(null==b?void 0:b.length)&&(null==e?void 0:e.length)>1){var n,r,i,l=e.map(function(e){return e.getPosition()});e[0].setZIndex(138),e[e.length-1].setZIndex(138);var a=function(){var e,t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=I.current)?void 0:e.map)return new google.maps.Marker({label:{className:"nb-map-google-point-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:t?K("Start point"):K("End point")},icon:O(s.X),position:t?l[0]:l[l.length-1],map:I.current.map})};e.push.apply(e,function(e){if(Array.isArray(e))return U(e)}(n=[I.current.setOverlay("lineString",l.map(function(e){return[e.lng(),e.lat()]}),{strokeColor:f.A,fillColor:f.A,strokeWeight:2,cursor:"pointer"}),a(),a(!1)].filter(Boolean))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||F(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return null==(i=I.current)||i.setFitView(e),function(){e.forEach(function(e){e.setMap(null),e.unbindAll()}),t.forEach(function(e){return e()})}}},[h,k,g,Z,!1]),(0,c.useEffect)(function(){setTimeout(function(){m([])})},[h]),u().createElement("div",{style:{position:"relative",height:"100%"}},k&&u().createElement(u().Fragment,null,u().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},u().createElement(a.Space,{direction:"vertical"},u().createElement(a.Button,{style:{color:L?void 0:f.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("")},icon:u().createElement(i.EnvironmentOutlined,null)}),u().createElement(a.Button,{style:{color:"selection"===L?f.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("selection")},icon:u().createElement(i.ExpandOutlined,null)}),"selection"===L?u().createElement(a.Button,{type:"primary",icon:u().createElement(i.CheckOutlined,null),title:K("Confirm selection"),onClick:W}):null))),u().createElement(D,(t=_({},e),n=n={ref:function(e){I.current=e,C(!!(null==e?void 0:e.map)&&!e.errMessage)},style:y?{height:"100%"}:void 0,zoom:v,type:Z,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:f.v,fillColor:f.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},970:function(e,t,n){"use strict";n.d(t,{F:function(){return i},X:function(){return l}});var r=n(802),o=function(e){return"data:image/svg+xml;utf8,".concat(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="38" height="63" viewBox="0 0 38 63"><path fill="'.concat(e,'" d="M19 0C8.5 0 0 8.5 0 19c0 14.2 19 44 19 44s19-29.8 19-44C38 8.5 29.5 0 19 0Z"/><circle fill="white" cx="19" cy="19" r="8"/></svg>')))},i=o(r.v),l=o(r.A)},802:function(e,t,n){"use strict";n.d(t,{A:function(){return r},v:function(){return o}});var r="#4e9bff",o="#F18b62"},294:function(e,t,n){"use strict";n.d(t,{DP:function(){return i},Gq:function(){return l},PB:function(){return a},el:function(){return r},zd:function(){return o}});var r=function(e,t,n){var r=null==t?void 0:t.reduce(function(e,r,o){return o===t.length-1&&("o2m"===n||"m2m"===n)?null==e?void 0:e.map(function(e){return e[r]}).filter(function(e){return null!=e}):null==e?void 0:e[r]},e);return"o2m"===n||"m2m"===n?r:[r]},o=function(e){window.requestIdleCallback?window.requestIdleCallback(function(){e()}):window.setTimeout(e,1)},i=function(e,t){if("string"==typeof e)return e;if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"message"in e){var n,r=e.message;if("string"==typeof r&&r)return r}return t},l=function(e,t){return"string"!=typeof e?e:e.replace(/\{\{\s*t\(['"]([^'"]+)['"](?:,\s*([^}]+))?\)\s*\}\}/g,function(e,n){return t?t(n):n})},a=function(e,t){if(null==t)return t;var n=(null==e?void 0:e.enum)||(null==e||null==(r=e["x-component-props"])?void 0:r.options);if(Array.isArray(n)){var r,o,i,l=n.find(function(e){return(null==e?void 0:e.value)===t});if(l)return null!=(o=null!=(i=l.label)?i:l.title)?o:t}return t}}}]);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CommonMapFieldInterface } from './schema';
|
|
10
|
+
export declare class CircleFieldInterface extends CommonMapFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
order: number;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
availableTypes: string[];
|
|
16
|
+
default: {
|
|
17
|
+
interface: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uiSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-component-designer': string;
|
|
23
|
+
'x-component-props': {};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CircleFieldInterface } from './circle';
|
|
10
|
+
import { LineStringFieldInterface } from './lineString';
|
|
11
|
+
import { PointFieldInterface } from './point';
|
|
12
|
+
import { PolygonFieldInterface } from './polygon';
|
|
13
|
+
export declare const fields: (typeof CircleFieldInterface)[];
|
|
14
|
+
export { CircleFieldInterface, LineStringFieldInterface, PointFieldInterface, PolygonFieldInterface };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CommonMapFieldInterface } from './schema';
|
|
10
|
+
export declare class LineStringFieldInterface extends CommonMapFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
order: number;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
availableTypes: string[];
|
|
16
|
+
default: {
|
|
17
|
+
interface: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uiSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-component-designer': string;
|
|
23
|
+
'x-component-props': {};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CommonMapFieldInterface } from './schema';
|
|
10
|
+
export declare class PointFieldInterface extends CommonMapFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
order: number;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
availableTypes: string[];
|
|
16
|
+
default: {
|
|
17
|
+
interface: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uiSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-component-designer': string;
|
|
23
|
+
'x-component-props': {};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CommonMapFieldInterface } from './schema';
|
|
10
|
+
export declare class PolygonFieldInterface extends CommonMapFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
order: number;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
availableTypes: string[];
|
|
16
|
+
default: {
|
|
17
|
+
interface: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uiSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-component-designer': string;
|
|
23
|
+
'x-component-props': {};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CollectionFieldInterface, type FieldInterfaceConfigure } from '@nocobase/client-v2';
|
|
10
|
+
export declare class CommonMapFieldInterface extends CollectionFieldInterface {
|
|
11
|
+
type: string;
|
|
12
|
+
group: string;
|
|
13
|
+
sortable: boolean;
|
|
14
|
+
titleUsable: boolean;
|
|
15
|
+
availableTypes: string[];
|
|
16
|
+
configure: FieldInterfaceConfigure;
|
|
17
|
+
protected createDefault(type: string): {
|
|
18
|
+
interface: string;
|
|
19
|
+
type: string;
|
|
20
|
+
uiSchema: {
|
|
21
|
+
type: string;
|
|
22
|
+
'x-component': string;
|
|
23
|
+
'x-component-designer': string;
|
|
24
|
+
'x-component-props': {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-map/client-v2",["ahooks","@emotion/css","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-map/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-map/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,a){return function(){"use strict";var u,c,l,f={488:function(e,t,n){n.d(t,{MZ:function(){return a},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="@nocobase/plugin-map";function a(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"]},t))}function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"]},n))}}},375:function(e){e.exports=i},477:function(e){e.exports=t},485:function(e){e.exports=n},694:function(e){e.exports=a},625:function(t){t.exports=e},59:function(e){e.exports=o},155:function(e){e.exports=r}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return f[e].call(n.exports,n,n.exports,p),n.exports}p.m=f,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+"."+({577:"e1fcc82fab0ef39b",641:"a19dd82baa053f9e",694:"5f486a695fdeb42a",720:"6ede563c5d95f038",872:"53cbb217b7708463"})[e]+".js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},p.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-map/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","@nocobase/plugin-map/client-v2:"+n),o.src=e),d[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(b=p.g.location+"");var d,b,h=p.g.document;if(!b&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(b=h.currentScript.src),!b)){var v=h.getElementsByTagName("script");if(v.length)for(var m=v.length-1;m>-1&&(!b||!/^http(s?):/.test(b));)b=v[m--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");p.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},p.f.j=function(e,t){var n=p.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},c=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)p.o(i,n)&&(p.m[n]=i[n]);a&&a(p)}for(e&&e(t);c<o.length;c++)r=o[c],p.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).forEach(c.bind(null,0)),l.push=c.bind(null,l.push.bind(l));var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-map/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",a=i.indexOf(o);e=a>=0?i.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-map/dist/client-v2/"}p.p=e}(),!function(){p.r(y),p.d(y,{default:function(){return s}});var e=p(485),t=p(694),n=p(488);function r(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}var o=(0,t.defineAction)({name:"setDefaultZoomLevel",title:(0,n.MZ)("Set default zoom level"),uiSchema:function(e){return"text"===e.model.props.displayStyle?null:{zoom:{title:(0,n.MZ)("Zoom"),"x-component":"NumberPicker","x-decorator":"FormItem","x-component-props":{precision:0}}}},defaultParams:{zoom:13},handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return e.model.setProps("zoom",t.zoom),[2]})},function(){var e=this,t=arguments;return new Promise(function(o,i){var a=n.apply(e,t);function u(e){r(a,o,i,u,c,"next",e)}function c(e){r(a,o,i,u,c,"throw",e)}u(void 0)})})()}});function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function a(e,t,n){return(a=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&c(o,n.prototype),o}).apply(null,arguments)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,e)})(e)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var s=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=u(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,f()?Reflect.construct(e,t||[],u(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&c(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.pluginSettingsManager.addMenuItem({key:"map",title:this.t("Map manager"),icon:"EnvironmentOutlined",aclSnippet:"pm.map.configuration"}),this.pluginSettingsManager.addPageTabItem({menuKey:"map",key:"index",title:this.t("Map manager"),componentLoader:function(){return p.e("872").then(p.bind(p,75))}}),this.flowEngine.registerActions({setDefaultZoomLevel:o}),this.flowEngine.registerModelLoaders({CircleFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},DisplayCircleFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},DisplayLineStringFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},DisplayPointFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},DisplayPolygonFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},LineStringFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},MapActionGroupModel:{loader:function(){return p.e("694").then(p.bind(p,709))}},MapBlockModel:{loader:function(){return Promise.all([p.e("641"),p.e("720")]).then(p.bind(p,883))}},MapFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},PointFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}},PolygonFieldModel:{loader:function(){return Promise.all([p.e("641"),p.e("577")]).then(p.bind(p,128))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(l(e.Plugin))}(),y}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-map/client-v2",["ahooks","@emotion/css","@nocobase/client-v2","antd","react","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-map/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-map/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/client-v2"],e.antd,e.react,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,c){return function(){"use strict";var u,a,l,f={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="@nocobase/plugin-map";function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"]},t))}function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"]},n))}}},375:function(e){e.exports=i},477:function(e){e.exports=t},485:function(e){e.exports=n},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=r},155:function(e){e.exports=o}},p={};function s(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return f[e].call(n.exports,n,n.exports,s),n.exports}s.m=f,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+"."+({577:"e1fcc82fab0ef39b",641:"ef67f0b66b92ff21",694:"5f486a695fdeb42a",720:"6ede563c5d95f038",872:"53cbb217b7708463"})[e]+".js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},s.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-map/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","@nocobase/plugin-map/client-v2:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(y=s.g.location+"");var b,y,d=s.g.document;if(!y&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(y=d.currentScript.src),!y)){var h=d.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!y||!/^http(s?):/.test(y));)y=h[v--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");s.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},s.f.j=function(e,t){var n=s.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),i=Error();s.l(o,function(t){if(s.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)s.o(i,n)&&(s.m[n]=i[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-map/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(o);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-map/dist/client-v2/"}s.p=e}(),!function(){s.r(m),s.d(m,{default:function(){return D}});var e=s(485),t=s(488),n=[{label:(0,t.MZ)("AMap"),value:"amap"},{label:(0,t.MZ)("Google Maps"),value:"google"}];function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var u;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,i,u;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return i=a,u=arguments,i=o(i),r(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(i,u||[],o(this).constructor):i.apply(this,u)),"type","object"),r(e,"group","map"),r(e,"sortable",!0),r(e,"titleUsable",!1),r(e,"availableTypes",["json"]),r(e,"configure",{items:[{name:"uiSchema.x-component-props.mapType",title:(0,t.MZ)("Map type"),component:"Select",required:!0,disabled:function(e){return!e.context.createOnly},defaultValue:"amap",componentProps:{showSearch:!1,allowClear:!1},options:n}]}),e}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&i(a,e),u=[{key:"createDefault",value:function(e){return{interface:e,type:e,uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(a.prototype,u),a}(e.CollectionFieldInterface);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var b=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=l(r),a(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(r,o||[],l(this).constructor):r.apply(this,o)),"name","circle"),a(e,"order",3),a(e,"title",(0,t.MZ)("Circle")),a(e,"description",(0,t.MZ)("Circle")),a(e,"availableTypes",["circle","json"]),a(e,"default",e.createDefault("circle")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&f(n,e),n}(u);function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var g=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=d(r),y(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(r,o||[],d(this).constructor):r.apply(this,o)),"name","lineString"),y(e,"order",2),y(e,"title",(0,t.MZ)("Line")),y(e,"description",(0,t.MZ)("Line")),y(e,"availableTypes",["lineString","json"]),y(e,"default",e.createDefault("lineString")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),n}(u);function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var E=[function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=w(r),O(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(r,o||[],w(this).constructor):r.apply(this,o)),"name","point"),O(e,"order",1),O(e,"title",(0,t.MZ)("Point")),O(e,"description",(0,t.MZ)("Point")),O(e,"availableTypes",["point","json"]),O(e,"default",e.createDefault("point")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_(n,e),n}(u),g,b,function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=S(r),P(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,M()?Reflect.construct(r,o||[],S(this).constructor):r.apply(this,o)),"name","polygon"),P(e,"order",4),P(e,"title",(0,t.MZ)("Polygon")),P(e,"description",(0,t.MZ)("Polygon")),P(e,"availableTypes",["polygon","json"]),P(e,"default",e.createDefault("polygon")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&x(n,e),n}(u)];function k(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}var T=(0,s(694).defineAction)({name:"setDefaultZoomLevel",title:(0,t.MZ)("Set default zoom level"),uiSchema:function(e){return"text"===e.model.props.displayStyle?null:{zoom:{title:(0,t.MZ)("Zoom"),"x-component":"NumberPicker","x-decorator":"FormItem","x-component-props":{precision:0}}}},defaultParams:{zoom:13},handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return e.model.setProps("zoom",t.zoom),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){k(i,r,o,c,u,"next",e)}function u(e){k(i,r,o,c,u,"throw",e)}c(void 0)})})()}});function R(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function C(e,t,n){return(C=B()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&F(o,n.prototype),o}).apply(null,arguments)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t="function"==typeof Map?new Map:void 0;return(q=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return C(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),F(n,e)})(e)}function B(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(B=function(){return!!e})()}var D=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=Z(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,B()?Reflect.construct(e,t||[],Z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&F(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces(E),this.app.addFieldInterfaceGroups({map:{label:(0,t.MZ)("Map-based geometry"),order:300}}),this.pluginSettingsManager.addMenuItem({key:"map",title:this.t("Map manager"),icon:"EnvironmentOutlined",aclSnippet:"pm.map.configuration"}),this.pluginSettingsManager.addPageTabItem({menuKey:"map",key:"index",title:this.t("Map manager"),componentLoader:function(){return s.e("872").then(s.bind(s,75))}}),this.flowEngine.registerActions({setDefaultZoomLevel:T}),this.flowEngine.registerModelLoaders({CircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayCircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayLineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},LineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},MapActionGroupModel:{loader:function(){return s.e("694").then(s.bind(s,709))}},MapBlockModel:{loader:function(){return Promise.all([s.e("641"),s.e("720")]).then(s.bind(s,883))}},MapFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){R(i,r,o,c,u,"next",e)}function u(e){R(i,r,o,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(q(e.Plugin))}(),m}()});
|
|
@@ -10,7 +10,44 @@
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { MapEditorType } from '../../../../shared/types';
|
|
12
12
|
export type OverlayOptions = google.maps.PolygonOptions & google.maps.MarkerOptions & google.maps.PolylineOptions;
|
|
13
|
+
type GoogleMapsOverlay = google.maps.Marker | google.maps.Polygon | google.maps.Polyline | google.maps.Circle;
|
|
14
|
+
export type GoogleMapsDrawingMode = 'marker' | 'polygon' | 'polyline' | 'circle' | null;
|
|
15
|
+
type GoogleMapsOverlayCompleteEvent = {
|
|
16
|
+
type: Exclude<GoogleMapsDrawingMode, null>;
|
|
17
|
+
overlay: GoogleMapsOverlay;
|
|
18
|
+
};
|
|
19
|
+
type OverlayCompleteListener = (event: GoogleMapsOverlayCompleteEvent) => void;
|
|
13
20
|
export declare const getDrawingMode: (type: MapEditorType) => "polygon" | "circle" | "marker" | "polyline";
|
|
21
|
+
export declare class GoogleMapsDrawingManager {
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
private readonly mapListeners;
|
|
24
|
+
private readonly options;
|
|
25
|
+
private drawingMode;
|
|
26
|
+
private draftOverlay;
|
|
27
|
+
private draftPath;
|
|
28
|
+
private circleCenter;
|
|
29
|
+
constructor(options: OverlayOptions & {
|
|
30
|
+
drawingMode?: GoogleMapsDrawingMode;
|
|
31
|
+
map?: google.maps.Map;
|
|
32
|
+
});
|
|
33
|
+
addListener(eventName: 'overlaycomplete', listener: OverlayCompleteListener): {
|
|
34
|
+
remove: () => void;
|
|
35
|
+
};
|
|
36
|
+
setDrawingMode(mode: GoogleMapsDrawingMode): void;
|
|
37
|
+
unbindAll(): void;
|
|
38
|
+
private bindMapEvents;
|
|
39
|
+
private clearMapEvents;
|
|
40
|
+
private resetDraft;
|
|
41
|
+
private handleClick;
|
|
42
|
+
private handlePathClick;
|
|
43
|
+
private handleCircleClick;
|
|
44
|
+
private updatePreview;
|
|
45
|
+
private updatePath;
|
|
46
|
+
private updateCircle;
|
|
47
|
+
private completePathOverlay;
|
|
48
|
+
private completeCircleOverlay;
|
|
49
|
+
private emitComplete;
|
|
50
|
+
}
|
|
14
51
|
export interface GoogleMapsCompProps {
|
|
15
52
|
value?: any;
|
|
16
53
|
onChange?: (value: number[]) => void;
|
|
@@ -31,10 +68,11 @@ export interface GoogleMapForwardedRefProps {
|
|
|
31
68
|
setOverlay: (t: MapEditorType, v: any, o?: OverlayOptions) => google.maps.MVCObject;
|
|
32
69
|
getOverlay: (t: MapEditorType, v: any, o?: OverlayOptions) => google.maps.MVCObject;
|
|
33
70
|
setFitView: (overlays: google.maps.MVCObject[]) => void;
|
|
34
|
-
createDraw: (onlyCreate?: boolean, additionalOptions?: OverlayOptions) =>
|
|
71
|
+
createDraw: (onlyCreate?: boolean, additionalOptions?: OverlayOptions) => GoogleMapsDrawingManager;
|
|
35
72
|
map: google.maps.Map;
|
|
36
73
|
overlay: google.maps.MVCObject;
|
|
37
|
-
drawingManager:
|
|
74
|
+
drawingManager: GoogleMapsDrawingManager;
|
|
38
75
|
errMessage?: string;
|
|
39
76
|
}
|
|
40
77
|
export declare const GoogleMapsCom: React.ForwardRefExoticComponent<GoogleMapsCompProps & React.RefAttributes<GoogleMapForwardedRefProps>>;
|
|
78
|
+
export {};
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.48",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
14
|
-
"@nocobase/client-v2": "2.1.0-beta.
|
|
15
|
-
"@nocobase/server": "2.1.0-beta.
|
|
16
|
-
"@nocobase/test": "2.1.0-beta.
|
|
13
|
+
"@nocobase/flow-engine": "2.1.0-beta.48",
|
|
14
|
+
"@nocobase/client-v2": "2.1.0-beta.48",
|
|
15
|
+
"@nocobase/server": "2.1.0-beta.48",
|
|
16
|
+
"@nocobase/test": "2.1.0-beta.48",
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"lodash": "4.18.1",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
"antd": "5.24.2",
|
|
24
24
|
"@formily/shared": "2.3.7",
|
|
25
25
|
"@formily/core": "2.3.7",
|
|
26
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
27
|
-
"@nocobase/database": "2.1.0-beta.
|
|
26
|
+
"@nocobase/actions": "2.1.0-beta.48",
|
|
27
|
+
"@nocobase/database": "2.1.0-beta.48",
|
|
28
28
|
"ahooks": "3.7.8"
|
|
29
29
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Block: Map",
|
|
4
4
|
"displayName.ru-RU": "Блок: Карта",
|
|
5
5
|
"displayName.zh-CN": "区块:地图",
|
|
6
|
-
"version": "2.1.0-beta.
|
|
6
|
+
"version": "2.1.0-beta.48",
|
|
7
7
|
"description": "Map block, support Gaode map and Google map, you can also extend more map types.",
|
|
8
8
|
"description.ru-RU": "Блок карты, поддерживает карты Gaode и Google, можно расширить поддержку других типов карт.",
|
|
9
9
|
"description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@nocobase/test": "2.x",
|
|
42
42
|
"@nocobase/utils": "2.x"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f8c27a286db015c5e433b48241f14c0412e50530",
|
|
45
45
|
"keywords": [
|
|
46
46
|
"Blocks"
|
|
47
47
|
]
|