@tachybase/plugin-block-map 0.23.8 → 0.23.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- (function(B,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("react"),require("@tachybase/client"),require("@tachybase/schema"),require("@ant-design/icons"),require("ahooks"),require("antd"),require("react-router-dom"),require("lodash"),require("@tachybase/components")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@tachybase/client","@tachybase/schema","@ant-design/icons","ahooks","antd","react-router-dom","lodash","@tachybase/components"],n):(B=typeof globalThis!="undefined"?globalThis:B||self,n(B["@tachybase/plugin-block-map"]={},B.jsxRuntime,B.react,B["@tachybase/client"],B["@tachybase/schema"],B["@ant-design/icons"],B.ahooks,B.antd,B["react-router-dom"],B.lodash,B["@tachybase/components"]))})(this,function(B,n,f,a,K,te,V,w,oe,pe,qe){"use strict";var Tt=Object.defineProperty,zt=Object.defineProperties;var Bt=Object.getOwnPropertyDescriptors;var je=Object.getOwnPropertySymbols;var Kt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var Pe=(B,n,f)=>n in B?Tt(B,n,{enumerable:!0,configurable:!0,writable:!0,value:f}):B[n]=f,O=(B,n)=>{for(var f in n||(n={}))Kt.call(n,f)&&Pe(B,f,n[f]);if(je)for(var f of je(n))Ut.call(n,f)&&Pe(B,f,n[f]);return B},J=(B,n)=>zt(B,Bt(n));var F=(B,n,f)=>Pe(B,typeof n!="symbol"?n+"":n,f);var he=(B,n,f)=>new Promise((a,K)=>{var te=oe=>{try{w(f.next(oe))}catch(pe){K(pe)}},V=oe=>{try{w(f.throw(oe))}catch(pe){K(pe)}},w=oe=>oe.done?a(oe.value):Promise.resolve(oe.value).then(te,V);w((f=f.apply(B,n)).next())});const ye="block-map";function H(e){return a.tval(e,{ns:[ye,"core"]})}function Z(){return a.useTranslation([ye,"core"])}const ke=[{label:H("AMap"),value:"amap"},{label:H("Google Maps"),value:"google"}],be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAMAAAC7OkrPAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEJQTFRFAAAA8Yti8Yti8Itj8Iti74tj8Itj8YtiKwADKwADKhw5Kh07KwADKwADKwADKwAD4odn1YBlKwADKwADKwADKwAD/5y7LQAAABZ0Uk5TAP/8/f/B/PYOHjY3CCozLP3XCSkvMhA05K4AAAC4SURBVHic7dXLDoIwEIXhwSsoLSrw/q8qbSAiMy3/oivj2czmS5omnVORdapVJJFKBSEL2mrrUurbpdXa5dTH5dXi9tTsGNtX0TFG1OT+7PdY2YdEGd0FuFmUwXWm5UAZbCTKYA3SUrXZQTHLHbUy2OlsMO0ultLsajLlbEWZMEUZ+ig5E6YKM2GqMBOmGKubW1D3ps6g1nnvA5uGa5Os85E9nmF2ebYkzeKhc9wre4V+GMeh317hDfXgCWigIGJbAAAAAElFTkSuQmCC",ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAYAAACM5Lr9AAAFkklEQVR42s3VaWxUVRjG8ddiEKPRxAQTCVSWLnZaWmjpTgulpYUBExP9Agou4IKAogUKAgItlNJCgUIXINFPfsFoDCjibkQRI0QIICAQWUpZugKtpcv0+DxyYqaTe2/vTLf58Etu7znnPf+0k44opQw5i5qsjIFs2APHoBZatFq+02vZeq94yyKs0dOjsAzOTCtuVtNKWtX0UpeaXqHU07tgt4ZnvuMa93Avz/CsniE2WIQV2iEaCDnQ8F/MTgZ4h2d4ljNgmZ4pFszDpmIRIuFP57YWDMcFu7uHMziLMyEKxJBl2MbbM6DZub2NQ3sUZ3K2vkMMGIdNKbi1ADqcZe1q2i7VKzibd8BCEE8GUQ3PQ4ez3KWcGNCbeAfv0neKm85hWRvqo+Hu1LJ2HuwTvAt3tkAciKbDIDO/7iE4l7X9rpqCA30pa3uLwt3nYRAIuIfV5mcWN6msnapf8G405IGQMGry+prB0DiloqPfwng3G3SLDltXnTt5S6PK3NnRr9jAFhDJyLsZAJcz8SGcjOr+xAa0XGGTpOfeSMrYUKcyKlx+gS1oSkbY9VXpm2+rjHKXX2ALm2TS2qq96duaVHp5u19gC5skbc3V05N23FWT8NIfsIVNkra6siGttE2llbX7h9JWhaZ6mfj+lfaJZW3Kn6DJJRNWXWqbgN+Y39jRqtDUKKkrL15PxfdjammrfyhpVmiqlNQVfx9KwX/cFJT6A7awSVLeu1CeUlinxu9o8QsphbUKTWUyfvn5Wcm511QSXvoDtrBJkpedewzaE/E58wdsYZMopSQ55+z+pKK6fo9KKqpXaDkAIgxLWnomK3H1JZVQ0tyv2ICW6XAvLHHJ6QD4K6GgRsVjQ3/g3WzQLffCKGHJqfHgisOXaNy2f/oU7+TdukGIUW5xJ0vic6+oWGzsS7yTd4NoncPiF594GC7FFlSrcVub+gTv4p36btE6h1Fc9nFn7IpzKmZrY5/gXbwTxI0O8xD77rGPYtZeVtE42Jt4B+8C8WAcNu6dPwZDzVh8PYzdcqdXcDbvgMdBPDHEOG7R0Xkxqy6oKAzpDZzNO0AMmIfFvH1kABwZk1epIotv9yjOxOyj+g4xYB4W/dbvlAAdozGsJ3Gmni0mzMPGLvyN6IMo/NojNt/qEZyFmR+CWLAIW3CYaDDUR+D/TTgGdwdncJaeKRbMw8bM/9XdosjlZ5VjU0O3cAZngXTBPCzqzV/cPQAXHeuqVBgu8IVj/TXFGXqWdME8LHLez55mRSw9qUI31fuEZzFjNogNFmFvHPQUACfC8IUbUlTvlbDcSsWzeobYYB42+vWfjDwbnn3c6zCewdnnQGwyD4t47UcjAXA2JO+qCi6ss4V7eUafFZuswn4wM8ex+LgKwqV2cC/OzAXxgnlY+KvfmxkIVaPyr6tRhbWWuId79RnxgnmYY+53VlaHLj2lRm6stRSSc0ph7xoQL1mEzfnWyhPQNrKgGgE1hrjGPTAExEvmYWGvfNOVPUErz6vhiDDCNez5GMQHVmFfd2Vq6MLD6smCGkNc4x4QH5iHPfXyV125H64NX1eFkOpO+I5reo/4wDws9KUDdhSPxFdNIGLc8R3XQHxkFfalHYnB8w6qYRuqO+E7roH4yDws5MX9dtwHlYF5lQi6qYjPfKfXxEcWYbO/sKtsBP50QxFFI/D/De8qQLrBPCwYizY9M2r+of/D+Mx3ID6zDJv1uaVwGfAIBDqGJsbhZ9eQ/BuK+OwYlhzPNe7hXh9Yhe0zwqBB4IAYouCZn1wIXH5GEZ/d1sjBMzzrBfOwoBf2GWFYBMS4C03JWRA087OaoBmf3uCz5zrP8Kx9lmF7jXiE2RbBs95ghB0MIo8/pS0OeJAzvOBLmKY//BAGURBN+jmMa3qPkLdh/wKOL8SpLbnYFgAAAABJRU5ErkJggg==",Fe=(e,o,t)=>{const r=o==null?void 0:o.reduce((i,s,l)=>l===o.length-1&&(t==="o2m"||t==="m2m")?i==null?void 0:i.map(m=>m[s]).filter(m=>m!=null):i==null?void 0:i[s],e);return t==="o2m"||t==="m2m"?r:[r]};var Ve=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function We(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oe={exports:{}};(function(e,o){(function(t,r){e.exports=r()})(Ve,function(){function t(c){var y=[];return c.AMapUI&&y.push(r(c.AMapUI)),c.Loca&&y.push(i(c.Loca)),Promise.all(y)}function r(c){return new Promise(function(y,p){var d=[];if(c.plugins)for(var M=0;M<c.plugins.length;M+=1)l.AMapUI.plugins.indexOf(c.plugins[M])==-1&&d.push(c.plugins[M]);if(m.AMapUI===s.failed)p("前次请求 AMapUI 失败");else if(m.AMapUI===s.notload){m.AMapUI=s.loading,l.AMapUI.version=c.version||l.AMapUI.version,M=l.AMapUI.version;var D=document.body||document.head,U=document.createElement("script");U.type="text/javascript",U.src="https://webapi.amap.com/ui/"+M+"/main.js",U.onerror=function(I){m.AMapUI=s.failed,p("请求 AMapUI 失败")},U.onload=function(){if(m.AMapUI=s.loaded,d.length)window.AMapUI.loadUI(d,function(){for(var I=0,_=d.length;I<_;I++){var Y=d[I].split("/").slice(-1)[0];window.AMapUI[Y]=arguments[I]}for(y();v.AMapUI.length;)v.AMapUI.splice(0,1)[0]()});else for(y();v.AMapUI.length;)v.AMapUI.splice(0,1)[0]()},D.appendChild(U)}else m.AMapUI===s.loaded?c.version&&c.version!==l.AMapUI.version?p("不允许多个版本 AMapUI 混用"):d.length?window.AMapUI.loadUI(d,function(){for(var I=0,_=d.length;I<_;I++){var Y=d[I].split("/").slice(-1)[0];window.AMapUI[Y]=arguments[I]}y()}):y():c.version&&c.version!==l.AMapUI.version?p("不允许多个版本 AMapUI 混用"):v.AMapUI.push(function(I){I?p(I):d.length?window.AMapUI.loadUI(d,function(){for(var _=0,Y=d.length;_<Y;_++){var N=d[_].split("/").slice(-1)[0];window.AMapUI[N]=arguments[_]}y()}):y()})})}function i(c){return new Promise(function(y,p){if(m.Loca===s.failed)p("前次请求 Loca 失败");else if(m.Loca===s.notload){m.Loca=s.loading,l.Loca.version=c.version||l.Loca.version;var d=l.Loca.version,M=l.AMap.version.startsWith("2"),D=d.startsWith("2");if(M&&!D||!M&&D)p("JSAPI 与 Loca 版本不对应!!");else{M=l.key,D=document.body||document.head;var U=document.createElement("script");U.type="text/javascript",U.src="https://webapi.amap.com/loca?v="+d+"&key="+M,U.onerror=function(I){m.Loca=s.failed,p("请求 AMapUI 失败")},U.onload=function(){for(m.Loca=s.loaded,y();v.Loca.length;)v.Loca.splice(0,1)[0]()},D.appendChild(U)}}else m.Loca===s.loaded?c.version&&c.version!==l.Loca.version?p("不允许多个版本 Loca 混用"):y():c.version&&c.version!==l.Loca.version?p("不允许多个版本 Loca 混用"):v.Loca.push(function(I){I?p(I):p()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var s;(function(c){c.notload="notload",c.loading="loading",c.loaded="loaded",c.failed="failed"})(s||(s={}));var l={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},m={AMap:s.notload,AMapUI:s.notload,Loca:s.notload},v={AMap:[],AMapUI:[],Loca:[]},S=[],A=function(c){typeof c=="function"&&(m.AMap===s.loaded?c(window.AMap):S.push(c))};return{load:function(c){return new Promise(function(y,p){if(m.AMap==s.failed)p("");else if(m.AMap==s.notload){var d=c.key,M=c.version,D=c.plugins;d?(window.AMap&&location.host!=="lbs.amap.com"&&p("禁止多种API加载方式混用"),l.key=d,l.AMap.version=M||l.AMap.version,l.AMap.plugins=D||l.AMap.plugins,m.AMap=s.loading,M=document.body||document.head,window.___onAPILoaded=function(I){if(delete window.___onAPILoaded,I)m.AMap=s.failed,p(I);else for(m.AMap=s.loaded,t(c).then(function(){y(window.AMap)}).catch(p);S.length;)S.splice(0,1)[0]()},D=document.createElement("script"),D.type="text/javascript",D.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+l.AMap.version+"&key="+d+"&plugin="+l.AMap.plugins.join(","),D.onerror=function(I){m.AMap=s.failed,p(I)},M.appendChild(D)):p("请填写key")}else if(m.AMap==s.loaded)if(c.key&&c.key!==l.key)p("多个不一致的 key");else if(c.version&&c.version!==l.AMap.version)p("不允许多个版本 JSAPI 混用");else{if(d=[],c.plugins)for(M=0;M<c.plugins.length;M+=1)l.AMap.plugins.indexOf(c.plugins[M])==-1&&d.push(c.plugins[M]);d.length?window.AMap.plugin(d,function(){t(c).then(function(){y(window.AMap)}).catch(p)}):t(c).then(function(){y(window.AMap)}).catch(p)}else if(c.key&&c.key!==l.key)p("多个不一致的 key");else if(c.version&&c.version!==l.AMap.version)p("不允许多个版本 JSAPI 混用");else{var U=[];if(c.plugins)for(M=0;M<c.plugins.length;M+=1)l.AMap.plugins.indexOf(c.plugins[M])==-1&&U.push(c.plugins[M]);A(function(){U.length?window.AMap.plugin(U,function(){t(c).then(function(){y(window.AMap)}).catch(p)}):t(c).then(function(){y(window.AMap)}).catch(p)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,l={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},m={AMap:s.notload,AMapUI:s.notload,Loca:s.notload},v={AMap:[],AMapUI:[],Loca:[]}}}})})(Oe);var Ye=Oe.exports;const Je=We(Ye),Ee="map-configuration",ve=e=>`TACHYBASE_PLUGIN_MAP_CONFIGURATION_${e}`,Ae=e=>{const o=f.useMemo(()=>{const r=sessionStorage.getItem(ve(e));return r&&JSON.parse(r)},[e]),{data:t}=a.useRequest({resource:Ee,action:"get",params:{type:e}},{onSuccess(r){sessionStorage.setItem(ve(e),JSON.stringify(r==null?void 0:r.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!o});return o||(t==null?void 0:t.data)},Ze=e=>{const{aMap:o,toCenter:t}=e,{t:r}=Z(),i=f.useRef(),[s,l]=f.useState([]);f.useEffect(()=>{o==null||o.plugin("AMap.PlaceSearch",()=>{i.current=new o.PlaceSearch({city:"全国",pageSize:30})})},[o]);const{run:m}=V.useDebounceFn(S=>{i.current&&i.current.search(S||" ",(A,c)=>{if(A==="complete")l(c.poiList.pois.map(y=>J(O({},y),{label:`${y.name}-${y.address}`,value:y.id})));else{if(A==="no_data"){l([]);return}w.message.error(r("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}),v=S=>{const A=s.find(c=>c.value===S);A!=null&&A.location&&t(A.location)};return n.jsx("div",{className:a.css`
1
+ (function(B,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("react"),require("@tachybase/client"),require("@tachybase/schema"),require("@ant-design/icons"),require("ahooks"),require("antd"),require("react-router-dom"),require("lodash"),require("@tachybase/components")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@tachybase/client","@tachybase/schema","@ant-design/icons","ahooks","antd","react-router-dom","lodash","@tachybase/components"],n):(B=typeof globalThis!="undefined"?globalThis:B||self,n(B["@tachybase/plugin-block-map"]={},B.jsxRuntime,B.react,B["@tachybase/client"],B["@tachybase/schema"],B["@ant-design/icons"],B.ahooks,B.antd,B["react-router-dom"],B.lodash,B["@tachybase/components"]))})(this,function(B,n,f,a,K,te,V,w,oe,pe,qe){"use strict";var Tt=Object.defineProperty,zt=Object.defineProperties;var Bt=Object.getOwnPropertyDescriptors;var je=Object.getOwnPropertySymbols;var Kt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var Ie=(B,n,f)=>n in B?Tt(B,n,{enumerable:!0,configurable:!0,writable:!0,value:f}):B[n]=f,O=(B,n)=>{for(var f in n||(n={}))Kt.call(n,f)&&Ie(B,f,n[f]);if(je)for(var f of je(n))Ut.call(n,f)&&Ie(B,f,n[f]);return B},J=(B,n)=>zt(B,Bt(n));var F=(B,n,f)=>Ie(B,typeof n!="symbol"?n+"":n,f);var he=(B,n,f)=>new Promise((a,K)=>{var te=oe=>{try{w(f.next(oe))}catch(pe){K(pe)}},V=oe=>{try{w(f.throw(oe))}catch(pe){K(pe)}},w=oe=>oe.done?a(oe.value):Promise.resolve(oe.value).then(te,V);w((f=f.apply(B,n)).next())});const ye="block-map";function H(e){return a.tval(e,{ns:[ye,"core"]})}function Z(){return a.useTranslation([ye,"core"])}const ke=[{label:H("AMap"),value:"amap"},{label:H("Google Maps"),value:"google"}],be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAMAAAC7OkrPAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEJQTFRFAAAA8Yti8Yti8Itj8Iti74tj8Itj8YtiKwADKwADKhw5Kh07KwADKwADKwADKwAD4odn1YBlKwADKwADKwADKwAD/5y7LQAAABZ0Uk5TAP/8/f/B/PYOHjY3CCozLP3XCSkvMhA05K4AAAC4SURBVHic7dXLDoIwEIXhwSsoLSrw/q8qbSAiMy3/oivj2czmS5omnVORdapVJJFKBSEL2mrrUurbpdXa5dTH5dXi9tTsGNtX0TFG1OT+7PdY2YdEGd0FuFmUwXWm5UAZbCTKYA3SUrXZQTHLHbUy2OlsMO0ultLsajLlbEWZMEUZ+ig5E6YKM2GqMBOmGKubW1D3ps6g1nnvA5uGa5Os85E9nmF2ebYkzeKhc9wre4V+GMeh317hDfXgCWigIGJbAAAAAElFTkSuQmCC",ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAYAAACM5Lr9AAAFkklEQVR42s3VaWxUVRjG8ddiEKPRxAQTCVSWLnZaWmjpTgulpYUBExP9Agou4IKAogUKAgItlNJCgUIXINFPfsFoDCjibkQRI0QIICAQWUpZugKtpcv0+DxyYqaTe2/vTLf58Etu7znnPf+0k44opQw5i5qsjIFs2APHoBZatFq+02vZeq94yyKs0dOjsAzOTCtuVtNKWtX0UpeaXqHU07tgt4ZnvuMa93Avz/CsniE2WIQV2iEaCDnQ8F/MTgZ4h2d4ljNgmZ4pFszDpmIRIuFP57YWDMcFu7uHMziLMyEKxJBl2MbbM6DZub2NQ3sUZ3K2vkMMGIdNKbi1ADqcZe1q2i7VKzibd8BCEE8GUQ3PQ4ez3KWcGNCbeAfv0neKm85hWRvqo+Hu1LJ2HuwTvAt3tkAciKbDIDO/7iE4l7X9rpqCA30pa3uLwt3nYRAIuIfV5mcWN6msnapf8G405IGQMGry+prB0DiloqPfwng3G3SLDltXnTt5S6PK3NnRr9jAFhDJyLsZAJcz8SGcjOr+xAa0XGGTpOfeSMrYUKcyKlx+gS1oSkbY9VXpm2+rjHKXX2ALm2TS2qq96duaVHp5u19gC5skbc3V05N23FWT8NIfsIVNkra6siGttE2llbX7h9JWhaZ6mfj+lfaJZW3Kn6DJJRNWXWqbgN+Y39jRqtDUKKkrL15PxfdjammrfyhpVmiqlNQVfx9KwX/cFJT6A7awSVLeu1CeUlinxu9o8QsphbUKTWUyfvn5Wcm511QSXvoDtrBJkpedewzaE/E58wdsYZMopSQ55+z+pKK6fo9KKqpXaDkAIgxLWnomK3H1JZVQ0tyv2ICW6XAvLHHJ6QD4K6GgRsVjQ3/g3WzQLffCKGHJqfHgisOXaNy2f/oU7+TdukGIUW5xJ0vic6+oWGzsS7yTd4NoncPiF594GC7FFlSrcVub+gTv4p36btE6h1Fc9nFn7IpzKmZrY5/gXbwTxI0O8xD77rGPYtZeVtE42Jt4B+8C8WAcNu6dPwZDzVh8PYzdcqdXcDbvgMdBPDHEOG7R0Xkxqy6oKAzpDZzNO0AMmIfFvH1kABwZk1epIotv9yjOxOyj+g4xYB4W/dbvlAAdozGsJ3Gmni0mzMPGLvyN6IMo/NojNt/qEZyFmR+CWLAIW3CYaDDUR+D/TTgGdwdncJaeKRbMw8bM/9XdosjlZ5VjU0O3cAZngXTBPCzqzV/cPQAXHeuqVBgu8IVj/TXFGXqWdME8LHLez55mRSw9qUI31fuEZzFjNogNFmFvHPQUACfC8IUbUlTvlbDcSsWzeobYYB42+vWfjDwbnn3c6zCewdnnQGwyD4t47UcjAXA2JO+qCi6ss4V7eUafFZuswn4wM8ex+LgKwqV2cC/OzAXxgnlY+KvfmxkIVaPyr6tRhbWWuId79RnxgnmYY+53VlaHLj2lRm6stRSSc0ph7xoQL1mEzfnWyhPQNrKgGgE1hrjGPTAExEvmYWGvfNOVPUErz6vhiDDCNez5GMQHVmFfd2Vq6MLD6smCGkNc4x4QH5iHPfXyV125H64NX1eFkOpO+I5reo/4wDws9KUDdhSPxFdNIGLc8R3XQHxkFfalHYnB8w6qYRuqO+E7roH4yDws5MX9dtwHlYF5lQi6qYjPfKfXxEcWYbO/sKtsBP50QxFFI/D/De8qQLrBPCwYizY9M2r+of/D+Mx3ID6zDJv1uaVwGfAIBDqGJsbhZ9eQ/BuK+OwYlhzPNe7hXh9Yhe0zwqBB4IAYouCZn1wIXH5GEZ/d1sjBMzzrBfOwoBf2GWFYBMS4C03JWRA087OaoBmf3uCz5zrP8Kx9lmF7jXiE2RbBs95ghB0MIo8/pS0OeJAzvOBLmKY//BAGURBN+jmMa3qPkLdh/wKOL8SpLbnYFgAAAABJRU5ErkJggg==",Fe=(e,o,t)=>{const r=o==null?void 0:o.reduce((i,s,l)=>l===o.length-1&&(t==="o2m"||t==="m2m")?i==null?void 0:i.map(m=>m[s]).filter(m=>m!=null):i==null?void 0:i[s],e);return t==="o2m"||t==="m2m"?r:[r]};var Ve=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function We(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oe={exports:{}};(function(e,o){(function(t,r){e.exports=r()})(Ve,function(){function t(c){var y=[];return c.AMapUI&&y.push(r(c.AMapUI)),c.Loca&&y.push(i(c.Loca)),Promise.all(y)}function r(c){return new Promise(function(y,p){var d=[];if(c.plugins)for(var A=0;A<c.plugins.length;A+=1)l.AMapUI.plugins.indexOf(c.plugins[A])==-1&&d.push(c.plugins[A]);if(m.AMapUI===s.failed)p("前次请求 AMapUI 失败");else if(m.AMapUI===s.notload){m.AMapUI=s.loading,l.AMapUI.version=c.version||l.AMapUI.version,A=l.AMapUI.version;var D=document.body||document.head,U=document.createElement("script");U.type="text/javascript",U.src="https://webapi.amap.com/ui/"+A+"/main.js",U.onerror=function(P){m.AMapUI=s.failed,p("请求 AMapUI 失败")},U.onload=function(){if(m.AMapUI=s.loaded,d.length)window.AMapUI.loadUI(d,function(){for(var P=0,_=d.length;P<_;P++){var Y=d[P].split("/").slice(-1)[0];window.AMapUI[Y]=arguments[P]}for(y();v.AMapUI.length;)v.AMapUI.splice(0,1)[0]()});else for(y();v.AMapUI.length;)v.AMapUI.splice(0,1)[0]()},D.appendChild(U)}else m.AMapUI===s.loaded?c.version&&c.version!==l.AMapUI.version?p("不允许多个版本 AMapUI 混用"):d.length?window.AMapUI.loadUI(d,function(){for(var P=0,_=d.length;P<_;P++){var Y=d[P].split("/").slice(-1)[0];window.AMapUI[Y]=arguments[P]}y()}):y():c.version&&c.version!==l.AMapUI.version?p("不允许多个版本 AMapUI 混用"):v.AMapUI.push(function(P){P?p(P):d.length?window.AMapUI.loadUI(d,function(){for(var _=0,Y=d.length;_<Y;_++){var N=d[_].split("/").slice(-1)[0];window.AMapUI[N]=arguments[_]}y()}):y()})})}function i(c){return new Promise(function(y,p){if(m.Loca===s.failed)p("前次请求 Loca 失败");else if(m.Loca===s.notload){m.Loca=s.loading,l.Loca.version=c.version||l.Loca.version;var d=l.Loca.version,A=l.AMap.version.startsWith("2"),D=d.startsWith("2");if(A&&!D||!A&&D)p("JSAPI 与 Loca 版本不对应!!");else{A=l.key,D=document.body||document.head;var U=document.createElement("script");U.type="text/javascript",U.src="https://webapi.amap.com/loca?v="+d+"&key="+A,U.onerror=function(P){m.Loca=s.failed,p("请求 AMapUI 失败")},U.onload=function(){for(m.Loca=s.loaded,y();v.Loca.length;)v.Loca.splice(0,1)[0]()},D.appendChild(U)}}else m.Loca===s.loaded?c.version&&c.version!==l.Loca.version?p("不允许多个版本 Loca 混用"):y():c.version&&c.version!==l.Loca.version?p("不允许多个版本 Loca 混用"):v.Loca.push(function(P){P?p(P):p()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var s;(function(c){c.notload="notload",c.loading="loading",c.loaded="loaded",c.failed="failed"})(s||(s={}));var l={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},m={AMap:s.notload,AMapUI:s.notload,Loca:s.notload},v={AMap:[],AMapUI:[],Loca:[]},S=[],M=function(c){typeof c=="function"&&(m.AMap===s.loaded?c(window.AMap):S.push(c))};return{load:function(c){return new Promise(function(y,p){if(m.AMap==s.failed)p("");else if(m.AMap==s.notload){var d=c.key,A=c.version,D=c.plugins;d?(window.AMap&&location.host!=="lbs.amap.com"&&p("禁止多种API加载方式混用"),l.key=d,l.AMap.version=A||l.AMap.version,l.AMap.plugins=D||l.AMap.plugins,m.AMap=s.loading,A=document.body||document.head,window.___onAPILoaded=function(P){if(delete window.___onAPILoaded,P)m.AMap=s.failed,p(P);else for(m.AMap=s.loaded,t(c).then(function(){y(window.AMap)}).catch(p);S.length;)S.splice(0,1)[0]()},D=document.createElement("script"),D.type="text/javascript",D.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+l.AMap.version+"&key="+d+"&plugin="+l.AMap.plugins.join(","),D.onerror=function(P){m.AMap=s.failed,p(P)},A.appendChild(D)):p("请填写key")}else if(m.AMap==s.loaded)if(c.key&&c.key!==l.key)p("多个不一致的 key");else if(c.version&&c.version!==l.AMap.version)p("不允许多个版本 JSAPI 混用");else{if(d=[],c.plugins)for(A=0;A<c.plugins.length;A+=1)l.AMap.plugins.indexOf(c.plugins[A])==-1&&d.push(c.plugins[A]);d.length?window.AMap.plugin(d,function(){t(c).then(function(){y(window.AMap)}).catch(p)}):t(c).then(function(){y(window.AMap)}).catch(p)}else if(c.key&&c.key!==l.key)p("多个不一致的 key");else if(c.version&&c.version!==l.AMap.version)p("不允许多个版本 JSAPI 混用");else{var U=[];if(c.plugins)for(A=0;A<c.plugins.length;A+=1)l.AMap.plugins.indexOf(c.plugins[A])==-1&&U.push(c.plugins[A]);M(function(){U.length?window.AMap.plugin(U,function(){t(c).then(function(){y(window.AMap)}).catch(p)}):t(c).then(function(){y(window.AMap)}).catch(p)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,l={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},m={AMap:s.notload,AMapUI:s.notload,Loca:s.notload},v={AMap:[],AMapUI:[],Loca:[]}}}})})(Oe);var Ye=Oe.exports;const Je=We(Ye),Ee="map-configuration",ve=e=>`TACHYBASE_PLUGIN_MAP_CONFIGURATION_${e}`,Me=e=>{const o=f.useMemo(()=>{const r=sessionStorage.getItem(ve(e));return r&&JSON.parse(r)},[e]),{data:t}=a.useRequest({resource:Ee,action:"get",params:{type:e}},{onSuccess(r){sessionStorage.setItem(ve(e),JSON.stringify(r==null?void 0:r.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!o});return o||(t==null?void 0:t.data)},Ze=e=>{const{aMap:o,toCenter:t}=e,{t:r}=Z(),i=f.useRef(),[s,l]=f.useState([]);f.useEffect(()=>{o==null||o.plugin("AMap.PlaceSearch",()=>{i.current=new o.PlaceSearch({city:"全国",pageSize:30})})},[o]);const{run:m}=V.useDebounceFn(S=>{i.current&&i.current.search(S||" ",(M,c)=>{if(M==="complete")l(c.poiList.pois.map(y=>J(O({},y),{label:`${y.name}-${y.address}`,value:y.id})));else{if(M==="no_data"){l([]);return}w.message.error(r("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}),v=S=>{const M=s.find(c=>c.value===S);M!=null&&M.location&&t(M.location)};return n.jsx("div",{className:a.css`
2
2
  position: absolute;
3
3
  top: 10px;
4
4
  left: 10px;
5
5
  z-index: 10;
6
6
  width: calc(100% - 20px);
7
- `,children:n.jsx(w.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:r("Enter keywords to search"),filterOption:!1,onSearch:m,onSelect:v,options:s,popupMatchSelectWidth:!1})})},Me={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(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},Ce=f.forwardRef((e,o)=>{const{accessKey:t,securityJsCode:r}=Ae(e.mapType)||{},{value:i,onChange:s,block:l=!1,readonly:m,disabled:v=l,zoom:S=13,overlayCommonOptions:A}=e,{t:c}=Z(),y=K.useFieldSchema(),p=f.useRef(),d=f.useRef(),M=f.useRef(),[D,U]=f.useState([]),[I,_]=f.useState(""),{getField:Y}=a.useCollection_deprecated(),N=f.useMemo(()=>{if(e.type)return e.type;const g=Y(y==null?void 0:y.name);return g==null?void 0:g.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),T=f.useRef(),z=f.useRef(null),R=oe.useNavigate(),Q=f.useRef(`tachybase-map-${N||""}-${Date.now().toString(32)}`),{modal:ee}=w.App.useApp(),[X]=f.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1},A)),se=V.useMemoizedFn(()=>{T.current&&T.current.remove()}),re=V.useMemoizedFn(()=>{(!v||l)&&N!=="point"&&z.current&&(z.current.setTarget(T.current),z.current.open())}),P=V.useMemoizedFn((g,u=!1)=>{let h=null;if(N==="point"){const{lat:C,lng:G}=g.getPosition();h=[G,C]}else if(N==="polygon"||N==="lineString"){if(h=g.getPath().map(C=>[C.lng,C.lat]),h.length<2)return}else if(N==="circle"){const C=g.getCenter(),G=g.getRadius();h=[C.lng,C.lat,G]}u||(se(),T.current=g,re()),s==null||s(h)}),W=V.useMemoizedFn((g=N)=>{const u=Me[g];if(u&&"editor"in u&&!z.current)return z.current=new p.current[u.editor](d.current,null,{createOptions:X,editOptions:X,controlPoint:J(O({},X),{strokeWeight:3}),midControlPoint:J(O({},X),{strokeWeight:2,fillColor:"#fff"})}),z.current.on("adjust",function({target:h}){P(h,!0)}),z.current.on("move",function({target:h}){P(h,!0)}),z.current}),E=V.useMemoizedFn((g=N)=>{var h;if(!M.current||(h=z.current)!=null&&h.getTarget())return;const u=Me[g];u&&M.current[u.mouseTool](O({},X))}),$=V.useMemoizedFn((g=N)=>{M.current||(M.current=new p.current.MouseTool(d.current),M.current.on("draw",function({obj:u}){P(u)}),E(g))}),x=(g,u)=>{d.current&&d.current.setZoomAndCenter(18,g,u)},L=()=>{const g=()=>{se(),z.current&&(z.current.setTarget(),z.current.close()),s==null||s(null)};ee.confirm({title:c("Clear the canvas"),content:c("Are you sure to clear the canvas?"),okText:c("Confirm"),cancelText:c("Cancel"),getContainer:()=>document.getElementById(Q.current),onOk(){g()}})},b=()=>{T.current&&d.current.setFitView([T.current])},k=f.useCallback((g=N,u=i,h)=>{const C=Me[g];if(!C)return;const G=O(O({},X),h);return"transformOptions"in C?Object.assign(G,C.transformOptions(u)):"propertyKey"in C&&(G[C.propertyKey]=u),new p.current[C.overlay](G)},[X]),j=(g=N,u=i,h)=>{if(!p.current)return;const C=k(g,u,h);return C.setMap(d.current),C};f.useEffect(()=>{if(!p.current||!i||!m&&T.current)return;const g=j();d.current.setFitView([g]),T.current=g,v||(W(),re())},[i,D,N,X,v,m]),f.useEffect(()=>{var g,u,h;M.current&&(v?((g=M.current)==null||g.close(),(u=z.current)==null||u.close()):(E(),(h=z.current)==null||h.open()))},[v]),f.useEffect(()=>{!p.current||!N||v||($(),W())},[v,D,N]),f.useEffect(()=>{var u,h;if(!i&&(M.current||z.current)&&(se(),z.current&&(z.current.setTarget(),z.current.close()),s==null||s(null)),!M.current||!z.current)return;z.current.getTarget()?(h=(u=M.current).close)==null||h.call(u):E()},[N,i]),f.useEffect(()=>{if(!t||d.current)return;r&&(window._AMapSecurityConfig={[r.endsWith("_AMapService")?"serviceHOST":"securityJsCode"]:r});const g=window.define;return window.define=void 0,Je.load({key:t,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(u=>(window.define=g,requestIdleCallback(()=>{d.current=new u.Map(Q.current,{resizeEnable:!0,zoom:S}),p.current=u,_(""),U([])}))).catch(u=>{typeof u=="string"?u.includes("多个不一致的 key")?_(c("The AccessKey is incorrect, please check it")):_(u):(u==null?void 0:u.type)==="error"&&_("Something went wrong, please refresh the page and try again")}),()=>{var u;(u=d.current)==null||u.destroy(),p.current=null,d.current=null,M.current=null,z.current=null}},[t,N,r]),f.useImperativeHandle(o,()=>({setOverlay:j,getOverlay:k,createMouseTool:$,createEditor:W,executeMouseTool:E,aMap:p.current,map:d.current,overlay:T.current,mouseTool:()=>M.current,editor:()=>z.current,errMessage:I}));const q=a.useApp();return!t||I?n.jsx(w.Alert,{action:n.jsx(w.Button,{type:"primary",onClick:()=>R(q.systemSettingsManager.getRoutePath("map")),children:c("Go to the configuration page")}),message:I||c("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):n.jsxs("div",{className:a.css`
7
+ `,children:n.jsx(w.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:r("Enter keywords to search"),filterOption:!1,onSearch:m,onSelect:v,options:s,popupMatchSelectWidth:!1})})},Ae={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(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},Ce=f.forwardRef((e,o)=>{const{accessKey:t,securityJsCode:r}=Me(e.mapType)||{},{value:i,onChange:s,block:l=!1,readonly:m,disabled:v=l,zoom:S=13,overlayCommonOptions:M}=e,{t:c}=Z(),y=K.useFieldSchema(),p=f.useRef(),d=f.useRef(),A=f.useRef(),[D,U]=f.useState([]),[P,_]=f.useState(""),{getField:Y}=a.useCollection_deprecated(),N=f.useMemo(()=>{if(e.type)return e.type;const g=Y(y==null?void 0:y.name);return g==null?void 0:g.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),T=f.useRef(),z=f.useRef(null),R=oe.useNavigate(),Q=f.useRef(`tachybase-map-${N||""}-${Date.now().toString(32)}`),{modal:ee}=w.App.useApp(),[X]=f.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1},M)),se=V.useMemoizedFn(()=>{T.current&&T.current.remove()}),re=V.useMemoizedFn(()=>{(!v||l)&&N!=="point"&&z.current&&(z.current.setTarget(T.current),z.current.open())}),I=V.useMemoizedFn((g,u=!1)=>{let h=null;if(N==="point"){const{lat:C,lng:G}=g.getPosition();h=[G,C]}else if(N==="polygon"||N==="lineString"){if(h=g.getPath().map(C=>[C.lng,C.lat]),h.length<2)return}else if(N==="circle"){const C=g.getCenter(),G=g.getRadius();h=[C.lng,C.lat,G]}u||(se(),T.current=g,re()),s==null||s(h)}),W=V.useMemoizedFn((g=N)=>{const u=Ae[g];if(u&&"editor"in u&&!z.current)return z.current=new p.current[u.editor](d.current,null,{createOptions:X,editOptions:X,controlPoint:J(O({},X),{strokeWeight:3}),midControlPoint:J(O({},X),{strokeWeight:2,fillColor:"#fff"})}),z.current.on("adjust",function({target:h}){I(h,!0)}),z.current.on("move",function({target:h}){I(h,!0)}),z.current}),E=V.useMemoizedFn((g=N)=>{var h;if(!A.current||(h=z.current)!=null&&h.getTarget())return;const u=Ae[g];u&&A.current[u.mouseTool](O({},X))}),$=V.useMemoizedFn((g=N)=>{A.current||(A.current=new p.current.MouseTool(d.current),A.current.on("draw",function({obj:u}){I(u)}),E(g))}),x=(g,u)=>{d.current&&d.current.setZoomAndCenter(18,g,u)},L=()=>{const g=()=>{se(),z.current&&(z.current.setTarget(),z.current.close()),s==null||s(null)};ee.confirm({title:c("Clear the canvas"),content:c("Are you sure to clear the canvas?"),okText:c("Confirm"),cancelText:c("Cancel"),getContainer:()=>document.getElementById(Q.current),onOk(){g()}})},b=()=>{T.current&&d.current.setFitView([T.current])},k=f.useCallback((g=N,u=i,h)=>{const C=Ae[g];if(!C)return;const G=O(O({},X),h);return"transformOptions"in C?Object.assign(G,C.transformOptions(u)):"propertyKey"in C&&(G[C.propertyKey]=u),new p.current[C.overlay](G)},[X]),j=(g=N,u=i,h)=>{if(!p.current)return;const C=k(g,u,h);return C.setMap(d.current),C};f.useEffect(()=>{if(!p.current||!i||!m&&T.current)return;const g=j();d.current.setFitView([g]),T.current=g,v||(W(),re())},[i,D,N,X,v,m]),f.useEffect(()=>{var g,u,h;A.current&&(v?((g=A.current)==null||g.close(),(u=z.current)==null||u.close()):(E(),(h=z.current)==null||h.open()))},[v]),f.useEffect(()=>{!p.current||!N||v||($(),W())},[v,D,N]),f.useEffect(()=>{var u,h;if(!i&&(A.current||z.current)&&(se(),z.current&&(z.current.setTarget(),z.current.close()),s==null||s(null)),!A.current||!z.current)return;z.current.getTarget()?(h=(u=A.current).close)==null||h.call(u):E()},[N,i]),f.useEffect(()=>{if(!t||d.current)return;r&&(window._AMapSecurityConfig={[r.endsWith("_AMapService")?"serviceHOST":"securityJsCode"]:r});const g=window.define;return window.define=void 0,Je.load({key:t,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(u=>(window.define=g,requestIdleCallback(()=>{d.current=new u.Map(Q.current,{resizeEnable:!0,zoom:S}),p.current=u,_(""),U([])}))).catch(u=>{typeof u=="string"?u.includes("多个不一致的 key")?_(c("The AccessKey is incorrect, please check it")):_(u):(u==null?void 0:u.type)==="error"&&_("Something went wrong, please refresh the page and try again")}),()=>{var u;(u=d.current)==null||u.destroy(),p.current=null,d.current=null,A.current=null,z.current=null}},[t,N,r]),f.useImperativeHandle(o,()=>({setOverlay:j,getOverlay:k,createMouseTool:$,createEditor:W,executeMouseTool:E,aMap:p.current,map:d.current,overlay:T.current,mouseTool:()=>A.current,editor:()=>z.current,errMessage:P}));const q=a.useApp();return!t||P?n.jsx(w.Alert,{action:n.jsx(w.Button,{type:"primary",onClick:()=>R(q.systemSettingsManager.getRoutePath("map")),children:c("Go to the configuration page")}),message:P||c("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):n.jsxs("div",{className:a.css`
8
8
  position: relative;
9
9
  height: 500px;
10
10
  `,id:Q.current,style:e==null?void 0:e.style,children:[!p.current&&n.jsx("div",{className:a.css`
@@ -29,7 +29,7 @@
29
29
  bottom: 20px;
30
30
  right: 20px;
31
31
  z-index: 2;
32
- `,children:n.jsx(w.Button,{disabled:!i,style:{height:"40px"},onClick:L,type:"primary",danger:!0,children:c("Clear")})})]})]})});Ce.displayName="AMapComponent";const Xe=e=>{var P,W,E,$;const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:s,setSelectedRecordKeys:l,lineSort:m}=a.useProps(e),{name:v,getPrimaryKey:S}=a.useCollection_deprecated(),{getCollectionJoinField:A}=a.useCollectionManager_deprecated(),c=S(),[y,p]=f.useState(!1),d=f.useRef(),M=(W=(P=d.current)==null?void 0:P.aMap)==null?void 0:W.GeometryUtil,[D,U]=f.useState(),[I,_]=f.useState(""),{t:Y}=Z(),N=a.useCompile(),{isConnected:T,doFilter:z}=a.useFilterAPI(),[,R]=f.useState(null),Q=f.useRef(I);Q.current=I;const ee=(x,L)=>{const b=x.getExtData(),k=typeof L=="undefined"?b.selected:!L;b.selected=!k,"setIcon"in x&&x.setIcon(new d.current.aMap.Icon({imageSize:[19,32],image:k?ue:be})),x.setOptions(O({extData:b},k?{strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{strokeColor:"#F18b62",fillColor:"#F18b62"}))},X=()=>{var x,L,b;d.current&&((x=d.current)==null||x.mouseTool().close(!0),(L=d.current)==null||L.editor().setTarget(null),(b=d.current)==null||b.editor().close())};f.useEffect(()=>{var x,L,b,k;if(I==="selection")return(x=d.current)!=null&&x.editor()?(k=d.current)==null||k.executeMouseTool("polygon"):((L=d.current)==null||L.createEditor("polygon"),(b=d.current)==null||b.createMouseTool("polygon")),()=>{X()}},[I]),f.useEffect(()=>{if(I)return()=>{var x;Q.current||(x=d.current)==null||x.map.getAllOverlays().forEach(L=>{ee(L,!1)})}},[I]);const se=V.useMemoizedFn(()=>{var j,q,g;const x=(j=d.current)==null?void 0:j.editor().getTarget(),L=(q=d.current)==null?void 0:q.map.getAllOverlays(),b=L==null?void 0:L.filter(u=>{if(!(u===x||u.getExtData().id===void 0))return"getPosition"in u?M.isPointInRing(u.getPosition(),x==null?void 0:x.getPath()):M.doesRingRingIntersect(u.getPath(),x==null?void 0:x.getPath())}),k=b==null?void 0:b.map(u=>(ee(u,!0),u.getExtData().id));l(u=>k==null?void 0:k.concat(u)),x==null||x.remove(),(g=d.current)==null||g.editor().close()});f.useEffect(()=>{var j,q,g;if(!o||!d.current||!r)return;const x=Array.isArray(t==null?void 0:t.field)&&(t==null?void 0:t.field.length)>1?t==null?void 0:t.field.slice(0,-1):t==null?void 0:t.field,L=A([v,...x].flat().join(".")),b=r.map(u=>{var C;const h=(C=Fe(u,t==null?void 0:t.field,L==null?void 0:L.interface))==null?void 0:C.filter(Boolean);return h!=null&&h.length?h.map(G=>{var ie;return(ie=d.current)==null?void 0:ie.setOverlay(o.type,G,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:t!=null&&t.marker?N(u[t.marker]):void 0},extData:{id:u[c]}})}):[]}).flat().filter(Boolean);(q=(j=d.current)==null?void 0:j.map)==null||q.setFitView(b);const k=b.map(u=>{const h=C=>{const G=C.target,ne=G.getExtData();if(!ne)return;if(Q.current){Q.current==="click"&&(l(ae=>ne.selected?ae.filter(Ie=>Ie!==ne.id):[...ae,ne.id]),ee(G));return}const ie=r.find(ae=>ne.id===ae[c]);if(T){R(ae=>(ae&&Le(ae),ae===u?(Le(u),z(null),null):(Qe(u),z(ie[c],Ie=>Ie.field||c,"$eq"),u)));return}ie&&U(ie)};return u.on("click",h),()=>u.off("click",h)});if(o.type==="point"&&(m!=null&&m.length)&&(b==null?void 0:b.length)>1){const u=b.map(C=>C.getPosition());b[0].setzIndex(13),b[b.length-1].setzIndex(13);const h=(C=!0)=>{var G,ne;if((G=d.current)!=null&&G.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:Y(C?"Start point":"End point")},position:u[C?0:u.length-1],map:(ne=d.current)==null?void 0:ne.map})};b.push(...[(g=d.current)==null?void 0:g.setOverlay("lineString",u,{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),h(),h(!1)].filter(Boolean))}return()=>{b.forEach(u=>{u.remove()}),k.forEach(u=>u())}},[r,y,t,v,c,o.type,T,m]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const re=x=>{d.current=x,p(!!(x!=null&&x.map)&&!x.errMessage)};return n.jsxs("div",{className:a.css`
32
+ `,children:n.jsx(w.Button,{disabled:!i,style:{height:"40px"},onClick:L,type:"primary",danger:!0,children:c("Clear")})})]})]})});Ce.displayName="AMapComponent";const Xe=e=>{var I,W,E,$;const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:s,setSelectedRecordKeys:l,lineSort:m}=a.useProps(e),{name:v,getPrimaryKey:S}=a.useCollection_deprecated(),{getCollectionJoinField:M}=a.useCollectionManager_deprecated(),c=S(),[y,p]=f.useState(!1),d=f.useRef(),A=(W=(I=d.current)==null?void 0:I.aMap)==null?void 0:W.GeometryUtil,[D,U]=f.useState(),[P,_]=f.useState(""),{t:Y}=Z(),N=a.useCompile(),{isConnected:T,doFilter:z}=a.useFilterAPI(),[,R]=f.useState(null),Q=f.useRef(P);Q.current=P;const ee=(x,L)=>{const b=x.getExtData(),k=typeof L=="undefined"?b.selected:!L;b.selected=!k,"setIcon"in x&&x.setIcon(new d.current.aMap.Icon({imageSize:[19,32],image:k?ue:be})),x.setOptions(O({extData:b},k?{strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{strokeColor:"#F18b62",fillColor:"#F18b62"}))},X=()=>{var x,L,b;d.current&&((x=d.current)==null||x.mouseTool().close(!0),(L=d.current)==null||L.editor().setTarget(null),(b=d.current)==null||b.editor().close())};f.useEffect(()=>{var x,L,b,k;if(P==="selection")return(x=d.current)!=null&&x.editor()?(k=d.current)==null||k.executeMouseTool("polygon"):((L=d.current)==null||L.createEditor("polygon"),(b=d.current)==null||b.createMouseTool("polygon")),()=>{X()}},[P]),f.useEffect(()=>{if(P)return()=>{var x;Q.current||(x=d.current)==null||x.map.getAllOverlays().forEach(L=>{ee(L,!1)})}},[P]);const se=V.useMemoizedFn(()=>{var j,q,g;const x=(j=d.current)==null?void 0:j.editor().getTarget(),L=(q=d.current)==null?void 0:q.map.getAllOverlays(),b=L==null?void 0:L.filter(u=>{if(!(u===x||u.getExtData().id===void 0))return"getPosition"in u?A.isPointInRing(u.getPosition(),x==null?void 0:x.getPath()):A.doesRingRingIntersect(u.getPath(),x==null?void 0:x.getPath())}),k=b==null?void 0:b.map(u=>(ee(u,!0),u.getExtData().id));l(u=>k==null?void 0:k.concat(u)),x==null||x.remove(),(g=d.current)==null||g.editor().close()});f.useEffect(()=>{var j,q,g;if(!o||!d.current||!r)return;const x=Array.isArray(t==null?void 0:t.field)&&(t==null?void 0:t.field.length)>1?t==null?void 0:t.field.slice(0,-1):t==null?void 0:t.field,L=M([v,...x].flat().join(".")),b=r.map(u=>{var C;const h=(C=Fe(u,t==null?void 0:t.field,L==null?void 0:L.interface))==null?void 0:C.filter(Boolean);return h!=null&&h.length?h.map(G=>{var ie;return(ie=d.current)==null?void 0:ie.setOverlay(o.type,G,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:t!=null&&t.marker?N(u[t.marker]):void 0},extData:{id:u[c]}})}):[]}).flat().filter(Boolean);(q=(j=d.current)==null?void 0:j.map)==null||q.setFitView(b);const k=b.map(u=>{const h=C=>{const G=C.target,ne=G.getExtData();if(!ne)return;if(Q.current){Q.current==="click"&&(l(ae=>ne.selected?ae.filter(Pe=>Pe!==ne.id):[...ae,ne.id]),ee(G));return}const ie=r.find(ae=>ne.id===ae[c]);if(T){R(ae=>(ae&&Le(ae),ae===u?(Le(u),z(null),null):(Qe(u),z(ie[c],Pe=>Pe.field||c,"$eq"),u)));return}ie&&U(ie)};return u.on("click",h),()=>u.off("click",h)});if(o.type==="point"&&(m!=null&&m.length)&&(b==null?void 0:b.length)>1){const u=b.map(C=>C.getPosition());b[0].setzIndex(13),b[b.length-1].setzIndex(13);const h=(C=!0)=>{var G,ne;if((G=d.current)!=null&&G.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:Y(C?"Start point":"End point")},position:u[C?0:u.length-1],map:(ne=d.current)==null?void 0:ne.map})};b.push(...[(g=d.current)==null?void 0:g.setOverlay("lineString",u,{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),h(),h(!1)].filter(Boolean))}return()=>{b.forEach(u=>{u.remove()}),k.forEach(u=>u())}},[r,y,t,v,c,o.type,T,m]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const re=x=>{d.current=x,p(!!(x!=null&&x.map)&&!x.errMessage)};return n.jsxs("div",{className:a.css`
33
33
  position: relative;
34
34
  height: 100%;
35
35
  `,children:[n.jsx("div",{className:a.css`
@@ -37,13 +37,13 @@
37
37
  left: 10px;
38
38
  top: 10px;
39
39
  z-index: 999;
40
- `,children:y&&!((E=d.current)!=null&&E.errMessage)?n.jsxs(w.Space,{direction:"vertical",children:[n.jsx(w.Button,{style:{color:I?void 0:"#F18b62",borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),_("")},icon:n.jsx(te.EnvironmentOutlined,{})}),n.jsx(w.Button,{style:{color:I==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),_("selection")},icon:n.jsx(te.ExpandOutlined,{})}),I==="selection"?n.jsx(w.Button,{type:"primary",icon:n.jsx(te.CheckOutlined,{}),title:Y("Confirm selection"),onClick:se}):null]}):null}),n.jsx(He,{record:D,setVisible:U}),n.jsx(Ce,J(O({},($=o==null?void 0:o.uiSchema)==null?void 0:$["x-component-props"]),{ref:re,style:{height:i?"100%":null},zoom:s,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},He=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=K.useFieldSchema(),s=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return s&&n.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:n.jsx(a.RecordProvider,{record:t,parent:r,children:n.jsx(K.RecursionField,{schema:s,name:s.name})})})};function Le(e){e.dom?e.dom.style.filter="none":e.setOptions&&e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function Qe(e){e.dom?e.dom.style.filter="brightness(1.2) contrast(1.2) hue-rotate(180deg)":e.setOptions&&e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const De=({type:e,children:o})=>{const{t}=Z(),[r,i]=V.useBoolean(!1),s=a.useAPIClient(),[l]=w.Form.useForm(),m=Ae(e);f.useEffect(()=>{m&&(l.setFieldsValue(m),i.toggle())},[m]);const v=f.useMemo(()=>s.resource(Ee),[s]),S=A=>{v.set(J(O({},A),{type:e})).then(c=>{sessionStorage.removeItem(ve(e)),i.toggle(),w.message.success(t("Saved successfully"))}).catch(c=>{w.message.success(t("Saved failed"))})};return n.jsxs(w.Form,{disabled:r,form:l,layout:"vertical",onFinish:S,children:[o,r?n.jsx(w.Button,{disabled:!1,onClick:i.toggle,children:t("Edit")}):n.jsx(w.Form.Item,{children:n.jsx(w.Button,{disabled:!1,type:"primary",htmlType:"submit",children:t("Save")})})]})},$e={amap:()=>{const{t:e}=Z();return n.jsxs(De,{type:"amap",children:[n.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Access key"),children:n.jsx(w.Input,{})}),n.jsx(w.Form.Item,{required:!0,name:"securityJsCode",label:e("securityJsCode or serviceHost"),children:n.jsx(w.Input,{})})]})},google:()=>{const{t:e}=Z();return n.jsx(De,{type:"google",children:n.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Api key"),children:n.jsx(w.Input,{})})})}},Re=ke.map(e=>J(O({},e),{component:$e[e.value]})),et=()=>{const e=a.useCompile(),o=oe.useLocation(),t=new URLSearchParams(o.search);return n.jsx(w.Card,{bordered:!0,children:n.jsx(w.Tabs,{type:"card",defaultActiveKey:t.get("tab"),children:Re.map(r=>n.jsx(w.Tabs.TabPane,{tab:e(r.label),children:n.jsx(r.component,{type:r.value})},r.value))})})};function tt(e,o,t,r){function i(s){return s instanceof t?s:new t(function(l){l(s)})}return new(t||(t=Promise))(function(s,l){function m(A){try{S(r.next(A))}catch(c){l(c)}}function v(A){try{S(r.throw(A))}catch(c){l(c)}}function S(A){A.done?s(A.value):i(A.value).then(m,v)}S((r=r.apply(e,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function ot(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rt=function e(o,t){if(o===t)return!0;if(o&&t&&typeof o=="object"&&typeof t=="object"){if(o.constructor!==t.constructor)return!1;var r,i,s;if(Array.isArray(o)){if(r=o.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!e(o[i],t[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===t.source&&o.flags===t.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===t.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===t.toString();if(s=Object.keys(o),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){var l=s[i];if(!e(o[l],t[l]))return!1}return!0}return o!==o&&t!==t},nt=ot(rt);const Te="__googleMapsScriptId";var de;(function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"})(de||(de={}));class le{constructor({apiKey:o,authReferrerPolicy:t,channel:r,client:i,id:s=Te,language:l,libraries:m=[],mapIds:v,nonce:S,region:A,retries:c=3,url:y="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=o,this.authReferrerPolicy=t,this.channel=r,this.client=i,this.id=s||Te,this.language=l,this.libraries=m,this.mapIds=v,this.nonce=S,this.region=A,this.retries=c,this.url=y,this.version=p,le.instance){if(!nt(this.options,le.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(le.instance.options)}`);return le.instance}le.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?de.FAILURE:this.done?de.SUCCESS:this.loading?de.LOADING:de.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let o=this.url;return o+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(o+=`&key=${this.apiKey}`),this.channel&&(o+=`&channel=${this.channel}`),this.client&&(o+=`&client=${this.client}`),this.libraries.length>0&&(o+=`&libraries=${this.libraries.join(",")}`),this.language&&(o+=`&language=${this.language}`),this.region&&(o+=`&region=${this.region}`),this.version&&(o+=`&v=${this.version}`),this.mapIds&&(o+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(o+=`&auth_referrer_policy=${this.authReferrerPolicy}`),o}deleteScript(){const o=document.getElementById(this.id);o&&o.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((o,t)=>{this.loadCallback(r=>{r?t(r.error):o(window.google)})})}importLibrary(o){return this.execute(),google.maps.importLibrary(o)}loadCallback(o){this.callbacks.push(o),this.execute()}setScript(){var o,t;if(document.getElementById(this.id)){this.callback();return}const r={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(r).forEach(s=>!r[s]&&delete r[s]),!((t=(o=window==null?void 0:window.google)===null||o===void 0?void 0:o.maps)===null||t===void 0)&&t.importLibrary||(s=>{let l,m,v,S="The Google Maps JavaScript API",A="google",c="importLibrary",y="__ib__",p=document,d=window;d=d[A]||(d[A]={});const M=d.maps||(d.maps={}),D=new Set,U=new URLSearchParams,I=()=>l||(l=new Promise((_,Y)=>tt(this,void 0,void 0,function*(){var N;yield m=p.createElement("script"),m.id=this.id,U.set("libraries",[...D]+"");for(v in s)U.set(v.replace(/[A-Z]/g,T=>"_"+T[0].toLowerCase()),s[v]);U.set("callback",A+".maps."+y),m.src=this.url+"?"+U,M[y]=_,m.onerror=()=>l=Y(Error(S+" could not load.")),m.nonce=this.nonce||((N=p.querySelector("script[nonce]"))===null||N===void 0?void 0:N.nonce)||"",p.head.append(m)})));M[c]?console.warn(S+" only loads once. Ignoring:",s):M[c]=(_,...Y)=>D.add(_)&&I().then(()=>M[c](_,...Y))})(r);const i=this.libraries.map(s=>this.importLibrary(s));i.length||i.push(this.importLibrary("core")),Promise.all(i).then(()=>this.callback(),s=>{const l=new ErrorEvent("error",{error:s});this.loadErrorCallback(l)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(o){if(this.errors.push(o),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},t)}else this.onerrorEvent=o,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(o=>{o(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(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=!0,this.setScript()}}}const st=e=>{const{toCenter:o,mapRef:t}=e,{t:r}=Z(),i=f.useRef(),[s,l]=f.useState([]);f.useEffect(()=>{google.maps.importLibrary("places").then(S=>{i.current=new S.AutocompleteService}).catch(()=>{w.message.error("Please configure the Google API Key correctly")})},[t]);const{run:m}=V.useDebounceFn(S=>{i.current&&i.current.getPlacePredictions({input:S||" "},(A,c)=>{if(c===google.maps.places.PlacesServiceStatus.OK)l(A.map(y=>{const p=y.structured_formatting;return J(O({},y),{label:`${p.main_text}${p.secondary_text?" "+p.secondary_text:""}`,value:y.place_id})}));else{l([]);return}})},{wait:300}),v=S=>{const A=s.find(y=>y.value===S);new google.maps.places.PlacesService(t.current).getDetails({placeId:A.place_id,fields:["geometry"]},(y,p)=>{p===google.maps.places.PlacesServiceStatus.OK&&o(y.geometry.location)})};return n.jsx("div",{className:a.css`
40
+ `,children:y&&!((E=d.current)!=null&&E.errMessage)?n.jsxs(w.Space,{direction:"vertical",children:[n.jsx(w.Button,{style:{color:P?void 0:"#F18b62",borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),_("")},icon:n.jsx(te.EnvironmentOutlined,{})}),n.jsx(w.Button,{style:{color:P==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),_("selection")},icon:n.jsx(te.ExpandOutlined,{})}),P==="selection"?n.jsx(w.Button,{type:"primary",icon:n.jsx(te.CheckOutlined,{}),title:Y("Confirm selection"),onClick:se}):null]}):null}),n.jsx(He,{record:D,setVisible:U}),n.jsx(Ce,J(O({},($=o==null?void 0:o.uiSchema)==null?void 0:$["x-component-props"]),{ref:re,style:{height:i?"100%":null},zoom:s,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},He=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=K.useFieldSchema(),s=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return s&&n.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:n.jsx(a.RecordProvider,{record:t,parent:r,children:n.jsx(K.RecursionField,{schema:s,name:s.name})})})};function Le(e){e.dom?e.dom.style.filter="none":e.setOptions&&e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function Qe(e){e.dom?e.dom.style.filter="brightness(1.2) contrast(1.2) hue-rotate(180deg)":e.setOptions&&e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const De=({type:e,children:o})=>{const{t}=Z(),[r,i]=V.useBoolean(!1),s=a.useAPIClient(),[l]=w.Form.useForm(),m=Me(e);f.useEffect(()=>{m&&(l.setFieldsValue(m),i.toggle())},[m]);const v=f.useMemo(()=>s.resource(Ee),[s]),S=M=>{v.set(J(O({},M),{type:e})).then(c=>{sessionStorage.removeItem(ve(e)),i.toggle(),w.message.success(t("Saved successfully"))}).catch(c=>{w.message.success(t("Saved failed"))})};return n.jsxs(w.Form,{disabled:r,form:l,layout:"vertical",onFinish:S,children:[o,r?n.jsx(w.Button,{disabled:!1,onClick:i.toggle,children:t("Edit")}):n.jsx(w.Form.Item,{children:n.jsx(w.Button,{disabled:!1,type:"primary",htmlType:"submit",children:t("Save")})})]})},$e={amap:()=>{const{t:e}=Z();return n.jsxs(De,{type:"amap",children:[n.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Access key"),children:n.jsx(w.Input,{})}),n.jsx(w.Form.Item,{required:!0,name:"securityJsCode",label:e("securityJsCode or serviceHost"),children:n.jsx(w.Input,{})})]})},google:()=>{const{t:e}=Z();return n.jsx(De,{type:"google",children:n.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Api key"),children:n.jsx(w.Input,{})})})}},Re=ke.map(e=>J(O({},e),{component:$e[e.value]})),et=()=>{const e=a.useCompile(),o=oe.useLocation(),t=new URLSearchParams(o.search);return n.jsx(w.Card,{bordered:!0,children:n.jsx(w.Tabs,{type:"card",defaultActiveKey:t.get("tab"),children:Re.map(r=>n.jsx(w.Tabs.TabPane,{tab:e(r.label),children:n.jsx(r.component,{type:r.value})},r.value))})})};function tt(e,o,t,r){function i(s){return s instanceof t?s:new t(function(l){l(s)})}return new(t||(t=Promise))(function(s,l){function m(M){try{S(r.next(M))}catch(c){l(c)}}function v(M){try{S(r.throw(M))}catch(c){l(c)}}function S(M){M.done?s(M.value):i(M.value).then(m,v)}S((r=r.apply(e,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function ot(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rt=function e(o,t){if(o===t)return!0;if(o&&t&&typeof o=="object"&&typeof t=="object"){if(o.constructor!==t.constructor)return!1;var r,i,s;if(Array.isArray(o)){if(r=o.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!e(o[i],t[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===t.source&&o.flags===t.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===t.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===t.toString();if(s=Object.keys(o),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){var l=s[i];if(!e(o[l],t[l]))return!1}return!0}return o!==o&&t!==t},nt=ot(rt);const Te="__googleMapsScriptId";var de;(function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"})(de||(de={}));class le{constructor({apiKey:o,authReferrerPolicy:t,channel:r,client:i,id:s=Te,language:l,libraries:m=[],mapIds:v,nonce:S,region:M,retries:c=3,url:y="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=o,this.authReferrerPolicy=t,this.channel=r,this.client=i,this.id=s||Te,this.language=l,this.libraries=m,this.mapIds=v,this.nonce=S,this.region=M,this.retries=c,this.url=y,this.version=p,le.instance){if(!nt(this.options,le.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(le.instance.options)}`);return le.instance}le.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?de.FAILURE:this.done?de.SUCCESS:this.loading?de.LOADING:de.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let o=this.url;return o+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(o+=`&key=${this.apiKey}`),this.channel&&(o+=`&channel=${this.channel}`),this.client&&(o+=`&client=${this.client}`),this.libraries.length>0&&(o+=`&libraries=${this.libraries.join(",")}`),this.language&&(o+=`&language=${this.language}`),this.region&&(o+=`&region=${this.region}`),this.version&&(o+=`&v=${this.version}`),this.mapIds&&(o+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(o+=`&auth_referrer_policy=${this.authReferrerPolicy}`),o}deleteScript(){const o=document.getElementById(this.id);o&&o.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((o,t)=>{this.loadCallback(r=>{r?t(r.error):o(window.google)})})}importLibrary(o){return this.execute(),google.maps.importLibrary(o)}loadCallback(o){this.callbacks.push(o),this.execute()}setScript(){var o,t;if(document.getElementById(this.id)){this.callback();return}const r={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(r).forEach(s=>!r[s]&&delete r[s]),!((t=(o=window==null?void 0:window.google)===null||o===void 0?void 0:o.maps)===null||t===void 0)&&t.importLibrary||(s=>{let l,m,v,S="The Google Maps JavaScript API",M="google",c="importLibrary",y="__ib__",p=document,d=window;d=d[M]||(d[M]={});const A=d.maps||(d.maps={}),D=new Set,U=new URLSearchParams,P=()=>l||(l=new Promise((_,Y)=>tt(this,void 0,void 0,function*(){var N;yield m=p.createElement("script"),m.id=this.id,U.set("libraries",[...D]+"");for(v in s)U.set(v.replace(/[A-Z]/g,T=>"_"+T[0].toLowerCase()),s[v]);U.set("callback",M+".maps."+y),m.src=this.url+"?"+U,A[y]=_,m.onerror=()=>l=Y(Error(S+" could not load.")),m.nonce=this.nonce||((N=p.querySelector("script[nonce]"))===null||N===void 0?void 0:N.nonce)||"",p.head.append(m)})));A[c]?console.warn(S+" only loads once. Ignoring:",s):A[c]=(_,...Y)=>D.add(_)&&P().then(()=>A[c](_,...Y))})(r);const i=this.libraries.map(s=>this.importLibrary(s));i.length||i.push(this.importLibrary("core")),Promise.all(i).then(()=>this.callback(),s=>{const l=new ErrorEvent("error",{error:s});this.loadErrorCallback(l)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(o){if(this.errors.push(o),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},t)}else this.onerrorEvent=o,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(o=>{o(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(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=!0,this.setScript()}}}const st=e=>{const{toCenter:o,mapRef:t}=e,{t:r}=Z(),i=f.useRef(),[s,l]=f.useState([]);f.useEffect(()=>{google.maps.importLibrary("places").then(S=>{i.current=new S.AutocompleteService}).catch(()=>{w.message.error("Please configure the Google API Key correctly")})},[t]);const{run:m}=V.useDebounceFn(S=>{i.current&&i.current.getPlacePredictions({input:S||" "},(M,c)=>{if(c===google.maps.places.PlacesServiceStatus.OK)l(M.map(y=>{const p=y.structured_formatting;return J(O({},y),{label:`${p.main_text}${p.secondary_text?" "+p.secondary_text:""}`,value:y.place_id})}));else{l([]);return}})},{wait:300}),v=S=>{const M=s.find(y=>y.value===S);new google.maps.places.PlacesService(t.current).getDetails({placeId:M.place_id,fields:["geometry"]},(y,p)=>{p===google.maps.places.PlacesServiceStatus.OK&&o(y.geometry.location)})};return n.jsx("div",{className:a.css`
41
41
  position: absolute;
42
42
  top: 10px;
43
43
  left: 10px;
44
44
  z-index: 10;
45
45
  width: calc(100% - 20px);
46
- `,children:n.jsx(w.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:r("Enter keywords to search"),filterOption:!1,onSearch:m,onSelect:v,options:s})})},ce=e=>({url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(19/2,42)}),it=()=>new Promise(e=>{const o=()=>{e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const{latitude:r,longitude:i}=t.coords;e({lat:r,lng:i})},()=>{o()}):o()}),at=e=>e==="point"?"marker":e==="lineString"?"polyline":e,lt={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},Se=f.forwardRef((e,o)=>{const{value:t,onChange:r,block:i=!1,readonly:s,disabled:l=i,zoom:m=13,overlayCommonOptions:v}=e,{accessKey:S}=Ae(e.mapType)||{},{t:A}=Z(),{getField:c}=a.useCollection_deprecated(),y=K.useFieldSchema(),p=f.useRef(),d=f.useRef(),M=f.useRef(),[D,U]=f.useState([]),[I,_]=f.useState(""),Y=a.useAPIClient(),{modal:N}=w.App.useApp(),T=f.useMemo(()=>{if(e.type)return e.type;const g=c(y==null?void 0:y.name);return g==null?void 0:g.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),z=f.useRef(at(T)),[R]=f.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1,editable:!l,draggable:!l},v)),Q=oe.useNavigate(),ee=f.useRef(),X=f.useRef(new Set),se=V.useMemoizedFn(g=>{if(X.current.forEach(u=>{X.current.delete(u)}),"getPath"in g){const u=g.getPath();["insert_at","remove_at","set_at"].forEach(h=>{X.current.add(u.addListener(h,()=>{x(g,!0)}).remove)})}else g instanceof google.maps.Circle&&["center_changed","radius_changed"].forEach(u=>{X.current.add(g.addListener(u,()=>{x(g,!0)}).remove)})}),re=V.useMemoizedFn(()=>{var g;M.current&&(M.current.unbindAll(),M.current.setMap(null)),T!=="point"&&((g=p.current)==null||g.setDrawingMode(null))}),P=V.useMemoizedFn(g=>{d.current&&(d.current.setCenter(g),d.current.setZoom(m))}),W=V.useMemoizedFn(g=>{re(),se(g),M.current=g}),E=V.useMemoizedFn(g=>{const u=new google.maps.LatLngBounds;g.forEach(h=>{if(h instanceof google.maps.Marker)u.extend(h.getPosition());else if(h instanceof google.maps.Polyline||h instanceof google.maps.Polygon){const C=h.getPath();for(let G=0;G<C.getLength();G++)u.extend(C.getAt(G))}else h instanceof google.maps.Circle&&u.union(h.getBounds())}),d.current.setCenter(u.getCenter())}),$=()=>{M.current&&E([M.current])},x=V.useMemoizedFn((g,u=!1)=>{let h=null;if(T==="point"){const{lat:C,lng:G}=g.getPosition();h=[G(),C()]}else if(T==="polygon"||T==="lineString"){if(h=g.getPath().getArray().map(C=>[C.lng(),C.lat()]),h.length<2)return}else if(T==="circle"){const C=g.getCenter(),G=g.getRadius();h=[C.lng(),C.lat(),G]}u||W(g),r==null||r(h)}),L=V.useMemoizedFn((g=!1,u)=>{const h=J(O(O({},R),u),{map:d.current});return p.current=new google.maps.drawing.DrawingManager({drawingMode:z.current,drawingControl:!1,markerOptions:J(O({},h),{icon:ce(ue)}),polygonOptions:h,polylineOptions:h,circleOptions:h,map:d.current}),g||p.current.addListener("overlaycomplete",C=>{const G=C.overlay;x(G)}),p.current}),b=V.useMemoizedFn((g=T,u=t,h)=>{const C=lt[g];if(!C)return;const G=O(J(O({},R),{icon:ce(ue)}),h);return"transformOptions"in C?Object.assign(G,C.transformOptions(u)):"propertyKey"in C&&(G[C.propertyKey]=Array.isArray(u[0])?u.map(ie=>new google.maps.LatLng(ie[1],ie[0])):new google.maps.LatLng(u[1],u[0])),new google.maps[C.overlay](G)}),k=V.useMemoizedFn((g=T,u=t,h)=>d.current?b(g,u,J(O({},h),{map:d.current})):void 0);f.useEffect(()=>{var u,h;if(!t&&d.current&&(re(),(h=(u=p==null?void 0:p.current)==null?void 0:u.setDrawingMode)==null||h.call(u,z.current),r==null||r(null)),!d.current||!t||!s&&M.current)return;const g=k();W(g),E([g])},[t,D,T,l,s,k,E,W]),f.useEffect(()=>{if(!S||d.current||!ee.current)return;let g;try{g=new le({apiKey:S,version:"weekly",language:Y.auth.getLocale()})}catch(h){_(A("Load google maps failed, Please check the Api key and refresh the page"));return}const u=console.error;return console.error=(h,...C)=>{h!=null&&h.includes("InvalidKeyMapError")&&_(A("Load google maps failed, Please check the Api key and refresh the page")),u(h,...C)},Promise.all([g.importLibrary("drawing"),g.importLibrary("core"),g.importLibrary("geometry")]).then(h=>he(this,null,function*(){const C=yield it();d.current=new google.maps.Map(ee.current,{zoom:m,center:C,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),_(""),U([])})).catch(h=>{if(h instanceof Error){_(h.message);return}}),()=>{var h,C;(h=d.current)==null||h.unbindAll(),d.current=null,(C=p.current)==null||C.unbindAll()}},[S,Y.auth,T,m]),f.useEffect(()=>{!d.current||!T||l||p.current||L()},[L,l,D,T]),f.useImperativeHandle(o,()=>({setOverlay:k,getOverlay:b,setFitView:E,createDraw:L,map:d.current,overlay:M.current,drawingManager:p.current,errMessage:I}));const j=V.useMemoizedFn(()=>{const g=()=>{re(),p.current.setDrawingMode(z.current),r==null||r(null)};N.confirm({title:A("Clear the canvas"),content:A("Are you sure to clear the canvas?"),okText:A("Confirm"),cancelText:A("Cancel"),getContainer:()=>ee.current,onOk(){g()}})}),q=a.useApp();return!S||I?n.jsx(w.Alert,{action:n.jsx(w.Button,{type:"primary",onClick:()=>Q(q.systemSettingsManager.getRoutePath("map")+"?tab=google"),children:A("Go to the configuration page")}),message:I||A("Please configure the Api key first"),type:"error"}):n.jsxs("div",{className:a.css`
46
+ `,children:n.jsx(w.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:r("Enter keywords to search"),filterOption:!1,onSearch:m,onSelect:v,options:s})})},ce=e=>({url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(19/2,42)}),it=()=>new Promise(e=>{const o=()=>{e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const{latitude:r,longitude:i}=t.coords;e({lat:r,lng:i})},()=>{o()}):o()}),at=e=>e==="point"?"marker":e==="lineString"?"polyline":e,lt={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},Se=f.forwardRef((e,o)=>{const{value:t,onChange:r,block:i=!1,readonly:s,disabled:l=i,zoom:m=13,overlayCommonOptions:v}=e,{accessKey:S}=Me(e.mapType)||{},{t:M}=Z(),{getField:c}=a.useCollection_deprecated(),y=K.useFieldSchema(),p=f.useRef(),d=f.useRef(),A=f.useRef(),[D,U]=f.useState([]),[P,_]=f.useState(""),Y=a.useAPIClient(),{modal:N}=w.App.useApp(),T=f.useMemo(()=>{if(e.type)return e.type;const g=c(y==null?void 0:y.name);return g==null?void 0:g.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),z=f.useRef(at(T)),[R]=f.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1,editable:!l,draggable:!l},v)),Q=oe.useNavigate(),ee=f.useRef(),X=f.useRef(new Set),se=V.useMemoizedFn(g=>{if(X.current.forEach(u=>{X.current.delete(u)}),"getPath"in g){const u=g.getPath();["insert_at","remove_at","set_at"].forEach(h=>{X.current.add(u.addListener(h,()=>{x(g,!0)}).remove)})}else g instanceof google.maps.Circle&&["center_changed","radius_changed"].forEach(u=>{X.current.add(g.addListener(u,()=>{x(g,!0)}).remove)})}),re=V.useMemoizedFn(()=>{var g;A.current&&(A.current.unbindAll(),A.current.setMap(null)),T!=="point"&&((g=p.current)==null||g.setDrawingMode(null))}),I=V.useMemoizedFn(g=>{d.current&&(d.current.setCenter(g),d.current.setZoom(m))}),W=V.useMemoizedFn(g=>{re(),se(g),A.current=g}),E=V.useMemoizedFn(g=>{const u=new google.maps.LatLngBounds;g.forEach(h=>{if(h instanceof google.maps.Marker)u.extend(h.getPosition());else if(h instanceof google.maps.Polyline||h instanceof google.maps.Polygon){const C=h.getPath();for(let G=0;G<C.getLength();G++)u.extend(C.getAt(G))}else h instanceof google.maps.Circle&&u.union(h.getBounds())}),d.current.setCenter(u.getCenter())}),$=()=>{A.current&&E([A.current])},x=V.useMemoizedFn((g,u=!1)=>{let h=null;if(T==="point"){const{lat:C,lng:G}=g.getPosition();h=[G(),C()]}else if(T==="polygon"||T==="lineString"){if(h=g.getPath().getArray().map(C=>[C.lng(),C.lat()]),h.length<2)return}else if(T==="circle"){const C=g.getCenter(),G=g.getRadius();h=[C.lng(),C.lat(),G]}u||W(g),r==null||r(h)}),L=V.useMemoizedFn((g=!1,u)=>{const h=J(O(O({},R),u),{map:d.current});return p.current=new google.maps.drawing.DrawingManager({drawingMode:z.current,drawingControl:!1,markerOptions:J(O({},h),{icon:ce(ue)}),polygonOptions:h,polylineOptions:h,circleOptions:h,map:d.current}),g||p.current.addListener("overlaycomplete",C=>{const G=C.overlay;x(G)}),p.current}),b=V.useMemoizedFn((g=T,u=t,h)=>{const C=lt[g];if(!C)return;const G=O(J(O({},R),{icon:ce(ue)}),h);return"transformOptions"in C?Object.assign(G,C.transformOptions(u)):"propertyKey"in C&&(G[C.propertyKey]=Array.isArray(u[0])?u.map(ie=>new google.maps.LatLng(ie[1],ie[0])):new google.maps.LatLng(u[1],u[0])),new google.maps[C.overlay](G)}),k=V.useMemoizedFn((g=T,u=t,h)=>d.current?b(g,u,J(O({},h),{map:d.current})):void 0);f.useEffect(()=>{var u,h;if(!t&&d.current&&(re(),(h=(u=p==null?void 0:p.current)==null?void 0:u.setDrawingMode)==null||h.call(u,z.current),r==null||r(null)),!d.current||!t||!s&&A.current)return;const g=k();W(g),E([g])},[t,D,T,l,s,k,E,W]),f.useEffect(()=>{if(!S||d.current||!ee.current)return;let g;try{g=new le({apiKey:S,version:"weekly",language:Y.auth.getLocale()})}catch(h){_(M("Load google maps failed, Please check the Api key and refresh the page"));return}const u=console.error;return console.error=(h,...C)=>{h!=null&&h.includes("InvalidKeyMapError")&&_(M("Load google maps failed, Please check the Api key and refresh the page")),u(h,...C)},Promise.all([g.importLibrary("drawing"),g.importLibrary("core"),g.importLibrary("geometry")]).then(h=>he(this,null,function*(){const C=yield it();d.current=new google.maps.Map(ee.current,{zoom:m,center:C,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),_(""),U([])})).catch(h=>{if(h instanceof Error){_(h.message);return}}),()=>{var h,C;(h=d.current)==null||h.unbindAll(),d.current=null,(C=p.current)==null||C.unbindAll()}},[S,Y.auth,T,m]),f.useEffect(()=>{!d.current||!T||l||p.current||L()},[L,l,D,T]),f.useImperativeHandle(o,()=>({setOverlay:k,getOverlay:b,setFitView:E,createDraw:L,map:d.current,overlay:A.current,drawingManager:p.current,errMessage:P}));const j=V.useMemoizedFn(()=>{const g=()=>{re(),p.current.setDrawingMode(z.current),r==null||r(null)};N.confirm({title:M("Clear the canvas"),content:M("Are you sure to clear the canvas?"),okText:M("Confirm"),cancelText:M("Cancel"),getContainer:()=>ee.current,onOk(){g()}})}),q=a.useApp();return!S||P?n.jsx(w.Alert,{action:n.jsx(w.Button,{type:"primary",onClick:()=>Q(q.systemSettingsManager.getRoutePath("map")+"?tab=google"),children:M("Go to the configuration page")}),message:P||M("Please configure the Api key first"),type:"error"}):n.jsxs("div",{className:a.css`
47
47
  position: relative;
48
48
  height: 500px;
49
49
  `,children:[!d.current&&n.jsx("div",{className:a.css`
@@ -52,23 +52,23 @@
52
52
  display: flex;
53
53
  align-items: center;
54
54
  justify-content: center;
55
- `,children:n.jsx(w.Spin,{})}),l?null:n.jsxs(n.Fragment,{children:[d.current&&n.jsx(st,{toCenter:P,mapRef:d}),n.jsx("div",{className:a.css`
55
+ `,children:n.jsx(w.Spin,{})}),l?null:n.jsxs(n.Fragment,{children:[d.current&&n.jsx(st,{toCenter:I,mapRef:d}),n.jsx("div",{className:a.css`
56
56
  position: absolute;
57
57
  bottom: 80px;
58
58
  right: 20px;
59
59
  z-index: 10;
60
- `,children:n.jsx(w.Button,{onClick:$,disabled:!M.current,type:"primary",shape:"round",size:"large",icon:n.jsx(te.SyncOutlined,{})})}),T==="lineString"||T==="polygon"?n.jsx("div",{className:a.css`
60
+ `,children:n.jsx(w.Button,{onClick:$,disabled:!A.current,type:"primary",shape:"round",size:"large",icon:n.jsx(te.SyncOutlined,{})})}),T==="lineString"||T==="polygon"?n.jsx("div",{className:a.css`
61
61
  position: absolute;
62
62
  bottom: 20px;
63
63
  left: 10px;
64
64
  z-index: 2;
65
65
  pointer-events: none;
66
- `,children:n.jsx(w.Alert,{message:A("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,n.jsx("div",{className:a.css`
66
+ `,children:n.jsx(w.Alert,{message:M("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,n.jsx("div",{className:a.css`
67
67
  position: absolute;
68
68
  bottom: 20px;
69
69
  right: 20px;
70
70
  z-index: 2;
71
- `,children:n.jsx(w.Button,{disabled:!t,style:{height:"40px"},onClick:j,type:"primary",danger:!0,children:A("Clear")})})]}),n.jsx("div",{ref:ee,className:a.css`
71
+ `,children:n.jsx(w.Button,{disabled:!t,style:{height:"40px"},onClick:j,type:"primary",danger:!0,children:M("Clear")})})]}),n.jsx("div",{ref:ee,className:a.css`
72
72
  width: 100%;
73
73
  height: 100%;
74
74
  `,style:e==null?void 0:e.style})]})});Se.displayName="GoogleMapsComponent";const fe="google-maps-overlay-id",ze="google-maps-overlay-selected",ct=a.css`
@@ -81,7 +81,7 @@
81
81
  padding: 2px 4px;
82
82
  background: #fff;
83
83
  border: 1px solid #0000f5;
84
- `,ut=e=>{const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:s,setSelectedRecordKeys:l,lineSort:m}=a.useProps(e),{getPrimaryKey:v}=a.useCollection_deprecated(),S=v(),{marker:A="id"}=t,[c,y]=f.useState(!1),p=f.useRef(),[d,M]=f.useState(),[D,U]=f.useState(""),{t:I}=Z(),_=a.useCompile(),{isConnected:Y,doFilter:N}=a.useFilterAPI(),[,T]=f.useState(null),z=f.useRef(D),R=f.useRef(null),Q=f.useRef([]);z.current=D;const{getCollectionJoinField:ee}=a.useCollectionManager_deprecated(),X=(P,W)=>{const E=typeof W!="undefined"?!W:P.get(ze);P.set(ze,!E),P.setOptions(O({},E?{icon:ce(ue),strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{icon:ce(be),strokeColor:"#F18b62",fillColor:"#F18b62"}))};f.useEffect(()=>{var W,E,$,x;if(D!=="selection")return;p.current&&!((W=p.current)!=null&&W.drawingManager)&&(p.current.drawingManager=(E=p.current)==null?void 0:E.createDraw(!0,{editable:!0,draggable:!0}));const P=new Set;return($=p.current)==null||$.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),(x=p.current)==null||x.drawingManager.addListener("overlaycomplete",L=>{var j;const b=L.overlay;(j=p.current)==null||j.drawingManager.setDrawingMode(null),R.current=b;const k=b.getPath();["insert_at","remove_at","set_at"].forEach(q=>{P.add(k.addListener(q,()=>{}).remove)})}),()=>{var L,b,k,j;P.forEach(q=>{q()}),p.current&&((L=R.current)==null||L.unbindAll(),(b=R.current)==null||b.setMap(null),R.current=null,(k=p.current)==null||k.drawingManager.setDrawingMode(null),(j=p.current)==null||j.drawingManager.unbindAll())}},[D]),f.useEffect(()=>{if(D)return()=>{z.current||Q.current.forEach(P=>{X(P,!1)})}},[D]);const se=V.useMemoizedFn(()=>{var L;const P=R.current,W=Q.current,E=google.maps.geometry.poly,x=W.filter(b=>{if(!(b===P||b.get(fe)===void 0))return b instanceof google.maps.Marker?E.containsLocation(b.getPosition(),P):b instanceof google.maps.Circle?E.containsLocation(b.getCenter(),P):b.getPath().getArray().some(k=>E.containsLocation(k,P))}).map(b=>(X(b,!0),b.get(fe)));l(b=>x.concat(b)),P==null||P.unbindAll(),P==null||P.setMap(null),(L=p.current)==null||L.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});f.useEffect(()=>{var x,L;if(!o||!(r!=null&&r.length)||!((x=p.current)!=null&&x.map))return;const P=Array.isArray(t==null?void 0:t.field)&&(t==null?void 0:t.field.length)>1?t==null?void 0:t.field.slice(0,-1):t==null?void 0:t.field,W=ee([name,...P].flat().join(".")),E=r.map(b=>{const k=Fe(b,t==null?void 0:t.field,W==null?void 0:W.interface);return k!=null&&k.length?k==null?void 0:k.filter(Boolean).map(j=>{var g;if(!k)return;const q=(g=p.current)==null?void 0:g.setOverlay(o.type,j,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{className:ct,fontFamily:"inherit",fontSize:"13px",color:"#333",text:t!=null&&t.marker?_(b[A]):void 0}});return q==null||q.set(fe,b[S]),q}):[]}).flat().filter(Boolean);Q.current=E;const $=E.map(b=>{const k=j=>{const q=b,g=q.get(fe);if(!g)return;const u=r==null?void 0:r.find(h=>g===h[S]);if(Y){T(h=>(h&&Be(q),h===b?(Be(q),N(null),null):(ft(q),N(u[S],C=>C.field||S,"$eq"),q)));return}u&&M(u)};return b.addListener("click",k),()=>b.unbindAll()});if(o.type==="point"&&(m!=null&&m.length)&&(E==null?void 0:E.length)>1){const b=E.map(j=>j.getPosition());E[0].setZIndex(138),E[E.length-1].setZIndex(138);const k=(j=!0)=>{var q;if((q=p.current)!=null&&q.map)return new google.maps.Marker({label:{className:pt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:I(j?"Start point":"End point")},icon:ce(ue),position:j?b[0]:b[b.length-1],map:p.current.map})};E.push(...[p.current.setOverlay("lineString",b.map(j=>[j.lng(),j.lat()]),{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),k(),k(!1)].filter(Boolean))}return(L=p.current)==null||L.setFitView(E),()=>{E.forEach(b=>{b.setMap(null),b.unbindAll()}),$.forEach(b=>b())}},[r,c,A,o.type,Y]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const re=P=>{p.current=P,y(!!(P!=null&&P.map)&&!P.errMessage)};return n.jsxs("div",{className:a.css`
84
+ `,ut=e=>{const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:s,setSelectedRecordKeys:l,lineSort:m}=a.useProps(e),{getPrimaryKey:v}=a.useCollection_deprecated(),S=v(),{marker:M="id"}=t,[c,y]=f.useState(!1),p=f.useRef(),[d,A]=f.useState(),[D,U]=f.useState(""),{t:P}=Z(),_=a.useCompile(),{isConnected:Y,doFilter:N}=a.useFilterAPI(),[,T]=f.useState(null),z=f.useRef(D),R=f.useRef(null),Q=f.useRef([]);z.current=D;const{getCollectionJoinField:ee}=a.useCollectionManager_deprecated(),X=(I,W)=>{const E=typeof W!="undefined"?!W:I.get(ze);I.set(ze,!E),I.setOptions(O({},E?{icon:ce(ue),strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{icon:ce(be),strokeColor:"#F18b62",fillColor:"#F18b62"}))};f.useEffect(()=>{var W,E,$,x;if(D!=="selection")return;p.current&&!((W=p.current)!=null&&W.drawingManager)&&(p.current.drawingManager=(E=p.current)==null?void 0:E.createDraw(!0,{editable:!0,draggable:!0}));const I=new Set;return($=p.current)==null||$.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),(x=p.current)==null||x.drawingManager.addListener("overlaycomplete",L=>{var j;const b=L.overlay;(j=p.current)==null||j.drawingManager.setDrawingMode(null),R.current=b;const k=b.getPath();["insert_at","remove_at","set_at"].forEach(q=>{I.add(k.addListener(q,()=>{}).remove)})}),()=>{var L,b,k,j;I.forEach(q=>{q()}),p.current&&((L=R.current)==null||L.unbindAll(),(b=R.current)==null||b.setMap(null),R.current=null,(k=p.current)==null||k.drawingManager.setDrawingMode(null),(j=p.current)==null||j.drawingManager.unbindAll())}},[D]),f.useEffect(()=>{if(D)return()=>{z.current||Q.current.forEach(I=>{X(I,!1)})}},[D]);const se=V.useMemoizedFn(()=>{var L;const I=R.current,W=Q.current,E=google.maps.geometry.poly,x=W.filter(b=>{if(!(b===I||b.get(fe)===void 0))return b instanceof google.maps.Marker?E.containsLocation(b.getPosition(),I):b instanceof google.maps.Circle?E.containsLocation(b.getCenter(),I):b.getPath().getArray().some(k=>E.containsLocation(k,I))}).map(b=>(X(b,!0),b.get(fe)));l(b=>x.concat(b)),I==null||I.unbindAll(),I==null||I.setMap(null),(L=p.current)==null||L.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});f.useEffect(()=>{var x,L;if(!o||!(r!=null&&r.length)||!((x=p.current)!=null&&x.map))return;const I=Array.isArray(t==null?void 0:t.field)&&(t==null?void 0:t.field.length)>1?t==null?void 0:t.field.slice(0,-1):t==null?void 0:t.field,W=ee([name,...I].flat().join(".")),E=r.map(b=>{const k=Fe(b,t==null?void 0:t.field,W==null?void 0:W.interface);return k!=null&&k.length?k==null?void 0:k.filter(Boolean).map(j=>{var g;if(!k)return;const q=(g=p.current)==null?void 0:g.setOverlay(o.type,j,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{className:ct,fontFamily:"inherit",fontSize:"13px",color:"#333",text:t!=null&&t.marker?_(b[M]):void 0}});return q==null||q.set(fe,b[S]),q}):[]}).flat().filter(Boolean);Q.current=E;const $=E.map(b=>{const k=j=>{const q=b,g=q.get(fe);if(!g)return;const u=r==null?void 0:r.find(h=>g===h[S]);if(Y){T(h=>(h&&Be(q),h===b?(Be(q),N(null),null):(ft(q),N(u[S],C=>C.field||S,"$eq"),q)));return}u&&A(u)};return b.addListener("click",k),()=>b.unbindAll()});if(o.type==="point"&&(m!=null&&m.length)&&(E==null?void 0:E.length)>1){const b=E.map(j=>j.getPosition());E[0].setZIndex(138),E[E.length-1].setZIndex(138);const k=(j=!0)=>{var q;if((q=p.current)!=null&&q.map)return new google.maps.Marker({label:{className:pt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:P(j?"Start point":"End point")},icon:ce(ue),position:j?b[0]:b[b.length-1],map:p.current.map})};E.push(...[p.current.setOverlay("lineString",b.map(j=>[j.lng(),j.lat()]),{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),k(),k(!1)].filter(Boolean))}return(L=p.current)==null||L.setFitView(E),()=>{E.forEach(b=>{b.setMap(null),b.unbindAll()}),$.forEach(b=>b())}},[r,c,M,o.type,Y]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const re=I=>{p.current=I,y(!!(I!=null&&I.map)&&!I.errMessage)};return n.jsxs("div",{className:a.css`
85
85
  position: relative;
86
86
  height: 100%;
87
87
  `,children:[c&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:a.css`
@@ -89,10 +89,10 @@
89
89
  left: 10px;
90
90
  top: 10px;
91
91
  z-index: 999;
92
- `,children:n.jsxs(w.Space,{direction:"vertical",children:[n.jsx(w.Button,{style:{color:D?void 0:"#F18b62",borderColor:"currentcolor"},onClick:P=>{P.stopPropagation(),U("")},icon:n.jsx(te.EnvironmentOutlined,{})}),n.jsx(w.Button,{style:{color:D==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:P=>{P.stopPropagation(),U("selection")},icon:n.jsx(te.ExpandOutlined,{})}),D==="selection"?n.jsx(w.Button,{type:"primary",icon:n.jsx(te.CheckOutlined,{}),title:I("Confirm selection"),onClick:se}):null]})}),n.jsx(dt,{record:d,setVisible:M})]}),n.jsx(Se,J(O({},e),{ref:re,style:{height:i?"100%":null},zoom:s,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},dt=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=K.useFieldSchema(),s=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return s&&n.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:n.jsx(a.RecordProvider,{record:t,parent:r,children:n.jsx(K.RecursionField,{schema:s,name:s.name})})})};function Be(e){if(e instanceof google.maps.Marker)return e.setIcon(ce(ue));e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function ft(e){if(e instanceof google.maps.Marker)return e.setIcon(ce(be));e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const gt=()=>{var c;const{getCollectionJoinField:e}=a.useCollectionManager_deprecated(),{getField:o}=a.useCollection_deprecated(),{form:t}=a.useFormBlockContext(),r=K.useField(),i=K.useFieldSchema(),{t:s}=Z(),{dn:l,refresh:m}=a.useDesignable(),v=o(i.name)||e(i["x-collection-field"]),S=(c=v==null?void 0:v.uiSchema)==null?void 0:c.title;r.title===S||r.title,r.readPretty||r.required;let A="editable";return i["x-disabled"]===!0&&(A="readonly"),i["x-read-pretty"]===!0&&(A="read-pretty"),n.jsxs(a.GeneralSchemaDesigner,{children:[n.jsx(a.GeneralSchemaItems,{}),t&&!(t!=null&&t.readPretty)&&!a.isPatternDisabled(i)&&n.jsx(a.SchemaSettingsSelectItem,{title:s("Pattern"),options:[{label:s("Editable"),value:"editable"},{label:s("Readonly"),value:"readonly"},{label:s("Easy-reading"),value:"read-pretty"}],value:A,onChange:y=>{const p={"x-uid":i["x-uid"]};switch(y){case"readonly":{i["x-read-pretty"]=!1,i["x-disabled"]=!0,p["x-read-pretty"]=!1,p["x-disabled"]=!0,r.readPretty=!1,r.disabled=!0;break}case"read-pretty":{i["x-read-pretty"]=!0,i["x-disabled"]=!1,p["x-read-pretty"]=!0,p["x-disabled"]=!1,r.readPretty=!0;break}default:{i["x-read-pretty"]=!1,i["x-disabled"]=!1,p["x-read-pretty"]=!1,p["x-disabled"]=!1,r.readPretty=!1,r.disabled=!1;break}}l.emit("patch",{schema:p}),l.refresh()}},"pattern"),n.jsx(a.SchemaSettingsModalItem,{title:s("Set default zoom level"),schema:{type:"object",title:s("Set default zoom level"),properties:{zoom:{title:s("Zoom"),default:r.componentProps.zoom||13,description:s("The default zoom level of the map"),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}}}},onSubmit:({zoom:y})=>{y&&(pe.set(i,"x-component-props.zoom",y),Object.assign(r.componentProps,i["x-component-props"]),l.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":r.componentProps}})),l.refresh()}},"map-zoom"),n.jsx(a.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,confirm:{title:s("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},mt={amap:Ce,google:Se},xe=f.forwardRef((e,o)=>{const{t}=Z(),{mapType:r}=e,i=f.useMemo(()=>mt[r],[r]);return i?n.jsx(i,O({ref:o},e)):n.jsx("div",{children:t(`The ${r} cannot found`)})});xe.displayName="MapComponent";const ht=e=>{var m,v;const{value:o}=e,t=K.useFieldSchema(),{getField:r}=a.useCollection_deprecated(),i=r(t.name),s=e.mapType||((m=i==null?void 0:i.uiSchema["x-component-props"])==null?void 0:m.mapType),l=K.useForm();return a.useFieldTitle(),l.readPretty?n.jsx(xe,O({readonly:!0,mapType:s},e)):n.jsx("div",{children:n.jsx(a.EllipsisWithTooltip,{ellipsis:!0,children:(v=o==null?void 0:o.map)==null?void 0:v.call(o,S=>Array.isArray(S)?`(${S.join(",")})`:S).join(",")})})},Ke=K.connect(e=>n.jsx("div",{className:a.css`
92
+ `,children:n.jsxs(w.Space,{direction:"vertical",children:[n.jsx(w.Button,{style:{color:D?void 0:"#F18b62",borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),U("")},icon:n.jsx(te.EnvironmentOutlined,{})}),n.jsx(w.Button,{style:{color:D==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),U("selection")},icon:n.jsx(te.ExpandOutlined,{})}),D==="selection"?n.jsx(w.Button,{type:"primary",icon:n.jsx(te.CheckOutlined,{}),title:P("Confirm selection"),onClick:se}):null]})}),n.jsx(dt,{record:d,setVisible:A})]}),n.jsx(Se,J(O({},e),{ref:re,style:{height:i?"100%":null},zoom:s,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},dt=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=K.useFieldSchema(),s=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return s&&n.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:n.jsx(a.RecordProvider,{record:t,parent:r,children:n.jsx(K.RecursionField,{schema:s,name:s.name})})})};function Be(e){if(e instanceof google.maps.Marker)return e.setIcon(ce(ue));e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function ft(e){if(e instanceof google.maps.Marker)return e.setIcon(ce(be));e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const gt=()=>{var c;const{getCollectionJoinField:e}=a.useCollectionManager_deprecated(),{getField:o}=a.useCollection_deprecated(),{form:t}=a.useFormBlockContext(),r=K.useField(),i=K.useFieldSchema(),{t:s}=Z(),{dn:l,refresh:m}=a.useDesignable(),v=o(i.name)||e(i["x-collection-field"]),S=(c=v==null?void 0:v.uiSchema)==null?void 0:c.title;r.title===S||r.title,r.readPretty||r.required;let M="editable";return i["x-disabled"]===!0&&(M="readonly"),i["x-read-pretty"]===!0&&(M="read-pretty"),n.jsxs(a.GeneralSchemaDesigner,{children:[n.jsx(a.GeneralSchemaItems,{}),t&&!(t!=null&&t.readPretty)&&!a.isPatternDisabled(i)&&n.jsx(a.SchemaSettingsSelectItem,{title:s("Pattern"),options:[{label:s("Editable"),value:"editable"},{label:s("Readonly"),value:"readonly"},{label:s("Easy-reading"),value:"read-pretty"}],value:M,onChange:y=>{const p={"x-uid":i["x-uid"]};switch(y){case"readonly":{i["x-read-pretty"]=!1,i["x-disabled"]=!0,p["x-read-pretty"]=!1,p["x-disabled"]=!0,r.readPretty=!1,r.disabled=!0;break}case"read-pretty":{i["x-read-pretty"]=!0,i["x-disabled"]=!1,p["x-read-pretty"]=!0,p["x-disabled"]=!1,r.readPretty=!0;break}default:{i["x-read-pretty"]=!1,i["x-disabled"]=!1,p["x-read-pretty"]=!1,p["x-disabled"]=!1,r.readPretty=!1,r.disabled=!1;break}}l.emit("patch",{schema:p}),l.refresh()}},"pattern"),n.jsx(a.SchemaSettingsModalItem,{title:s("Set default zoom level"),schema:{type:"object",title:s("Set default zoom level"),properties:{zoom:{title:s("Zoom"),default:r.componentProps.zoom||13,description:s("The default zoom level of the map"),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}}}},onSubmit:({zoom:y})=>{y&&(pe.set(i,"x-component-props.zoom",y),Object.assign(r.componentProps,i["x-component-props"]),l.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":r.componentProps}})),l.refresh()}},"map-zoom"),n.jsx(a.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,confirm:{title:s("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},mt={amap:Ce,google:Se},xe=f.forwardRef((e,o)=>{const{t}=Z(),{mapType:r}=e,i=f.useMemo(()=>mt[r],[r]);return i?n.jsx(i,O({ref:o},e)):n.jsx("div",{children:t(`The ${r} cannot found`)})});xe.displayName="MapComponent";const ht=e=>{var m,v;const{value:o}=e,t=K.useFieldSchema(),{getField:r}=a.useCollection_deprecated(),i=r(t.name),s=e.mapType||((m=i==null?void 0:i.uiSchema["x-component-props"])==null?void 0:m.mapType),l=K.useForm();return a.useFieldTitle(),l.readPretty?n.jsx(xe,O({readonly:!0,mapType:s},e)):n.jsx("div",{children:n.jsx(a.EllipsisWithTooltip,{ellipsis:!0,children:(v=o==null?void 0:o.map)==null?void 0:v.call(o,S=>Array.isArray(S)?`(${S.join(",")})`:S).join(",")})})},Ke=K.connect(e=>n.jsx("div",{className:a.css`
93
93
  height: 100%;
94
94
  border: 1px solid transparent;
95
95
  .ant-formily-item-error & {
96
96
  border: 1px solid #ff4d4f;
97
97
  }
98
- `,children:n.jsx(xe,O({},e))}),K.mapReadPretty(ht));Ke.Designer=gt;const yt={amap:Xe,google:ut},bt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>yt[t],[t]);return r?n.jsx(r,O({},e)):n.jsx("div",{children:o(`The ${t} cannot found`)})},vt=a.withDynamicSchemaProps(e=>{var l;const{fieldNames:o}=a.useProps(e),{getCollectionJoinField:t}=a.useCollectionManager_deprecated(),{name:r}=a.useCollection_deprecated(),i=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),s=(l=i==null?void 0:i.uiSchema)==null?void 0:l["x-component-props"];return n.jsx(bt,J(O(O({},s),e),{collectionField:i}))}),At=()=>{const{name:e,title:o}=a.useCollection(),t=a.useSchemaTemplate();return n.jsx(a.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},Mt=e=>{const{collectionName:o,fieldNames:t,dataSource:r}=e;return{type:"void","x-acl-action":`${o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":{collection:o,dataSource:r,action:"list",fieldNames:t,params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:map","x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":"map:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}}},[K.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock"}}}}}}}}}}}},Ue=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,r,i)=>{const s=t==null?void 0:t.find(l=>l.value===r);return i===e.length-1?s:s==null?void 0:s.children},o)),Ct=()=>{const e=a.useSchemaInitializerItem(),{insert:o}=a.useSchemaInitializer(),t=f.useContext(K.SchemaOptionsContext),{getCollectionFieldsOptions:r}=a.useCollectionManager_deprecated(),{t:i}=Z(),{theme:s}=a.useGlobalTheme();return n.jsx(a.DataBlockInitializer,O({componentType:"Map",icon:n.jsx(te.TableOutlined,{}),onCreateBlockSchema:m=>he(this,[m],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),S=r(l.name,"string",{dataSource:l.dataSource}),A=yield a.FormDialog(i("Create map block"),()=>{var c;return n.jsx(a.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:n.jsx(qe.FormLayout,{layout:"vertical",children:n.jsx(a.SchemaComponent,{schema:{properties:{field:{title:i("Map field"),enum:v,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:v.length?[v[0].value,(c=v[0].children)==null?void 0:c[0].value].filter(y=>y!=null):[]},marker:{title:i("Marker field"),enum:S,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ue(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},s).open({initialValues:{}});o(Mt({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},A)}))}),title:i("Map block")},e))},we=f.createContext({});we.displayName="MapBlockContext";const St=e=>{var v;const{fieldNames:o}=e,t=K.useFieldSchema(),r=K.useField(),{resource:i,service:s}=a.useBlockRequestContext(),[l,m]=f.useState([]);return n.jsx(a.FixedBlockWrapper,{children:n.jsx(a.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:n.jsx(we.Provider,{value:{field:r,service:s,resource:i,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:m},children:e.children})})})},xt=e=>{const o=K.useField(),{params:t,fieldNames:r}=e,i=t.appends||[],{field:s}=r||{};return Array.isArray(s)&&s.length>1&&i.push(s[0]),n.jsx(a.BlockProvider,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:i,paginate:!1,sort:o.componentProps.lineSort}),children:n.jsx(St,O({},e))}))},ge=()=>f.useContext(we),Ne=()=>{var o,t,r,i,s,l;const e=ge();return J(O({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((i=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:i.zoom)||13,lineSort:(l=(s=e==null?void 0:e.field)==null?void 0:s.componentProps)==null?void 0:l.lineSort})},wt=e=>n.jsx(a.SchemaComponentOptions,{scope:{useMapBlockProps:Ne},components:{MapBlockInitializer:Ct,MapBlockDesigner:At,MapBlockProvider:xt,MapBlock:vt},children:e.children}),It=new a.SchemaInitializer({name:"map:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return a.useCollection_deprecated().template!=="sql"}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}}]},{name:"divider",type:"divider",useVisible(){return a.useCollection_deprecated().template!=="sql"}},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[],useVisible(){return a.useCollection_deprecated().template!=="sql"}}]}),Pt=new a.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:a.SchemaSettingsBlockTitleItem},{name:"fixBlock",Component:a.FixedBlockDesignerItem},{name:"mapField",Component:a.SchemaSettingsCascaderItem,useComponentProps(){var S;const{getCollectionFieldsOptions:e}=a.useCollectionManager_deprecated(),{t:o}=Z(),t=K.useFieldSchema(),r=((S=t==null?void 0:t["x-decorator-props"])==null?void 0:S.fieldNames)||{},i=K.useField(),{dn:s}=a.useDesignable(),{service:l}=ge(),{name:m}=a.useCollection(),v=e(m,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:v,allowClear:!1,onChange:A=>{const c=i.decoratorProps.fieldNames||{};c.field=A,i.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),s.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}}},{name:"markerField",Component:a.SchemaSettingsSelectItem,useComponentProps(){var S;const{t:e}=Z(),o=K.useFieldSchema(),t=((S=o==null?void 0:o["x-decorator-props"])==null?void 0:S.fieldNames)||{},{service:r}=ge(),i=K.useField(),{dn:s}=a.useDesignable(),{getCollectionFieldsOptions:l}=a.useCollectionManager_deprecated(),{name:m}=a.useCollection(),v=l(m,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:A=>{const c=i.decoratorProps.fieldNames||{};c.marker=A,i.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}},useVisible(){var l,m;const e=K.useFieldSchema(),{getCollectionFieldsOptions:o}=a.useCollectionManager_deprecated(),{name:t}=a.useCollection(),r=((l=e==null?void 0:e["x-decorator-props"])==null?void 0:l.fieldNames)||{},i=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((m=Ue(r.field,i))==null?void 0:m.type)==="point"}},{name:"setDefaultSortingRules",Component:a.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},a.setDataLoadingModeSettingsItem,{name:"defaultZoomLevel",Component:a.SchemaSettingsModalItem,useComponentProps(){var s;const{t:e}=Z(),o=K.useFieldSchema(),t=K.useField(),{dn:r}=a.useDesignable(),i=((s=o==null?void 0:o["x-component-props"])==null?void 0:s.zoom)||13;return{title:e("The default zoom level of the map"),schema:{type:"object",title:e("Set default zoom level"),properties:{zoom:{title:e("Zoom"),default:i,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:l})=>{pe.set(o,"x-component-props.zoom",l),Object.assign(t.componentProps,o["x-component-props"]),r.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":t.componentProps}}),r.refresh()}}}},{name:"dataScope",Component:a.SchemaSettingsDataScope,useComponentProps(){var m,v;const{name:e}=a.useCollection(),o=K.useFieldSchema(),{form:t}=a.useFormBlockContext(),r=K.useField(),{service:i}=ge(),{dn:s}=a.useDesignable(),l=a.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(m=o==null?void 0:o["x-decorator-props"])==null?void 0:m.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:S})=>{var y,p,d;const A=r.decoratorProps.params||{};A.filter=S,r.decoratorProps.params=A,o["x-decorator-props"].params=A;const c=((p=(y=i.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&i.run(J(O({},(d=i.params)==null?void 0:d[0]),{filter:a.mergeFilter([...Object.values(c),S]),page:1}),{filters:c}),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:a.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=Z();return{type:a.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:a.SchemaSettingsTemplate,useComponentProps(){var r,i;const{name:e}=a.useCollection(),o=K.useFieldSchema(),t=((r=o==null?void 0:o["x-decorator-props"])==null?void 0:r.resource)||((i=o==null?void 0:o["x-decorator-props"])==null?void 0:i.association);return{componentName:"Map",collectionName:e,resourceName:t}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:kt}=a.interfacesProperties;Array.isArray(a.interfacesProperties.type.enum)&&a.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class me extends a.CollectionFieldInterface{constructor(){super(...arguments);F(this,"properties",J(O({},kt),{"uiSchema.x-component-props.mapType":{title:H("Map type"),type:"string",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1},"x-disabled":"{{ isOverride || !createOnly }}",default:"amap",enum:ke}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Ft extends me{constructor(){super(...arguments);F(this,"name","circle");F(this,"type","object");F(this,"group","map");F(this,"order",3);F(this,"title",H("Circle"));F(this,"availableTypes",["circle"]);F(this,"description",H("Circle"));F(this,"sortable",!0);F(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Ot extends me{constructor(){super(...arguments);F(this,"name","lineString");F(this,"type","object");F(this,"group","map");F(this,"order",2);F(this,"title",H("Line"));F(this,"description",H("Line"));F(this,"availableTypes",["lineString"]);F(this,"sortable",!0);F(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Et extends me{constructor(){super(...arguments);F(this,"name","point");F(this,"type","object");F(this,"group","map");F(this,"order",1);F(this,"title",H("Point"));F(this,"description",H("Point"));F(this,"availableTypes",["point"]);F(this,"sortable",!0);F(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Lt extends me{constructor(){super(...arguments);F(this,"name","polygon");F(this,"type","object");F(this,"group","map");F(this,"order",4);F(this,"title",H("Polygon"));F(this,"description",H("Polygon"));F(this,"availableTypes",["polygon"]);F(this,"sortable",!0);F(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const Dt=[Et,Lt,Ot,Ft],Ge=f.memo(e=>n.jsx(a.SchemaComponentOptions,{components:{Map:Ke},children:n.jsx(wt,{children:e.children})}));Ge.displayName="MapProvider";class _e extends a.Plugin{load(){return he(this,null,function*(){this.app.use(Ge),this.app.dataSourceManager.addFieldInterfaces(Dt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:H("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(It),this.schemaSettingsManager.add(Pt);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:H("Map"),Component:"MapBlockInitializer"}),this.app.systemSettingsManager.add("business-components."+ye,{title:H("Map Manager"),icon:"EnvironmentOutlined",Component:et,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:Ne})})}}B.MapPlugin=_e,B.default=_e,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
98
+ `,children:n.jsx(xe,O({},e))}),K.mapReadPretty(ht));Ke.Designer=gt;const yt={amap:Xe,google:ut},bt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>yt[t],[t]);return r?n.jsx(r,O({},e)):n.jsx("div",{children:o(`The ${t} cannot found`)})},vt=a.withDynamicSchemaProps(e=>{var l;const{fieldNames:o}=a.useProps(e),{getCollectionJoinField:t}=a.useCollectionManager_deprecated(),{name:r}=a.useCollection_deprecated(),i=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),s=(l=i==null?void 0:i.uiSchema)==null?void 0:l["x-component-props"];return n.jsx(bt,J(O(O({},s),e),{collectionField:i}))}),Mt=()=>{const{name:e,title:o}=a.useCollection(),t=a.useSchemaTemplate();return n.jsx(a.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},At=e=>{const{collectionName:o,fieldNames:t,dataSource:r}=e;return{type:"void","x-acl-action":`${o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":{collection:o,dataSource:r,action:"list",fieldNames:t,params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:map","x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":"map:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}}},[K.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock"}}}}}}}}}}}},Ue=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,r,i)=>{const s=t==null?void 0:t.find(l=>l.value===r);return i===e.length-1?s:s==null?void 0:s.children},o)),Ct=()=>{const e=a.useSchemaInitializerItem(),{insert:o}=a.useSchemaInitializer(),t=f.useContext(K.SchemaOptionsContext),{getCollectionFieldsOptions:r}=a.useCollectionManager_deprecated(),{t:i}=Z(),{theme:s}=a.useGlobalTheme();return n.jsx(a.DataBlockInitializer,O({componentType:"Map",icon:n.jsx(te.TableOutlined,{}),onCreateBlockSchema:m=>he(this,[m],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),S=r(l.name,"string",{dataSource:l.dataSource}),M=yield a.FormDialog(i("Create map block"),()=>{var c;return n.jsx(a.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:n.jsx(qe.FormLayout,{layout:"vertical",children:n.jsx(a.SchemaComponent,{schema:{properties:{field:{title:i("Map field"),enum:v,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:v.length?[v[0].value,(c=v[0].children)==null?void 0:c[0].value].filter(y=>y!=null):[]},marker:{title:i("Marker field"),enum:S,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ue(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},s).open({initialValues:{}});o(At({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},M)}))}),title:i("Map block")},e))},we=f.createContext({});we.displayName="MapBlockContext";const St=e=>{var v;const{fieldNames:o}=e,t=K.useFieldSchema(),r=K.useField(),{resource:i,service:s}=a.useBlockRequestContext(),[l,m]=f.useState([]);return n.jsx(a.FixedBlockWrapper,{children:n.jsx(a.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:n.jsx(we.Provider,{value:{field:r,service:s,resource:i,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:m},children:e.children})})})},xt=e=>{const o=K.useField(),{params:t,fieldNames:r}=e,i=t.appends||[],{field:s}=r||{};return Array.isArray(s)&&s.length>1&&i.push(s[0]),n.jsx(a.BlockProvider,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:i,paginate:!1,sort:o.componentProps.lineSort}),children:n.jsx(St,O({},e))}))},ge=()=>f.useContext(we),Ne=()=>{var o,t,r,i,s,l;const e=ge();return J(O({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((i=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:i.zoom)||13,lineSort:(l=(s=e==null?void 0:e.field)==null?void 0:s.componentProps)==null?void 0:l.lineSort})},wt=e=>n.jsx(a.SchemaComponentOptions,{scope:{useMapBlockProps:Ne},components:{MapBlockInitializer:Ct,MapBlockDesigner:Mt,MapBlockProvider:xt,MapBlock:vt},children:e.children}),Pt=new a.SchemaInitializer({name:"map:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return a.useCollection_deprecated().template!=="sql"}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}}]},{name:"divider",type:"divider",useVisible(){return a.useCollection_deprecated().template!=="sql"}},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[],useVisible(){return a.useCollection_deprecated().template!=="sql"}}]}),It=new a.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:a.SchemaSettingsBlockTitleItem},{name:"fixBlock",Component:a.FixedBlockDesignerItem},{name:"mapField",Component:a.SchemaSettingsCascaderItem,useComponentProps(){var S;const{getCollectionFieldsOptions:e}=a.useCollectionManager_deprecated(),{t:o}=Z(),t=K.useFieldSchema(),r=((S=t==null?void 0:t["x-decorator-props"])==null?void 0:S.fieldNames)||{},i=K.useField(),{dn:s}=a.useDesignable(),{service:l}=ge(),{name:m}=a.useCollection(),v=e(m,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:v,allowClear:!1,onChange:M=>{const c=i.decoratorProps.fieldNames||{};c.field=M,i.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),s.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}}},{name:"markerField",Component:a.SchemaSettingsSelectItem,useComponentProps(){var S;const{t:e}=Z(),o=K.useFieldSchema(),t=((S=o==null?void 0:o["x-decorator-props"])==null?void 0:S.fieldNames)||{},{service:r}=ge(),i=K.useField(),{dn:s}=a.useDesignable(),{getCollectionFieldsOptions:l}=a.useCollectionManager_deprecated(),{name:m}=a.useCollection(),v=l(m,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:M=>{const c=i.decoratorProps.fieldNames||{};c.marker=M,i.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}},useVisible(){var l,m;const e=K.useFieldSchema(),{getCollectionFieldsOptions:o}=a.useCollectionManager_deprecated(),{name:t}=a.useCollection(),r=((l=e==null?void 0:e["x-decorator-props"])==null?void 0:l.fieldNames)||{},i=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((m=Ue(r.field,i))==null?void 0:m.type)==="point"}},{name:"setDefaultSortingRules",Component:a.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},{name:"setDataLoadingMode",Component:a.SetDataLoadingMode},{name:"defaultZoomLevel",Component:a.SchemaSettingsModalItem,useComponentProps(){var s;const{t:e}=Z(),o=K.useFieldSchema(),t=K.useField(),{dn:r}=a.useDesignable(),i=((s=o==null?void 0:o["x-component-props"])==null?void 0:s.zoom)||13;return{title:e("The default zoom level of the map"),schema:{type:"object",title:e("Set default zoom level"),properties:{zoom:{title:e("Zoom"),default:i,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:l})=>{pe.set(o,"x-component-props.zoom",l),Object.assign(t.componentProps,o["x-component-props"]),r.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":t.componentProps}}),r.refresh()}}}},{name:"dataScope",Component:a.SchemaSettingsDataScope,useComponentProps(){var m,v;const{name:e}=a.useCollection(),o=K.useFieldSchema(),{form:t}=a.useFormBlockContext(),r=K.useField(),{service:i}=ge(),{dn:s}=a.useDesignable(),l=a.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(m=o==null?void 0:o["x-decorator-props"])==null?void 0:m.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:S})=>{var y,p,d;const M=r.decoratorProps.params||{};M.filter=S,r.decoratorProps.params=M,o["x-decorator-props"].params=M;const c=((p=(y=i.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&i.run(J(O({},(d=i.params)==null?void 0:d[0]),{filter:a.mergeFilter([...Object.values(c),S]),page:1}),{filters:c}),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:a.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=Z();return{type:a.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:a.SchemaSettingsTemplate,useComponentProps(){var r,i;const{name:e}=a.useCollection(),o=K.useFieldSchema(),t=((r=o==null?void 0:o["x-decorator-props"])==null?void 0:r.resource)||((i=o==null?void 0:o["x-decorator-props"])==null?void 0:i.association);return{componentName:"Map",collectionName:e,resourceName:t}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:kt}=a.interfacesProperties;Array.isArray(a.interfacesProperties.type.enum)&&a.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class me extends a.CollectionFieldInterface{constructor(){super(...arguments);F(this,"properties",J(O({},kt),{"uiSchema.x-component-props.mapType":{title:H("Map type"),type:"string",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1},"x-disabled":"{{ isOverride || !createOnly }}",default:"amap",enum:ke}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Ft extends me{constructor(){super(...arguments);F(this,"name","circle");F(this,"type","object");F(this,"group","map");F(this,"order",3);F(this,"title",H("Circle"));F(this,"availableTypes",["circle"]);F(this,"description",H("Circle"));F(this,"sortable",!0);F(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Ot extends me{constructor(){super(...arguments);F(this,"name","lineString");F(this,"type","object");F(this,"group","map");F(this,"order",2);F(this,"title",H("Line"));F(this,"description",H("Line"));F(this,"availableTypes",["lineString"]);F(this,"sortable",!0);F(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Et extends me{constructor(){super(...arguments);F(this,"name","point");F(this,"type","object");F(this,"group","map");F(this,"order",1);F(this,"title",H("Point"));F(this,"description",H("Point"));F(this,"availableTypes",["point"]);F(this,"sortable",!0);F(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Lt extends me{constructor(){super(...arguments);F(this,"name","polygon");F(this,"type","object");F(this,"group","map");F(this,"order",4);F(this,"title",H("Polygon"));F(this,"description",H("Polygon"));F(this,"availableTypes",["polygon"]);F(this,"sortable",!0);F(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const Dt=[Et,Lt,Ot,Ft],Ge=f.memo(e=>n.jsx(a.SchemaComponentOptions,{components:{Map:Ke},children:n.jsx(wt,{children:e.children})}));Ge.displayName="MapProvider";class _e extends a.Plugin{load(){return he(this,null,function*(){this.app.use(Ge),this.app.dataSourceManager.addFieldInterfaces(Dt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:H("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(Pt),this.schemaSettingsManager.add(It);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:H("Map"),Component:"MapBlockInitializer"}),this.app.systemSettingsManager.add("business-components."+ye,{title:H("Map Manager"),icon:"EnvironmentOutlined",Component:et,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:Ne})})}}B.MapPlugin=_e,B.default=_e,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,14 +1,14 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "0.23.8",
4
- "@tachybase/server": "0.23.8",
5
- "@tachybase/schema": "0.23.8",
3
+ "@tachybase/client": "0.23.14",
4
+ "@tachybase/server": "0.23.14",
5
+ "@tachybase/schema": "0.23.14",
6
6
  "lodash": "4.17.21",
7
- "@tachybase/components": "0.23.8",
7
+ "@tachybase/components": "0.23.14",
8
8
  "@ant-design/icons": "5.3.7",
9
9
  "ahooks": "3.8.4",
10
10
  "antd": "5.22.5",
11
11
  "react-router-dom": "6.28.1",
12
- "@tachybase/actions": "0.23.8",
13
- "@tachybase/database": "0.23.8"
12
+ "@tachybase/actions": "0.23.14",
13
+ "@tachybase/database": "0.23.14"
14
14
  };
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-block-map",
3
3
  "displayName": "Block: Map",
4
- "version": "0.23.8",
4
+ "version": "0.23.14",
5
5
  "description": "Map block, support Gaode map and Google map, you can also extend more map types.",
6
6
  "keywords": [
7
7
  "Blocks"
8
8
  ],
9
9
  "license": "Apache-2.0",
10
10
  "main": "./dist/server/index.js",
11
+ "dependencies": {},
11
12
  "devDependencies": {
12
13
  "@amap/amap-jsapi-loader": "^1.0.1",
13
14
  "@amap/amap-jsapi-types": "^0.0.10",
@@ -23,16 +24,16 @@
23
24
  "react-dom": "~18.3.1",
24
25
  "react-i18next": "^15.2.0",
25
26
  "react-router-dom": "6.28.1",
26
- "@tachybase/components": "0.23.8",
27
- "@tachybase/schema": "0.23.8"
27
+ "@tachybase/components": "0.23.14",
28
+ "@tachybase/schema": "0.23.14"
28
29
  },
29
30
  "peerDependencies": {
30
- "@tachybase/client": "0.23.8",
31
- "@tachybase/test": "0.23.8",
32
- "@tachybase/server": "0.23.8",
33
- "@tachybase/utils": "0.23.8",
34
- "@tachybase/database": "0.23.8",
35
- "@tachybase/actions": "0.23.8"
31
+ "@tachybase/actions": "0.23.14",
32
+ "@tachybase/client": "0.23.14",
33
+ "@tachybase/database": "0.23.14",
34
+ "@tachybase/server": "0.23.14",
35
+ "@tachybase/test": "0.23.14",
36
+ "@tachybase/utils": "0.23.14"
36
37
  },
37
38
  "description.zh-CN": "地图卡片,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
38
39
  "displayName.zh-CN": "卡片:地图",
@@ -1,14 +0,0 @@
1
-
2
- 
3
- > @tachybase/plugin-block-map@0.23.2 build /Users/seal/Documents/projects/tachybase/packages/plugin-block-map
4
- > tachybase-build --no-dts @tachybase/plugin-block-map
5
-
6
- The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
7
- @tachybase/plugin-block-map: plugin-block-map build start
8
- @tachybase/plugin-block-map: build plugin client
9
- @tachybase/plugin-block-map: build plugin server source
10
- @tachybase/plugin-block-map: delete server files
11
- @tachybase/plugin-block-map: build plugin server dependencies
12
- @tachybase/plugin-block-map: These packages @tachybase/server, @tachybase/actions, @tachybase/database will be exclude.
13
- @tachybase/plugin-block-map: write external version
14
-