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