@tachybase/plugin-block-map 0.23.35 → 0.23.41
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 +6 -6
- package/package.json +9 -9
package/dist/client/index.js
CHANGED
|
@@ -95,4 +95,4 @@
|
|
|
95
95
|
.ant-formily-item-error & {
|
|
96
96
|
border: 1px solid #ff4d4f;
|
|
97
97
|
}
|
|
98
|
-
`,children:n.jsx(xe,O({},e))}),K.mapReadPretty(ht));Ke.Designer=gt;const yt={amap:Xe,google:ut},bt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>yt[t],[t]);return r?n.jsx(r,O({},e)):n.jsx("div",{children:o(`The ${t} cannot found`)})},vt=a.withDynamicSchemaProps(e=>{var l;const{fieldNames:o}=a.useProps(e),{getCollectionJoinField:t}=a.useCollectionManager_deprecated(),{name:r}=a.useCollection_deprecated(),i=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),s=(l=i==null?void 0:i.uiSchema)==null?void 0:l["x-component-props"];return n.jsx(bt,J(O(O({},s),e),{collectionField:i}))}),Mt=()=>{const{name:e,title:o}=a.useCollection(),t=a.useSchemaTemplate();return n.jsx(a.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},At=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}}},[K.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"tb-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"}}}}}}}}}}}},Ue=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,r,i)=>{const s=t==null?void 0:t.find(l=>l.value===r);return i===e.length-1?s:s==null?void 0:s.children},o)),Ct=()=>{const e=a.useSchemaInitializerItem(),{insert:o}=a.useSchemaInitializer(),t=f.useContext(K.SchemaOptionsContext),{getCollectionFieldsOptions:r}=a.useCollectionManager_deprecated(),{t:i}=Z(),{theme:s}=a.useGlobalTheme();return n.jsx(a.DataBlockInitializer,O({componentType:"Map",icon:n.jsx(te.TableOutlined,{}),onCreateBlockSchema:m=>he(this,[m],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),S=r(l.name,"string",{dataSource:l.dataSource}),M=yield a.FormDialog(i("Create map block"),()=>{var c;return n.jsx(a.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:n.jsx(qe.FormLayout,{layout:"vertical",children:n.jsx(a.SchemaComponent,{schema:{properties:{field:{title:i("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:i("Marker field"),enum:S,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ue(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},s).open({initialValues:{}});o(At({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},M)}))}),title:i("Map block")},e))},we=f.createContext({});we.displayName="MapBlockContext";const St=e=>{var v;const{fieldNames:o}=e,t=K.useFieldSchema(),r=K.useField(),{resource:i,service:s}=a.useBlockRequestContext(),[l,m]=f.useState([]);return n.jsx(a.FixedBlockWrapper,{children:n.jsx(a.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:n.jsx(we.Provider,{value:{field:r,service:s,resource:i,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:m},children:e.children})})})},xt=e=>{const o=K.useField(),{params:t,fieldNames:r}=e,i=t.appends||[],{field:s}=r||{};return Array.isArray(s)&&s.length>1&&i.push(s[0]),n.jsx(a.BlockProvider,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:i,paginate:!1,sort:o.componentProps.lineSort}),children:n.jsx(St,O({},e))}))},ge=()=>f.useContext(we),Ne=()=>{var o,t,r,i,s,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:((i=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:i.zoom)||13,lineSort:(l=(s=e==null?void 0:e.field)==null?void 0:s.componentProps)==null?void 0:l.lineSort})},wt=e=>n.jsx(a.SchemaComponentOptions,{scope:{useMapBlockProps:Ne},components:{MapBlockInitializer:Ct,MapBlockDesigner:Mt,MapBlockProvider:xt,MapBlock:vt},children:e.children}),Pt=new a.SchemaInitializer({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 a.useCollection_deprecated().template!=="sql"}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}}]},{name:"divider",type:"divider",useVisible(){return a.useCollection_deprecated().template!=="sql"}},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[],useVisible(){return a.useCollection_deprecated().template!=="sql"}}]}),It=new a.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:a.SchemaSettingsBlockTitleItem},{name:"fixBlock",Component:a.FixedBlockDesignerItem},{name:"mapField",Component:a.SchemaSettingsCascaderItem,useComponentProps(){var S;const{getCollectionFieldsOptions:e}=a.useCollectionManager_deprecated(),{t:o}=Z(),t=K.useFieldSchema(),r=((S=t==null?void 0:t["x-decorator-props"])==null?void 0:S.fieldNames)||{},i=K.useField(),{dn:s}=a.useDesignable(),{service:l}=ge(),{name:m}=a.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:M=>{const c=i.decoratorProps.fieldNames||{};c.field=M,i.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),s.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}}},{name:"markerField",Component:a.SchemaSettingsSelectItem,useComponentProps(){var S;const{t:e}=Z(),o=K.useFieldSchema(),t=((S=o==null?void 0:o["x-decorator-props"])==null?void 0:S.fieldNames)||{},{service:r}=ge(),i=K.useField(),{dn:s}=a.useDesignable(),{getCollectionFieldsOptions:l}=a.useCollectionManager_deprecated(),{name:m}=a.useCollection(),v=l(m,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:M=>{const c=i.decoratorProps.fieldNames||{};c.marker=M,i.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}},useVisible(){var l,m;const e=K.useFieldSchema(),{getCollectionFieldsOptions:o}=a.useCollectionManager_deprecated(),{name:t}=a.useCollection(),r=((l=e==null?void 0:e["x-decorator-props"])==null?void 0:l.fieldNames)||{},i=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((m=Ue(r.field,i))==null?void 0:m.type)==="point"}},{name:"setDefaultSortingRules",Component:a.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},{name:"setDataLoadingMode",Component:a.SetDataLoadingMode},{name:"defaultZoomLevel",Component:a.SchemaSettingsModalItem,useComponentProps(){var s;const{t:e}=Z(),o=K.useFieldSchema(),t=K.useField(),{dn:r}=a.useDesignable(),i=((s=o==null?void 0:o["x-component-props"])==null?void 0:s.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:i,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:l})=>{pe.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:a.SchemaSettingsDataScope,useComponentProps(){var m,v;const{name:e}=a.useCollection(),o=K.useFieldSchema(),{form:t}=a.useFormBlockContext(),r=K.useField(),{service:i}=ge(),{dn:s}=a.useDesignable(),l=a.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(m=o==null?void 0:o["x-decorator-props"])==null?void 0:m.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:S})=>{var y,p,d;const M=r.decoratorProps.params||{};M.filter=S,r.decoratorProps.params=M,o["x-decorator-props"].params=M;const c=((p=(y=i.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&i.run(J(O({},(d=i.params)==null?void 0:d[0]),{filter:a.mergeFilter([...Object.values(c),S]),page:1}),{filters:c}),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:a.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=Z();return{type:a.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:a.SchemaSettingsTemplate,useComponentProps(){var r,i;const{name:e}=a.useCollection(),o=K.useFieldSchema(),t=((r=o==null?void 0:o["x-decorator-props"])==null?void 0:r.resource)||((i=o==null?void 0:o["x-decorator-props"])==null?void 0:i.association);return{componentName:"Map",collectionName:e,resourceName:t}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:kt}=a.interfacesProperties;Array.isArray(a.interfacesProperties.type.enum)&&a.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class me extends a.CollectionFieldInterface{constructor(){super(...arguments);F(this,"properties",J(O({},kt),{"uiSchema.x-component-props.mapType":{title:H("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:ke}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Ft extends me{constructor(){super(...arguments);F(this,"name","circle");F(this,"type","object");F(this,"group","map");F(this,"order",3);F(this,"title",H("Circle"));F(this,"availableTypes",["circle"]);F(this,"description",H("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 Ot extends me{constructor(){super(...arguments);F(this,"name","lineString");F(this,"type","object");F(this,"group","map");F(this,"order",2);F(this,"title",H("Line"));F(this,"description",H("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 Et extends me{constructor(){super(...arguments);F(this,"name","point");F(this,"type","object");F(this,"group","map");F(this,"order",1);F(this,"title",H("Point"));F(this,"description",H("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 me{constructor(){super(...arguments);F(this,"name","polygon");F(this,"type","object");F(this,"group","map");F(this,"order",4);F(this,"title",H("Polygon"));F(this,"description",H("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=[Et,Lt,Ot,Ft],Ge=f.memo(e=>n.jsx(a.SchemaComponentOptions,{components:{Map:Ke},children:n.jsx(wt,{children:e.children})}));Ge.displayName="MapProvider";class _e extends a.Plugin{load(){return he(this,null,function*(){this.app.use(Ge),this.app.dataSourceManager.addFieldInterfaces(Dt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:H("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(Pt),this.schemaSettingsManager.add(It);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:H("Map"),Component:"MapBlockInitializer"}),this.app.systemSettingsManager.add("business-components."+ye,{title:H("Map Manager"),icon:"EnvironmentOutlined",Component:et,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:Ne})})}}B.MapPlugin=_e,B.default=_e,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
98
|
+
`,children:n.jsx(xe,O({},e))}),K.mapReadPretty(ht));Ke.Designer=gt;const yt={amap:Xe,google:ut},bt=e=>{const{t:o}=Z(),{mapType:t}=e,r=f.useMemo(()=>yt[t],[t]);return r?n.jsx(r,O({},e)):n.jsx("div",{children:o(`The ${t} cannot found`)})},vt=a.withDynamicSchemaProps(e=>{var l;const{fieldNames:o}=a.useProps(e),{getCollectionJoinField:t}=a.useCollectionManager_deprecated(),{name:r}=a.useCollection_deprecated(),i=f.useMemo(()=>t([r,o==null?void 0:o.field].flat().join(".")),[r,o==null?void 0:o.field]),s=(l=i==null?void 0:i.uiSchema)==null?void 0:l["x-component-props"];return n.jsx(bt,J(O(O({},s),e),{collectionField:i}))}),Mt=()=>{const{name:e,title:o}=a.useCollection(),t=a.useSchemaTemplate();return n.jsx(a.GeneralSchemaDesigner,{schemaSettings:"blockSettings:map",template:t,title:o||e})},At=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}}},[K.uid()]:{type:"void","x-component":"MapBlock","x-use-component-props":"useMapBlockProps",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"tb-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"}}}}}}}}}}}},Ue=(e,o=[])=>(typeof e=="string"&&(e=[e]),e==null?void 0:e.reduce((t,r,i)=>{const s=t==null?void 0:t.find(l=>l.value===r);return i===e.length-1?s:s==null?void 0:s.children},o)),Ct=()=>{const e=a.useSchemaInitializerItem(),{insert:o}=a.useSchemaInitializer(),t=f.useContext(K.SchemaOptionsContext),{getCollectionFieldsOptions:r}=a.useCollectionManager_deprecated(),{t:i}=Z(),{theme:s}=a.useGlobalTheme();return n.jsx(a.DataBlockInitializer,O({componentType:"Map",icon:n.jsx(te.TableOutlined,{}),onCreateBlockSchema:m=>he(this,[m],function*({item:l}){const v=r(l.name,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"],dataSource:l.dataSource}),S=r(l.name,"string",{dataSource:l.dataSource}),M=yield a.FormDialog(i("Create map block"),()=>{var c;return n.jsx(a.SchemaComponentOptions,{scope:t.scope,components:O({},t.components),children:n.jsx(qe.FormLayout,{layout:"vertical",children:n.jsx(a.SchemaComponent,{schema:{properties:{field:{title:i("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:i("Marker field"),enum:S,"x-component":"Select","x-decorator":"FormItem","x-reactions":y=>{const p=y.form.values.field;if(!(p!=null&&p.length))return;const d=Ue(p,v);d&&(y.hidden=d.type!=="point")}}}}})})})},s).open({initialValues:{}});o(At({collectionName:l.name,dataSource:l.dataSource,fieldNames:O({},M)}))}),title:i("Map block")},e))},we=f.createContext({});we.displayName="MapBlockContext";const St=e=>{var v;const{fieldNames:o}=e,t=K.useFieldSchema(),r=K.useField(),{resource:i,service:s}=a.useBlockRequestContext(),[l,m]=f.useState([]);return n.jsx(a.FixedBlockWrapper,{children:n.jsx(a.SchemaComponentOptions,{scope:{selectedRecordKeys:l},children:n.jsx(we.Provider,{value:{field:r,service:s,resource:i,fieldNames:o,fixedBlock:(v=t==null?void 0:t["x-decorator-props"])==null?void 0:v.fixedBlock,selectedRecordKeys:l,setSelectedRecordKeys:m},children:e.children})})})},xt=e=>{const o=K.useField(),{params:t,fieldNames:r}=e,i=t.appends||[],{field:s}=r||{};return Array.isArray(s)&&s.length>1&&i.push(s[0]),n.jsx(a.BlockProvider,J(O({name:"map"},e),{runWhenParamsChanged:!0,params:J(O({},t),{appends:i,paginate:!1,sort:o.componentProps.lineSort}),children:n.jsx(St,O({},e))}))},ge=()=>f.useContext(we),Ne=()=>{var o,t,r,i,s,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:((i=(r=e==null?void 0:e.field)==null?void 0:r.componentProps)==null?void 0:i.zoom)||13,lineSort:(l=(s=e==null?void 0:e.field)==null?void 0:s.componentProps)==null?void 0:l.lineSort})},wt=e=>n.jsx(a.SchemaComponentOptions,{scope:{useMapBlockProps:Ne},components:{MapBlockInitializer:Ct,MapBlockDesigner:Mt,MapBlockProvider:xt,MapBlock:vt},children:e.children}),Pt=new a.SchemaInitializer({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 a.useCollection_deprecated().template!=="sql"}},{name:"refresh",title:"{{t('Refresh')}}",Component:"RefreshActionInitializer",schema:{"x-align":"right"}}]},{name:"divider",type:"divider",useVisible(){return a.useCollection_deprecated().template!=="sql"}},{type:"subMenu",title:'{{t("Customize")}}',name:"customize",children:[],useVisible(){return a.useCollection_deprecated().template!=="sql"}}]}),It=new a.SchemaSettings({name:"blockSettings:map",items:[{name:"title",Component:a.SchemaSettingsBlockTitleItem},{name:"fixBlock",Component:a.FixedBlockDesignerItem},{name:"mapField",Component:a.SchemaSettingsCascaderItem,useComponentProps(){var S;const{getCollectionFieldsOptions:e}=a.useCollectionManager_deprecated(),{t:o}=Z(),t=K.useFieldSchema(),r=((S=t==null?void 0:t["x-decorator-props"])==null?void 0:S.fieldNames)||{},i=K.useField(),{dn:s}=a.useDesignable(),{service:l}=ge(),{name:m}=a.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:M=>{const c=i.decoratorProps.fieldNames||{};c.field=M,i.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,l.refresh(),s.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}}},{name:"markerField",Component:a.SchemaSettingsSelectItem,useComponentProps(){var S;const{t:e}=Z(),o=K.useFieldSchema(),t=((S=o==null?void 0:o["x-decorator-props"])==null?void 0:S.fieldNames)||{},{service:r}=ge(),i=K.useField(),{dn:s}=a.useDesignable(),{getCollectionFieldsOptions:l}=a.useCollectionManager_deprecated(),{name:m}=a.useCollection(),v=l(m,"string");return{title:e("Marker field"),value:t.marker,options:v,onChange:M=>{const c=i.decoratorProps.fieldNames||{};c.marker=M,i.decoratorProps.fieldNames=c,o["x-decorator-props"].fieldNames=c,r.refresh(),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":i.decoratorProps}}),s.refresh()}}},useVisible(){var l,m;const e=K.useFieldSchema(),{getCollectionFieldsOptions:o}=a.useCollectionManager_deprecated(),{name:t}=a.useCollection(),r=((l=e==null?void 0:e["x-decorator-props"])==null?void 0:l.fieldNames)||{},i=o(t,["point","lineString","polygon"],{association:["o2o","obo","oho","o2m","m2o","m2m"]});return((m=Ue(r.field,i))==null?void 0:m.type)==="point"}},{name:"setDefaultSortingRules",Component:a.SchemaSettingsDefaultSortingRules,useComponentProps(){const{t:e}=Z();return{path:"x-component-props.lineSort",title:e("Concatenation order field")}}},{name:"setDataLoadingMode",Component:a.SetDataLoadingMode},{name:"defaultZoomLevel",Component:a.SchemaSettingsModalItem,useComponentProps(){var s;const{t:e}=Z(),o=K.useFieldSchema(),t=K.useField(),{dn:r}=a.useDesignable(),i=((s=o==null?void 0:o["x-component-props"])==null?void 0:s.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:i,"x-component":"InputNumber","x-decorator":"FormItem","x-component-props":{precision:0}}}},onSubmit:({zoom:l})=>{pe.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:a.SchemaSettingsDataScope,useComponentProps(){var m,v;const{name:e}=a.useCollection(),o=K.useFieldSchema(),{form:t}=a.useFormBlockContext(),r=K.useField(),{service:i}=ge(),{dn:s}=a.useDesignable(),l=a.useDataLoadingMode();return{collectionName:e,defaultFilter:((v=(m=o==null?void 0:o["x-decorator-props"])==null?void 0:m.params)==null?void 0:v.filter)||{},form:t,onSubmit:({filter:S})=>{var y,p,d;const M=r.decoratorProps.params||{};M.filter=S,r.decoratorProps.params=M,o["x-decorator-props"].params=M;const c=((p=(y=i.params)==null?void 0:y[1])==null?void 0:p.filters)||{};l==="auto"&&i.run(J(O({},(d=i.params)==null?void 0:d[0]),{filter:a.mergeFilter([...Object.values(c),S]),page:1}),{filters:c}),s.emit("patch",{schema:{"x-uid":o["x-uid"],"x-decorator-props":o["x-decorator-props"]}})}}}},{name:"ConnectDataBlocks",Component:a.SchemaSettingsConnectDataBlocks,useComponentProps(){const{t:e}=Z();return{type:a.FilterBlockType.TABLE,emptyDescription:e("No blocks to connect")}}},{name:"divider",type:"divider"},{name:"template",Component:a.SchemaSettingsTemplate,useComponentProps(){var r,i;const{name:e}=a.useCollection(),o=K.useFieldSchema(),t=((r=o==null?void 0:o["x-decorator-props"])==null?void 0:r.resource)||((i=o==null?void 0:o["x-decorator-props"])==null?void 0:i.association);return{componentName:"Map",collectionName:e,resourceName:t}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),{defaultProps:kt}=a.interfacesProperties;Array.isArray(a.interfacesProperties.type.enum)&&a.interfacesProperties.type.enum.push({label:"Point",value:"point"},{label:"LineString",value:"lineString"},{label:"Polygon",value:"polygon"},{label:"Circle",value:"circle"});class me extends a.CollectionFieldInterface{constructor(){super(...arguments);F(this,"properties",J(O({},kt),{"uiSchema.x-component-props.mapType":{title:H("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:ke}}))}schemaInitialize(t,{block:r}){r==="Form"&&Object.assign(t,{"x-designer":"Map.Designer"})}}class Ft extends me{constructor(){super(...arguments);F(this,"name","circle");F(this,"type","object");F(this,"group","map");F(this,"order",3);F(this,"title",H("Circle"));F(this,"availableTypes",["circle"]);F(this,"description",H("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 Ot extends me{constructor(){super(...arguments);F(this,"name","lineString");F(this,"type","object");F(this,"group","map");F(this,"order",2);F(this,"title",H("Line"));F(this,"description",H("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 Et extends me{constructor(){super(...arguments);F(this,"name","point");F(this,"type","object");F(this,"group","map");F(this,"order",1);F(this,"title",H("Point"));F(this,"description",H("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 me{constructor(){super(...arguments);F(this,"name","polygon");F(this,"type","object");F(this,"group","map");F(this,"order",4);F(this,"title",H("Polygon"));F(this,"description",H("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=[Et,Lt,Ot,Ft],Ge=f.memo(e=>n.jsx(a.SchemaComponentOptions,{components:{Map:Ke},children:n.jsx(wt,{children:e.children})}));Ge.displayName="MapProvider";class _e extends a.Plugin{load(){return he(this,null,function*(){this.app.use(Ge),this.app.dataSourceManager.addFieldInterfaces(Dt),this.app.dataSourceManager.addFieldInterfaceGroups({map:{label:H("Map-based geometry"),order:51}}),this.app.schemaInitializerManager.add(Pt),this.schemaSettingsManager.add(It);const o=this.app.schemaInitializerManager.get("page:addBlock");o==null||o.add("dataBlocks.map",{title:H("Map"),Component:"MapBlockInitializer"}),this.app.systemSettingsManager.add("business-components."+ye,{title:H("Map Manager"),icon:"EnvironmentOutlined",Component:et,aclSnippet:"pm.map.configuration"}),this.app.addScopes({useMapBlockProps:Ne})})}}B.MapPlugin=_e,B.default=_e,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "0.23.
|
|
4
|
-
"@tachybase/server": "0.23.
|
|
5
|
-
"@tachybase/schema": "0.23.
|
|
3
|
+
"@tachybase/client": "0.23.41",
|
|
4
|
+
"@tachybase/server": "0.23.41",
|
|
5
|
+
"@tachybase/schema": "0.23.41",
|
|
6
6
|
"lodash": "4.17.21",
|
|
7
|
-
"@tachybase/components": "0.23.
|
|
7
|
+
"@tachybase/components": "0.23.41",
|
|
8
8
|
"@ant-design/icons": "5.3.7",
|
|
9
9
|
"ahooks": "3.8.4",
|
|
10
10
|
"antd": "5.22.5",
|
|
11
11
|
"react-router-dom": "6.28.1",
|
|
12
|
-
"@tachybase/actions": "0.23.
|
|
13
|
-
"@tachybase/database": "0.23.
|
|
12
|
+
"@tachybase/actions": "0.23.41",
|
|
13
|
+
"@tachybase/database": "0.23.41"
|
|
14
14
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-block-map",
|
|
3
3
|
"displayName": "Block: Map",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.41",
|
|
5
5
|
"description": "Map block, support Gaode map and Google map, you can also extend more map types.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Blocks"
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"react-dom": "~18.3.1",
|
|
25
25
|
"react-i18next": "^15.2.0",
|
|
26
26
|
"react-router-dom": "6.28.1",
|
|
27
|
-
"@tachybase/components": "0.23.
|
|
28
|
-
"@tachybase/schema": "0.23.
|
|
27
|
+
"@tachybase/components": "0.23.41",
|
|
28
|
+
"@tachybase/schema": "0.23.41"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tachybase/actions": "0.23.
|
|
32
|
-
"@tachybase/client": "0.23.
|
|
33
|
-
"@tachybase/database": "0.23.
|
|
34
|
-
"@tachybase/
|
|
35
|
-
"@tachybase/
|
|
36
|
-
"@tachybase/utils": "0.23.
|
|
31
|
+
"@tachybase/actions": "0.23.41",
|
|
32
|
+
"@tachybase/client": "0.23.41",
|
|
33
|
+
"@tachybase/database": "0.23.41",
|
|
34
|
+
"@tachybase/test": "0.23.41",
|
|
35
|
+
"@tachybase/server": "0.23.41",
|
|
36
|
+
"@tachybase/utils": "0.23.41"
|
|
37
37
|
},
|
|
38
38
|
"description.zh-CN": "地图卡片,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
|
|
39
39
|
"displayName.zh-CN": "卡片:地图",
|