@tachybase/plugin-block-map 0.23.41 → 0.23.47

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,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AMapComponentProps } from './AMap';
3
3
  import Designer from './Designer';
4
- declare const InternalMap: React.ForwardRefExoticComponent<Partial<AMapComponentProps> & React.RefAttributes<unknown>>;
4
+ declare const InternalMap: React.ForwardRefExoticComponent<AMapComponentProps & React.RefAttributes<never>>;
5
5
  declare const Map: typeof InternalMap & {
6
6
  Designer: typeof Designer;
7
7
  };
@@ -1,98 +1,98 @@
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`
1
+ (function(U,s){typeof exports=="object"&&typeof module!="undefined"?s(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"],s):(U=typeof globalThis!="undefined"?globalThis:U||self,s(U["@tachybase/plugin-block-map"]={},U.jsxRuntime,U.react,U["@tachybase/client"],U["@tachybase/schema"],U["@ant-design/icons"],U.ahooks,U.antd,U["react-router-dom"],U.lodash,U["@tachybase/components"]))})(this,function(U,s,f,a,z,ee,q,w,te,ce,je){"use strict";var Dt=Object.defineProperty,Tt=Object.defineProperties;var zt=Object.getOwnPropertyDescriptors;var Ge=Object.getOwnPropertySymbols;var Bt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var _e=(U,s,f)=>s in U?Dt(U,s,{enumerable:!0,configurable:!0,writable:!0,value:f}):U[s]=f,F=(U,s)=>{for(var f in s||(s={}))Bt.call(s,f)&&_e(U,f,s[f]);if(Ge)for(var f of Ge(s))Kt.call(s,f)&&_e(U,f,s[f]);return U},Y=(U,s)=>Tt(U,zt(s));var me=(U,s,f)=>new Promise((a,z)=>{var ee=te=>{try{w(f.next(te))}catch(ce){z(ce)}},q=te=>{try{w(f.throw(te))}catch(ce){z(ce)}},w=te=>te.done?a(te.value):Promise.resolve(te.value).then(ee,q);w((f=f.apply(U,s)).next())});const he="block-map";function X(e){return a.tval(e,{ns:[he,"core"]})}function J(){return a.useTranslation([he,"core"])}const Pe=[{label:X("AMap"),value:"amap"},{label:X("Google Maps"),value:"google"}],ye="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAMAAAC7OkrPAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEJQTFRFAAAA8Yti8Yti8Itj8Iti74tj8Itj8YtiKwADKwADKhw5Kh07KwADKwADKwADKwAD4odn1YBlKwADKwADKwADKwAD/5y7LQAAABZ0Uk5TAP/8/f/B/PYOHjY3CCozLP3XCSkvMhA05K4AAAC4SURBVHic7dXLDoIwEIXhwSsoLSrw/q8qbSAiMy3/oivj2czmS5omnVORdapVJJFKBSEL2mrrUurbpdXa5dTH5dXi9tTsGNtX0TFG1OT+7PdY2YdEGd0FuFmUwXWm5UAZbCTKYA3SUrXZQTHLHbUy2OlsMO0ultLsajLlbEWZMEUZ+ig5E6YKM2GqMBOmGKubW1D3ps6g1nnvA5uGa5Os85E9nmF2ebYkzeKhc9wre4V+GMeh317hDfXgCWigIGJbAAAAAElFTkSuQmCC",pe="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==",Ie=(e,o,t)=>{const r=o==null?void 0:o.reduce((i,n,l)=>l===o.length-1&&(t==="o2m"||t==="m2m")?i==null?void 0:i.map(m=>m[n]).filter(m=>m!=null):i==null?void 0:i[n],e);return t==="o2m"||t==="m2m"?r:[r]};var qe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ke={exports:{}};(function(e,o){(function(t,r){e.exports=r()})(qe,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===n.failed)p("前次请求 AMapUI 失败");else if(m.AMapUI===n.notload){m.AMapUI=n.loading,l.AMapUI.version=c.version||l.AMapUI.version,A=l.AMapUI.version;var L=document.body||document.head,B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/ui/"+A+"/main.js",B.onerror=function(P){m.AMapUI=n.failed,p("请求 AMapUI 失败")},B.onload=function(){if(m.AMapUI=n.loaded,d.length)window.AMapUI.loadUI(d,function(){for(var P=0,G=d.length;P<G;P++){var W=d[P].split("/").slice(-1)[0];window.AMapUI[W]=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]()},L.appendChild(B)}else m.AMapUI===n.loaded?c.version&&c.version!==l.AMapUI.version?p("不允许多个版本 AMapUI 混用"):d.length?window.AMapUI.loadUI(d,function(){for(var P=0,G=d.length;P<G;P++){var W=d[P].split("/").slice(-1)[0];window.AMapUI[W]=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 G=0,W=d.length;G<W;G++){var K=d[G].split("/").slice(-1)[0];window.AMapUI[K]=arguments[G]}y()}):y()})})}function i(c){return new Promise(function(y,p){if(m.Loca===n.failed)p("前次请求 Loca 失败");else if(m.Loca===n.notload){m.Loca=n.loading,l.Loca.version=c.version||l.Loca.version;var d=l.Loca.version,A=l.AMap.version.startsWith("2"),L=d.startsWith("2");if(A&&!L||!A&&L)p("JSAPI 与 Loca 版本不对应!!");else{A=l.key,L=document.body||document.head;var B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/loca?v="+d+"&key="+A,B.onerror=function(P){m.Loca=n.failed,p("请求 AMapUI 失败")},B.onload=function(){for(m.Loca=n.loaded,y();v.Loca.length;)v.Loca.splice(0,1)[0]()},L.appendChild(B)}}else m.Loca===n.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 n;(function(c){c.notload="notload",c.loading="loading",c.loaded="loaded",c.failed="failed"})(n||(n={}));var l={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},m={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},v={AMap:[],AMapUI:[],Loca:[]},S=[],M=function(c){typeof c=="function"&&(m.AMap===n.loaded?c(window.AMap):S.push(c))};return{load:function(c){return new Promise(function(y,p){if(m.AMap==n.failed)p("");else if(m.AMap==n.notload){var d=c.key,A=c.version,L=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=L||l.AMap.plugins,m.AMap=n.loading,A=document.body||document.head,window.___onAPILoaded=function(P){if(delete window.___onAPILoaded,P)m.AMap=n.failed,p(P);else for(m.AMap=n.loaded,t(c).then(function(){y(window.AMap)}).catch(p);S.length;)S.splice(0,1)[0]()},L=document.createElement("script"),L.type="text/javascript",L.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+l.AMap.version+"&key="+d+"&plugin="+l.AMap.plugins.join(","),L.onerror=function(P){m.AMap=n.failed,p(P)},A.appendChild(L)):p("请填写key")}else if(m.AMap==n.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 B=[];if(c.plugins)for(A=0;A<c.plugins.length;A+=1)l.AMap.plugins.indexOf(c.plugins[A])==-1&&B.push(c.plugins[A]);M(function(){B.length?window.AMap.plugin(B,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:n.notload,AMapUI:n.notload,Loca:n.notload},v={AMap:[],AMapUI:[],Loca:[]}}}})})(ke);var We=ke.exports;const Ye=Ve(We),Fe="map-configuration",be=e=>`TACHYBASE_PLUGIN_MAP_CONFIGURATION_${e}`,ve=e=>{const o=f.useMemo(()=>{const r=sessionStorage.getItem(be(e));return r&&JSON.parse(r)},[e]),{data:t}=a.useRequest({resource:Fe,action:"get",params:{type:e}},{onSuccess(r){sessionStorage.setItem(be(e),JSON.stringify(r==null?void 0:r.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!o});return o||(t==null?void 0:t.data)},Je=e=>{const{aMap:o,toCenter:t}=e,{t:r}=J(),i=f.useRef(),[n,l]=f.useState([]);f.useEffect(()=>{o==null||o.plugin("AMap.PlaceSearch",()=>{i.current=new o.PlaceSearch({city:"全国",pageSize:30})})},[o]);const{run:m}=q.useDebounceFn(S=>{i.current&&i.current.search(S||" ",(M,c)=>{if(M==="complete")l(c.poiList.pois.map(y=>Y(F({},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=n.find(c=>c.value===S);M!=null&&M.location&&t(M.location)};return s.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})})},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`
7
+ `,children:s.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:n,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"}},Ae=f.forwardRef((e,o)=>{const{accessKey:t,securityJsCode:r}=ve(e.mapType)||{},{value:i,onChange:n,block:l=!1,readonly:m,disabled:v=l,zoom:S=13,overlayCommonOptions:M}=e,{t:c}=J(),y=z.useFieldSchema(),p=f.useRef(),d=f.useRef(),A=f.useRef(),[L,B]=f.useState([]),[P,G]=f.useState(""),{getField:W}=a.useCollection_deprecated(),K=f.useMemo(()=>{if(e.type)return e.type;const g=W(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]),D=f.useRef(),T=f.useRef(null),$=te.useNavigate(),H=f.useRef(`tachybase-map-${K||""}-${Date.now().toString(32)}`),{modal:R}=w.App.useApp(),[Z]=f.useState(F({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1},M)),ne=q.useMemoizedFn(()=>{D.current&&D.current.remove()}),oe=q.useMemoizedFn(()=>{(!v||l)&&K!=="point"&&T.current&&(T.current.setTarget(D.current),T.current.open())}),I=q.useMemoizedFn((g,u=!1)=>{let h=null;if(K==="point"){const{lat:C,lng:N}=g.getPosition();h=[N,C]}else if(K==="polygon"||K==="lineString"){if(h=g.getPath().map(C=>[C.lng,C.lat]),h.length<2)return}else if(K==="circle"){const C=g.getCenter(),N=g.getRadius();h=[C.lng,C.lat,N]}u||(ne(),D.current=g,oe()),n==null||n(h)}),V=q.useMemoizedFn((g=K)=>{const u=Me[g];if(u&&"editor"in u&&!T.current)return T.current=new p.current[u.editor](d.current,null,{createOptions:Z,editOptions:Z,controlPoint:Y(F({},Z),{strokeWeight:3}),midControlPoint:Y(F({},Z),{strokeWeight:2,fillColor:"#fff"})}),T.current.on("adjust",function({target:h}){I(h,!0)}),T.current.on("move",function({target:h}){I(h,!0)}),T.current}),O=q.useMemoizedFn((g=K)=>{var h;if(!A.current||(h=T.current)!=null&&h.getTarget())return;const u=Me[g];u&&A.current[u.mouseTool](F({},Z))}),Q=q.useMemoizedFn((g=K)=>{A.current||(A.current=new p.current.MouseTool(d.current),A.current.on("draw",function({obj:u}){I(u)}),O(g))}),x=(g,u)=>{d.current&&d.current.setZoomAndCenter(18,g,u)},E=()=>{const g=()=>{ne(),T.current&&(T.current.setTarget(),T.current.close()),n==null||n(null)};R.confirm({title:c("Clear the canvas"),content:c("Are you sure to clear the canvas?"),okText:c("Confirm"),cancelText:c("Cancel"),getContainer:()=>document.getElementById(H.current),onOk(){g()}})},b=()=>{D.current&&d.current.setFitView([D.current])},k=f.useCallback((g=K,u=i,h)=>{const C=Me[g];if(!C)return;const N=F(F({},Z),h);return"transformOptions"in C?Object.assign(N,C.transformOptions(u)):"propertyKey"in C&&(N[C.propertyKey]=u),new p.current[C.overlay](N)},[Z]),_=(g=K,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&&D.current)return;const g=_();d.current.setFitView([g]),D.current=g,v||(V(),oe())},[i,L,K,Z,v,m]),f.useEffect(()=>{var g,u,h;A.current&&(v?((g=A.current)==null||g.close(),(u=T.current)==null||u.close()):(O(),(h=T.current)==null||h.open()))},[v]),f.useEffect(()=>{!p.current||!K||v||(Q(),V())},[v,L,K]),f.useEffect(()=>{var u,h;if(!i&&(A.current||T.current)&&(ne(),T.current&&(T.current.setTarget(),T.current.close()),n==null||n(null)),!A.current||!T.current)return;T.current.getTarget()?(h=(u=A.current).close)==null||h.call(u):O()},[K,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,Ye.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(H.current,{resizeEnable:!0,zoom:S}),p.current=u,G(""),B([])}))).catch(u=>{typeof u=="string"?u.includes("多个不一致的 key")?G(c("The AccessKey is incorrect, please check it")):G(u):(u==null?void 0:u.type)==="error"&&G("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,T.current=null}},[t,K,r]),f.useImperativeHandle(o,()=>({setOverlay:_,getOverlay:k,createMouseTool:Q,createEditor:V,executeMouseTool:O,aMap:p.current,map:d.current,overlay:D.current,mouseTool:()=>A.current,editor:()=>T.current,errMessage:P}));const j=a.useApp();return!t||P?s.jsx(w.Alert,{action:s.jsx(w.Button,{type:"primary",onClick:()=>$(j.systemSettingsManager.getRoutePath("map")),children:c("Go to the configuration page")}),message:P||c("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):s.jsxs("div",{className:a.css`
8
8
  position: relative;
