@nocobase/plugin-map 0.20.0-alpha.15 → 0.20.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -108,4 +108,4 @@
|
|
|
108
108
|
.ant-formily-item-error & {
|
|
109
109
|
border: 1px solid #ff4d4f;
|
|
110
110
|
}
|
|
111
|
-
`,children:s.jsx(we,O({},e))}),G.mapReadPretty(vt));Ne.Designer=yt;const At={amap:et,google:mt},Mt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>At[t],[t]);return r?s.jsx(r,O({},e)):s.jsx("div",{children:o(`The ${t} cannot found`)})},Ct=e=>{var l;const{fieldNames:o}=n.useProps(e),{getCollectionJoinField:t}=n.useCollectionManager_deprecated(),{name:r}=n.useCollection_deprecated(),a=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),i=(l=a==null?void 0:a.uiSchema)==null?void 0:l["x-component-props"];return s.jsx(Mt,J(O(O({},i),e),{collectionField:a}))},xt=()=>{const{name:e,title:o}=n.useCollection(),t=n.useSchemaTemplate();return s.jsx(n.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},St=e=>{const g=e,{collection:o,resource:t,fieldNames:r,settings:a}=g,i=Ye(g,["collection","resource","fieldNames","settings"]);return{type:"void","x-acl-action":`${t||o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":O({collection:o,resource:t||o,action:"list",fieldNames:r,params:{paginate:!1}},i),"x-toolbar":"BlockSchemaToolbar","x-settings":a,"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":"map:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},[Ze.uid()]:{type:"void","x-component":"MapBlock","x-component-props":{useProps:"{{ useMapBlockProps }}"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"nb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}}}}},Ge=(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)),wt=()=>{const e=n.useSchemaInitializerItem(),{insert:o}=n.useSchemaInitializer(),t=f.useContext(G.SchemaOptionsContext),{getCollectionFieldsOptions:r}=n.useCollectionManager_deprecated(),{t:a}=Z(),{theme:i}=n.useGlobalTheme();return s.jsx(n.DataBlockInitializer,O({componentType:"Map",icon:s.jsx(R.TableOutlined,{}),onCreateBlockSchema:g=>be(this,[g],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),x=r(l.name,"string",{dataSource:l.dataSource}),A=yield n.FormDialog(a("Create map block"),()=>{var c;return s.jsx(n.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:s.jsx(Je.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(y=>y!=null):[]},marker:{title:a("Marker field"),enum:x,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ge(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},i).open({initialValues:{}});o(St({collection:l.name,dataSource:l.dataSource,fieldNames:O({},A),settings:"blockSettings:map"}))}),title:a("Map block")},e))},Ie=f.createContext({});Ie.displayName="MapBlockContext";const It=e=>{var v;const{fieldNames:o}=e,t=G.useFieldSchema(),r=G.useField(),{resource:a,service:i}=n.useBlockRequestContext(),[l,g]=f.useState([]);return s.jsx(n.FixedBlockWrapper,{children:s.jsx(n.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:s.jsx(Ie.Provider,{value:{field:r,service:i,resource:a,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:g},children:e.children})})})},Pt=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,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:a,paginate:!1,sort:o.componentProps.lineSort}),children:s.jsx(It,O({},e))}))},ge=()=>f.useContext(Ie),kt=()=>{var o,t,r,a,i,l;const e=ge();return J(O({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((a=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:a.zoom)||13,lineSort:(l=(i=e==null?void 0:e.field)==null?void 0:i.componentProps)==null?void 0:l.lineSort})},Ft=e=>s.jsx(n.SchemaComponentOptions,{scope:{useMapBlockProps:kt},components:{MapBlockInitializer:wt,MapBlockDesigner:xt,MapBlockProvider:Pt,MapBlock:Ct},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"}}]}),Ot=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),Et=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}=Z(),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:g}=n.useCollection(),v=e(g,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:v,allowClear:!1,onChange:A=>{const c=a.decoratorProps.fieldNames||{};c.field=A,a.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"markerField",Component:n.SchemaSettingsSelectItem,useComponentProps(){var x;const{t:e}=Z(),o=G.useFieldSchema(),t=((x=o==null?void 0:o["x-decorator-props"])==null?void 0:x.fieldNames)||{},{service:r}=ge(),a=G.useField(),{dn:i}=n.useDesignable(),{getCollectionFieldsOptions:l}=n.useCollectionManager_deprecated(),{name:g}=n.useCollection(),v=l(g,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:A=>{const c=a.decoratorProps.fieldNames||{};c.marker=A,a.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}},useVisible(){var l,g;const e=G.useFieldSchema(),{getCollectionFieldsOptions:o}=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((g=Ge(r.field,a))==null?void 0:g.type)==="point"}},{name:"setDefaultSortingRules",Component:n.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},n.setDataLoadingModeSettingsItem,{name:"defaultZoomLevel",Component:n.SchemaSettingsModalItem,useComponentProps(){var i;const{t:e}=Z(),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})=>{Fe.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 g,v;const{name:e}=n.useCollection(),o=G.useFieldSchema(),{form:t}=n.useFormBlockContext(),r=G.useField(),{service:a}=ge(),{dn:i}=n.useDesignable(),l=n.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(g=o==null?void 0:o["x-decorator-props"])==null?void 0:g.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:x})=>{var y,p,d;const A=r.decoratorProps.params||{};A.filter=x,r.decoratorProps.params=A,o["x-decorator-props"].params=A;const c=((p=(y=a.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&a.run(J(O({},(d=a.params)==null?void 0:d[0]),{filter:n.mergeFilter([...Object.values(c),x]),page:1}),{filters:c}),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}=Z();return{type:n.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:n.SchemaSettingsTemplate,useComponentProps(){var r;const{name:e}=n.useCollection(),o=G.useFieldSchema(),t=(r=o==null?void 0:o["x-decorator-props"])==null?void 0:r.resource;return{componentName:"Map",collectionName:e,resourceName:t}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:Lt}=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);E(this,"properties",J(O({},Lt),{"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:Oe}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class zt extends he{constructor(){super(...arguments);E(this,"name","circle");E(this,"type","object");E(this,"group","map");E(this,"order",3);E(this,"title",Q("Circle"));E(this,"availableTypes",["circle"]);E(this,"description",Q("Circle"));E(this,"sortable",!0);E(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Dt extends he{constructor(){super(...arguments);E(this,"name","lineString");E(this,"type","object");E(this,"group","map");E(this,"order",2);E(this,"title",Q("Line"));E(this,"description",Q("Line"));E(this,"availableTypes",["lineString"]);E(this,"sortable",!0);E(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Tt extends he{constructor(){super(...arguments);E(this,"name","point");E(this,"type","object");E(this,"group","map");E(this,"order",1);E(this,"title",Q("Point"));E(this,"description",Q("Point"));E(this,"availableTypes",["point"]);E(this,"sortable",!0);E(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Bt extends he{constructor(){super(...arguments);E(this,"name","polygon");E(this,"type","object");E(this,"group","map");E(this,"order",4);E(this,"title",Q("Polygon"));E(this,"description",Q("Polygon"));E(this,"availableTypes",["polygon"]);E(this,"sortable",!0);E(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const Kt=[Tt,Bt,Dt,zt],_e=f.memo(e=>s.jsx(n.CurrentAppInfoProvider,{children:s.jsx(n.SchemaComponentOptions,{components:{Map:Ne},children:s.jsx(Ft,{children:e.children})})}));_e.displayName="MapProvider";class je extends n.Plugin{load(){return be(this,null,function*(){this.app.use(_e),this.app.dataSourceManager.addFieldInterfaces(Kt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:Q("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(qe),this.app.schemaInitializerManager.add(Ot),this.schemaSettingsManager.add(Et);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:st,aclSnippet:"pm.map.configuration"})})}}P.MapPlugin=je,P.default=je,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
111
|
+
`,children:s.jsx(we,O({},e))}),G.mapReadPretty(vt));Ne.Designer=yt;const At={amap:et,google:mt},Mt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>At[t],[t]);return r?s.jsx(r,O({},e)):s.jsx("div",{children:o(`The ${t} cannot found`)})},Ct=e=>{var l;const{fieldNames:o}=n.useProps(e),{getCollectionJoinField:t}=n.useCollectionManager_deprecated(),{name:r}=n.useCollection_deprecated(),a=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),i=(l=a==null?void 0:a.uiSchema)==null?void 0:l["x-component-props"];return s.jsx(Mt,J(O(O({},i),e),{collectionField:a}))},xt=()=>{const{name:e,title:o}=n.useCollection(),t=n.useSchemaTemplate();return s.jsx(n.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},St=e=>{const g=e,{collection:o,resource:t,fieldNames:r,settings:a}=g,i=Ye(g,["collection","resource","fieldNames","settings"]);return{type:"void","x-acl-action":`${t||o}:list`,"x-decorator":"MapBlockProvider","x-decorator-props":O({collection:o,resource:t||o,action:"list",fieldNames:r,params:{paginate:!1}},i),"x-toolbar":"BlockSchemaToolbar","x-settings":a,"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-initializer":"map:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},[Ze.uid()]:{type:"void","x-component":"MapBlock","x-component-props":{useProps:"{{ useMapBlockProps }}"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"nb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}}}}},Ge=(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)),wt=()=>{const e=n.useSchemaInitializerItem(),{insert:o}=n.useSchemaInitializer(),t=f.useContext(G.SchemaOptionsContext),{getCollectionFieldsOptions:r}=n.useCollectionManager_deprecated(),{t:a}=Z(),{theme:i}=n.useGlobalTheme();return s.jsx(n.DataBlockInitializer,O({componentType:"Map",icon:s.jsx(R.TableOutlined,{}),onCreateBlockSchema:g=>be(this,[g],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),x=r(l.name,"string",{dataSource:l.dataSource}),A=yield n.FormDialog(a("Create map block"),()=>{var c;return s.jsx(n.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:s.jsx(Je.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(y=>y!=null):[]},marker:{title:a("Marker field"),enum:x,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ge(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},i).open({initialValues:{}});o(St({collection:l.name,dataSource:l.dataSource,fieldNames:O({},A),settings:"blockSettings:map"}))}),title:a("Map block")},e))},Ie=f.createContext({});Ie.displayName="MapBlockContext";const It=e=>{var v;const{fieldNames:o}=e,t=G.useFieldSchema(),r=G.useField(),{resource:a,service:i}=n.useBlockRequestContext(),[l,g]=f.useState([]);return s.jsx(n.FixedBlockWrapper,{children:s.jsx(n.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:s.jsx(Ie.Provider,{value:{field:r,service:i,resource:a,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:g},children:e.children})})})},Pt=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,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:a,paginate:!1,sort:o.componentProps.lineSort}),children:s.jsx(It,O({},e))}))},ge=()=>f.useContext(Ie),kt=()=>{var o,t,r,a,i,l;const e=ge();return J(O({},e),{dataSource:(t=(o=e==null?void 0:e.service)==null?void 0:o.data)==null?void 0:t.data,zoom:((a=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:a.zoom)||13,lineSort:(l=(i=e==null?void 0:e.field)==null?void 0:i.componentProps)==null?void 0:l.lineSort})},Ft=e=>s.jsx(n.SchemaComponentOptions,{scope:{useMapBlockProps:kt},components:{MapBlockInitializer:wt,MapBlockDesigner:xt,MapBlockProvider:Pt,MapBlock:Ct},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"}}]}),Ot=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),Et=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}=Z(),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:g}=n.useCollection(),v=e(g,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return{title:o("Map field"),value:r.field,options:v,allowClear:!1,onChange:A=>{const c=a.decoratorProps.fieldNames||{};c.field=A,a.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"markerField",Component:n.SchemaSettingsSelectItem,useComponentProps(){var x;const{t:e}=Z(),o=G.useFieldSchema(),t=((x=o==null?void 0:o["x-decorator-props"])==null?void 0:x.fieldNames)||{},{service:r}=ge(),a=G.useField(),{dn:i}=n.useDesignable(),{getCollectionFieldsOptions:l}=n.useCollectionManager_deprecated(),{name:g}=n.useCollection(),v=l(g,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:A=>{const c=a.decoratorProps.fieldNames||{};c.marker=A,a.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}},useVisible(){var l,g;const e=G.useFieldSchema(),{getCollectionFieldsOptions:o}=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((g=Ge(r.field,a))==null?void 0:g.type)==="point"}},{name:"setDefaultSortingRules",Component:n.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},n.setDataLoadingModeSettingsItem,{name:"defaultZoomLevel",Component:n.SchemaSettingsModalItem,useComponentProps(){var i;const{t:e}=Z(),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})=>{Fe.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 g,v;const{name:e}=n.useCollection(),o=G.useFieldSchema(),{form:t}=n.useFormBlockContext(),r=G.useField(),{service:a}=ge(),{dn:i}=n.useDesignable(),l=n.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(g=o==null?void 0:o["x-decorator-props"])==null?void 0:g.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:x})=>{var y,p,d;const A=r.decoratorProps.params||{};A.filter=x,r.decoratorProps.params=A,o["x-decorator-props"].params=A;const c=((p=(y=a.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&a.run(J(O({},(d=a.params)==null?void 0:d[0]),{filter:n.mergeFilter([...Object.values(c),x]),page:1}),{filters:c}),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}=Z();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:Lt}=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);E(this,"properties",J(O({},Lt),{"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:Oe}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class zt extends he{constructor(){super(...arguments);E(this,"name","circle");E(this,"type","object");E(this,"group","map");E(this,"order",3);E(this,"title",Q("Circle"));E(this,"availableTypes",["circle"]);E(this,"description",Q("Circle"));E(this,"sortable",!0);E(this,"default",{type:"circle",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Dt extends he{constructor(){super(...arguments);E(this,"name","lineString");E(this,"type","object");E(this,"group","map");E(this,"order",2);E(this,"title",Q("Line"));E(this,"description",Q("Line"));E(this,"availableTypes",["lineString"]);E(this,"sortable",!0);E(this,"default",{type:"lineString",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Tt extends he{constructor(){super(...arguments);E(this,"name","point");E(this,"type","object");E(this,"group","map");E(this,"order",1);E(this,"title",Q("Point"));E(this,"description",Q("Point"));E(this,"availableTypes",["point"]);E(this,"sortable",!0);E(this,"default",{type:"point",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}class Bt extends he{constructor(){super(...arguments);E(this,"name","polygon");E(this,"type","object");E(this,"group","map");E(this,"order",4);E(this,"title",Q("Polygon"));E(this,"description",Q("Polygon"));E(this,"availableTypes",["polygon"]);E(this,"sortable",!0);E(this,"default",{type:"polygon",uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}})}}const Kt=[Tt,Bt,Dt,zt],_e=f.memo(e=>s.jsx(n.CurrentAppInfoProvider,{children:s.jsx(n.SchemaComponentOptions,{components:{Map:Ne},children:s.jsx(Ft,{children:e.children})})}));_e.displayName="MapProvider";class je extends n.Plugin{load(){return be(this,null,function*(){this.app.use(_e),this.app.dataSourceManager.addFieldInterfaces(Kt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:Q("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(qe),this.app.schemaInitializerManager.add(Ot),this.schemaSettingsManager.add(Et);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:st,aclSnippet:"pm.map.configuration"})})}}P.MapPlugin=je,P.default=je,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.20.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.20.0-alpha.17",
|
|
3
3
|
"react": "18.2.0",
|
|
4
|
-
"@nocobase/server": "0.20.0-alpha.
|
|
4
|
+
"@nocobase/server": "0.20.0-alpha.17",
|
|
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.20.0-alpha.
|
|
16
|
-
"@nocobase/database": "0.20.0-alpha.
|
|
15
|
+
"@nocobase/actions": "0.20.0-alpha.17",
|
|
16
|
+
"@nocobase/database": "0.20.0-alpha.17"
|
|
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.20.0-alpha.
|
|
5
|
+
"version": "0.20.0-alpha.17",
|
|
6
6
|
"description": "Map block, support Gaode map and Google map, you can also extend more map types.",
|
|
7
7
|
"description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@nocobase/test": "0.x",
|
|
37
37
|
"@nocobase/utils": "0.x"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a2460c222bc0b8a3bcb783b5c856499d756efa82",
|
|
40
40
|
"keywords": [
|
|
41
41
|
"Blocks"
|
|
42
42
|
]
|