@nocobase/plugin-map 1.4.0-beta.7 → 1.4.0-beta.8

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.
@@ -7,13 +7,13 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(D,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("lodash"),require("@ant-design/icons"),require("ahooks"),require("antd"),require("react-i18next"),require("@formily/react"),require("@formily/antd-v5"),require("@formily/shared"),require("@emotion/css")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","lodash","@ant-design/icons","ahooks","antd","react-i18next","@formily/react","@formily/antd-v5","@formily/shared","@emotion/css"],i):(D=typeof globalThis!="undefined"?globalThis:D||self,i(D["@nocobase/plugin-map"]={},D.jsxRuntime,D["@nocobase/client"],D.react,D.lodash,D["@ant-design/icons"],D.ahooks,D.antd,D["react-i18next"],D["@formily/react"],D["@formily/antd-v5"],D["@formily/shared"],D["@emotion/css"]))})(this,function(D,i,r,h,me,ee,G,x,le,z,et,tt,ot){"use strict";var Vt=Object.defineProperty,Wt=Object.defineProperties;var Yt=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var De=(D,i,r)=>i in D?Vt(D,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):D[i]=r,k=(D,i)=>{for(var r in i||(i={}))Ht.call(i,r)&&De(D,r,i[r]);if(Re)for(var r of Re(i))Jt.call(i,r)&&De(D,r,i[r]);return D},V=(D,i)=>Wt(D,Yt(i));var O=(D,i,r)=>(De(D,typeof i!="symbol"?i+"":i,r),r);var Ce=(D,i,r)=>new Promise((h,me)=>{var ee=le=>{try{x(r.next(le))}catch(z){me(z)}},G=le=>{try{x(r.throw(le))}catch(z){me(z)}},x=le=>le.done?h(le.value):Promise.resolve(le.value).then(ee,G);x((r=r.apply(D,i)).next())});const be="map";function X(e){return`{{t('${e}', { ns: '${be}', nsMode: 'fallback' })}}`}function W(){return le.useTranslation([be,"client"],{nsMode:"fallback"})}const Te=[{label:X("AMap"),value:"amap"},{label:X("Google Maps"),value:"google"}],Se="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAMAAAC7OkrPAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEJQTFRFAAAA8Yti8Yti8Itj8Iti74tj8Itj8YtiKwADKwADKhw5Kh07KwADKwADKwADKwAD4odn1YBlKwADKwADKwADKwAD/5y7LQAAABZ0Uk5TAP/8/f/B/PYOHjY3CCozLP3XCSkvMhA05K4AAAC4SURBVHic7dXLDoIwEIXhwSsoLSrw/q8qbSAiMy3/oivj2czmS5omnVORdapVJJFKBSEL2mrrUurbpdXa5dTH5dXi9tTsGNtX0TFG1OT+7PdY2YdEGd0FuFmUwXWm5UAZbCTKYA3SUrXZQTHLHbUy2OlsMO0ultLsajLlbEWZMEUZ+ig5E6YKM2GqMBOmGKubW1D3ps6g1nnvA5uGa5Os85E9nmF2ebYkzeKhc9wre4V+GMeh317hDfXgCWigIGJbAAAAAElFTkSuQmCC",ge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAYAAACM5Lr9AAAFkklEQVR42s3VaWxUVRjG8ddiEKPRxAQTCVSWLnZaWmjpTgulpYUBExP9Agou4IKAogUKAgItlNJCgUIXINFPfsFoDCjibkQRI0QIICAQWUpZugKtpcv0+DxyYqaTe2/vTLf58Etu7znnPf+0k44opQw5i5qsjIFs2APHoBZatFq+02vZeq94yyKs0dOjsAzOTCtuVtNKWtX0UpeaXqHU07tgt4ZnvuMa93Avz/CsniE2WIQV3iEaCDnQ8F/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==",ze=(e,o,t)=>{const n=o==null?void 0:o.reduce((l,a,c)=>c===o.length-1&&(t==="o2m"||t==="m2m")?l==null?void 0:l.map(g=>g[a]).filter(g=>g!=null):l==null?void 0:l[a],e);return t==="o2m"||t==="m2m"?n:[n]},xe=e=>{const o=r.useCollectionRecordData(),t=r.useCollection(),n=z.useFieldSchema(),l=h.useMemo(()=>n.reduceProperties((a,c)=>c.name==="drawer"?c:a,null),[n]);return l?i.jsx(r.VariablePopupRecordProvider,{recordData:o,collection:t,children:i.jsx(z.RecursionField,{schema:l,name:l.name})}):null};var rt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be={exports:{}};(function(e,o){(function(t,n){e.exports=n()})(rt,function(){function t(p){var y=[];return p.AMapUI&&y.push(n(p.AMapUI)),p.Loca&&y.push(l(p.Loca)),Promise.all(y)}function n(p){return new Promise(function(y,d){var f=[];if(p.plugins)for(var C=0;C<p.plugins.length;C+=1)c.AMapUI.plugins.indexOf(p.plugins[C])==-1&&f.push(p.plugins[C]);if(g.AMapUI===a.failed)d("前次请求 AMapUI 失败");else if(g.AMapUI===a.notload){g.AMapUI=a.loading,c.AMapUI.version=p.version||c.AMapUI.version,C=c.AMapUI.version;var L=document.body||document.head,B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/ui/"+C+"/main.js",B.onerror=function(w){g.AMapUI=a.failed,d("请求 AMapUI 失败")},B.onload=function(){if(g.AMapUI=a.loaded,f.length)window.AMapUI.loadUI(f,function(){for(var w=0,U=f.length;w<U;w++){var j=f[w].split("/").slice(-1)[0];window.AMapUI[j]=arguments[w]}for(y();A.AMapUI.length;)A.AMapUI.splice(0,1)[0]()});else for(y();A.AMapUI.length;)A.AMapUI.splice(0,1)[0]()},L.appendChild(B)}else g.AMapUI===a.loaded?p.version&&p.version!==c.AMapUI.version?d("不允许多个版本 AMapUI 混用"):f.length?window.AMapUI.loadUI(f,function(){for(var w=0,U=f.length;w<U;w++){var j=f[w].split("/").slice(-1)[0];window.AMapUI[j]=arguments[w]}y()}):y():p.version&&p.version!==c.AMapUI.version?d("不允许多个版本 AMapUI 混用"):A.AMapUI.push(function(w){w?d(w):f.length?window.AMapUI.loadUI(f,function(){for(var U=0,j=f.length;U<j;U++){var K=f[U].split("/").slice(-1)[0];window.AMapUI[K]=arguments[U]}y()}):y()})})}function l(p){return new Promise(function(y,d){if(g.Loca===a.failed)d("前次请求 Loca 失败");else if(g.Loca===a.notload){g.Loca=a.loading,c.Loca.version=p.version||c.Loca.version;var f=c.Loca.version,C=c.AMap.version.startsWith("2"),L=f.startsWith("2");if(C&&!L||!C&&L)d("JSAPI 与 Loca 版本不对应!!");else{C=c.key,L=document.body||document.head;var B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/loca?v="+f+"&key="+C,B.onerror=function(w){g.Loca=a.failed,d("请求 AMapUI 失败")},B.onload=function(){for(g.Loca=a.loaded,y();A.Loca.length;)A.Loca.splice(0,1)[0]()},L.appendChild(B)}}else g.Loca===a.loaded?p.version&&p.version!==c.Loca.version?d("不允许多个版本 Loca 混用"):y():p.version&&p.version!==c.Loca.version?d("不允许多个版本 Loca 混用"):A.Loca.push(function(w){w?d(w):d()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var a;(function(p){p.notload="notload",p.loading="loading",p.loaded="loaded",p.failed="failed"})(a||(a={}));var c={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},A={AMap:[],AMapUI:[],Loca:[]},v=[],b=function(p){typeof p=="function"&&(g.AMap===a.loaded?p(window.AMap):v.push(p))};return{load:function(p){return new Promise(function(y,d){if(g.AMap==a.failed)d("");else if(g.AMap==a.notload){var f=p.key,C=p.version,L=p.plugins;f?(window.AMap&&location.host!=="lbs.amap.com"&&d("禁止多种API加载方式混用"),c.key=f,c.AMap.version=C||c.AMap.version,c.AMap.plugins=L||c.AMap.plugins,g.AMap=a.loading,C=document.body||document.head,window.___onAPILoaded=function(w){if(delete window.___onAPILoaded,w)g.AMap=a.failed,d(w);else for(g.AMap=a.loaded,t(p).then(function(){y(window.AMap)}).catch(d);v.length;)v.splice(0,1)[0]()},L=document.createElement("script"),L.type="text/javascript",L.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+c.AMap.version+"&key="+f+"&plugin="+c.AMap.plugins.join(","),L.onerror=function(w){g.AMap=a.failed,d(w)},C.appendChild(L)):d("请填写key")}else if(g.AMap==a.loaded)if(p.key&&p.key!==c.key)d("多个不一致的 key");else if(p.version&&p.version!==c.AMap.version)d("不允许多个版本 JSAPI 混用");else{if(f=[],p.plugins)for(C=0;C<p.plugins.length;C+=1)c.AMap.plugins.indexOf(p.plugins[C])==-1&&f.push(p.plugins[C]);f.length?window.AMap.plugin(f,function(){t(p).then(function(){y(window.AMap)}).catch(d)}):t(p).then(function(){y(window.AMap)}).catch(d)}else if(p.key&&p.key!==c.key)d("多个不一致的 key");else if(p.version&&p.version!==c.AMap.version)d("不允许多个版本 JSAPI 混用");else{var B=[];if(p.plugins)for(C=0;C<p.plugins.length;C+=1)c.AMap.plugins.indexOf(p.plugins[C])==-1&&B.push(p.plugins[C]);b(function(){B.length?window.AMap.plugin(B,function(){t(p).then(function(){y(window.AMap)}).catch(d)}):t(p).then(function(){y(window.AMap)}).catch(d)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,c={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},A={AMap:[],AMapUI:[],Loca:[]}}}})})(Be);var st=Be.exports;const Ue=nt(st),Ke="map-configuration",we=e=>`NOCOBASE_PLUGIN_MAP_CONFIGURATION_${e}`,Pe=e=>{const o=h.useMemo(()=>{const n=sessionStorage.getItem(we(e));return n&&JSON.parse(n)},[e]),{data:t}=r.useRequest({resource:Ke,action:"get",params:{type:e}},{onSuccess(n){sessionStorage.setItem(we(e),JSON.stringify(n==null?void 0:n.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!o});return o||(t==null?void 0:t.data)},Ne=()=>{var b,p;const e=r.useDataBlockHeight(),{token:o}=x.theme.useToken(),{designable:t}=r.useDesignable(),{heightProps:n}=r.useBlockHeightProps()||{},{title:l}=n||{},a=z.useFieldSchema();if(!e)return;const c=Object.keys(((p=(b=a.parent)==null?void 0:b.properties.actions)==null?void 0:p.properties)||{}).length>0,g=t||c?o.paddingLG+o.controlHeight+o.margin:o.paddingLG+o.margin,A=o.paddingLG,v=l?o.fontSizeLG*o.lineHeightLG+o.padding*2-1:0;return e-g-A-v},it=e=>{const{aMap:o,toCenter:t}=e,{t:n}=W(),l=h.useRef(),[a,c]=h.useState([]);h.useEffect(()=>{o==null||o.plugin("AMap.PlaceSearch",()=>{l.current=new o.PlaceSearch({city:"全国",pageSize:30})})},[o]);const{run:g}=G.useDebounceFn(v=>{l.current&&l.current.search(v||" ",(b,p)=>{if(b==="complete")c(p.poiList.pois.map(y=>V(k({},y),{label:`${y.name}-${y.address}`,value:y.id})));else{if(b==="no_data"){c([]);return}x.message.error(n("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}),A=v=>{const b=a.find(p=>p.value===v);b!=null&&b.location&&t(b.location)};return i.jsx("div",{className:r.css`
10
+ (function(D,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("lodash"),require("@ant-design/icons"),require("ahooks"),require("antd"),require("react-i18next"),require("@formily/react"),require("@formily/antd-v5"),require("@formily/shared"),require("@emotion/css")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","lodash","@ant-design/icons","ahooks","antd","react-i18next","@formily/react","@formily/antd-v5","@formily/shared","@emotion/css"],i):(D=typeof globalThis!="undefined"?globalThis:D||self,i(D["@nocobase/plugin-map"]={},D.jsxRuntime,D["@nocobase/client"],D.react,D.lodash,D["@ant-design/icons"],D.ahooks,D.antd,D["react-i18next"],D["@formily/react"],D["@formily/antd-v5"],D["@formily/shared"],D["@emotion/css"]))})(this,function(D,i,r,h,me,ee,G,x,le,z,et,tt,ot){"use strict";var Vt=Object.defineProperty,Wt=Object.defineProperties;var Yt=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var De=(D,i,r)=>i in D?Vt(D,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):D[i]=r,O=(D,i)=>{for(var r in i||(i={}))Ht.call(i,r)&&De(D,r,i[r]);if(Re)for(var r of Re(i))Jt.call(i,r)&&De(D,r,i[r]);return D},W=(D,i)=>Wt(D,Yt(i));var E=(D,i,r)=>(De(D,typeof i!="symbol"?i+"":i,r),r);var Ce=(D,i,r)=>new Promise((h,me)=>{var ee=le=>{try{x(r.next(le))}catch(z){me(z)}},G=le=>{try{x(r.throw(le))}catch(z){me(z)}},x=le=>le.done?h(le.value):Promise.resolve(le.value).then(ee,G);x((r=r.apply(D,i)).next())});const be="map";function X(e){return`{{t('${e}', { ns: '${be}', nsMode: 'fallback' })}}`}function Y(){return le.useTranslation([be,"client"],{nsMode:"fallback"})}const Te=[{label:X("AMap"),value:"amap"},{label:X("Google Maps"),value:"google"}],Se="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAMAAAC7OkrPAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEJQTFRFAAAA8Yti8Yti8Itj8Iti74tj8Itj8YtiKwADKwADKhw5Kh07KwADKwADKwADKwAD4odn1YBlKwADKwADKwADKwAD/5y7LQAAABZ0Uk5TAP/8/f/B/PYOHjY3CCozLP3XCSkvMhA05K4AAAC4SURBVHic7dXLDoIwEIXhwSsoLSrw/q8qbSAiMy3/oivj2czmS5omnVORdapVJJFKBSEL2mrrUurbpdXa5dTH5dXi9tTsGNtX0TFG1OT+7PdY2YdEGd0FuFmUwXWm5UAZbCTKYA3SUrXZQTHLHbUy2OlsMO0ultLsajLlbEWZMEUZ+ig5E6YKM2GqMBOmGKubW1D3ps6g1nnvA5uGa5Os85E9nmF2ebYkzeKhc9wre4V+GMeh317hDfXgCWigIGJbAAAAAElFTkSuQmCC",ge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAA/CAYAAACM5Lr9AAAFkklEQVR42s3VaWxUVRjG8ddiEKPRxAQTCVSWLnZaWmjpTgulpYUBExP9Agou4IKAogUKAgItlNJCgUIXINFPfsFoDCjibkQRI0QIICAQWUpZugKtpcv0+DxyYqaTe2/vTLf58Etu7znnPf+0k44opQw5i5qsjIFs2APHoBZatFq+02vZeq94yyKs0dOjsAzOTCtuVtNKWtX0UpeaXqHU07tgt4ZnvuMa93Avz/CsniE2WIQV3iEaCDnQ8F/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==",ze=(e,o,t)=>{const n=o==null?void 0:o.reduce((l,a,c)=>c===o.length-1&&(t==="o2m"||t==="m2m")?l==null?void 0:l.map(g=>g[a]).filter(g=>g!=null):l==null?void 0:l[a],e);return t==="o2m"||t==="m2m"?n:[n]},xe=e=>{const o=r.useCollectionRecordData(),t=r.useCollection(),n=z.useFieldSchema(),l=h.useMemo(()=>n.reduceProperties((a,c)=>c.name==="drawer"?c:a,null),[n]);return l?i.jsx(r.VariablePopupRecordProvider,{recordData:o,collection:t,children:i.jsx(z.RecursionField,{schema:l,name:l.name})}):null};var rt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be={exports:{}};(function(e,o){(function(t,n){e.exports=n()})(rt,function(){function t(p){var y=[];return p.AMapUI&&y.push(n(p.AMapUI)),p.Loca&&y.push(l(p.Loca)),Promise.all(y)}function n(p){return new Promise(function(y,d){var f=[];if(p.plugins)for(var C=0;C<p.plugins.length;C+=1)c.AMapUI.plugins.indexOf(p.plugins[C])==-1&&f.push(p.plugins[C]);if(g.AMapUI===a.failed)d("前次请求 AMapUI 失败");else if(g.AMapUI===a.notload){g.AMapUI=a.loading,c.AMapUI.version=p.version||c.AMapUI.version,C=c.AMapUI.version;var L=document.body||document.head,B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/ui/"+C+"/main.js",B.onerror=function(w){g.AMapUI=a.failed,d("请求 AMapUI 失败")},B.onload=function(){if(g.AMapUI=a.loaded,f.length)window.AMapUI.loadUI(f,function(){for(var w=0,U=f.length;w<U;w++){var q=f[w].split("/").slice(-1)[0];window.AMapUI[q]=arguments[w]}for(y();A.AMapUI.length;)A.AMapUI.splice(0,1)[0]()});else for(y();A.AMapUI.length;)A.AMapUI.splice(0,1)[0]()},L.appendChild(B)}else g.AMapUI===a.loaded?p.version&&p.version!==c.AMapUI.version?d("不允许多个版本 AMapUI 混用"):f.length?window.AMapUI.loadUI(f,function(){for(var w=0,U=f.length;w<U;w++){var q=f[w].split("/").slice(-1)[0];window.AMapUI[q]=arguments[w]}y()}):y():p.version&&p.version!==c.AMapUI.version?d("不允许多个版本 AMapUI 混用"):A.AMapUI.push(function(w){w?d(w):f.length?window.AMapUI.loadUI(f,function(){for(var U=0,q=f.length;U<q;U++){var K=f[U].split("/").slice(-1)[0];window.AMapUI[K]=arguments[U]}y()}):y()})})}function l(p){return new Promise(function(y,d){if(g.Loca===a.failed)d("前次请求 Loca 失败");else if(g.Loca===a.notload){g.Loca=a.loading,c.Loca.version=p.version||c.Loca.version;var f=c.Loca.version,C=c.AMap.version.startsWith("2"),L=f.startsWith("2");if(C&&!L||!C&&L)d("JSAPI 与 Loca 版本不对应!!");else{C=c.key,L=document.body||document.head;var B=document.createElement("script");B.type="text/javascript",B.src="https://webapi.amap.com/loca?v="+f+"&key="+C,B.onerror=function(w){g.Loca=a.failed,d("请求 AMapUI 失败")},B.onload=function(){for(g.Loca=a.loaded,y();A.Loca.length;)A.Loca.splice(0,1)[0]()},L.appendChild(B)}}else g.Loca===a.loaded?p.version&&p.version!==c.Loca.version?d("不允许多个版本 Loca 混用"):y():p.version&&p.version!==c.Loca.version?d("不允许多个版本 Loca 混用"):A.Loca.push(function(w){w?d(w):d()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var a;(function(p){p.notload="notload",p.loading="loading",p.loaded="loaded",p.failed="failed"})(a||(a={}));var c={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},A={AMap:[],AMapUI:[],Loca:[]},v=[],b=function(p){typeof p=="function"&&(g.AMap===a.loaded?p(window.AMap):v.push(p))};return{load:function(p){return new Promise(function(y,d){if(g.AMap==a.failed)d("");else if(g.AMap==a.notload){var f=p.key,C=p.version,L=p.plugins;f?(window.AMap&&location.host!=="lbs.amap.com"&&d("禁止多种API加载方式混用"),c.key=f,c.AMap.version=C||c.AMap.version,c.AMap.plugins=L||c.AMap.plugins,g.AMap=a.loading,C=document.body||document.head,window.___onAPILoaded=function(w){if(delete window.___onAPILoaded,w)g.AMap=a.failed,d(w);else for(g.AMap=a.loaded,t(p).then(function(){y(window.AMap)}).catch(d);v.length;)v.splice(0,1)[0]()},L=document.createElement("script"),L.type="text/javascript",L.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+c.AMap.version+"&key="+f+"&plugin="+c.AMap.plugins.join(","),L.onerror=function(w){g.AMap=a.failed,d(w)},C.appendChild(L)):d("请填写key")}else if(g.AMap==a.loaded)if(p.key&&p.key!==c.key)d("多个不一致的 key");else if(p.version&&p.version!==c.AMap.version)d("不允许多个版本 JSAPI 混用");else{if(f=[],p.plugins)for(C=0;C<p.plugins.length;C+=1)c.AMap.plugins.indexOf(p.plugins[C])==-1&&f.push(p.plugins[C]);f.length?window.AMap.plugin(f,function(){t(p).then(function(){y(window.AMap)}).catch(d)}):t(p).then(function(){y(window.AMap)}).catch(d)}else if(p.key&&p.key!==c.key)d("多个不一致的 key");else if(p.version&&p.version!==c.AMap.version)d("不允许多个版本 JSAPI 混用");else{var B=[];if(p.plugins)for(C=0;C<p.plugins.length;C+=1)c.AMap.plugins.indexOf(p.plugins[C])==-1&&B.push(p.plugins[C]);b(function(){B.length?window.AMap.plugin(B,function(){t(p).then(function(){y(window.AMap)}).catch(d)}):t(p).then(function(){y(window.AMap)}).catch(d)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,c={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},g={AMap:a.notload,AMapUI:a.notload,Loca:a.notload},A={AMap:[],AMapUI:[],Loca:[]}}}})})(Be);var st=Be.exports;const Ue=nt(st),Ke="map-configuration",we=e=>`NOCOBASE_PLUGIN_MAP_CONFIGURATION_${e}`,Pe=e=>{const o=h.useMemo(()=>{const n=sessionStorage.getItem(we(e));return n&&JSON.parse(n)},[e]),{data:t}=r.useRequest({resource:Ke,action:"get",params:{type:e}},{onSuccess(n){sessionStorage.setItem(we(e),JSON.stringify(n==null?void 0:n.data))},refreshOnWindowFocus:!1,refreshDeps:[],manual:!!o});return o||(t==null?void 0:t.data)},Ne=()=>{var b,p;const e=r.useDataBlockHeight(),{token:o}=x.theme.useToken(),{designable:t}=r.useDesignable(),{heightProps:n}=r.useBlockHeightProps()||{},{title:l}=n||{},a=z.useFieldSchema();if(!e)return;const c=Object.keys(((p=(b=a.parent)==null?void 0:b.properties.actions)==null?void 0:p.properties)||{}).length>0,g=t||c?o.paddingLG+o.controlHeight+o.margin:o.paddingLG+o.margin,A=o.paddingLG,v=l?o.fontSizeLG*o.lineHeightLG+o.padding*2-1:0;return e-g-A-v},it=e=>{const{aMap:o,toCenter:t}=e,{t:n}=Y(),l=h.useRef(),[a,c]=h.useState([]);h.useEffect(()=>{o==null||o.plugin("AMap.PlaceSearch",()=>{l.current=new o.PlaceSearch({city:"全国",pageSize:30})})},[o]);const{run:g}=G.useDebounceFn(v=>{l.current&&l.current.search(v||" ",(b,p)=>{if(b==="complete")c(p.poiList.pois.map(y=>W(O({},y),{label:`${y.name}-${y.address}`,value:y.id})));else{if(b==="no_data"){c([]);return}x.message.error(n("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}),A=v=>{const b=a.find(p=>p.value===v);b!=null&&b.location&&t(b.location)};return i.jsx("div",{className:r.css`
11
11
  position: absolute;
12
12
  top: 10px;
13
13
  left: 10px;
14
14
  z-index: 10;
15
15
  width: calc(100% - 20px);
16
- `,children:i.jsx(x.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:n("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:A,options:a,popupMatchSelectWidth:!1})})},Ie={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"}},ke=h.forwardRef((e,o)=>{const{accessKey:t,securityJsCode:n}=Pe(e.mapType)||{},{value:l,onChange:a,block:c=!1,readonly:g,disabled:A=c,zoom:v=13,overlayCommonOptions:b}=e,{t:p}=W(),y=z.useFieldSchema(),d=h.useRef(),f=h.useRef(),C=h.useRef(),[L,B]=h.useState([]),[w,U]=h.useState(""),{getField:j}=r.useCollection_deprecated(),K=h.useMemo(()=>{if(e.type)return e.type;const s=j(y==null?void 0:y.name);return s==null?void 0:s.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),_=h.useRef(),P=h.useRef(null),Q=r.useNavigateNoUpdate(),J=h.useRef(`nocobase-map-${K||""}-${Date.now().toString(32)}`),{modal:fe}=x.App.useApp(),re=Ne(),[Y]=h.useState(k({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1},b));h.useEffect(()=>{f.current&&f.current.setZoom(v)},[v]);const ce=G.useMemoizedFn(()=>{_.current&&_.current.remove()}),$=G.useMemoizedFn(()=>{(!A||c)&&K!=="point"&&P.current&&(P.current.setTarget(_.current),P.current.open())}),ne=G.useMemoizedFn((s,u=!1)=>{let m=null;if(K==="point"){const{lat:M,lng:E}=s.getPosition();m=[E,M]}else if(K==="polygon"||K==="lineString"){if(m=s.getPath().map(M=>[M.lng,M.lat]),m.length<2)return}else if(K==="circle"){const M=s.getCenter(),E=s.getRadius();m=[M.lng,M.lat,E]}u||(ce(),_.current=s,$()),a==null||a(m)}),te=G.useMemoizedFn((s=K)=>{const u=Ie[s];if(u&&"editor"in u&&!P.current)return P.current=new d.current[u.editor](f.current,null,{createOptions:Y,editOptions:Y,controlPoint:V(k({},Y),{strokeWeight:3}),midControlPoint:V(k({},Y),{strokeWeight:2,fillColor:"#fff"})}),P.current.on("adjust",function({target:m}){ne(m,!0)}),P.current.on("move",function({target:m}){ne(m,!0)}),P.current}),R=G.useMemoizedFn((s=K)=>{var m;if(!C.current||(m=P.current)!=null&&m.getTarget())return;const u=Ie[s];u&&C.current[u.mouseTool](k({},Y))}),se=G.useMemoizedFn((s=K)=>{C.current||(C.current=new d.current.MouseTool(f.current),C.current.on("draw",function({obj:u}){ne(u)}),R(s))}),I=(s,u)=>{f.current&&f.current.setZoomAndCenter(18,s,u)},q=()=>{const s=()=>{ce(),P.current&&(P.current.setTarget(),P.current.close()),a==null||a(null)};fe.confirm({title:p("Clear the canvas"),content:p("Are you sure to clear the canvas?"),okText:p("Confirm"),cancelText:p("Cancel"),getContainer:()=>document.getElementById(J.current),onOk(){s()}})},N=()=>{_.current&&f.current.setFitView([_.current])},Z=h.useCallback((s=K,u=l,m)=>{const M=Ie[s];if(!M)return;const E=k(k({},Y),m);return"transformOptions"in M?Object.assign(E,M.transformOptions(u)):"propertyKey"in M&&(E[M.propertyKey]=u),new d.current[M.overlay](E)},[Y]),S=(s=K,u=l,m)=>{if(!d.current)return;const M=Z(s,u,m);return M.setMap(f.current),M};h.useEffect(()=>{if(!d.current||!l||!g&&_.current)return;const s=S();f.current.setFitView([s]),_.current=s,A||(te(),$())},[l,L,K,Y,A,g]),h.useEffect(()=>{var s,u,m;C.current&&(A?((s=C.current)==null||s.close(),(u=P.current)==null||u.close()):(R(),(m=P.current)==null||m.open()))},[A]),h.useEffect(()=>{!d.current||!K||A||(se(),te())},[A,L,K]),h.useEffect(()=>{var u,m;if(!l&&(C.current||P.current)&&(ce(),P.current&&(P.current.setTarget(),P.current.close()),a==null||a(null)),!C.current||!P.current)return;P.current.getTarget()?(m=(u=C.current).close)==null||m.call(u):R()},[K,l]),h.useEffect(()=>{if(!t||f.current)return;n&&(window._AMapSecurityConfig={[n.endsWith("_AMapService")?"serviceHOST":"securityJsCode"]:n});const s=window.define;if(window.define=void 0,window.AMap)try{requestIdleCallback(()=>{f.current=new AMap.Map(J.current,{resizeEnable:!0,zoom:v}),d.current=AMap,U(""),B([])});return}catch(u){U(u)}return Ue.load({key:t,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(u=>(window.define=s,requestIdleCallback(()=>{f.current=new u.Map(J.current,{resizeEnable:!0,zoom:v}),d.current=u,U(""),B([])}))).catch(u=>{typeof u=="string"?u.includes("多个不一致的 key")?U(p("The AccessKey is incorrect, please check it")):U(u):(u==null?void 0:u.type)==="error"&&U("Something went wrong, please refresh the page and try again")}),()=>{var u;(u=f.current)==null||u.destroy(),d.current=null,f.current=null,C.current=null,P.current=null,Ue.reset()}},[t,K,n]),h.useImperativeHandle(o,()=>({setOverlay:S,getOverlay:Z,createMouseTool:se,createEditor:te,executeMouseTool:R,aMap:d.current,map:f.current,overlay:_.current,mouseTool:()=>C.current,editor:()=>P.current,errMessage:w}));const T=r.useApp();return!t||w?i.jsx(x.Alert,{action:i.jsx(x.Button,{type:"primary",onClick:()=>Q(T.pluginSettingsManager.getRoutePath("map")),children:p("Go to the configuration page")}),message:w||p("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):i.jsxs("div",{className:r.css`
16
+ `,children:i.jsx(x.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:n("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:A,options:a,popupMatchSelectWidth:!1})})},Ie={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"}},ke=h.forwardRef((e,o)=>{const{accessKey:t,securityJsCode:n}=Pe(e.mapType)||{},{value:l,onChange:a,block:c=!1,readonly:g,disabled:A=c,zoom:v=13,overlayCommonOptions:b}=e,{t:p}=Y(),y=z.useFieldSchema(),d=h.useRef(),f=h.useRef(),C=h.useRef(),[L,B]=h.useState([]),[w,U]=h.useState(""),{getField:q}=r.useCollection_deprecated(),K=h.useMemo(()=>{if(e.type)return e.type;const s=q(y==null?void 0:y.name);return s==null?void 0:s.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),V=h.useRef(),P=h.useRef(null),Q=r.useNavigateNoUpdate(),J=h.useRef(`nocobase-map-${K||""}-${Date.now().toString(32)}`),{modal:fe}=x.App.useApp(),re=Ne(),[H]=h.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1},b));h.useEffect(()=>{f.current&&f.current.setZoom(v)},[v]);const ce=G.useMemoizedFn(()=>{V.current&&V.current.remove()}),$=G.useMemoizedFn(()=>{(!A||c)&&K!=="point"&&P.current&&(P.current.setTarget(V.current),P.current.open())}),ne=G.useMemoizedFn((s,u=!1)=>{let m=null;if(K==="point"){const{lat:M,lng:F}=s.getPosition();m=[F,M]}else if(K==="polygon"||K==="lineString"){if(m=s.getPath().map(M=>[M.lng,M.lat]),m.length<2)return}else if(K==="circle"){const M=s.getCenter(),F=s.getRadius();m=[M.lng,M.lat,F]}u||(ce(),V.current=s,$()),a==null||a(m)}),te=G.useMemoizedFn((s=K)=>{const u=Ie[s];if(u&&"editor"in u&&!P.current)return P.current=new d.current[u.editor](f.current,null,{createOptions:H,editOptions:H,controlPoint:W(O({},H),{strokeWeight:3}),midControlPoint:W(O({},H),{strokeWeight:2,fillColor:"#fff"})}),P.current.on("adjust",function({target:m}){ne(m,!0)}),P.current.on("move",function({target:m}){ne(m,!0)}),P.current}),R=G.useMemoizedFn((s=K)=>{var m;if(!C.current||(m=P.current)!=null&&m.getTarget())return;const u=Ie[s];u&&C.current[u.mouseTool](O({},H))}),se=G.useMemoizedFn((s=K)=>{C.current||(C.current=new d.current.MouseTool(f.current),C.current.on("draw",function({obj:u}){ne(u)}),R(s))}),I=(s,u)=>{f.current&&f.current.setZoomAndCenter(18,s,u)},_=()=>{const s=()=>{ce(),P.current&&(P.current.setTarget(),P.current.close()),a==null||a(null)};fe.confirm({title:p("Clear the canvas"),content:p("Are you sure to clear the canvas?"),okText:p("Confirm"),cancelText:p("Cancel"),getContainer:()=>document.getElementById(J.current),onOk(){s()}})},N=()=>{V.current&&f.current.setFitView([V.current])},Z=h.useCallback((s=K,u=l,m)=>{const M=Ie[s];if(!M)return;const F=O(O({},H),m);return"transformOptions"in M?Object.assign(F,M.transformOptions(u)):"propertyKey"in M&&(F[M.propertyKey]=u),new d.current[M.overlay](F)},[H]),S=(s=K,u=l,m)=>{if(!d.current)return;const M=Z(s,u,m);return M.setMap(f.current),M};h.useEffect(()=>{if(!d.current||!l||!g&&V.current)return;const s=S();f.current.setFitView([s]),V.current=s,A||(te(),$())},[l,L,K,H,A,g]),h.useEffect(()=>{var s,u,m;C.current&&(A?((s=C.current)==null||s.close(),(u=P.current)==null||u.close()):(R(),(m=P.current)==null||m.open()))},[A]),h.useEffect(()=>{!d.current||!K||A||(se(),te())},[A,L,K]),h.useEffect(()=>{var u,m;if(!l&&(C.current||P.current)&&(ce(),P.current&&(P.current.setTarget(),P.current.close()),a==null||a(null)),!C.current||!P.current)return;P.current.getTarget()?(m=(u=C.current).close)==null||m.call(u):R()},[K,l]),h.useEffect(()=>{if(!t||f.current)return;n&&(window._AMapSecurityConfig={[n.endsWith("_AMapService")?"serviceHOST":"securityJsCode"]:n});const s=window.define;if(window.define=void 0,window.AMap)try{requestIdleCallback(()=>{f.current=new AMap.Map(J.current,{resizeEnable:!0,zoom:v}),d.current=AMap,U(""),B([])});return}catch(u){U(u)}return Ue.load({key:t,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(u=>(window.define=s,requestIdleCallback(()=>{f.current=new u.Map(J.current,{resizeEnable:!0,zoom:v}),d.current=u,U(""),B([])}))).catch(u=>{typeof u=="string"?u.includes("多个不一致的 key")?U(p("The AccessKey is incorrect, please check it")):U(u):(u==null?void 0:u.type)==="error"&&U("Something went wrong, please refresh the page and try again")}),()=>{var u;(u=f.current)==null||u.destroy(),d.current=null,f.current=null,C.current=null,P.current=null,Ue.reset()}},[t,K,n]),h.useImperativeHandle(o,()=>({setOverlay:S,getOverlay:Z,createMouseTool:se,createEditor:te,executeMouseTool:R,aMap:d.current,map:f.current,overlay:V.current,mouseTool:()=>C.current,editor:()=>P.current,errMessage:w}));const T=r.useApp();return!t||w?i.jsx(x.Alert,{action:i.jsx(x.Button,{type:"primary",onClick:()=>Q(T.pluginSettingsManager.getRoutePath("map")),children:p("Go to the configuration page")}),message:w||p("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):i.jsxs("div",{className:r.css`
17
17
  position: relative;
18
18
  height: ${re||500}px !important;
19
19
  `,id:J.current,style:e==null?void 0:e.style,children:[!d.current&&i.jsx("div",{className:r.css`
@@ -27,7 +27,7 @@
27
27
  bottom: 80px;
28
28
  right: 20px;
29
29
  z-index: 10;
30
- `,children:i.jsx(x.Button,{onClick:N,disabled:!_.current,type:"primary",shape:"round",size:"large",icon:i.jsx(ee.SyncOutlined,{})})}),K!=="point"?i.jsx("div",{className:r.css`
30
+ `,children:i.jsx(x.Button,{onClick:N,disabled:!V.current,type:"primary",shape:"round",size:"large",icon:i.jsx(ee.SyncOutlined,{})})}),K!=="point"?i.jsx("div",{className:r.css`
31
31
  position: absolute;
32
32
  bottom: 20px;
33
33
  left: 10px;
@@ -38,7 +38,7 @@
38
38
  bottom: 20px;
39
39
  right: 20px;
40
40
  z-index: 2;
41
- `,children:i.jsx(x.Button,{disabled:!l,style:{height:"40px"},onClick:q,type:"primary",danger:!0,children:p("Clear")})})]})]})});ke.displayName="AMapComponent";const at=e=>{var se,I,q,N,Z;const{collectionField:o,fieldNames:t,dataSource:n,fixedBlock:l,zoom:a,setSelectedRecordKeys:c,lineSort:g}=r.useProps(e),{name:A,getPrimaryKey:v}=r.useCollection_deprecated(),{getCollectionJoinField:b}=r.useCollectionManager_deprecated(),p=v(),[y,d]=h.useState(!1),f=h.useRef(),C=(I=(se=f.current)==null?void 0:se.aMap)==null?void 0:I.GeometryUtil,[L,B]=h.useState(),[w,U]=h.useState(""),{t:j}=W(),K=r.useCompile(),{isConnected:_,doFilter:P}=r.useFilterAPI(),[,Q]=h.useState(null),J=h.useRef(w);J.current=w;const{fields:fe}=r.useCollection(),re=r.useCollectionParentRecordData(),{openPopup:Y}=r.usePopupUtils(),ce=(q=fe.find(S=>S.name===(t==null?void 0:t.marker)))==null?void 0:q.uiSchema,$=(S,T)=>{const s=S.getExtData(),u=typeof T=="undefined"?s.selected:!T;s.selected=!u,"setIcon"in S&&S.setIcon(new f.current.aMap.Icon({imageSize:[19,32],image:u?ge:Se})),S.setOptions(k({extData:s},u?{strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{strokeColor:"#F18b62",fillColor:"#F18b62"}))},ne=()=>{var S,T,s;f.current&&((S=f.current)==null||S.mouseTool().close(!0),(T=f.current)==null||T.editor().setTarget(null),(s=f.current)==null||s.editor().close())};h.useEffect(()=>{var S,T,s,u;if(w==="selection")return(S=f.current)!=null&&S.editor()?(u=f.current)==null||u.executeMouseTool("polygon"):((T=f.current)==null||T.createEditor("polygon"),(s=f.current)==null||s.createMouseTool("polygon")),()=>{ne()}},[w]),h.useEffect(()=>{if(w)return()=>{var S;J.current||(S=f.current)==null||S.map.getAllOverlays().forEach(T=>{$(T,!1)})}},[w]);const te=G.useMemoizedFn(()=>{var m,M,E;const S=(m=f.current)==null?void 0:m.editor().getTarget(),T=(M=f.current)==null?void 0:M.map.getAllOverlays(),s=T==null?void 0:T.filter(F=>{if(!(F===S||F.getExtData().id===void 0))return"getPosition"in F?C.isPointInRing(F.getPosition(),S==null?void 0:S.getPath()):C.doesRingRingIntersect(F.getPath(),S==null?void 0:S.getPath())}),u=s==null?void 0:s.map(F=>($(F,!0),F.getExtData().id));c(F=>u==null?void 0:u.concat(F)),S==null||S.remove(),(E=f.current)==null||E.editor().close()});h.useEffect(()=>{var m,M,E;if(!o||!f.current||!n)return;const S=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,T=b([A,...S].flat().join(".")),s=n.map(F=>{var pe;const H=(pe=ze(F,t==null?void 0:t.field,T==null?void 0:T.interface))==null?void 0:pe.filter(Boolean),ie=r.getLabelFormatValue(ce,F[t.marker]);return H!=null&&H.length?H.map(ae=>{var oe;return(oe=f.current)==null?void 0:oe.setOverlay(o.type,ae,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:t!=null&&t.marker?K(ie):void 0},extData:{id:F[p]}})}):[]}).flat().filter(Boolean);(M=(m=f.current)==null?void 0:m.map)==null||M.setFitView(s);const u=s.map(F=>{const H=ie=>{const pe=ie.target,ae=pe.getExtData();if(!ae)return;if(J.current){J.current==="click"&&(c(oe=>ae.selected?oe.filter(Le=>Le!==ae.id):[...oe,ae.id]),$(pe));return}const ye=n.find(oe=>ae.id===oe[p]);if(_){Q(oe=>(oe&&Ge(oe),oe===F?(Ge(F),P(null),null):(lt(F),P(ye[p],Le=>Le.field||p,"$eq"),F)));return}ye&&(B(ye),Y({recordData:ye}))};return F.on("click",H),()=>F.off("click",H)});if(o.type==="point"&&(g!=null&&g.length)&&(s==null?void 0:s.length)>1){const F=s.map(ie=>ie.getPosition());s[0].setzIndex(13),s[s.length-1].setzIndex(13);const H=(ie=!0)=>{var pe,ae;if((pe=f.current)!=null&&pe.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:j(ie?"Start point":"End point")},position:F[ie?0:F.length-1],map:(ae=f.current)==null?void 0:ae.map})};s.push(...[(E=f.current)==null?void 0:E.setOverlay("lineString",F,{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),H(),H(!1)].filter(Boolean))}return()=>{s.forEach(F=>{F.remove()}),u.forEach(F=>F())}},[n,y,t,A,p,o.type,_,g,Y]),h.useEffect(()=>{setTimeout(()=>{c([])})},[n]);const R=S=>{f.current=S,d(!!(S!=null&&S.map)&&!S.errMessage)};return i.jsxs("div",{className:r.css`
41
+ `,children:i.jsx(x.Button,{disabled:!l,style:{height:"40px"},onClick:_,type:"primary",danger:!0,children:p("Clear")})})]})]})});ke.displayName="AMapComponent";const at=e=>{var se,I,_,N,Z;const{collectionField:o,fieldNames:t,dataSource:n,fixedBlock:l,zoom:a,setSelectedRecordKeys:c,lineSort:g}=r.useProps(e),{name:A,getPrimaryKey:v}=r.useCollection_deprecated(),{getCollectionJoinField:b}=r.useCollectionManager_deprecated(),p=v(),[y,d]=h.useState(!1),f=h.useRef(),C=(I=(se=f.current)==null?void 0:se.aMap)==null?void 0:I.GeometryUtil,[L,B]=h.useState(),[w,U]=h.useState(""),{t:q}=Y(),K=r.useCompile(),{isConnected:V,doFilter:P}=r.useFilterAPI(),[,Q]=h.useState(null),J=h.useRef(w);J.current=w;const{fields:fe}=r.useCollection(),re=r.useCollectionParentRecordData(),{openPopup:H}=r.usePopupUtils(),ce=(_=fe.find(S=>S.name===(t==null?void 0:t.marker)))==null?void 0:_.uiSchema,$=(S,T)=>{const s=S.getExtData(),u=typeof T=="undefined"?s.selected:!T;s.selected=!u,"setIcon"in S&&S.setIcon(new f.current.aMap.Icon({imageSize:[19,32],image:u?ge:Se})),S.setOptions(O({extData:s},u?{strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{strokeColor:"#F18b62",fillColor:"#F18b62"}))},ne=()=>{var S,T,s;f.current&&((S=f.current)==null||S.mouseTool().close(!0),(T=f.current)==null||T.editor().setTarget(null),(s=f.current)==null||s.editor().close())};h.useEffect(()=>{var S,T,s,u;if(w==="selection")return(S=f.current)!=null&&S.editor()?(u=f.current)==null||u.executeMouseTool("polygon"):((T=f.current)==null||T.createEditor("polygon"),(s=f.current)==null||s.createMouseTool("polygon")),()=>{ne()}},[w]),h.useEffect(()=>{if(w)return()=>{var S;J.current||(S=f.current)==null||S.map.getAllOverlays().forEach(T=>{$(T,!1)})}},[w]);const te=G.useMemoizedFn(()=>{var m,M,F;const S=(m=f.current)==null?void 0:m.editor().getTarget(),T=(M=f.current)==null?void 0:M.map.getAllOverlays(),s=T==null?void 0:T.filter(k=>{if(!(k===S||k.getExtData().id===void 0))return"getPosition"in k?C.isPointInRing(k.getPosition(),S==null?void 0:S.getPath()):C.doesRingRingIntersect(k.getPath(),S==null?void 0:S.getPath())}),u=s==null?void 0:s.map(k=>($(k,!0),k.getExtData().id));c(k=>u==null?void 0:u.concat(k)),S==null||S.remove(),(F=f.current)==null||F.editor().close()});h.useEffect(()=>{var m,M,F;if(!o||!f.current||!n)return;const S=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,T=b([A,...S].flat().join(".")),s=n.map(k=>{var pe;const j=(pe=ze(k,t==null?void 0:t.field,T==null?void 0:T.interface))==null?void 0:pe.filter(Boolean),ie=r.getLabelFormatValue(ce,k[t.marker]);return j!=null&&j.length?j.map(ae=>{var oe;return(oe=f.current)==null?void 0:oe.setOverlay(o.type,ae,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:t!=null&&t.marker?K(ie):void 0},extData:{id:k[p]}})}):[]}).flat().filter(Boolean);(M=(m=f.current)==null?void 0:m.map)==null||M.setFitView(s);const u=s.map(k=>{const j=ie=>{const pe=ie.target,ae=pe.getExtData();if(!ae)return;if(J.current){J.current==="click"&&(c(oe=>ae.selected?oe.filter(Le=>Le!==ae.id):[...oe,ae.id]),$(pe));return}const ye=n.find(oe=>ae.id===oe[p]);if(V){Q(oe=>(oe&&Ge(oe),oe===k?(Ge(k),P(null),null):(lt(k),P(ye[p],Le=>Le.field||p,"$eq"),k)));return}ye&&(B(ye),H({recordData:ye}))};return k.on("click",j),()=>k.off("click",j)});if(o.type==="point"&&(g!=null&&g.length)&&(s==null?void 0:s.length)>1){const k=s.map(ie=>ie.getPosition());s[0].setzIndex(13),s[s.length-1].setzIndex(13);const j=(ie=!0)=>{var pe,ae;if((pe=f.current)!=null&&pe.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:q(ie?"Start point":"End point")},position:k[ie?0:k.length-1],map:(ae=f.current)==null?void 0:ae.map})};s.push(...[(F=f.current)==null?void 0:F.setOverlay("lineString",k,{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),j(),j(!1)].filter(Boolean))}return()=>{s.forEach(k=>{k.remove()}),u.forEach(k=>k())}},[n,y,t,A,p,o.type,V,g,H]),h.useEffect(()=>{setTimeout(()=>{c([])})},[n]);const R=S=>{f.current=S,d(!!(S!=null&&S.map)&&!S.errMessage)};return i.jsxs("div",{className:r.css`
42
42
  position: relative;
43
43
  height: 100%;
44
44
  `,children:[i.jsx("div",{className:r.css`
@@ -46,7 +46,7 @@
46
46
  left: 10px;
47
47
  top: 10px;
48
48
  z-index: 999;
49
- `,children:y&&!((N=f.current)!=null&&N.errMessage)?i.jsxs(x.Space,{direction:"vertical",children:[i.jsx(x.Button,{style:{color:w?void 0:"#F18b62",borderColor:"currentcolor"},onClick:S=>{S.stopPropagation(),U("")},icon:i.jsx(ee.EnvironmentOutlined,{})}),i.jsx(x.Button,{style:{color:w==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:S=>{S.stopPropagation(),U("selection")},icon:i.jsx(ee.ExpandOutlined,{})}),w==="selection"?i.jsx(x.Button,{type:"primary",icon:i.jsx(ee.CheckOutlined,{}),title:j("Confirm selection"),onClick:te}):null]}):null}),i.jsx(r.RecordProvider,{record:L,parent:re,children:i.jsx(xe,{})}),i.jsx(ke,V(k({},(Z=o==null?void 0:o.uiSchema)==null?void 0:Z["x-component-props"]),{ref:R,style:{height:l?"100%":null},zoom:a,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})};function Ge(e){e.dom?e.dom.style.filter="none":e.setOptions&&e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function lt(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 je=({type:e,children:o})=>{const{t}=W(),[n,l]=G.useBoolean(!1),a=r.useAPIClient(),[c]=x.Form.useForm(),g=Pe(e);h.useEffect(()=>{g&&(c.setFieldsValue(g),l.toggle())},[g]);const A=h.useMemo(()=>a.resource(Ke),[a]),v=b=>{A.set(V(k({},b),{type:e})).then(p=>{sessionStorage.removeItem(we(e)),l.toggle(),x.message.success(t("Saved successfully"))}).catch(p=>{x.message.success(t("Saved failed"))})};return i.jsxs(x.Form,{disabled:n,form:c,layout:"vertical",onFinish:v,children:[o,n?i.jsx(x.Button,{disabled:!1,onClick:l.toggle,children:t("Edit")}):i.jsx(x.Form.Item,{children:i.jsx(x.Button,{disabled:!1,type:"primary",htmlType:"submit",children:t("Save")})})]})},ct={amap:()=>{const{t:e}=W();return i.jsxs(je,{type:"amap",children:[i.jsx(x.Form.Item,{required:!0,name:"accessKey",label:e("Access key"),children:i.jsx(x.Input,{})}),i.jsx(x.Form.Item,{required:!0,name:"securityJsCode",label:e("securityJsCode or serviceHost"),children:i.jsx(x.Input,{})})]})},google:()=>{const{t:e}=W();return i.jsx(je,{type:"google",children:i.jsx(x.Form.Item,{required:!0,name:"accessKey",label:e("Api key"),children:i.jsx(x.Input,{})})})}},pt=Te.map(e=>V(k({},e),{component:ct[e.value]})),ut=()=>{const e=r.useCompile(),o=r.useLocationSearch(),t=new URLSearchParams(o);return i.jsx(x.Card,{bordered:!0,children:i.jsx(x.Tabs,{type:"card",defaultActiveKey:t.get("tab"),children:pt.map(n=>i.jsx(x.Tabs.TabPane,{tab:e(n.label),children:i.jsx(n.component,{type:n.value})},n.value))})})};/*! *****************************************************************************
49
+ `,children:y&&!((N=f.current)!=null&&N.errMessage)?i.jsxs(x.Space,{direction:"vertical",children:[i.jsx(x.Button,{style:{color:w?void 0:"#F18b62",borderColor:"currentcolor"},onClick:S=>{S.stopPropagation(),U("")},icon:i.jsx(ee.EnvironmentOutlined,{})}),i.jsx(x.Button,{style:{color:w==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:S=>{S.stopPropagation(),U("selection")},icon:i.jsx(ee.ExpandOutlined,{})}),w==="selection"?i.jsx(x.Button,{type:"primary",icon:i.jsx(ee.CheckOutlined,{}),title:q("Confirm selection"),onClick:te}):null]}):null}),i.jsx(r.RecordProvider,{record:L,parent:re,children:i.jsx(xe,{})}),i.jsx(ke,W(O({},(Z=o==null?void 0:o.uiSchema)==null?void 0:Z["x-component-props"]),{ref:R,style:{height:l?"100%":null},zoom:a,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})};function Ge(e){e.dom?e.dom.style.filter="none":e.setOptions&&e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function lt(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 je=({type:e,children:o})=>{const{t}=Y(),[n,l]=G.useBoolean(!1),a=r.useAPIClient(),[c]=x.Form.useForm(),g=Pe(e);h.useEffect(()=>{g&&(c.setFieldsValue(g),l.toggle())},[g]);const A=h.useMemo(()=>a.resource(Ke),[a]),v=b=>{A.set(W(O({},b),{type:e})).then(p=>{sessionStorage.removeItem(we(e)),l.toggle(),x.message.success(t("Saved successfully"))}).catch(p=>{x.message.success(t("Saved failed"))})};return i.jsxs(x.Form,{disabled:n,form:c,layout:"vertical",onFinish:v,children:[o,n?i.jsx(x.Button,{disabled:!1,onClick:l.toggle,children:t("Edit")}):i.jsx(x.Form.Item,{children:i.jsx(x.Button,{disabled:!1,type:"primary",htmlType:"submit",children:t("Save")})})]})},ct={amap:()=>{const{t:e}=Y();return i.jsxs(je,{type:"amap",children:[i.jsx(x.Form.Item,{required:!0,name:"accessKey",label:e("Access key"),children:i.jsx(x.Input,{})}),i.jsx(x.Form.Item,{required:!0,name:"securityJsCode",label:e("securityJsCode or serviceHost"),children:i.jsx(x.Input,{})})]})},google:()=>{const{t:e}=Y();return i.jsx(je,{type:"google",children:i.jsx(x.Form.Item,{required:!0,name:"accessKey",label:e("Api key"),children:i.jsx(x.Input,{})})})}},pt=Te.map(e=>W(O({},e),{component:ct[e.value]})),ut=()=>{const e=r.useCompile(),o=r.useLocationSearch(),t=new URLSearchParams(o);return i.jsx(x.Card,{bordered:!0,children:i.jsx(x.Tabs,{type:"card",defaultActiveKey:t.get("tab"),children:pt.map(n=>i.jsx(x.Tabs.TabPane,{tab:e(n.label),children:i.jsx(n.component,{type:n.value})},n.value))})})};/*! *****************************************************************************
50
50
  Copyright (c) Microsoft Corporation.
51
51
 
52
52
  Permission to use, copy, modify, and/or distribute this software for any
@@ -59,15 +59,15 @@
59
59
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
60
60
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
61
61
  PERFORMANCE OF THIS SOFTWARE.
62
- ***************************************************************************** */function dt(e,o,t,n){function l(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function g(b){try{v(n.next(b))}catch(p){c(p)}}function A(b){try{v(n.throw(b))}catch(p){c(p)}}function v(b){b.done?a(b.value):l(b.value).then(g,A)}v((n=n.apply(e,[])).next())})}var ft=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 n,l,a;if(Array.isArray(o)){if(n=o.length,n!=t.length)return!1;for(l=n;l--!==0;)if(!e(o[l],t[l]))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(a=Object.keys(o),n=a.length,n!==Object.keys(t).length)return!1;for(l=n;l--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[l]))return!1;for(l=n;l--!==0;){var c=a[l];if(!e(o[c],t[c]))return!1}return!0}return o!==o&&t!==t};const qe="__googleMapsScriptId";var he;(function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"})(he||(he={}));class ue{constructor({apiKey:o,authReferrerPolicy:t,channel:n,client:l,id:a=qe,language:c,libraries:g=[],mapIds:A,nonce:v,region:b,retries:p=3,url:y="https://maps.googleapis.com/maps/api/js",version:d}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=o,this.authReferrerPolicy=t,this.channel=n,this.client=l,this.id=a||qe,this.language=c,this.libraries=g,this.mapIds=A,this.nonce=v,this.region=b,this.retries=p,this.url=y,this.version=d,ue.instance){if(!ft(this.options,ue.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(ue.instance.options)}`);return ue.instance}ue.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?he.FAILURE:this.done?he.SUCCESS:this.loading?he.LOADING:he.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let o=this.url;return o+="?callback=__googleMapsCallback",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(n=>{n?t(n.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 n={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(n).forEach(a=>!n[a]&&delete n[a]),!((t=(o=window==null?void 0:window.google)===null||o===void 0?void 0:o.maps)===null||t===void 0)&&t.importLibrary||(a=>{let c,g,A,v="The Google Maps JavaScript API",b="google",p="importLibrary",y="__ib__",d=document,f=window;f=f[b]||(f[b]={});const C=f.maps||(f.maps={}),L=new Set,B=new URLSearchParams,w=()=>c||(c=new Promise((U,j)=>dt(this,void 0,void 0,function*(){var K;yield g=d.createElement("script"),g.id=this.id,B.set("libraries",[...L]+"");for(A in a)B.set(A.replace(/[A-Z]/g,_=>"_"+_[0].toLowerCase()),a[A]);B.set("callback",b+".maps."+y),g.src=this.url+"?"+B,C[y]=U,g.onerror=()=>c=j(Error(v+" could not load.")),g.nonce=this.nonce||((K=d.querySelector("script[nonce]"))===null||K===void 0?void 0:K.nonce)||"",d.head.append(g)})));C[p]?console.warn(v+" only loads once. Ignoring:",a):C[p]=(U,...j)=>L.add(U)&&w().then(()=>C[p](U,...j))})(n);const l=this.libraries.map(a=>this.importLibrary(a));l.length||l.push(this.importLibrary("core")),Promise.all(l).then(()=>this.callback(),a=>{const c=new ErrorEvent("error",{error:a});this.loadErrorCallback(c)})}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.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}const mt=e=>{const{toCenter:o,mapRef:t}=e,{t:n}=W(),l=h.useRef(),[a,c]=h.useState([]);h.useEffect(()=>{google.maps.importLibrary("places").then(v=>{l.current=new v.AutocompleteService}).catch(()=>{x.message.error("Please configure the Google API Key correctly")})},[t]);const{run:g}=G.useDebounceFn(v=>{l.current&&l.current.getPlacePredictions({input:v||" "},(b,p)=>{if(p===google.maps.places.PlacesServiceStatus.OK)c(b.map(y=>{const d=y.structured_formatting;return V(k({},y),{label:`${d.main_text}${d.secondary_text?" "+d.secondary_text:""}`,value:y.place_id})}));else{c([]);return}})},{wait:300}),A=v=>{const b=a.find(y=>y.value===v);new google.maps.places.PlacesService(t.current).getDetails({placeId:b.place_id,fields:["geometry"]},(y,d)=>{d===google.maps.places.PlacesServiceStatus.OK&&o(y.geometry.location)})};return i.jsx("div",{className:r.css`
62
+ ***************************************************************************** */function dt(e,o,t,n){function l(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function g(b){try{v(n.next(b))}catch(p){c(p)}}function A(b){try{v(n.throw(b))}catch(p){c(p)}}function v(b){b.done?a(b.value):l(b.value).then(g,A)}v((n=n.apply(e,[])).next())})}var ft=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 n,l,a;if(Array.isArray(o)){if(n=o.length,n!=t.length)return!1;for(l=n;l--!==0;)if(!e(o[l],t[l]))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(a=Object.keys(o),n=a.length,n!==Object.keys(t).length)return!1;for(l=n;l--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[l]))return!1;for(l=n;l--!==0;){var c=a[l];if(!e(o[c],t[c]))return!1}return!0}return o!==o&&t!==t};const qe="__googleMapsScriptId";var he;(function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"})(he||(he={}));class ue{constructor({apiKey:o,authReferrerPolicy:t,channel:n,client:l,id:a=qe,language:c,libraries:g=[],mapIds:A,nonce:v,region:b,retries:p=3,url:y="https://maps.googleapis.com/maps/api/js",version:d}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=o,this.authReferrerPolicy=t,this.channel=n,this.client=l,this.id=a||qe,this.language=c,this.libraries=g,this.mapIds=A,this.nonce=v,this.region=b,this.retries=p,this.url=y,this.version=d,ue.instance){if(!ft(this.options,ue.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(ue.instance.options)}`);return ue.instance}ue.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?he.FAILURE:this.done?he.SUCCESS:this.loading?he.LOADING:he.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let o=this.url;return o+="?callback=__googleMapsCallback",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(n=>{n?t(n.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 n={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(n).forEach(a=>!n[a]&&delete n[a]),!((t=(o=window==null?void 0:window.google)===null||o===void 0?void 0:o.maps)===null||t===void 0)&&t.importLibrary||(a=>{let c,g,A,v="The Google Maps JavaScript API",b="google",p="importLibrary",y="__ib__",d=document,f=window;f=f[b]||(f[b]={});const C=f.maps||(f.maps={}),L=new Set,B=new URLSearchParams,w=()=>c||(c=new Promise((U,q)=>dt(this,void 0,void 0,function*(){var K;yield g=d.createElement("script"),g.id=this.id,B.set("libraries",[...L]+"");for(A in a)B.set(A.replace(/[A-Z]/g,V=>"_"+V[0].toLowerCase()),a[A]);B.set("callback",b+".maps."+y),g.src=this.url+"?"+B,C[y]=U,g.onerror=()=>c=q(Error(v+" could not load.")),g.nonce=this.nonce||((K=d.querySelector("script[nonce]"))===null||K===void 0?void 0:K.nonce)||"",d.head.append(g)})));C[p]?console.warn(v+" only loads once. Ignoring:",a):C[p]=(U,...q)=>L.add(U)&&w().then(()=>C[p](U,...q))})(n);const l=this.libraries.map(a=>this.importLibrary(a));l.length||l.push(this.importLibrary("core")),Promise.all(l).then(()=>this.callback(),a=>{const c=new ErrorEvent("error",{error:a});this.loadErrorCallback(c)})}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.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}const mt=e=>{const{toCenter:o,mapRef:t}=e,{t:n}=Y(),l=h.useRef(),[a,c]=h.useState([]);h.useEffect(()=>{google.maps.importLibrary("places").then(v=>{l.current=new v.AutocompleteService}).catch(()=>{x.message.error("Please configure the Google API Key correctly")})},[t]);const{run:g}=G.useDebounceFn(v=>{l.current&&l.current.getPlacePredictions({input:v||" "},(b,p)=>{if(p===google.maps.places.PlacesServiceStatus.OK)c(b.map(y=>{const d=y.structured_formatting;return W(O({},y),{label:`${d.main_text}${d.secondary_text?" "+d.secondary_text:""}`,value:y.place_id})}));else{c([]);return}})},{wait:300}),A=v=>{const b=a.find(y=>y.value===v);new google.maps.places.PlacesService(t.current).getDetails({placeId:b.place_id,fields:["geometry"]},(y,d)=>{d===google.maps.places.PlacesServiceStatus.OK&&o(y.geometry.location)})};return i.jsx("div",{className:r.css`
63
63
  position: absolute;
64
64
  top: 10px;
65
65
  left: 10px;
66
66
  z-index: 10;
67
67
  width: calc(100% - 20px);
68
- `,children:i.jsx(x.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:n("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:A,options:a})})},de=e=>({url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(19/2,42)}),gt=()=>new Promise(e=>{const o=()=>{e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;e({lat:n,lng:l})},()=>{o()}):o()}),ht=e=>e==="point"?"marker":e==="lineString"?"polyline":e,yt={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"}},Fe=h.forwardRef((e,o)=>{const{value:t,onChange:n,block:l=!1,readonly:a,disabled:c=l,zoom:g=13,overlayCommonOptions:A}=e,{accessKey:v}=Pe(e.mapType)||{},{t:b}=W(),{getField:p}=r.useCollection_deprecated(),y=z.useFieldSchema(),d=h.useRef(),f=h.useRef(),C=h.useRef(),[L,B]=h.useState([]),[w,U]=h.useState(""),j=r.useAPIClient(),{modal:K}=x.App.useApp(),_=Ne();h.useEffect(()=>{f.current&&f.current.setZoom(g)},[g]);const P=h.useMemo(()=>{if(e.type)return e.type;const s=p(y==null?void 0:y.name);return s==null?void 0:s.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),Q=h.useRef(ht(P)),[J]=h.useState(k({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1,editable:!c,draggable:!c},A)),fe=r.useNavigateNoUpdate(),re=h.useRef(),Y=h.useRef(new Set),ce=G.useMemoizedFn(s=>{if(Y.current.forEach(u=>{Y.current.delete(u)}),"getPath"in s){const u=s.getPath();["insert_at","remove_at","set_at"].forEach(m=>{Y.current.add(u.addListener(m,()=>{I(s,!0)}).remove)})}else s instanceof google.maps.Circle&&["center_changed","radius_changed"].forEach(u=>{Y.current.add(s.addListener(u,()=>{I(s,!0)}).remove)})}),$=G.useMemoizedFn(()=>{var s;C.current&&(C.current.unbindAll(),C.current.setMap(null)),P!=="point"&&((s=d.current)==null||s.setDrawingMode(null))}),ne=G.useMemoizedFn(s=>{f.current&&(f.current.setCenter(s),f.current.setZoom(g))}),te=G.useMemoizedFn(s=>{$(),ce(s),C.current=s}),R=G.useMemoizedFn(s=>{const u=new google.maps.LatLngBounds;s.forEach(m=>{if(m instanceof google.maps.Marker)u.extend(m.getPosition());else if(m instanceof google.maps.Polyline||m instanceof google.maps.Polygon){const M=m.getPath();for(let E=0;E<M.getLength();E++)u.extend(M.getAt(E))}else m instanceof google.maps.Circle&&u.union(m.getBounds())}),f.current.setCenter(u.getCenter())}),se=()=>{C.current&&R([C.current])},I=G.useMemoizedFn((s,u=!1)=>{let m=null;if(P==="point"){const{lat:M,lng:E}=s.getPosition();m=[E(),M()]}else if(P==="polygon"||P==="lineString"){if(m=s.getPath().getArray().map(M=>[M.lng(),M.lat()]),m.length<2)return}else if(P==="circle"){const M=s.getCenter(),E=s.getRadius();m=[M.lng(),M.lat(),E]}u||te(s),n==null||n(m)}),q=G.useMemoizedFn((s=!1,u)=>{const m=V(k(k({},J),u),{map:f.current});return d.current=new google.maps.drawing.DrawingManager({drawingMode:Q.current,drawingControl:!1,markerOptions:V(k({},m),{icon:de(ge)}),polygonOptions:m,polylineOptions:m,circleOptions:m,map:f.current}),s||d.current.addListener("overlaycomplete",M=>{const E=M.overlay;I(E)}),d.current}),N=G.useMemoizedFn((s=P,u=t,m)=>{const M=yt[s];if(!M)return;const E=k(V(k({},J),{icon:de(ge)}),m);return"transformOptions"in M?Object.assign(E,M.transformOptions(u)):"propertyKey"in M&&(E[M.propertyKey]=Array.isArray(u[0])?u.map(H=>new google.maps.LatLng(H[1],H[0])):new google.maps.LatLng(u[1],u[0])),new google.maps[M.overlay](E)}),Z=G.useMemoizedFn((s=P,u=t,m)=>f.current?N(s,u,V(k({},m),{map:f.current})):void 0);h.useEffect(()=>{var u,m;if(!t&&f.current&&($(),(m=(u=d==null?void 0:d.current)==null?void 0:u.setDrawingMode)==null||m.call(u,Q.current),n==null||n(null)),!f.current||!t||!a&&C.current)return;const s=Z();te(s),R([s])},[t,L,P,c,a,Z,R,te]),h.useEffect(()=>{if(!v||f.current||!re.current)return;let s;try{s=new ue({apiKey:v,version:"weekly",language:j.auth.getLocale()})}catch(m){U(b("Load google maps failed, Please check the Api key and refresh the page"));return}const u=console.error;return console.error=(m,...M)=>{m!=null&&m.includes("InvalidKeyMapError")&&U(b("Load google maps failed, Please check the Api key and refresh the page")),u(m,...M)},Promise.all([s.importLibrary("drawing"),s.importLibrary("core"),s.importLibrary("geometry")]).then(m=>Ce(this,null,function*(){const M=yield gt();f.current=new google.maps.Map(re.current,{zoom:g,center:M,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),U(""),B([])})).catch(m=>{if(m instanceof Error){U(m.message);return}}),()=>{var m,M;(m=f.current)==null||m.unbindAll(),f.current=null,(M=d.current)==null||M.unbindAll()}},[v,j.auth,P,g]),h.useEffect(()=>{!f.current||!P||c||d.current||q()},[q,c,L,P]),h.useImperativeHandle(o,()=>({setOverlay:Z,getOverlay:N,setFitView:R,createDraw:q,map:f.current,overlay:C.current,drawingManager:d.current,errMessage:w}));const S=G.useMemoizedFn(()=>{const s=()=>{$(),d.current.setDrawingMode(Q.current),n==null||n(null)};K.confirm({title:b("Clear the canvas"),content:b("Are you sure to clear the canvas?"),okText:b("Confirm"),cancelText:b("Cancel"),getContainer:()=>re.current,onOk(){s()}})}),T=r.useApp();return!v||w?i.jsx(x.Alert,{action:i.jsx(x.Button,{type:"primary",onClick:()=>fe(T.pluginSettingsManager.getRoutePath("map")+"?tab=google"),children:b("Go to the configuration page")}),message:w||b("Please configure the Api key first"),type:"error"}):i.jsxs("div",{className:r.css`
68
+ `,children:i.jsx(x.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:n("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:A,options:a})})},de=e=>({url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(19/2,42)}),gt=()=>new Promise(e=>{const o=()=>{e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;e({lat:n,lng:l})},()=>{o()},{timeout:2e3,maximumAge:0}):o()}),ht=e=>e==="point"?"marker":e==="lineString"?"polyline":e,yt={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"}},Fe=h.forwardRef((e,o)=>{const{value:t,onChange:n,block:l=!1,readonly:a,disabled:c=l,zoom:g=13,overlayCommonOptions:A}=e,{accessKey:v}=Pe(e.mapType)||{},{t:b}=Y(),{getField:p}=r.useCollection_deprecated(),y=z.useFieldSchema(),d=h.useRef(),f=h.useRef(),C=h.useRef(),[L,B]=h.useState([]),[w,U]=h.useState(""),q=r.useAPIClient(),{modal:K}=x.App.useApp(),V=Ne();h.useEffect(()=>{f.current&&f.current.setZoom(g)},[g]);const P=h.useMemo(()=>{if(e.type)return e.type;const s=p(y==null?void 0:y.name);return s==null?void 0:s.interface},[e==null?void 0:e.type,y==null?void 0:y.name]),Q=h.useRef(ht(P)),[J]=h.useState(O({strokeWeight:5,strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeOpacity:1,editable:!c,draggable:!c},A)),fe=r.useNavigateNoUpdate(),re=h.useRef(),H=h.useRef(new Set),ce=G.useMemoizedFn(s=>{if(H.current.forEach(u=>{H.current.delete(u)}),"getPath"in s){const u=s.getPath();["insert_at","remove_at","set_at"].forEach(m=>{H.current.add(u.addListener(m,()=>{I(s,!0)}).remove)})}else s instanceof google.maps.Circle&&["center_changed","radius_changed"].forEach(u=>{H.current.add(s.addListener(u,()=>{I(s,!0)}).remove)})}),$=G.useMemoizedFn(()=>{var s;C.current&&(C.current.unbindAll(),C.current.setMap(null)),P!=="point"&&((s=d.current)==null||s.setDrawingMode(null))}),ne=G.useMemoizedFn(s=>{var u,m;f.current&&s&&((u=f.current)==null||u.setCenter(s),(m=f.current)==null||m.setZoom(g))}),te=G.useMemoizedFn(s=>{$(),ce(s),C.current=s}),R=G.useMemoizedFn(s=>{var m,M;const u=new google.maps.LatLngBounds;s.forEach(F=>{if(F instanceof google.maps.Marker)u.extend(F.getPosition());else if(F instanceof google.maps.Polyline||F instanceof google.maps.Polygon){const k=F.getPath();for(let j=0;j<k.getLength();j++)u.extend(k.getAt(j))}else F instanceof google.maps.Circle&&u.union(F.getBounds())}),(M=(m=f.current)==null?void 0:m.setCenter)==null||M.call(m,u.getCenter())}),se=()=>{C.current&&R([C.current])},I=G.useMemoizedFn((s,u=!1)=>{let m=null;if(P==="point"){const{lat:M,lng:F}=s.getPosition();m=[F(),M()]}else if(P==="polygon"||P==="lineString"){if(m=s.getPath().getArray().map(M=>[M.lng(),M.lat()]),m.length<2)return}else if(P==="circle"){const M=s.getCenter(),F=s.getRadius();m=[M.lng(),M.lat(),F]}u||te(s),n==null||n(m)}),_=G.useMemoizedFn((s=!1,u)=>{const m=W(O(O({},J),u),{map:f.current});return d.current=new google.maps.drawing.DrawingManager({drawingMode:Q.current,drawingControl:!1,markerOptions:W(O({},m),{icon:de(ge)}),polygonOptions:m,polylineOptions:m,circleOptions:m,map:f.current}),s||d.current.addListener("overlaycomplete",M=>{const F=M.overlay;I(F)}),d.current}),N=G.useMemoizedFn((s=P,u=t,m)=>{const M=yt[s];if(!M)return;const F=O(W(O({},J),{icon:de(ge)}),m);return"transformOptions"in M?Object.assign(F,M.transformOptions(u)):"propertyKey"in M&&(F[M.propertyKey]=Array.isArray(u[0])?u.map(j=>new google.maps.LatLng(j[1],j[0])):new google.maps.LatLng(u[1],u[0])),new google.maps[M.overlay](F)}),Z=G.useMemoizedFn((s=P,u=t,m)=>f.current?N(s,u,W(O({},m),{map:f.current})):void 0);h.useEffect(()=>{var u,m;if(!t&&f.current&&($(),(m=(u=d==null?void 0:d.current)==null?void 0:u.setDrawingMode)==null||m.call(u,Q.current),n==null||n(null)),!f.current||!t||!a&&C.current)return;const s=Z();te(s),R([s])},[t,L,P,c,a,Z,R,te]),h.useEffect(()=>{if(!v||f.current||!re.current)return;let s;try{s=new ue({apiKey:v,version:"weekly",language:q.auth.getLocale()})}catch(m){U(b("Load google maps failed, Please check the Api key and refresh the page"));return}const u=console.error;return console.error=(m,...M)=>{m!=null&&m.includes("InvalidKeyMapError")&&U(b("Load google maps failed, Please check the Api key and refresh the page")),u(m,...M)},Promise.all([s.importLibrary("drawing"),s.importLibrary("core"),s.importLibrary("geometry")]).then(m=>Ce(this,null,function*(){const M=yield gt();f.current=new google.maps.Map(re.current,{zoom:g,center:M,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),U(""),B([])})).catch(m=>{if(m instanceof Error){U(m.message);return}}),()=>{var m,M;(m=f.current)==null||m.unbindAll(),f.current=null,(M=d.current)==null||M.unbindAll()}},[v,q.auth,P,g]),h.useEffect(()=>{!f.current||!P||c||d.current||_()},[_,c,L,P]),h.useImperativeHandle(o,()=>({setOverlay:Z,getOverlay:N,setFitView:R,createDraw:_,map:f.current,overlay:C.current,drawingManager:d.current,errMessage:w}));const S=G.useMemoizedFn(()=>{const s=()=>{$(),d.current.setDrawingMode(Q.current),n==null||n(null)};K.confirm({title:b("Clear the canvas"),content:b("Are you sure to clear the canvas?"),okText:b("Confirm"),cancelText:b("Cancel"),getContainer:()=>re.current,onOk(){s()}})}),T=r.useApp();return!v||w?i.jsx(x.Alert,{action:i.jsx(x.Button,{type:"primary",onClick:()=>fe(T.pluginSettingsManager.getRoutePath("map")+"?tab=google"),children:b("Go to the configuration page")}),message:w||b("Please configure the Api key first"),type:"error"}):i.jsxs("div",{className:r.css`
69
69
  position: relative;
70
- height: ${_||500}px !important;
70
+ height: ${V||500}px !important;
71
71
  `,children:[!f.current&&i.jsx("div",{className:r.css`
72
72
  position: absolute;
73
73
  inset: 0;
@@ -103,7 +103,7 @@
103
103
  padding: 2px 4px;
104
104
  background: #fff;
105
105
  border: 1px solid #0000f5;
106
- `,At=e=>{var se;const{collectionField:o,fieldNames:t,dataSource:n,fixedBlock:l,zoom:a,setSelectedRecordKeys:c,lineSort:g}=r.useProps(e),{getPrimaryKey:A}=r.useCollection_deprecated(),v=A(),{marker:b="id"}=t,[p,y]=h.useState(!1),d=h.useRef(),[f,C]=h.useState(),[L,B]=h.useState(""),{t:w}=W(),U=r.useCompile(),{isConnected:j,doFilter:K}=r.useFilterAPI(),[,_]=h.useState(null),P=h.useRef(L),Q=h.useRef(null),J=h.useRef([]);P.current=L;const{fields:fe}=r.useCollection(),re=r.useCollectionParentRecordData(),Y=(se=fe.find(I=>I.name===(t==null?void 0:t.marker)))==null?void 0:se.uiSchema,{getCollectionJoinField:ce}=r.useCollectionManager_deprecated(),{openPopup:$}=r.usePopupUtils(),ne=(I,q)=>{const N=typeof q!="undefined"?!q:I.get(_e);I.set(_e,!N),I.setOptions(k({},N?{icon:de(ge),strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{icon:de(Se),strokeColor:"#F18b62",fillColor:"#F18b62"}))};h.useEffect(()=>{var q,N,Z,S;if(L!=="selection")return;d.current&&!((q=d.current)!=null&&q.drawingManager)&&(d.current.drawingManager=(N=d.current)==null?void 0:N.createDraw(!0,{editable:!0,draggable:!0}));const I=new Set;return(Z=d.current)==null||Z.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),(S=d.current)==null||S.drawingManager.addListener("overlaycomplete",T=>{var m;const s=T.overlay;(m=d.current)==null||m.drawingManager.setDrawingMode(null),Q.current=s;const u=s.getPath();["insert_at","remove_at","set_at"].forEach(M=>{I.add(u.addListener(M,()=>{}).remove)})}),()=>{var T,s,u,m;I.forEach(M=>{M()}),d.current&&((T=Q.current)==null||T.unbindAll(),(s=Q.current)==null||s.setMap(null),Q.current=null,(u=d.current)==null||u.drawingManager.setDrawingMode(null),(m=d.current)==null||m.drawingManager.unbindAll())}},[L]),h.useEffect(()=>{if(L)return()=>{P.current||J.current.forEach(I=>{ne(I,!1)})}},[L]);const te=G.useMemoizedFn(()=>{var T;const I=Q.current,q=J.current,N=google.maps.geometry.poly,S=q.filter(s=>{if(!(s===I||s.get(Me)===void 0))return s instanceof google.maps.Marker?N.containsLocation(s.getPosition(),I):s instanceof google.maps.Circle?N.containsLocation(s.getCenter(),I):s.getPath().getArray().some(u=>N.containsLocation(u,I))}).map(s=>(ne(s,!0),s.get(Me)));c(s=>S.concat(s)),I==null||I.unbindAll(),I==null||I.setMap(null),(T=d.current)==null||T.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});h.useEffect(()=>{var S,T;if(!o||!(n!=null&&n.length)||!((S=d.current)!=null&&S.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,q=ce([name,...I].flat().join(".")),N=n.map(s=>{const u=ze(s,t==null?void 0:t.field,q==null?void 0:q.interface),m=r.getLabelFormatValue(Y,s[t.marker]);return u!=null&&u.length?u==null?void 0:u.filter(Boolean).map(M=>{var F;if(!u)return;const E=(F=d.current)==null?void 0:F.setOverlay(o.type,M,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{className:bt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:t!=null&&t.marker?U(m):void 0}});return E==null||E.set(Me,s[v]),E}):[]}).flat().filter(Boolean);J.current=N;const Z=N.map(s=>{const u=m=>{const M=s,E=M.get(Me);if(!E)return;const F=n==null?void 0:n.find(H=>E===H[v]);if(j){_(H=>(H&&Ve(M),H===s?(Ve(M),K(null),null):(vt(M),K(F[v],ie=>ie.field||v,"$eq"),M)));return}F&&(C(F),$({recordData:F}))};return s.addListener("click",u),()=>s.unbindAll()});if(o.type==="point"&&(g!=null&&g.length)&&(N==null?void 0:N.length)>1){const s=N.map(m=>m.getPosition());N[0].setZIndex(138),N[N.length-1].setZIndex(138);const u=(m=!0)=>{var M;if((M=d.current)!=null&&M.map)return new google.maps.Marker({label:{className:Mt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:w(m?"Start point":"End point")},icon:de(ge),position:m?s[0]:s[s.length-1],map:d.current.map})};N.push(...[d.current.setOverlay("lineString",s.map(m=>[m.lng(),m.lat()]),{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),u(),u(!1)].filter(Boolean))}return(T=d.current)==null||T.setFitView(N),()=>{N.forEach(s=>{s.setMap(null),s.unbindAll()}),Z.forEach(s=>s())}},[n,p,b,o.type,j,$]),h.useEffect(()=>{setTimeout(()=>{c([])})},[n]);const R=I=>{d.current=I,y(!!(I!=null&&I.map)&&!I.errMessage)};return i.jsxs("div",{className:r.css`
106
+ `,At=e=>{var se;const{collectionField:o,fieldNames:t,dataSource:n,fixedBlock:l,zoom:a,setSelectedRecordKeys:c,lineSort:g}=r.useProps(e),{getPrimaryKey:A}=r.useCollection_deprecated(),v=A(),{marker:b="id"}=t,[p,y]=h.useState(!1),d=h.useRef(),[f,C]=h.useState(),[L,B]=h.useState(""),{t:w}=Y(),U=r.useCompile(),{isConnected:q,doFilter:K}=r.useFilterAPI(),[,V]=h.useState(null),P=h.useRef(L),Q=h.useRef(null),J=h.useRef([]);P.current=L;const{fields:fe}=r.useCollection(),re=r.useCollectionParentRecordData(),H=(se=fe.find(I=>I.name===(t==null?void 0:t.marker)))==null?void 0:se.uiSchema,{getCollectionJoinField:ce}=r.useCollectionManager_deprecated(),{openPopup:$}=r.usePopupUtils(),ne=(I,_)=>{const N=typeof _!="undefined"?!_:I.get(_e);I.set(_e,!N),I.setOptions(O({},N?{icon:de(ge),strokeColor:"#4e9bff",fillColor:"#4e9bff"}:{icon:de(Se),strokeColor:"#F18b62",fillColor:"#F18b62"}))};h.useEffect(()=>{var _,N,Z,S;if(L!=="selection")return;d.current&&!((_=d.current)!=null&&_.drawingManager)&&(d.current.drawingManager=(N=d.current)==null?void 0:N.createDraw(!0,{editable:!0,draggable:!0}));const I=new Set;return(Z=d.current)==null||Z.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),(S=d.current)==null||S.drawingManager.addListener("overlaycomplete",T=>{var m;const s=T.overlay;(m=d.current)==null||m.drawingManager.setDrawingMode(null),Q.current=s;const u=s.getPath();["insert_at","remove_at","set_at"].forEach(M=>{I.add(u.addListener(M,()=>{}).remove)})}),()=>{var T,s,u,m;I.forEach(M=>{M()}),d.current&&((T=Q.current)==null||T.unbindAll(),(s=Q.current)==null||s.setMap(null),Q.current=null,(u=d.current)==null||u.drawingManager.setDrawingMode(null),(m=d.current)==null||m.drawingManager.unbindAll())}},[L]),h.useEffect(()=>{if(L)return()=>{P.current||J.current.forEach(I=>{ne(I,!1)})}},[L]);const te=G.useMemoizedFn(()=>{var T;const I=Q.current,_=J.current,N=google.maps.geometry.poly,S=_.filter(s=>{if(!(s===I||s.get(Me)===void 0))return s instanceof google.maps.Marker?N.containsLocation(s.getPosition(),I):s instanceof google.maps.Circle?N.containsLocation(s.getCenter(),I):s.getPath().getArray().some(u=>N.containsLocation(u,I))}).map(s=>(ne(s,!0),s.get(Me)));c(s=>S.concat(s)),I==null||I.unbindAll(),I==null||I.setMap(null),(T=d.current)==null||T.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});h.useEffect(()=>{var S,T;if(!o||!(n!=null&&n.length)||!((S=d.current)!=null&&S.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,_=ce([name,...I].flat().join(".")),N=n.map(s=>{const u=ze(s,t==null?void 0:t.field,_==null?void 0:_.interface),m=r.getLabelFormatValue(H,s[t.marker]);return u!=null&&u.length?u==null?void 0:u.filter(Boolean).map(M=>{var k;if(!u)return;const F=(k=d.current)==null?void 0:k.setOverlay(o.type,M,{strokeColor:"#4e9bff",fillColor:"#4e9bff",cursor:"pointer",label:{className:bt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:t!=null&&t.marker?U(m):void 0}});return F==null||F.set(Me,s[v]),F}):[]}).flat().filter(Boolean);J.current=N;const Z=N.map(s=>{const u=m=>{const M=s,F=M.get(Me);if(!F)return;const k=n==null?void 0:n.find(j=>F===j[v]);if(q){V(j=>(j&&Ve(M),j===s?(Ve(M),K(null),null):(vt(M),K(k[v],ie=>ie.field||v,"$eq"),M)));return}k&&(C(k),$({recordData:k}))};return s.addListener("click",u),()=>s.unbindAll()});if(o.type==="point"&&(g!=null&&g.length)&&(N==null?void 0:N.length)>1){const s=N.map(m=>m.getPosition());N[0].setZIndex(138),N[N.length-1].setZIndex(138);const u=(m=!0)=>{var M;if((M=d.current)!=null&&M.map)return new google.maps.Marker({label:{className:Mt,fontFamily:"inherit",fontSize:"13px",color:"#333",text:w(m?"Start point":"End point")},icon:de(ge),position:m?s[0]:s[s.length-1],map:d.current.map})};N.push(...[d.current.setOverlay("lineString",s.map(m=>[m.lng(),m.lat()]),{strokeColor:"#4e9bff",fillColor:"#4e9bff",strokeWeight:2,cursor:"pointer"}),u(),u(!1)].filter(Boolean))}return(T=d.current)==null||T.setFitView(N),()=>{N.forEach(s=>{s.setMap(null),s.unbindAll()}),Z.forEach(s=>s())}},[n,p,b,o.type,q,$]),h.useEffect(()=>{setTimeout(()=>{c([])})},[n]);const R=I=>{d.current=I,y(!!(I!=null&&I.map)&&!I.errMessage)};return i.jsxs("div",{className:r.css`
107
107
  position: relative;
108
108
  height: 100%;
109
109
  `,children:[p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:r.css`
@@ -111,14 +111,14 @@
111
111
  left: 10px;
112
112
  top: 10px;
113
113
  z-index: 999;
114
- `,children:i.jsxs(x.Space,{direction:"vertical",children:[i.jsx(x.Button,{style:{color:L?void 0:"#F18b62",borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("")},icon:i.jsx(ee.EnvironmentOutlined,{})}),i.jsx(x.Button,{style:{color:L==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("selection")},icon:i.jsx(ee.ExpandOutlined,{})}),L==="selection"?i.jsx(x.Button,{type:"primary",icon:i.jsx(ee.CheckOutlined,{}),title:w("Confirm selection"),onClick:te}):null]})}),i.jsx(r.RecordProvider,{record:f,parent:re,children:i.jsx(xe,{})})]}),i.jsx(Fe,V(k({},e),{ref:R,style:{height:l?"100%":null},zoom:a,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})};function Ve(e){if(e instanceof google.maps.Marker)return e.setIcon(de(ge));e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function vt(e){if(e instanceof google.maps.Marker)return e.setIcon(de(Se));e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const Ct=()=>{var p;const{getCollectionJoinField:e}=r.useCollectionManager_deprecated(),{getField:o}=r.useCollection_deprecated(),{form:t}=r.useFormBlockContext(),n=z.useField(),l=z.useFieldSchema(),{t:a}=W(),{dn:c,refresh:g}=r.useDesignable(),A=o(l.name)||e(l["x-collection-field"]),v=(p=A==null?void 0:A.uiSchema)==null?void 0:p.title;n.title===v||n.title,n.readPretty||n.required;let b="editable";return l["x-disabled"]===!0&&(b="readonly"),l["x-read-pretty"]===!0&&(b="read-pretty"),i.jsxs(r.GeneralSchemaDesigner,{children:[i.jsx(r.GeneralSchemaItems,{}),t&&!(t!=null&&t.readPretty)&&!r.isPatternDisabled(l)&&i.jsx(r.SchemaSettingsSelectItem,{title:a("Pattern"),options:[{label:a("Editable"),value:"editable"},{label:a("Readonly"),value:"readonly"},{label:a("Easy-reading"),value:"read-pretty"}],value:b,onChange:y=>{const d={"x-uid":l["x-uid"]};switch(y){case"readonly":{l["x-read-pretty"]=!1,l["x-disabled"]=!0,d["x-read-pretty"]=!1,d["x-disabled"]=!0,n.readPretty=!1,n.disabled=!0;break}case"read-pretty":{l["x-read-pretty"]=!0,l["x-disabled"]=!1,d["x-read-pretty"]=!0,d["x-disabled"]=!1,n.readPretty=!0;break}default:{l["x-read-pretty"]=!1,l["x-disabled"]=!1,d["x-read-pretty"]=!1,d["x-disabled"]=!1,n.readPretty=!1,n.disabled=!1;break}}c.emit("patch",{schema:d}),c.refresh()}},"pattern"),i.jsx(r.SchemaSettingsModalItem,{title:a("Set default zoom level"),schema:{type:"object",title:a("Set default zoom level"),properties:{zoom:{title:a("Zoom"),default:n.componentProps.zoom||13,description:a("The default zoom level of the map"),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}}}},onSubmit:({zoom:y})=>{y&&(me.set(l,"x-component-props.zoom",y),Object.assign(n.componentProps,l["x-component-props"]),c.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":n.componentProps}})),c.refresh()}},"map-zoom"),i.jsx(r.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,confirm:{title:a("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},St={amap:ke,google:Fe},Oe=h.forwardRef((e,o)=>{const{t}=W(),{mapType:n}=e,l=h.useMemo(()=>St[n],[n]);return l?i.jsx(l,k({ref:o},e)):i.jsx("div",{children:t(`The ${n} cannot found`)})});Oe.displayName="MapComponent";const xt=e=>{var A,v;const{value:o}=e,t=z.useFieldSchema(),l=r.useCollection().getField(t.name),a=e.mapType||((A=l==null?void 0:l.uiSchema["x-component-props"])==null?void 0:A.mapType),c=z.useForm(),g=z.useField();return r.useFieldTitle(),!c.readPretty||g.readPretty?i.jsx("div",{children:i.jsx(r.EllipsisWithTooltip,{ellipsis:!0,children:(v=o==null?void 0:o.map)==null?void 0:v.call(o,b=>Array.isArray(b)?`(${b.join(",")})`:b).join(",")})}):i.jsx(Oe,k({readonly:!0,mapType:a},e))},We=z.connect(e=>i.jsx("div",{className:r.css`
114
+ `,children:i.jsxs(x.Space,{direction:"vertical",children:[i.jsx(x.Button,{style:{color:L?void 0:"#F18b62",borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("")},icon:i.jsx(ee.EnvironmentOutlined,{})}),i.jsx(x.Button,{style:{color:L==="selection"?"#F18b62":void 0,borderColor:"currentcolor"},onClick:I=>{I.stopPropagation(),B("selection")},icon:i.jsx(ee.ExpandOutlined,{})}),L==="selection"?i.jsx(x.Button,{type:"primary",icon:i.jsx(ee.CheckOutlined,{}),title:w("Confirm selection"),onClick:te}):null]})}),i.jsx(r.RecordProvider,{record:f,parent:re,children:i.jsx(xe,{})})]}),i.jsx(Fe,W(O({},e),{ref:R,style:{height:l?"100%":null},zoom:a,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:"#F18b62",fillColor:"#F18b62"}}))]})};function Ve(e){if(e instanceof google.maps.Marker)return e.setIcon(de(ge));e.setOptions({strokeColor:"#4e9bff",fillColor:"#4e9bff"})}function vt(e){if(e instanceof google.maps.Marker)return e.setIcon(de(Se));e.setOptions({strokeColor:"#F18b62",fillColor:"#F18b62"})}const Ct=()=>{var p;const{getCollectionJoinField:e}=r.useCollectionManager_deprecated(),{getField:o}=r.useCollection_deprecated(),{form:t}=r.useFormBlockContext(),n=z.useField(),l=z.useFieldSchema(),{t:a}=Y(),{dn:c,refresh:g}=r.useDesignable(),A=o(l.name)||e(l["x-collection-field"]),v=(p=A==null?void 0:A.uiSchema)==null?void 0:p.title;n.title===v||n.title,n.readPretty||n.required;let b="editable";return l["x-disabled"]===!0&&(b="readonly"),l["x-read-pretty"]===!0&&(b="read-pretty"),i.jsxs(r.GeneralSchemaDesigner,{children:[i.jsx(r.GeneralSchemaItems,{}),t&&!(t!=null&&t.readPretty)&&!r.isPatternDisabled(l)&&i.jsx(r.SchemaSettingsSelectItem,{title:a("Pattern"),options:[{label:a("Editable"),value:"editable"},{label:a("Readonly"),value:"readonly"},{label:a("Easy-reading"),value:"read-pretty"}],value:b,onChange:y=>{const d={"x-uid":l["x-uid"]};switch(y){case"readonly":{l["x-read-pretty"]=!1,l["x-disabled"]=!0,d["x-read-pretty"]=!1,d["x-disabled"]=!0,n.readPretty=!1,n.disabled=!0;break}case"read-pretty":{l["x-read-pretty"]=!0,l["x-disabled"]=!1,d["x-read-pretty"]=!0,d["x-disabled"]=!1,n.readPretty=!0;break}default:{l["x-read-pretty"]=!1,l["x-disabled"]=!1,d["x-read-pretty"]=!1,d["x-disabled"]=!1,n.readPretty=!1,n.disabled=!1;break}}c.emit("patch",{schema:d}),c.refresh()}},"pattern"),i.jsx(r.SchemaSettingsModalItem,{title:a("Set default zoom level"),schema:{type:"object",title:a("Set default zoom level"),properties:{zoom:{title:a("Zoom"),default:n.componentProps.zoom||13,description:a("The default zoom level of the map"),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0}}}},onSubmit:({zoom:y})=>{y&&(me.set(l,"x-component-props.zoom",y),Object.assign(n.componentProps,l["x-component-props"]),c.emit("patch",{schema:{"x-uid":l["x-uid"],"x-component-props":n.componentProps}})),c.refresh()}},"map-zoom"),i.jsx(r.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,confirm:{title:a("Delete field")},breakRemoveOn:{"x-component":"Grid"}},"remove")]})},St={amap:ke,google:Fe},Oe=h.forwardRef((e,o)=>{const{t}=Y(),{mapType:n}=e,l=h.useMemo(()=>St[n],[n]);return l?i.jsx(l,O({ref:o},e)):i.jsx("div",{children:t(`The ${n} cannot found`)})});Oe.displayName="MapComponent";const xt=e=>{var A,v;const{value:o}=e,t=z.useFieldSchema(),l=r.useCollection().getField(t.name),a=e.mapType||((A=l==null?void 0:l.uiSchema["x-component-props"])==null?void 0:A.mapType),c=z.useForm(),g=z.useField();return r.useFieldTitle(),!c.readPretty||g.readPretty?i.jsx("div",{children:i.jsx(r.EllipsisWithTooltip,{ellipsis:!0,children:(v=o==null?void 0:o.map)==null?void 0:v.call(o,b=>Array.isArray(b)?`(${b.join(",")})`:b).join(",")})}):i.jsx(Oe,O({readonly:!0,mapType:a},e))},We=z.connect(e=>i.jsx("div",{className:r.css`
115
115
  height: 100%;
116
116
  border: 1px solid transparent;
117
117
  .ant-formily-item-error & {
118
118
  border: 1px solid #ff4d4f;
119
119
  }
120
- `,children:i.jsx(Oe,k({},e))}),z.mapReadPretty(xt));We.Designer=Ct;const wt={amap:at,google:At},Pt=e=>{const{t:o}=W(),{mapType:t}=e,n=h.useMemo(()=>wt[t],[t]);return n?i.jsx(r.PopupContextProvider,{children:i.jsx(n,k({},e))}):i.jsx("div",{children:o(`The ${t} cannot found`)})},It=r.withDynamicSchemaProps(e=>{var g,A;const{context:o}=r.usePopupUtils();if(o.currentLevel&&!me.isNil((g=o.params)==null?void 0:g.filterbytk))return i.jsx(r.PopupContextProvider,{children:i.jsx(xe,{})});const{fieldNames:t}=r.useProps(e),{getCollectionJoinField:n}=r.useCollectionManager_deprecated(),{name:l}=r.useCollection_deprecated(),a=h.useMemo(()=>n([l,t==null?void 0:t.field].flat().join(".")),[l,t==null?void 0:t.field]),c=(A=a==null?void 0:a.uiSchema)==null?void 0:A["x-component-props"];return i.jsx(Pt,V(k(k({},c),e),{collectionField:a}))}),kt=()=>{const{name:e,title:o}=r.useCollection(),t=r.useSchemaTemplate();return i.jsx(r.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},Ft=e=>{const{collectionName:o,fieldNames:t,dataSource:n}=e;return{type:"void","x-acl-action":`${o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":{collection:o,dataSource:n,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":{}},[tt.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Container","x-component-props":{className:"nb-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"}}}}}}}}}}}},Ye=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,n,l)=>{const a=t==null?void 0:t.find(c=>c.value===n);return l===e.length-1?a:a==null?void 0:a.children},o)),Ot=()=>{const e=r.useSchemaInitializerItem(),{insert:o}=r.useSchemaInitializer(),t=h.useContext(z.SchemaOptionsContext),{getCollectionFieldsOptions:n}=r.useCollectionManager_deprecated(),{t:l}=W(),{theme:a}=r.useGlobalTheme();return i.jsx(r.DataBlockInitializer,k({componentType:"Map",icon:i.jsx(ee.TableOutlined,{}),onCreateBlockSchema:g=>Ce(this,[g],function*({item:c}){const A=n(c.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:c.dataSource}),v=n(c.name,"string",{dataSource:c.dataSource}),b=yield r.FormDialog(l("Create map block"),()=>{var p;return i.jsx(r.SchemaComponentOptions,{scope:t.scope,components:k({},t.components),children:i.jsx(et.FormLayout,{layout:"vertical",children:i.jsx(r.SchemaComponent,{schema:{properties:{field:{title:l("Map field"),enum:A,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:A.length?[A[0].value,(p=A[0].children)==null?void 0:p[0].value].filter(y=>y!=null):[]},marker:{title:l("Marker field"),enum:v,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const d=y.form.values.field;if(!(d!=null&&d.length))return;const f=Ye(d,A);f&&(y.hidden=f.type!=="point")}}}}})})})},a).open({initialValues:{}});o(Ft({collectionName:c.name,dataSource:c.dataSource,fieldNames:k({},b)}))}),title:l("Map block")},e))},Ee=h.createContext({});Ee.displayName="MapBlockContext";const Et=e=>{var v;const{fieldNames:o}=e,t=z.useFieldSchema(),n=z.useField(),{resource:l,service:a}=r.useBlockRequestContext(),[c,g]=h.useState([]),{token:A}=x.theme.useToken();return i.jsx(r.FixedBlockWrapper,{children:i.jsx(r.SchemaComponentOptions,{scope:{selectedRecordKeys:c},children:i.jsxs(Ee.Provider,{value:{field:n,service:a,resource:l,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:c,setSelectedRecordKeys:g},children:[" ",i.jsx("div",{className:ot.css`
120
+ `,children:i.jsx(Oe,O({},e))}),z.mapReadPretty(xt));We.Designer=Ct;const wt={amap:at,google:At},Pt=e=>{const{t:o}=Y(),{mapType:t}=e,n=h.useMemo(()=>wt[t],[t]);return n?i.jsx(r.PopupContextProvider,{children:i.jsx(n,O({},e))}):i.jsx("div",{children:o(`The ${t} cannot found`)})},It=r.withDynamicSchemaProps(e=>{var g,A;const{context:o}=r.usePopupUtils();if(o.currentLevel&&!me.isNil((g=o.params)==null?void 0:g.filterbytk))return i.jsx(r.PopupContextProvider,{children:i.jsx(xe,{})});const{fieldNames:t}=r.useProps(e),{getCollectionJoinField:n}=r.useCollectionManager_deprecated(),{name:l}=r.useCollection_deprecated(),a=h.useMemo(()=>n([l,t==null?void 0:t.field].flat().join(".")),[l,t==null?void 0:t.field]),c=(A=a==null?void 0:a.uiSchema)==null?void 0:A["x-component-props"];return i.jsx(Pt,W(O(O({},c),e),{collectionField:a}))}),kt=()=>{const{name:e,title:o}=r.useCollection(),t=r.useSchemaTemplate();return i.jsx(r.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},Ft=e=>{const{collectionName:o,fieldNames:t,dataSource:n}=e;return{type:"void","x-acl-action":`${o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":{collection:o,dataSource:n,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":{}},[tt.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Container","x-component-props":{className:"nb-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"}}}}}}}}}}}},Ye=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,n,l)=>{const a=t==null?void 0:t.find(c=>c.value===n);return l===e.length-1?a:a==null?void 0:a.children},o)),Ot=()=>{const e=r.useSchemaInitializerItem(),{insert:o}=r.useSchemaInitializer(),t=h.useContext(z.SchemaOptionsContext),{getCollectionFieldsOptions:n}=r.useCollectionManager_deprecated(),{t:l}=Y(),{theme:a}=r.useGlobalTheme();return i.jsx(r.DataBlockInitializer,O({componentType:"Map",icon:i.jsx(ee.TableOutlined,{}),onCreateBlockSchema:g=>Ce(this,[g],function*({item:c}){const A=n(c.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:c.dataSource}),v=n(c.name,"string",{dataSource:c.dataSource}),b=yield r.FormDialog(l("Create map block"),()=>{var p;return i.jsx(r.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:i.jsx(et.FormLayout,{layout:"vertical",children:i.jsx(r.SchemaComponent,{schema:{properties:{field:{title:l("Map field"),enum:A,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:A.length?[A[0].value,(p=A[0].children)==null?void 0:p[0].value].filter(y=>y!=null):[]},marker:{title:l("Marker field"),enum:v,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const d=y.form.values.field;if(!(d!=null&&d.length))return;const f=Ye(d,A);f&&(y.hidden=f.type!=="point")}}}}})})})},a).open({initialValues:{}});o(Ft({collectionName:c.name,dataSource:c.dataSource,fieldNames:O({},b)}))}),title:l("Map block")},e))},Ee=h.createContext({});Ee.displayName="MapBlockContext";const Et=e=>{var v;const{fieldNames:o}=e,t=z.useFieldSchema(),n=z.useField(),{resource:l,service:a}=r.useBlockRequestContext(),[c,g]=h.useState([]),{token:A}=x.theme.useToken();return i.jsx(r.FixedBlockWrapper,{children:i.jsx(r.SchemaComponentOptions,{scope:{selectedRecordKeys:c},children:i.jsxs(Ee.Provider,{value:{field:n,service:a,resource:l,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:c,setSelectedRecordKeys:g},children:[" ",i.jsx("div",{className:ot.css`
121
121
  .nb-action-bar {
122
122
  margin-bottom: ${A.margin}px;
123
123
  }
124
- `,children:e.children})]})})})},Lt=e=>{const{filter:o,parseVariableLoading:t}=r.useParsedFilter({filterOption:e==null?void 0:e.filter});return{params:V(k({},e),{filter:o}),parseVariableLoading:t}},Dt=e=>{const o=z.useField(),{fieldNames:t}=e,{params:n,parseVariableLoading:l}=Lt(e.params);if(l)return null;const a=n.appends||[],{field:c}=t||{};return Array.isArray(c)&&c.length>1&&a.push(c[0]),i.jsx(r.BlockProvider,V(k({name:"map"},e),{runWhenParamsChanged:!0,params:V(k({},n),{appends:a,paginate:!1,sort:o.componentProps.lineSort}),children:i.jsx(Et,k({},e))}))},Ae=()=>h.useContext(Ee),He=()=>{var o,t,n,l,a,c;const e=Ae();return V(k({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((l=(n=e==null?void 0:e.field)==null?void 0:n.componentProps)==null?void 0:l.zoom)||13,lineSort:(c=(a=e==null?void 0:e.field)==null?void 0:a.componentProps)==null?void 0:c.lineSort})},Tt=e=>i.jsx(r.SchemaComponentOptions,{scope:{useMapBlockProps:He},components:{MapBlockInitializer:Ot,MapBlockDesigner:kt,MapBlockProvider:Dt,MapBlock:It},children:e.children}),Je={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{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:()=>r.useActionAvailable("create")},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",schema:{"x-action":"customize:table:request:global"}}]},Ze=new r.CompatibleSchemaInitializer(k({name:"MapActionInitializers"},Je)),zt=new r.CompatibleSchemaInitializer(k({name:"map:configureActions"},Je),Ze),Xe={name:"defaultZoomLevel",Component:r.SchemaSettingsModalItem,useComponentProps(){var a;const{t:e}=W(),o=z.useFieldSchema(),t=z.useField(),{dn:n}=r.useDesignable(),l=((a=o==null?void 0:o["x-component-props"])==null?void 0:a.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:l,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:c})=>{me.set(o,"x-component-props.zoom",c),t.componentProps.zoom=c,n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}}),n.refresh()}}},useVisible(){const{fieldSchema:e}=r.useColumnSchema();return!e}},Bt=new r.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:r.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:r.SchemaSettingsBlockHeightItem},{name:"mapField",Component:r.SchemaSettingsCascaderItem,useComponentProps(){var v;const{getCollectionFieldsOptions:e}=r.useCollectionManager_deprecated(),{t:o}=W(),t=z.useFieldSchema(),n=((v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fieldNames)||{},l=z.useField(),{dn:a}=r.useDesignable(),{service:c}=Ae(),{name:g}=r.useCollection(),A=e(g,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:n.field,options:A,allowClear:!1,onChange:b=>{const p=l.decoratorProps.fieldNames||{};p.field=b,l.decoratorProps.fieldNames=p,t["x-decorator-props"].fieldNames=p,c.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":l.decoratorProps}}),a.refresh()}}}},{name:"markerField",Component:r.SchemaSettingsSelectItem,useComponentProps(){var v;const{t:e}=W(),o=z.useFieldSchema(),t=((v=o==null?void 0:o["x-decorator-props"])==null?void 0:v.fieldNames)||{},{service:n}=Ae(),l=z.useField(),{dn:a}=r.useDesignable(),{getCollectionFieldsOptions:c}=r.useCollectionManager_deprecated(),{name:g}=r.useCollection(),A=c(g,"string");return{title:e("Marker field"),value:t.marker,options:A,onChange:b=>{const p=l.decoratorProps.fieldNames||{};p.marker=b,l.decoratorProps.fieldNames=p,o["x-decorator-props"].fieldNames=p,n.refresh(),a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":l.decoratorProps}}),a.refresh()}}},useVisible(){var c,g;const e=z.useFieldSchema(),{getCollectionFieldsOptions:o}=r.useCollectionManager_deprecated(),{name:t}=r.useCollection(),n=((c=e==null?void 0:e["x-decorator-props"])==null?void 0:c.fieldNames)||{},l=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((g=Ye(n.field,l))==null?void 0:g.type)==="point"}},{name:"setDefaultSortingRules",Component:r.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=W();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},r.setDataLoadingModeSettingsItem,Xe,{name:"dataScope",Component:r.SchemaSettingsDataScope,useComponentProps(){var c,g;const{name:e}=r.useCollection(),o=z.useFieldSchema(),{form:t}=r.useFormBlockContext(),n=z.useField(),{service:l}=Ae(),{dn:a}=r.useDesignable();return{collectionName:e,defaultFilter:((g=(c=o==null?void 0:o["x-decorator-props"])==null?void 0:c.params)==null?void 0:g.filter)||{},form:t,onSubmit:({filter:A})=>{var b,p;const v=n.decoratorProps.params||{};v.filter=A,n.decoratorProps.params=v,o["x-decorator-props"].params=v,(p=(b=l.params)==null?void 0:b[1])!=null&&p.filters,a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:r.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=W();return{type:r.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:r.SchemaSettingsTemplate,useComponentProps(){var l,a;const{name:e}=r.useCollection(),o=z.useFieldSchema(),{componentNamePrefix:t}=r.useBlockTemplateContext(),n=((l=o==null?void 0:o["x-decorator-props"])==null?void 0:l.resource)||((a=o==null?void 0:o["x-decorator-props"])==null?void 0:a.association);return{componentName:`${t}Map`,collectionName:e,resourceName:n}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:Ut}=r.interfacesProperties;Array.isArray(r.interfacesProperties.type.enum)&&r.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class ve extends r.CollectionFieldInterface{constructor(){super(...arguments);O(this,"properties",V(k({},Ut),{"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:Te}}))}schemaInitialize(t,{block:n}){n==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Kt extends ve{constructor(){super(...arguments);O(this,"name","circle");O(this,"type","object");O(this,"group","map");O(this,"order",3);O(this,"title",X("Circle"));O(this,"availableTypes",["circle","json"]);O(this,"description",X("Circle"));O(this,"sortable",!0);O(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Nt extends ve{constructor(){super(...arguments);O(this,"name","lineString");O(this,"type","object");O(this,"group","map");O(this,"order",2);O(this,"title",X("Line"));O(this,"description",X("Line"));O(this,"availableTypes",["lineString","json"]);O(this,"sortable",!0);O(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Gt extends ve{constructor(){super(...arguments);O(this,"name","point");O(this,"type","object");O(this,"group","map");O(this,"order",1);O(this,"title",X("Point"));O(this,"description",X("Point"));O(this,"availableTypes",["point","json"]);O(this,"sortable",!0);O(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class jt extends ve{constructor(){super(...arguments);O(this,"name","polygon");O(this,"type","object");O(this,"group","map");O(this,"order",4);O(this,"title",X("Polygon"));O(this,"description",X("Polygon"));O(this,"availableTypes",["polygon","json"]);O(this,"sortable",!0);O(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const qt=[Gt,jt,Nt,Kt],_t=new r.SchemaSettings({name:"fieldSettings:component:Map",items:[Xe]}),Qe=h.memo(e=>i.jsx(r.SchemaComponentOptions,{components:{Map:We},children:i.jsx(Tt,{children:e.children})}));Qe.displayName="MapProvider";class $e extends r.Plugin{load(){return Ce(this,null,function*(){this.app.use(Qe),this.app.dataSourceManager.addFieldInterfaces(qt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:X("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(Ze),this.app.schemaInitializerManager.add(zt),this.schemaSettingsManager.add(Bt),this.schemaSettingsManager.add(_t);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:X("Map"),Component:"MapBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","dataBlocks.map",{title:X("Map"),Component:"MapBlockInitializer"}),this.app.pluginSettingsManager.add(be,{title:`{{t("Map Manager", { ns: "${be}" })}}`,icon:"EnvironmentOutlined",Component:ut,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:He})})}}D.PluginMapClient=$e,D.default=$e,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
124
+ `,children:e.children})]})})})},Lt=e=>{const{filter:o,parseVariableLoading:t}=r.useParsedFilter({filterOption:e==null?void 0:e.filter});return{params:W(O({},e),{filter:o}),parseVariableLoading:t}},Dt=e=>{const o=z.useField(),{fieldNames:t}=e,{params:n,parseVariableLoading:l}=Lt(e.params);if(l)return null;const a=n.appends||[],{field:c}=t||{};return Array.isArray(c)&&c.length>1&&a.push(c[0]),i.jsx(r.BlockProvider,W(O({name:"map"},e),{runWhenParamsChanged:!0,params:W(O({},n),{appends:a,paginate:!1,sort:o.componentProps.lineSort}),children:i.jsx(Et,O({},e))}))},Ae=()=>h.useContext(Ee),He=()=>{var o,t,n,l,a,c;const e=Ae();return W(O({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((l=(n=e==null?void 0:e.field)==null?void 0:n.componentProps)==null?void 0:l.zoom)||13,lineSort:(c=(a=e==null?void 0:e.field)==null?void 0:a.componentProps)==null?void 0:c.lineSort})},Tt=e=>i.jsx(r.SchemaComponentOptions,{scope:{useMapBlockProps:He},components:{MapBlockInitializer:Ot,MapBlockDesigner:kt,MapBlockProvider:Dt,MapBlock:It},children:e.children}),Je={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{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:()=>r.useActionAvailable("create")},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"customRequest",title:'{{t("Custom request")}}',Component:"CustomRequestInitializer",schema:{"x-action":"customize:table:request:global"}}]},Ze=new r.CompatibleSchemaInitializer(O({name:"MapActionInitializers"},Je)),zt=new r.CompatibleSchemaInitializer(O({name:"map:configureActions"},Je),Ze),Xe={name:"defaultZoomLevel",Component:r.SchemaSettingsModalItem,useComponentProps(){var a;const{t:e}=Y(),o=z.useFieldSchema(),t=z.useField(),{dn:n}=r.useDesignable(),l=((a=o==null?void 0:o["x-component-props"])==null?void 0:a.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:l,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:c})=>{me.set(o,"x-component-props.zoom",c),t.componentProps.zoom=c,n.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":o["x-component-props"]}}),n.refresh()}}},useVisible(){const{fieldSchema:e}=r.useColumnSchema();return!e}},Bt=new r.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:r.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:r.SchemaSettingsBlockHeightItem},{name:"mapField",Component:r.SchemaSettingsCascaderItem,useComponentProps(){var v;const{getCollectionFieldsOptions:e}=r.useCollectionManager_deprecated(),{t:o}=Y(),t=z.useFieldSchema(),n=((v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fieldNames)||{},l=z.useField(),{dn:a}=r.useDesignable(),{service:c}=Ae(),{name:g}=r.useCollection(),A=e(g,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:n.field,options:A,allowClear:!1,onChange:b=>{const p=l.decoratorProps.fieldNames||{};p.field=b,l.decoratorProps.fieldNames=p,t["x-decorator-props"].fieldNames=p,c.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":l.decoratorProps}}),a.refresh()}}}},{name:"markerField",Component:r.SchemaSettingsSelectItem,useComponentProps(){var v;const{t:e}=Y(),o=z.useFieldSchema(),t=((v=o==null?void 0:o["x-decorator-props"])==null?void 0:v.fieldNames)||{},{service:n}=Ae(),l=z.useField(),{dn:a}=r.useDesignable(),{getCollectionFieldsOptions:c}=r.useCollectionManager_deprecated(),{name:g}=r.useCollection(),A=c(g,"string");return{title:e("Marker field"),value:t.marker,options:A,onChange:b=>{const p=l.decoratorProps.fieldNames||{};p.marker=b,l.decoratorProps.fieldNames=p,o["x-decorator-props"].fieldNames=p,n.refresh(),a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":l.decoratorProps}}),a.refresh()}}},useVisible(){var c,g;const e=z.useFieldSchema(),{getCollectionFieldsOptions:o}=r.useCollectionManager_deprecated(),{name:t}=r.useCollection(),n=((c=e==null?void 0:e["x-decorator-props"])==null?void 0:c.fieldNames)||{},l=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((g=Ye(n.field,l))==null?void 0:g.type)==="point"}},{name:"setDefaultSortingRules",Component:r.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Y();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},r.setDataLoadingModeSettingsItem,Xe,{name:"dataScope",Component:r.SchemaSettingsDataScope,useComponentProps(){var c,g;const{name:e}=r.useCollection(),o=z.useFieldSchema(),{form:t}=r.useFormBlockContext(),n=z.useField(),{service:l}=Ae(),{dn:a}=r.useDesignable();return{collectionName:e,defaultFilter:((g=(c=o==null?void 0:o["x-decorator-props"])==null?void 0:c.params)==null?void 0:g.filter)||{},form:t,onSubmit:({filter:A})=>{var b,p;const v=n.decoratorProps.params||{};v.filter=A,n.decoratorProps.params=v,o["x-decorator-props"].params=v,(p=(b=l.params)==null?void 0:b[1])!=null&&p.filters,a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:r.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=Y();return{type:r.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:r.SchemaSettingsTemplate,useComponentProps(){var l,a;const{name:e}=r.useCollection(),o=z.useFieldSchema(),{componentNamePrefix:t}=r.useBlockTemplateContext(),n=((l=o==null?void 0:o["x-decorator-props"])==null?void 0:l.resource)||((a=o==null?void 0:o["x-decorator-props"])==null?void 0:a.association);return{componentName:`${t}Map`,collectionName:e,resourceName:n}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:Ut}=r.interfacesProperties;Array.isArray(r.interfacesProperties.type.enum)&&r.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class ve extends r.CollectionFieldInterface{constructor(){super(...arguments);E(this,"properties",W(O({},Ut),{"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:Te}}))}schemaInitialize(t,{block:n}){n==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Kt extends ve{constructor(){super(...arguments);E(this,"name","circle");E(this,"type","object");E(this,"group","map");E(this,"order",3);E(this,"title",X("Circle"));E(this,"availableTypes",["circle","json"]);E(this,"description",X("Circle"));E(this,"sortable",!0);E(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Nt extends ve{constructor(){super(...arguments);E(this,"name","lineString");E(this,"type","object");E(this,"group","map");E(this,"order",2);E(this,"title",X("Line"));E(this,"description",X("Line"));E(this,"availableTypes",["lineString","json"]);E(this,"sortable",!0);E(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Gt extends ve{constructor(){super(...arguments);E(this,"name","point");E(this,"type","object");E(this,"group","map");E(this,"order",1);E(this,"title",X("Point"));E(this,"description",X("Point"));E(this,"availableTypes",["point","json"]);E(this,"sortable",!0);E(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class jt extends ve{constructor(){super(...arguments);E(this,"name","polygon");E(this,"type","object");E(this,"group","map");E(this,"order",4);E(this,"title",X("Polygon"));E(this,"description",X("Polygon"));E(this,"availableTypes",["polygon","json"]);E(this,"sortable",!0);E(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const qt=[Gt,jt,Nt,Kt],_t=new r.SchemaSettings({name:"fieldSettings:component:Map",items:[Xe]}),Qe=h.memo(e=>i.jsx(r.SchemaComponentOptions,{components:{Map:We},children:i.jsx(Tt,{children:e.children})}));Qe.displayName="MapProvider";class $e extends r.Plugin{load(){return Ce(this,null,function*(){this.app.use(Qe),this.app.dataSourceManager.addFieldInterfaces(qt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:X("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(Ze),this.app.schemaInitializerManager.add(zt),this.schemaSettingsManager.add(Bt),this.schemaSettingsManager.add(_t);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:X("Map"),Component:"MapBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","dataBlocks.map",{title:X("Map"),Component:"MapBlockInitializer"}),this.app.pluginSettingsManager.add(be,{title:`{{t("Map Manager", { ns: "${be}" })}}`,icon:"EnvironmentOutlined",Component:ut,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:He})})}}D.PluginMapClient=$e,D.default=$e,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,10 +8,10 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.4.0-beta.7",
11
+ "@nocobase/client": "1.4.0-beta.8",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "1.4.0-beta.7",
14
- "@nocobase/test": "1.4.0-beta.7",
13
+ "@nocobase/server": "1.4.0-beta.8",
14
+ "@nocobase/test": "1.4.0-beta.8",
15
15
  "@formily/react": "2.3.0",
16
16
  "lodash": "4.17.21",
17
17
  "@ant-design/icons": "5.2.6",
@@ -22,6 +22,6 @@ module.exports = {
22
22
  "ahooks": "3.7.8",
23
23
  "@formily/core": "2.3.0",
24
24
  "react-i18next": "11.18.6",
25
- "@nocobase/actions": "1.4.0-beta.7",
26
- "@nocobase/database": "1.4.0-beta.7"
25
+ "@nocobase/actions": "1.4.0-beta.8",
26
+ "@nocobase/database": "1.4.0-beta.8"
27
27
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nocobase/plugin-map",
3
3
  "displayName": "Block: Map",
4
4
  "displayName.zh-CN": "区块:地图",
5
- "version": "1.4.0-beta.7",
5
+ "version": "1.4.0-beta.8",
6
6
  "description": "Map block, support Gaode map and Google map, you can also extend more map types.",
7
7
  "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
8
8
  "license": "AGPL-3.0",
@@ -36,7 +36,7 @@
36
36
  "@nocobase/test": "1.x",
37
37
  "@nocobase/utils": "1.x"
38
38
  },
39
- "gitHead": "8a518a9a0354e5e9ea5caa7c45779654fb517f0a",
39
+ "gitHead": "d6ca78c29506d611937583d79fab5dffbd17a6fc",
40
40
  "keywords": [
41
41
  "Blocks"
42
42
  ]