9
9
  height: 500px;
10
- `,id:Q.current,style:e==null?void 0:e.style,children:[!p.current&&n.jsx("div",{className:a.css`
10
+ `,id:H.current,style:e==null?void 0:e.style,children:[!p.current&&s.jsx("div",{className:a.css`
11
11
  position: absolute;
12
12
  inset: 0;
13
13
  display: flex;
14
14
  align-items: center;
15
15
  justify-content: center;
16
- `,children:n.jsx(w.Spin,{})}),v?null:n.jsxs(n.Fragment,{children:[n.jsx(Ze,{toCenter:x,aMap:p.current}),n.jsx("div",{className:a.css`
16
+ `,children:s.jsx(w.Spin,{})}),v?null:s.jsxs(s.Fragment,{children:[s.jsx(Je,{toCenter:x,aMap:p.current}),s.jsx("div",{className:a.css`
17
17
  position: absolute;
18
18
  bottom: 80px;
19
19
  right: 20px;
20
20
  z-index: 10;
21
- `,children:n.jsx(w.Button,{onClick:b,disabled:!T.current,type:"primary",shape:"round",size:"large",icon:n.jsx(te.SyncOutlined,{})})}),N!=="point"?n.jsx("div",{className:a.css`
21
+ `,children:s.jsx(w.Button,{onClick:b,disabled:!D.current,type:"primary",shape:"round",size:"large",icon:s.jsx(ee.SyncOutlined,{})})}),K!=="point"?s.jsx("div",{className:a.css`
22
22
  position: absolute;
