@nocobase/plugin-map 0.21.0-alpha.2 → 0.21.0-alpha.3

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.
@@ -108,4 +108,4 @@
108
108
  .ant-formily-item-error & {
109
109
  border: 1px solid #ff4d4f;
110
110
  }
111
- `,children:s.jsx(Se,O({},e))}),G.mapReadPretty(yt));Ue.Designer=gt;const bt={amap:$e,google:dt},At=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`)})},vt=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(At,X(O(O({},i),e),{collectionField:a}))}),Mt=()=>{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)),Ct=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":"TabPaneInitializers",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock"}}}}}}}}}}}},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 A=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),x=r(l.name,"string",{dataSource:l.dataSource}),v=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:A,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:A.length?[A[0].value,(c=A[0].children)==null?void 0:c[0].value].filter(b=>b!=null):[]},marker:{title:a("Marker field"),enum:x,"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,A);d&&(b.hidden=d.type!=="point")}}}}})})})},i).open({initialValues:{}});o(Ct({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},v)}))}),title:a("Map block")},e))},we=h.createContext({});we.displayName="MapBlockContext";const St=e=>{var A;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:(A=t==null?void 0:t["x-decorator-props"])==null?void 0:A.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:Mt,MapBlockProvider:wt,MapBlock:vt},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 x;const{getCollectionFieldsOptions:e}=n.useCollectionManager_deprecated(),{t:o}=J(),t=G.useFieldSchema(),r=((x=t==null?void 0:t["x-decorator-props"])==null?void 0:x.fieldNames)||{},a=G.useField(),{dn:i}=n.useDesignable(),{service:l}=ge(),{name:m}=n.useCollection(),A=e(m,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:A,allowClear:!1,onChange:v=>{const c=a.decoratorProps.fieldNames||{};c.field=v,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 x;const{t:e}=J(),o=G.useFieldSchema(),t=((x=o==null?void 0:o["x-decorator-props"])==null?void 0:x.fieldNames)||{},{service:r}=ge(),a=G.useField(),{dn:i}=n.useDesignable(),{getCollectionFieldsOptions:l}=n.useCollectionManager_deprecated(),{name:m}=n.useCollection(),A=l(m,"string");return{title:e("Marker field"),value:t.marker,options:A,onChange:v=>{const c=a.decoratorProps.fieldNames||{};c.marker=v,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:A})=>{var v,c;const x=r.decoratorProps.params||{};x.filter=A,r.decoratorProps.params=x,o["x-decorator-props"].params=x,(c=(v=a.params)==null?void 0:v[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.MapPlugin=je,D.default=je,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
111
+ `,children:s.jsx(Se,O({},e))}),G.mapReadPretty(yt));Ue.Designer=gt;const bt={amap:$e,google:dt},At=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`)})},vt=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(At,X(O(O({},i),e),{collectionField:a}))}),Mt=()=>{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)),Ct=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 A=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),x=r(l.name,"string",{dataSource:l.dataSource}),v=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:A,required:!0,"x-component":"Cascader","x-decorator":"FormItem",default:A.length?[A[0].value,(c=A[0].children)==null?void 0:c[0].value].filter(b=>b!=null):[]},marker:{title:a("Marker field"),enum:x,"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,A);d&&(b.hidden=d.type!=="point")}}}}})})})},i).open({initialValues:{}});o(Ct({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},v)}))}),title:a("Map block")},e))},we=h.createContext({});we.displayName="MapBlockContext";const St=e=>{var A;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:(A=t==null?void 0:t["x-decorator-props"])==null?void 0:A.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:Mt,MapBlockProvider:wt,MapBlock:vt},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 x;const{getCollectionFieldsOptions:e}=n.useCollectionManager_deprecated(),{t:o}=J(),t=G.useFieldSchema(),r=((x=t==null?void 0:t["x-decorator-props"])==null?void 0:x.fieldNames)||{},a=G.useField(),{dn:i}=n.useDesignable(),{service:l}=ge(),{name:m}=n.useCollection(),A=e(m,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:A,allowClear:!1,onChange:v=>{const c=a.decoratorProps.fieldNames||{};c.field=v,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 x;const{t:e}=J(),o=G.useFieldSchema(),t=((x=o==null?void 0:o["x-decorator-props"])==null?void 0:x.fieldNames)||{},{service:r}=ge(),a=G.useField(),{dn:i}=n.useDesignable(),{getCollectionFieldsOptions:l}=n.useCollectionManager_deprecated(),{name:m}=n.useCollection(),A=l(m,"string");return{title:e("Marker field"),value:t.marker,options:A,onChange:v=>{const c=a.decoratorProps.fieldNames||{};c.marker=v,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:A})=>{var v,c;const x=r.decoratorProps.params||{};x.filter=A,r.decoratorProps.params=x,o["x-decorator-props"].params=x,(c=(v=a.params)==null?void 0:v[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.MapPlugin=je,D.default=je,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.21.0-alpha.2",
2
+ "@nocobase/client": "0.21.0-alpha.3",
3
3
  "react": "18.2.0",
4
- "@nocobase/server": "0.21.0-alpha.2",
4
+ "@nocobase/server": "0.21.0-alpha.3",
5
5
  "@formily/react": "2.3.0",
6
6
  "lodash": "4.17.21",
7
7
  "@ant-design/icons": "5.2.6",
@@ -12,6 +12,6 @@ module.exports = {
12
12
  "react-router-dom": "6.21.0",
13
13
  "@formily/core": "2.3.0",
14
14
  "react-i18next": "11.18.6",
15
- "@nocobase/actions": "0.21.0-alpha.2",
16
- "@nocobase/database": "0.21.0-alpha.2"
15
+ "@nocobase/actions": "0.21.0-alpha.3",
16
+ "@nocobase/database": "0.21.0-alpha.3"
17
17
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nocobase/plugin-map",
3
3
  "displayName": "Block: Map",
4
4
  "displayName.zh-CN": "区块:地图",
5
- "version": "0.21.0-alpha.2",
5
+ "version": "0.21.0-alpha.3",
6
6
  "description": "Map block, support Gaode map and Google map, you can also extend more map types.",
7
7
  "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
8
8
  "license": "AGPL-3.0",
@@ -36,7 +36,7 @@
36
36
  "@nocobase/test": "0.x",
37
37
  "@nocobase/utils": "0.x"
38
38
  },
39
- "gitHead": "90628f2e2da846208fb2d7966ddb4e467d187ffb",
39
+ "gitHead": "f7276aff14063a2cf825191a0c83aeacde05a912",
40
40
  "keywords": [
41
41
  "Blocks"
42
42
  ]