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