23
23
  bottom: 20px;
24
24
  left: 10px;
25
25
  z-index: 2;
26
26
  pointer-events: none;
27
- `,children:n.jsx(w.Alert,{message:c("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,n.jsx("div",{className:a.css`
27
+ `,children:s.jsx(w.Alert,{message:c("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,s.jsx("div",{className:a.css`
28
28
  position: absolute;
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 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`
32
+ `,children:s.jsx(w.Button,{disabled:!i,style:{height:"40px"},onClick:E,type:"primary",danger:!0,children:c("Clear")})})]})]})});Ae.displayName="AMapComponent";const Ze=e=>{var I,V,O,Q;const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:n,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=(V=(I=d.current)==null?void 0:I.aMap)==null?void 0:V.GeometryUtil,[L,B]=f.useState(),[P,G]=f.useState(""),{t:W}=J(),K=a.useCompile(),{isConnected:D,doFilter:T}=a.useFilterAPI(),[,$]=f.useState(null),H=f.useRef(P);H.current=P;const R=(x,E)=>{const b=x.getExtData(),k=typeof E=="undefined"?b.selected:!E;b.selected=!k,"setIcon"in x&&x.setIcon(new d.current.aMap.Icon({imageSize:[19,32],image:k?pe:ye})),x.setOptions(F({extData:b},k?{strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{strokeColor:"#F18b62",fillColor:"#F18b62"}))},Z=()=>{var x,E,b;d.current&&((x=d.current)==null||x.mouseTool().close(!0),(E=d.current)==null||E.editor().setTarget(null),(b=d.current)==null||b.editor().close())};f.useEffect(()=>{var x,E,b,k;if(P==="selection")return(x=d.current)!=null&&x.editor()?(k=d.current)==null||k.executeMouseTool("polygon"):((E=d.current)==null||E.createEditor("polygon"),(b=d.current)==null||b.createMouseTool("polygon")),()=>{Z()}},[P]),f.useEffect(()=>{if(P)return()=>{var x;H.current||(x=d.current)==null||x.map.getAllOverlays().forEach(E=>{R(E,!1)})}},[P]);const ne=q.useMemoizedFn(()=>{var _,j,g;const x=(_=d.current)==null?void 0:_.editor().getTarget(),E=(j=d.current)==null?void 0:j.map.getAllOverlays(),b=E==null?void 0:E.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=>(R(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,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,E=M([v,...x].flat().join(".")),b=r.map(u=>{var C;const h=(C=Ie(u,t==null?void 0:t.field,E==null?void 0:E.interface))==null?void 0:C.filter(Boolean);return h!=null&&h.length?h.map(N=>{var se;return(se=d.current)==null?void 0:se.setOverlay(o.type,N,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:t!=null&&t.marker?K(u[t.marker]):void 0},extData:{id:u[c]}})}):[]}).flat().filter(Boolean);(j=(_=d.current)==null?void 0:_.map)==null||j.setFitView(b);const k=b.map(u=>{const h=C=>{const N=C.target,re=N.getExtData();if(!re)return;if(H.current){H.current==="click"&&(l(ie=>re.selected?ie.filter(we=>we!==re.id):[...ie,re.id]),R(N));return}const se=r.find(ie=>re.id===ie[c]);if(D){$(ie=>(ie&&Oe(ie),ie===u?(Oe(u),T(null),null):(He(u),T(se[c],we=>we.field||c,"$eq"),u)));return}se&&B(se)};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 N,re;if((N=d.current)!=null&&N.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:W(C?"Start point":"End point")},position:u[C?0:u.length-1],map:(re=d.current)==null?void 0:re.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,D,m]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const oe=x=>{d.current=x,p(!!(x!=null&&x.map)&&!x.errMessage)};return s.jsxs("div",{className:a.css`
33
33
  position: relative;
34
34
  height: 100%;
35
- `,children:[n.jsx("div",{className:a.css`
35
+ `,children:[s.jsx("div",{className:a.css`
36
36
  position: absolute;
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: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`
40
+ `,children:y&&!((O=d.current)!=null&&O.errMessage)?s.jsxs(w.Space,{direction:"vertical",children:[s.jsx(w.Button,{style:{color:P?void 0:"#F18b62",borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),G("")},icon:s.jsx(ee.EnvironmentOutlined,{})}),s.jsx(w.Button,{style:{color:P==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:x=>{x.stopPropagation(),G("selection")},icon:s.jsx(ee.ExpandOutlined,{})}),P==="selection"?s.jsx(w.Button,{type:"primary",icon:s.jsx(ee.CheckOutlined,{}),title:W("Confirm selection"),onClick:ne}):null]}):null}),s.jsx(Xe,{record:L,setVisible:B}),s.jsx(Ae,Y(F({},(Q=o==null?void 0:o.uiSchema)==null?void 0:Q["x-component-props"]),{ref:oe,style:{height:i?"100%":null},zoom:n,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},Xe=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=z.useFieldSchema(),n=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return n&&s.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:s.jsx(a.RecordProvider,{record:t,parent:r,children:s.jsx(z.RecursionField,{schema:n,name:n.name})})})};function Oe(e){e.dom?e.dom.style.filter="none":e.setOptions&&e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function He(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 Ee=({type:e,children:o})=>{const{t}=J(),[r,i]=q.useBoolean(!1),n=a.useAPIClient(),[l]=w.Form.useForm(),m=ve(e);f.useEffect(()=>{m&&(l.setFieldsValue(m),i.toggle())},[m]);const v=f.useMemo(()=>n.resource(Fe),[n]),S=M=>{v.set(Y(F({},M),{type:e})).then(c=>{sessionStorage.removeItem(be(e)),i.toggle(),w.message.success(t("Saved successfully"))}).catch(c=>{w.message.success(t("Saved failed"))})};return s.jsxs(w.Form,{disabled:r,form:l,layout:"vertical",onFinish:S,children:[o,r?s.jsx(w.Button,{disabled:!1,onClick:i.toggle,children:t("Edit")}):s.jsx(w.Form.Item,{children:s.jsx(w.Button,{disabled:!1,type:"primary",htmlType:"submit",children:t("Save")})})]})},Qe={amap:()=>{const{t:e}=J();return s.jsxs(Ee,{type:"amap",children:[s.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Access key"),children:s.jsx(w.Input,{})}),s.jsx(w.Form.Item,{required:!0,name:"securityJsCode",label:e("securityJsCode or serviceHost"),children:s.jsx(w.Input,{})})]})},google:()=>{const{t:e}=J();return s.jsx(Ee,{type:"google",children:s.jsx(w.Form.Item,{required:!0,name:"accessKey",label:e("Api key"),children:s.jsx(w.Input,{})})})}},$e=Pe.map(e=>Y(F({},e),{component:Qe[e.value]})),Re=()=>{const e=a.useCompile(),o=te.useLocation(),t=new URLSearchParams(o.search);return s.jsx(w.Card,{bordered:!0,children:s.jsx(w.Tabs,{type:"card",defaultActiveKey:t.get("tab"),children:$e.map(r=>s.jsx(w.Tabs.TabPane,{tab:e(r.label),children:s.jsx(r.component,{type:r.value})},r.value))})})};function et(e,o,t,r){function i(n){return n instanceof t?n:new t(function(l){l(n)})}return new(t||(t=Promise))(function(n,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?n(M.value):i(M.value).then(m,v)}S((r=r.apply(e,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ot=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,n;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(n=Object.keys(o),r=n.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[i]))return!1;for(i=r;i--!==0;){var l=n[i];if(!e(o[l],t[l]))return!1}return!0}return o!==o&&t!==t},rt=tt(ot);const Le="__googleMapsScriptId";var ue;(function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"})(ue||(ue={}));class ae{constructor({apiKey:o,authReferrerPolicy:t,channel:r,client:i,id:n=Le,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=n||Le,this.language=l,this.libraries=m,this.mapIds=v,this.nonce=S,this.region=M,this.retries=c,this.url=y,this.version=p,ae.instance){if(!rt(this.options,ae.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(ae.instance.options)}`);return ae.instance}ae.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?ue.FAILURE:this.done?ue.SUCCESS:this.loading?ue.LOADING:ue.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(n=>!r[n]&&delete r[n]),!((t=(o=window==null?void 0:window.google)===null||o===void 0?void 0:o.maps)===null||t===void 0)&&t.importLibrary||(n=>{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={}),L=new Set,B=new URLSearchParams,P=()=>l||(l=new Promise((G,W)=>et(this,void 0,void 0,function*(){var K;yield m=p.createElement("script"),m.id=this.id,B.set("libraries",[...L]+"");for(v in n)B.set(v.replace(/[A-Z]/g,D=>"_"+D[0].toLowerCase()),n[v]);B.set("callback",M+".maps."+y),m.src=this.url+"?"+B,A[y]=G,m.onerror=()=>l=W(Error(S+" could not load.")),m.nonce=this.nonce||((K=p.querySelector("script[nonce]"))===null||K===void 0?void 0:K.nonce)||"",p.head.append(m)})));A[c]?console.warn(S+" only loads once. Ignoring:",n):A[c]=(G,...W)=>L.add(G)&&P().then(()=>A[c](G,...W))})(r);const i=this.libraries.map(n=>this.importLibrary(n));i.length||i.push(this.importLibrary("core")),Promise.all(i).then(()=>this.callback(),n=>{const l=new ErrorEvent("error",{error:n});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 nt=e=>{const{toCenter:o,mapRef:t}=e,{t:r}=J(),i=f.useRef(),[n,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}=q.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 Y(F({},y),{label:`${p.main_text}${p.secondary_text?" "+p.secondary_text:""}`,value:y.place_id})}));else{l([]);return}})},{wait:300}),v=S=>{const M=n.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 s.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}=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`
46
+ `,children:s.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:n})})},le=e=>({url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(19/2,42)}),st=()=>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()}),it=e=>e==="point"?"marker":e==="lineString"?"polyline":e,at={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"}},Ce=f.forwardRef((e,o)=>{const{value:t,onChange:r,block:i=!1,readonly:n,disabled:l=i,zoom:m=13,overlayCommonOptions:v}=e,{accessKey:S}=ve(e.mapType)||{},{t:M}=J(),{getField:c}=a.useCollection_deprecated(),y=z.useFieldSchema(),p=f.useRef(),d=f.useRef(),A=f.useRef(),[L,B]=f.useState([]),[P,G]=f.useState(""),W=a.useAPIClient(),{modal:K}=w.App.useApp(),D=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]),T=f.useRef(it(D)),[$]=f.useState(F({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1,editable:!l,draggable:!l},v)),H=te.useNavigate(),R=f.useRef(),Z=f.useRef(new Set),ne=q.useMemoizedFn(g=>{if(Z.current.forEach(u=>{Z.current.delete(u)}),"getPath"in g){const u=g.getPath();["insert_at","remove_at","set_at"].forEach(h=>{Z.current.add(u.addListener(h,()=>{x(g,!0)}).remove)})}else g instanceof google.maps.Circle&&["center_changed","radius_changed"].forEach(u=>{Z.current.add(g.addListener(u,()=>{x(g,!0)}).remove)})}),oe=q.useMemoizedFn(()=>{var g;A.current&&(A.current.unbindAll(),A.current.setMap(null)),D!=="point"&&((g=p.current)==null||g.setDrawingMode(null))}),I=q.useMemoizedFn(g=>{d.current&&(d.current.setCenter(g),d.current.setZoom(m))}),V=q.useMemoizedFn(g=>{oe(),ne(g),A.current=g}),O=q.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 N=0;N<C.getLength();N++)u.extend(C.getAt(N))}else h instanceof google.maps.Circle&&u.union(h.getBounds())}),d.current.setCenter(u.getCenter())}),Q=()=>{A.current&&O([A.current])},x=q.useMemoizedFn((g,u=!1)=>{let h=null;if(D==="point"){const{lat:C,lng:N}=g.getPosition();h=[N(),C()]}else if(D==="polygon"||D==="lineString"){if(h=g.getPath().getArray().map(C=>[C.lng(),C.lat()]),h.length<2)return}else if(D==="circle"){const C=g.getCenter(),N=g.getRadius();h=[C.lng(),C.lat(),N]}u||V(g),r==null||r(h)}),E=q.useMemoizedFn((g=!1,u)=>{const h=Y(F(F({},$),u),{map:d.current});return p.current=new google.maps.drawing.DrawingManager({drawingMode:T.current,drawingControl:!1,markerOptions:Y(F({},h),{icon:le(pe)}),polygonOptions:h,polylineOptions:h,circleOptions:h,map:d.current}),g||p.current.addListener("overlaycomplete",C=>{const N=C.overlay;x(N)}),p.current}),b=q.useMemoizedFn((g=D,u=t,h)=>{const C=at[g];if(!C)return;const N=F(Y(F({},$),{icon:le(pe)}),h);return"transformOptions"in C?Object.assign(N,C.transformOptions(u)):"propertyKey"in C&&(N[C.propertyKey]=Array.isArray(u[0])?u.map(se=>new google.maps.LatLng(se[1],se[0])):new google.maps.LatLng(u[1],u[0])),new google.maps[C.overlay](N)}),k=q.useMemoizedFn((g=D,u=t,h)=>d.current?b(g,u,Y(F({},h),{map:d.current})):void 0);f.useEffect(()=>{var u,h;if(!t&&d.current&&(oe(),(h=(u=p==null?void 0:p.current)==null?void 0:u.setDrawingMode)==null||h.call(u,T.current),r==null||r(null)),!d.current||!t||!n&&A.current)return;const g=k();V(g),O([g])},[t,L,D,l,n,k,O,V]),f.useEffect(()=>{if(!S||d.current||!R.current)return;let g;try{g=new ae({apiKey:S,version:"weekly",language:W.auth.getLocale()})}catch(h){G(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")&&G(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=>me(this,null,function*(){const C=yield st();d.current=new google.maps.Map(R.current,{zoom:m,center:C,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),G(""),B([])})).catch(h=>{if(h instanceof Error){G(h.message);return}}),()=>{var h,C;(h=d.current)==null||h.unbindAll(),d.current=null,(C=p.current)==null||C.unbindAll()}},[S,W.auth,D,m]),f.useEffect(()=>{!d.current||!D||l||p.current||E()},[E,l,L,D]),f.useImperativeHandle(o,()=>({setOverlay:k,getOverlay:b,setFitView:O,createDraw:E,map:d.current,overlay:A.current,drawingManager:p.current,errMessage:P}));const _=q.useMemoizedFn(()=>{const g=()=>{oe(),p.current.setDrawingMode(T.current),r==null||r(null)};K.confirm({title:M("Clear the canvas"),content:M("Are you sure to clear the canvas?"),okText:M("Confirm"),cancelText:M("Cancel"),getContainer:()=>R.current,onOk(){g()}})}),j=a.useApp();return!S||P?s.jsx(w.Alert,{action:s.jsx(w.Button,{type:"primary",onClick:()=>H(j.systemSettingsManager.getRoutePath("map")+"?tab=google"),children:M("Go to the configuration page")}),message:P||M("Please configure the Api key first"),type:"error"}):s.jsxs("div",{className:a.css`
47
47
  position: relative;
48
48
  height: 500px;
49
- `,children:[!d.current&&n.jsx("div",{className:a.css`
49
+ `,children:[!d.current&&s.jsx("div",{className:a.css`
50
50
  position: absolute;
51
51
  inset: 0;
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:I,mapRef:d}),n.jsx("div",{className:a.css`
55
+ `,children:s.jsx(w.Spin,{})}),l?null:s.jsxs(s.Fragment,{children:[d.current&&s.jsx(nt,{toCenter:I,mapRef:d}),s.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:!A.current,type:"primary",shape:"round",size:"large",icon:n.jsx(te.SyncOutlined,{})})}),T==="lineString"||T==="polygon"?n.jsx("div",{className:a.css`
60
+ `,children:s.jsx(w.Button,{onClick:Q,disabled:!A.current,type:"primary",shape:"round",size:"large",icon:s.jsx(ee.SyncOutlined,{})})}),D==="lineString"||D==="polygon"?s.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:M("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,n.jsx("div",{className:a.css`
66
+ `,children:s.jsx(w.Alert,{message:M("Click to select the starting point and double-click to end the drawing"),type:"info"})}):null,s.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:M("Clear")})})]}),n.jsx("div",{ref:ee,className:a.css`
71
+ `,children:s.jsx(w.Button,{disabled:!t,style:{height:"40px"},onClick:_,type:"primary",danger:!0,children:M("Clear")})})]}),s.jsx("div",{ref:R,className:a.css`
72
72
  width: 100%;
73
73
  height: 100%;
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`
74
+ `,style:e==null?void 0:e.style})]})});Ce.displayName="GoogleMapsComponent";const de="google-maps-overlay-id",De="google-maps-overlay-selected",lt=a.css`
75
75
  margin-top: 6px;
76
76
  padding: 2px 4px;
77
77
  background: #fff;
78
78
  border: 1px solid #0000f5;
79
- `,pt=a.css`
79
+ `,ct=a.css`
80
80
  margin-top: -64px;
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: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`
84
+ `,pt=e=>{const{collectionField:o,fieldNames:t,dataSource:r,fixedBlock:i,zoom:n,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(),[L,B]=f.useState(""),{t:P}=J(),G=a.useCompile(),{isConnected:W,doFilter:K}=a.useFilterAPI(),[,D]=f.useState(null),T=f.useRef(L),$=f.useRef(null),H=f.useRef([]);T.current=L;const{getCollectionJoinField:R}=a.useCollectionManager_deprecated(),Z=(I,V)=>{const O=typeof V!="undefined"?!V:I.get(De);I.set(De,!O),I.setOptions(F({},O?{icon:le(pe),strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{icon:le(ye),strokeColor:"#F18b62",fillColor:"#F18b62"}))};f.useEffect(()=>{var V,O,Q,x;if(L!=="selection")return;p.current&&!((V=p.current)!=null&&V.drawingManager)&&(p.current.drawingManager=(O=p.current)==null?void 0:O.createDraw(!0,{editable:!0,draggable:!0}));const I=new Set;return(Q=p.current)==null||Q.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),(x=p.current)==null||x.drawingManager.addListener("overlaycomplete",E=>{var _;const b=E.overlay;(_=p.current)==null||_.drawingManager.setDrawingMode(null),$.current=b;const k=b.getPath();["insert_at","remove_at","set_at"].forEach(j=>{I.add(k.addListener(j,()=>{}).remove)})}),()=>{var E,b,k,_;I.forEach(j=>{j()}),p.current&&((E=$.current)==null||E.unbindAll(),(b=$.current)==null||b.setMap(null),$.current=null,(k=p.current)==null||k.drawingManager.setDrawingMode(null),(_=p.current)==null||_.drawingManager.unbindAll())}},[L]),f.useEffect(()=>{if(L)return()=>{T.current||H.current.forEach(I=>{Z(I,!1)})}},[L]);const ne=q.useMemoizedFn(()=>{var E;const I=$.current,V=H.current,O=google.maps.geometry.poly,x=V.filter(b=>{if(!(b===I||b.get(de)===void 0))return b instanceof google.maps.Marker?O.containsLocation(b.getPosition(),I):b instanceof google.maps.Circle?O.containsLocation(b.getCenter(),I):b.getPath().getArray().some(k=>O.containsLocation(k,I))}).map(b=>(Z(b,!0),b.get(de)));l(b=>x.concat(b)),I==null||I.unbindAll(),I==null||I.setMap(null),(E=p.current)==null||E.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});f.useEffect(()=>{var x,E;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,V=R([name,...I].flat().join(".")),O=r.map(b=>{const k=Ie(b,t==null?void 0:t.field,V==null?void 0:V.interface);return k!=null&&k.length?k==null?void 0:k.filter(Boolean).map(_=>{var g;if(!k)return;const j=(g=p.current)==null?void 0:g.setOverlay(o.type,_,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{className:lt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:t!=null&&t.marker?G(b[M]):void 0}});return j==null||j.set(de,b[S]),j}):[]}).flat().filter(Boolean);H.current=O;const Q=O.map(b=>{const k=_=>{const j=b,g=j.get(de);if(!g)return;const u=r==null?void 0:r.find(h=>g===h[S]);if(W){D(h=>(h&&Te(j),h===b?(Te(j),K(null),null):(dt(j),K(u[S],C=>C.field||S,"$eq"),j)));return}u&&A(u)};return b.addListener("click",k),()=>b.unbindAll()});if(o.type==="point"&&(m!=null&&m.length)&&(O==null?void 0:O.length)>1){const b=O.map(_=>_.getPosition());O[0].setZIndex(138),O[O.length-1].setZIndex(138);const k=(_=!0)=>{var j;if((j=p.current)!=null&&j.map)return new google.maps.Marker({label:{className:ct,fontFamily:"inherit",fontSize:"13px",color:"#333",text:P(_?"Start point":"End point")},icon:le(pe),position:_?b[0]:b[b.length-1],map:p.current.map})};O.push(...[p.current.setOverlay("lineString",b.map(_=>[_.lng(),_.lat()]),{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),k(),k(!1)].filter(Boolean))}return(E=p.current)==null||E.setFitView(O),()=>{O.forEach(b=>{b.setMap(null),b.unbindAll()}),Q.forEach(b=>b())}},[r,c,M,o.type,W]),f.useEffect(()=>{setTimeout(()=>{l([])})},[r]);const oe=I=>{p.current=I,y(!!(I!=null&&I.map)&&!I.errMessage)};return s.jsxs("div",{className:a.css`
85
85
  position: relative;
86
86
  height: 100%;
87
- `,children:[c&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:a.css`
87
+ `,children:[c&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:a.css`
88
88
  position: absolute;
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: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`
92
+ `,children:s.jsxs(w.Space,{direction:"vertical",children:[s.jsx(w.Button,{style:{color:L?void 0:"#F18b62",borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("")},icon:s.jsx(ee.EnvironmentOutlined,{})}),s.jsx(w.Button,{style:{color:L==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("selection")},icon:s.jsx(ee.ExpandOutlined,{})}),L==="selection"?s.jsx(w.Button,{type:"primary",icon:s.jsx(ee.CheckOutlined,{}),title:P("Confirm selection"),onClick:ne}):null]})}),s.jsx(ut,{record:d,setVisible:A})]}),s.jsx(Ce,Y(F({},e),{ref:oe,style:{height:i?"100%":null},zoom:n,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})},ut=e=>{const{setVisible:o,record:t}=e,r=a.useCollectionParentRecordData(),i=z.useFieldSchema(),n=f.useMemo(()=>i.reduceProperties((l,m)=>m.name==="drawer"?m:l,null),[i]);return n&&s.jsx(a.ActionContextProvider,{value:{visible:!!t,setVisible:o},children:s.jsx(a.RecordProvider,{record:t,parent:r,children:s.jsx(z.RecursionField,{schema:n,name:n.name})})})};function Te(e){if(e instanceof google.maps.Marker)return e.setIcon(le(pe));e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function dt(e){if(e instanceof google.maps.Marker)return e.setIcon(le(ye));e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const ft=()=>{var c;const{getCollectionJoinField:e}=a.useCollectionManager_deprecated(),{getField:o}=a.useCollection_deprecated(),{form:t}=a.useFormBlockContext(),r=z.useField(),i=z.useFieldSchema(),{t:n}=J(),{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"),s.jsxs(a.GeneralSchemaDesigner,{children:[s.jsx(a.GeneralSchemaItems,{}),t&&!(t!=null&&t.readPretty)&&!a.isPatternDisabled(i)&&s.jsx(a.SchemaSettingsSelectItem,{title:n("Pattern"),options:[{label:n("Editable"),value:"editable"},{label:n("Readonly"),value:"readonly"},{label:n("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"),s.jsx(a.SchemaSettingsModalItem,{title:n("Set default zoom level"),schema:{type:"object",title:n("Set default zoom level"),properties:{zoom:{title:n("Zoom"),default:r.componentProps.zoom||13,description:n("The default zoom level of the map"),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}}}},onSubmit:({zoom:y})=>{y&&(ce.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"),s.jsx(a.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,confirm:{title:n("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},gt={amap:Ae,google:Ce},Se=f.forwardRef((e,o)=>{const{t}=J(),{mapType:r}=e,i=f.useMemo(()=>gt[r],[r]);return i?s.jsx(i,F({ref:o},e)):s.jsx("div",{children:t(`The ${r} cannot found`)})});Se.displayName="MapComponent";const mt=e=>{var m,v;const{value:o}=e,t=z.useFieldSchema(),{getField:r}=a.useCollection_deprecated(),i=r(t.name),n=e.mapType||((m=i==null?void 0:i.uiSchema["x-component-props"])==null?void 0:m.mapType),l=z.useForm();return a.useFieldTitle(),l.readPretty?s.jsx(Se,F({readonly:!0,mapType:n},e)):s.jsx("div",{children:s.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(",")})})},ze=z.connect(e=>s.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}))}),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":"popup:addTab",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"}})});
98
+ `,children:s.jsx(Se,F({},e))}),z.mapReadPretty(mt));ze.Designer=ft;const ht={amap:Ze,google:pt},yt=e=>{const{t:o}=J(),{mapType:t}=e,r=f.useMemo(()=>ht[t],[t]);return r?s.jsx(r,F({},e)):s.jsx("div",{children:o(`The ${t} cannot found`)})},bt=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]),n=(l=i==null?void 0:i.uiSchema)==null?void 0:l["x-component-props"];return s.jsx(yt,Y(F(F({},n),e),{collectionField:i}))}),vt=()=>{const{name:e,title:o}=a.useCollection(),t=a.useSchemaTemplate();return s.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}}},[z.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":"popup:addTab",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"}}}}}}}}}}}},Be=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,r,i)=>{const n=t==null?void 0:t.find(l=>l.value===r);return i===e.length-1?n:n==null?void 0:n.children},o)),At=()=>{const e=a.useSchemaInitializerItem(),{insert:o}=a.useSchemaInitializer(),t=f.useContext(z.SchemaOptionsContext),{getCollectionFieldsOptions:r}=a.useCollectionManager_deprecated(),{t:i}=J(),{theme:n}=a.useGlobalTheme();return s.jsx(a.DataBlockInitializer,F({componentType:"Map",icon:s.jsx(ee.TableOutlined,{}),onCreateBlockSchema:m=>me(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 s.jsx(a.SchemaComponentOptions,{scope:t.scope,components:F({},t.components),children:s.jsx(je.FormLayout,{layout:"vertical",children:s.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=Be(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},n).open({initialValues:{}});o(Mt({collectionName:l.name,dataSource:l.dataSource,fieldNames:F({},M)}))}),title:i("Map block")},e))},xe=f.createContext({});xe.displayName="MapBlockContext";const Ct=e=>{var v;const{fieldNames:o}=e,t=z.useFieldSchema(),r=z.useField(),{resource:i,service:n}=a.useBlockRequestContext(),[l,m]=f.useState([]);return s.jsx(a.FixedBlockWrapper,{children:s.jsx(a.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:s.jsx(xe.Provider,{value:{field:r,service:n,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})})})},St=e=>{const o=z.useField(),{params:t,fieldNames:r}=e,i=t.appends||[],{field:n}=r||{};return Array.isArray(n)&&n.length>1&&i.push(n[0]),s.jsx(a.BlockProvider,Y(F({name:"map"},e),{runWhenParamsChanged:!0,params:Y(F({},t),{appends:i,paginate:!1,sort:o.componentProps.lineSort}),children:s.jsx(Ct,F({},e))}))},fe=()=>f.useContext(xe),Ke=()=>{var o,t,r,i,n,l;const e=fe();return Y(F({},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=(n=e==null?void 0:e.field)==null?void 0:n.componentProps)==null?void 0:l.lineSort})},xt=e=>s.jsx(a.SchemaComponentOptions,{scope:{useMapBlockProps:Ke},components:{MapBlockInitializer:At,MapBlockDesigner:vt,MapBlockProvider:St,MapBlock:bt},children:e.children}),wt=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}=J(),t=z.useFieldSchema(),r=((S=t==null?void 0:t["x-decorator-props"])==null?void 0:S.fieldNames)||{},i=z.useField(),{dn:n}=a.useDesignable(),{service:l}=fe(),{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(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":i.decoratorProps}}),n.refresh()}}}},{name:"markerField",Component:a.SchemaSettingsSelectItem,useComponentProps(){var S;const{t:e}=J(),o=z.useFieldSchema(),t=((S=o==null?void 0:o["x-decorator-props"])==null?void 0:S.fieldNames)||{},{service:r}=fe(),i=z.useField(),{dn:n}=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(),n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":i.decoratorProps}}),n.refresh()}}},useVisible(){var l,m;const e=z.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=Be(r.field,i))==null?void 0:m.type)==="point"}},{name:"setDefaultSortingRules",Component:a.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=J();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},{name:"setDataLoadingMode",Component:a.SetDataLoadingMode},{name:"defaultZoomLevel",Component:a.SchemaSettingsModalItem,useComponentProps(){var n;const{t:e}=J(),o=z.useFieldSchema(),t=z.useField(),{dn:r}=a.useDesignable(),i=((n=o==null?void 0:o["x-component-props"])==null?void 0:n.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})=>{ce.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=z.useFieldSchema(),{form:t}=a.useFormBlockContext(),r=z.useField(),{service:i}=fe(),{dn:n}=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(Y(F({},(d=i.params)==null?void 0:d[0]),{filter:a.mergeFilter([...Object.values(c),S]),page:1}),{filters:c}),n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:a.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=J();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=z.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:It}=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 ge extends a.CollectionFieldInterface{constructor(){super(...arguments),this.properties=Y(F({},It),{"uiSchema.x-component-props.mapType":{title:X("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:Pe}})}schemaInitialize(o,{block:t}){t==="Form"&&Object.assign(o,{"x-designer":"Map.Designer"})}}class kt extends ge{constructor(){super(...arguments),this.name="circle",this.type="object",this.group="map",this.order=3,this.title=X("Circle"),this.availableTypes=["circle"],this.description=X("Circle"),this.sortable=!0,this.default={type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}class Ft extends ge{constructor(){super(...arguments),this.name="lineString",this.type="object",this.group="map",this.order=2,this.title=X("Line"),this.description=X("Line"),this.availableTypes=["lineString"],this.sortable=!0,this.default={type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}class Ot extends ge{constructor(){super(...arguments),this.name="point",this.type="object",this.group="map",this.order=1,this.title=X("Point"),this.description=X("Point"),this.availableTypes=["point"],this.sortable=!0,this.default={type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}class Et extends ge{constructor(){super(...arguments),this.name="polygon",this.type="object",this.group="map",this.order=4,this.title=X("Polygon"),this.description=X("Polygon"),this.availableTypes=["polygon"],this.sortable=!0,this.default={type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}const Lt=[Ot,Et,Ft,kt],Ue=f.memo(e=>s.jsx(a.SchemaComponentOptions,{components:{Map:ze},children:s.jsx(xt,{children:e.children})}));Ue.displayName="MapProvider";class Ne extends a.Plugin{load(){return me(this,null,function*(){this.app.use(Ue),this.app.dataSourceManager.addFieldInterfaces(Lt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:X("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(wt),this.schemaSettingsManager.add(Pt);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:X("Map"),Component:"MapBlockInitializer"}),this.app.systemSettingsManager.add("business-components."+he,{title:X("Map Manager"),icon:"EnvironmentOutlined",Component:Re,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:Ke})})}}U.MapPlugin=Ne,U.default=Ne,Object.defineProperties(U,{__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.41",
4
- "@tachybase/server": "0.23.41",
5
- "@tachybase/schema": "0.23.41",
3
+ "@tachybase/client": "0.23.47",
4
+ "@tachybase/server": "0.23.47",
5
+ "@tachybase/schema": "0.23.47",
6
6
  "lodash": "4.17.21",
7
- "@tachybase/components": "0.23.41",
7
+ "@tachybase/components": "0.23.47",
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.41",
13
- "@tachybase/database": "0.23.41"
12
+ "@tachybase/actions": "0.23.47",
13
+ "@tachybase/database": "0.23.47"
14
14
  };
@@ -23,7 +23,10 @@ module.exports = __toCommonJS(circle_exports);
23
23
  var import_database = require("@tachybase/database");
24
24
  var import_helpers = require("../helpers");
25
25
  class Circle extends import_database.DataTypes.ABSTRACT {
26
- key = "Circle";
26
+ constructor() {
27
+ super(...arguments);
28
+ this.key = "Circle";
29
+ }
27
30
  }
28
31
  class CircleField extends import_database.Field {
29
32
  constructor(options, context) {
@@ -23,7 +23,10 @@ module.exports = __toCommonJS(lineString_exports);
23
23
  var import_database = require("@tachybase/database");
24
24
  var import_helpers = require("../helpers");
25
25
  class LineString extends import_database.DataTypes.ABSTRACT {
26
- key = "Path";
26
+ constructor() {
27
+ super(...arguments);
28
+ this.key = "Path";
29
+ }
27
30
  }
28
31
  class LineStringField extends import_database.Field {
29
32
  constructor(options, context) {
@@ -23,7 +23,10 @@ module.exports = __toCommonJS(point_exports);
23
23
  var import_database = require("@tachybase/database");
24
24
  var import_helpers = require("../helpers");
25
25
  class Point extends import_database.DataTypes.ABSTRACT {
26
- key = "Point";
26
+ constructor() {
27
+ super(...arguments);
28
+ this.key = "Point";
29
+ }
27
30
  }
28
31
  class PointField extends import_database.Field {
29
32
  constructor(options, context) {
@@ -23,7 +23,10 @@ module.exports = __toCommonJS(polygon_exports);
23
23
  var import_database = require("@tachybase/database");
24
24
  var import_helpers = require("../helpers");
25
25
  class Polygon extends import_database.DataTypes.ABSTRACT {
26
- key = "Polygon";
26
+ constructor() {
27
+ super(...arguments);
28
+ this.key = "Polygon";
29
+ }
27
30
  }
28
31
  class PolygonField extends import_database.Field {
29
32
  constructor(options, context) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-block-map",
3
3
  "displayName": "Block: Map",
4
- "version": "0.23.41",
4
+ "version": "0.23.47",
5
5
  "description": "Map block, support Gaode map and Google map, you can also extend more map types.",
6
6
  "keywords": [
7
7
  "Blocks"
@@ -24,16 +24,16 @@
24
24
  "react-dom": "~18.3.1",
25
25
  "react-i18next": "^15.2.0",
26
26
  "react-router-dom": "6.28.1",
27
- "@tachybase/components": "0.23.41",
28
- "@tachybase/schema": "0.23.41"
27
+ "@tachybase/components": "0.23.47",
28
+ "@tachybase/schema": "0.23.47"
29
29
  },
30
30
  "peerDependencies": {
31
- "@tachybase/actions": "0.23.41",
32
- "@tachybase/client": "0.23.41",
33
- "@tachybase/database": "0.23.41",
34
- "@tachybase/test": "0.23.41",
35
- "@tachybase/server": "0.23.41",
36
- "@tachybase/utils": "0.23.41"
31
+ "@tachybase/actions": "0.23.47",
32
+ "@tachybase/client": "0.23.47",
33
+ "@tachybase/database": "0.23.47",
34
+ "@tachybase/test": "0.23.47",
35
+ "@tachybase/server": "0.23.47",
36
+ "@tachybase/utils": "0.23.47"
37
37
  },
38
38
  "description.zh-CN": "地图卡片,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
39
39
  "displayName.zh-CN": "卡片:地图",