@nocobase/plugin-graph-collection-manager 0.19.0-alpha.1 → 0.19.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.
@@ -702,14 +702,14 @@ Error generating stack: `+s.message+`
702
702
  height: calc(100vh) !important;
703
703
  width: calc(100vw) !important;
704
704
  }
705
- `})),mY=n=>{const e=n.collectionName,{run:t}=Xv(e,n.key);return{run(){return Be(this,null,function*(){yield t()})}}},yY=({item:n,database:e})=>_.jsx(L.AddFieldAction,{trigger:["click"],align:{overflow:{adjustY:!1}},item:n,database:e,scope:{useCancelAction:Xn,useCreateCollectionField:()=>mY(n)},getContainer:tt,children:_.jsx(ue.PlusOutlined,{className:"btn-add",id:"graph_btn_add_field"})}),vY=n=>{const{targetGraph:e,item:t}=n;return _.jsx(ue.BranchesOutlined,{className:"btn-assocition",onClick:()=>{e.onConnectionAssociation(t)}})},bY=n=>{const{targetGraph:e,item:t}=n,{t:r}=li(),{getChildrenCollections:i}=L.useCollectionManager(),s=i(t.name);return(s==null?void 0:s.some(({name:a})=>!e.hasCell(a)))?_.jsx(ce.Tooltip,{title:r("Show child"),getPopupContainer:tt,children:_.jsx(ue.FallOutlined,{className:"btn-inheriedChild",onClick:()=>{e.onConnectionChilds(s.map(a=>a.name))}})}):""},wY=n=>{const{targetGraph:e,item:t}=n,{t:r}=li(),{getInheritCollections:i}=L.useCollectionManager(),s=i(t.name);return(s==null?void 0:s.some(a=>!e.hasCell(a)))?_.jsx(ce.Tooltip,{title:r("Show parent"),getPopupContainer:tt,children:_.jsx(ue.RiseOutlined,{className:"btn-inheriedParent",onClick:()=>{e.onConnectionParents(s)}})}):""},xY=r=>{var i=r,{item:n,className:e}=i,t=Wy(i,["item","className"]);return _.jsx(L.DeleteCollection,$e(re({item:n,scope:{useCancelAction:Xn,useUpdateCollectionActionAndRefreshCM:pl,createOnly:!1},getContainer:tt},t),{children:_.jsx(ue.DeleteOutlined,{className:e})}))},CY=({item:n,className:e})=>_.jsx(L.EditCollection,{item:n,scope:{useCancelAction:Xn,useUpdateCollectionActionAndRefreshCM:pl,createOnly:!1},getContainer:tt,children:_.jsx(ue.EditOutlined,{className:e})}),SY=n=>{const e=n.collectionName,{run:t}=eR({collectionName:e,name:n.name,key:n.key});return{run(){return Be(this,null,function*(){yield t()})}}},PY=({item:n})=>_.jsx(L.EditFieldAction,{item:n,scope:{useCancelAction:Xn,useUpdateCollectionField:()=>SY(n)},getContainer:tt,children:_.jsx(ue.EditOutlined,{className:"btn-edit"})}),EY=Vt.observer(n=>{const{schemaKey:e}=n,{getInterface:t}=L.useCollectionManager(),r=L.useCompile(),{t:i}=Qa.useTranslation(),s=t(e);return s?_.jsxs("div",{className:L.css`
705
+ `})),mY=n=>{const e=n.collectionName,{run:t}=Xv(e,n.key);return{run(){return Be(this,null,function*(){yield t()})}}},yY=({item:n,database:e})=>_.jsx(L.AddFieldAction,{trigger:["click"],align:{overflow:{adjustY:!1}},item:n,database:e,scope:{useCancelAction:Xn,useCreateCollectionField:()=>mY(n)},getContainer:tt,children:_.jsx(ue.PlusOutlined,{className:"btn-add",id:"graph_btn_add_field"})}),vY=n=>{const{targetGraph:e,item:t}=n;return _.jsx(ue.BranchesOutlined,{className:"btn-assocition",onClick:()=>{e.onConnectionAssociation(t)}})},bY=n=>{const{targetGraph:e,item:t}=n,{t:r}=li(),{getChildrenCollections:i}=L.useCollectionManager(),s=i(t.name);return(s==null?void 0:s.some(({name:a})=>!e.hasCell(a)))?_.jsx(ce.Tooltip,{title:r("Show child"),getPopupContainer:tt,children:_.jsx(ue.FallOutlined,{className:"btn-inheriedChild",onClick:()=>{e.onConnectionChilds(s.map(a=>a.name))}})}):""},wY=n=>{const{targetGraph:e,item:t}=n,{t:r}=li(),{getInheritCollections:i}=L.useCollectionManager(),s=i(t.name);return(s==null?void 0:s.some(a=>!e.hasCell(a)))?_.jsx(ce.Tooltip,{title:r("Show parent"),getPopupContainer:tt,children:_.jsx(ue.RiseOutlined,{className:"btn-inheriedParent",onClick:()=>{e.onConnectionParents(s)}})}):""},xY=r=>{var i=r,{item:n,className:e}=i,t=Wy(i,["item","className"]);return _.jsx(L.DeleteCollection,$e(re({item:n,scope:{useCancelAction:Xn,useUpdateCollectionActionAndRefreshCM:pl,createOnly:!1},getContainer:tt},t),{children:_.jsx(ue.DeleteOutlined,{className:e})}))},CY=({item:n,className:e})=>_.jsx(L.EditCollection,{item:n,scope:{useCancelAction:Xn,useUpdateCollectionActionAndRefreshCM:pl,createOnly:!1},getContainer:tt,children:_.jsx(ue.EditOutlined,{className:e})}),SY=n=>{const e=n.collectionName,{run:t}=eR({collectionName:e,name:n.name,key:n.id});return{run(){return Be(this,null,function*(){yield t()})}}},PY=({item:n})=>_.jsx(L.EditFieldAction,{item:n,scope:{useCancelAction:Xn,useUpdateCollectionField:()=>SY(n)},getContainer:tt,children:_.jsx(ue.EditOutlined,{className:"btn-edit"})}),EY=Vt.observer(n=>{const{schemaKey:e}=n,{getInterface:t}=L.useCollectionManager(),r=L.useCompile(),{t:i}=Qa.useTranslation(),s=t(e);return s?_.jsxs("div",{className:L.css`
706
706
  background: #f6f6f6;
707
707
  margin-bottom: 24px;
708
708
  padding: 16px;
709
709
  `,children:[_.jsxs("div",{className:L.css``,children:[i("Field interface"),": ",_.jsx(ce.Tag,{children:r(s.title)})]}),s.description?_.jsx("div",{className:L.css`
710
710
  margin-top: 8px;
711
711
  color: rgba(0, 0, 0, 0.45);
712
- `,children:r(s.description)}):null]}):null},{displayName:"FieldSummary"}),AY=n=>{const e=n.targetCollection,{run:t}=Xv(e);return{run(){return Be(this,null,function*(){yield t()})}}},OY=({item:n})=>_.jsx(L.OverridingFieldAction,{item:re({},n),scope:{useCancelAction:Xn,useOverridingCollectionField:()=>AY(n)},getContainer:tt,children:_.jsx(ue.CopyOutlined,{className:"btn-override"})}),MY=({item:n})=>_.jsx(L.ViewFieldAction,{item:re({},n),getContainer:tt,children:_.jsx(ue.EyeOutlined,{className:"btn-view"})}),TY=Z.memo(n=>{const{property:e,loadCollections:t,collectionData:r,setTargetNode:i,node:s,handelOpenPorts:o,title:a,name:l,targetGraph:c}=n,u=e.collectionName===l,h=Z.useContext(Vt.SchemaOptionsContext),d=["hasOne","hasMany","belongsTo","belongsToMany"].includes(e.type)&&!(e.through?c.hasCell(e.through):c.hasCell(e.target)),{data:{database:g}}=L.useCurrentAppInfo(),p=m=>`${m||""}${ho.uid()}`,b=()=>{const m=L.useRecord(),{getCollectionFields:y}=L.useCollectionManager();return y(m.collectionName||m.name)};return _.jsx("div",{className:"field-operator",children:_.jsx(L.SchemaComponentProvider,{components:re({Select:m=>_.jsx(L.Select,$e(re({popupMatchSelectWidth:!1},m),{getPopupContainer:tt})),FieldSummary:EY,AddFieldAction:yY,OverrideFieldAction:OY,ViewFieldAction:MY,EditFieldAction:PY,ConnectAssociationAction:vY},h.components),scope:re({useAsyncDataSource:ch,loadCollections:t,useCancelAction:Xn,useNewId:p,useCurrentFields:b,useValuesFromRecord:ZL,useUpdateCollectionActionAndRefreshCM:pl,isInheritField:u,isShowAssocition:d},h.scope),children:_.jsx(Uv,{record:r.current,setTargetNode:i,node:s,handelOpenPorts:()=>o(!0),children:_.jsx(L.SchemaComponent,{scope:Xn,schema:{type:"object",properties:{create:{type:"void","x-action":"create","x-component":"AddFieldAction","x-visible":"{{isInheritField}}","x-component-props":{item:$e(re({},e),{title:a}),database:g}},update:{type:"void","x-action":"update","x-component":"EditFieldAction","x-visible":"{{isInheritField}}","x-component-props":{item:$e(re({},e),{title:a,__parent:r.current})}},delete:{type:"void","x-action":"destroy","x-component":"Action","x-visible":"{{isInheritField}}","x-component-props":{component:ue.DeleteOutlined,icon:"DeleteOutlined",className:"btn-del",confirm:{title:"{{t('Delete record')}}",getContainer:tt,collectionConten:"{{t('Are you sure you want to delete it?')}}"},useAction:()=>iR({collectionName:e.collectionName,name:e.name})}},override:{type:"void","x-action":"create","x-visible":"{{!isInheritField}}","x-component":"OverrideFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a,__parent:r.current,targetCollection:l})}},view:{type:"void","x-action":"view","x-visible":"{{!isInheritField}}","x-component":"ViewFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a,__parent:r.current})}},connectAssociation:{type:"void","x-action":"view","x-visible":"{{isShowAssocition}}","x-component":"ConnectAssociationAction","x-component-props":{item:$e(re({},e),{title:a,__parent:r.current}),targetGraph:c}}}}})})})})}),PM=Z.forwardRef((n,e)=>{var v,w,x,C;const y=n,{property:t,node:r}=y,i=Wy(y,["property","node"]),{store:{data:{title:s,name:o,sourcePort:a,associated:l,targetPort:c}}}=r,u=L.useCompile(),{styles:h}=Fy(),{getInterface:f}=L.useCollectionManager(),[d,g]=Z.useState(!1),p=Z.useCallback(S=>{const{type:E,name:A,primaryKey:M,allowNull:O,autoIncrement:I}=S;return _.jsxs("div",{className:h.collectionPopoverClass,children:[_.jsxs("div",{className:"field-content",children:[_.jsxs("div",{children:[_.jsx("span",{children:"name"}),": ",_.jsx("span",{className:"field-type",children:A})]}),_.jsxs("div",{children:[_.jsx("span",{children:"type"}),": ",_.jsx("span",{className:"field-type",children:E})]})]}),_.jsxs("p",{children:[M&&_.jsx(ce.Tag,{color:"green",children:"PRIMARY"}),O&&_.jsx(ce.Tag,{color:"geekblue",children:"ALLOWNULL"}),I&&_.jsx(ce.Tag,{color:"purple",children:"AUTOINCREMENT"})]})]})},[]),b=re({title:s,name:o,node:r},i),m=S=>{if(S.isForeignKey||S.primaryKey||S.interface==="id")return"red";if(["obo","oho","o2o","o2m","m2o","m2m","linkTo"].includes(S.interface))return"orange"};return _.jsx("div",{children:_.jsxs("div",{className:"body-item",id:t.id,style:{background:c||a===t.id||l!=null&&l.includes(t.name)?"#e6f7ff":null},onMouseEnter:()=>{g(!0)},onMouseLeave:()=>g(!1),children:[_.jsx(L.StablePopover,{content:p(t),getPopupContainer:tt,mouseLeaveDelay:0,title:_.jsxs("div",{children:[u((v=t.uiSchema)==null?void 0:v.title),_.jsx("span",{style:{color:"#ffa940",float:"right"},children:u((w=f(t.interface))==null?void 0:w.title)})]}),placement:"right",children:_.jsxs("div",{className:"name",children:[_.jsx(ce.Badge,{color:m(t)}),u((x=t.uiSchema)==null?void 0:x.title)]})},t.id),_.jsx("div",{className:"type field_type",children:u((C=f(t.interface))==null?void 0:C.title)}),d&&_.jsx(TY,re({property:t},b))]},t.id)})}),_Y=Z.memo(({targetGraph:n,collectionData:e,setTargetNode:t,node:r,loadCollections:i})=>{var p,b;const{store:{data:{item:s,ports:o,data:a}}}=r,[l,c]=Z.useState(!1),{t:u}=li(),h=Wu.groupBy(o.items,m=>m.isForeignKey||m.primaryKey||["obo","oho","o2o","o2m","m2o","m2m","linkTo","id"].includes(m.interface)?"initPorts":"morePorts"),f=m=>{var v;(v=n.getCellById(s.name))==null||v.toFront(),c(m);const y=n.collapseNodes||[];y.push({[s.name]:m}),n.collapseNodes=y,n.getCellById(s.name).setData({collapse:!0})},d=l&&(a==null?void 0:a.collapse),g={collectionData:e,setTargetNode:t,loadCollections:i,handelOpenPorts:f,node:r,targetGraph:n};return _.jsxs("div",{className:"body",children:[(p=h.initPorts)==null?void 0:p.map(m=>m.uiSchema&&Z.createElement(PM,$e(re({},g),{property:m,key:m.id}))),_.jsx("div",{className:"morePorts",children:d&&((b=h.morePorts)==null?void 0:b.map(m=>m.uiSchema&&Z.createElement(PM,$e(re({},g),{property:m,key:m.id}))))}),_.jsx("a",{className:Cr.css`
712
+ `,children:r(s.description)}):null]}):null},{displayName:"FieldSummary"}),AY=n=>{const e=n.targetCollection,{run:t}=Xv(e);return{run(){return Be(this,null,function*(){yield t()})}}},OY=({item:n})=>_.jsx(L.OverridingFieldAction,{item:re({},n),scope:{useCancelAction:Xn,useOverridingCollectionField:()=>AY(n)},getContainer:tt,children:_.jsx(ue.CopyOutlined,{className:"btn-override"})}),MY=({item:n})=>_.jsx(L.ViewFieldAction,{item:re({},n),getContainer:tt,children:_.jsx(ue.EyeOutlined,{className:"btn-view"})}),TY=Z.memo(n=>{const{property:e,loadCollections:t,collectionData:r,setTargetNode:i,node:s,handelOpenPorts:o,title:a,name:l,targetGraph:c}=n,u=e.collectionName===l,h=Z.useContext(Vt.SchemaOptionsContext),d=["hasOne","hasMany","belongsTo","belongsToMany"].includes(e.type)&&!(e.through?c.hasCell(e.through):c.hasCell(e.target)),{data:{database:g}}=L.useCurrentAppInfo(),p=m=>`${m||""}${ho.uid()}`,b=()=>{const m=L.useRecord(),{getCollectionFields:y}=L.useCollectionManager();return y(m.collectionName||m.name)};return _.jsx("div",{className:"field-operator",children:_.jsx(L.SchemaComponentProvider,{components:re({Select:m=>_.jsx(L.Select,$e(re({popupMatchSelectWidth:!1},m),{getPopupContainer:tt})),FieldSummary:EY,AddFieldAction:yY,OverrideFieldAction:OY,ViewFieldAction:MY,EditFieldAction:PY,ConnectAssociationAction:vY},h.components),scope:re({useAsyncDataSource:ch,loadCollections:t,useCancelAction:Xn,useNewId:p,useCurrentFields:b,useValuesFromRecord:ZL,useUpdateCollectionActionAndRefreshCM:pl,isInheritField:u,isShowAssocition:d},h.scope),children:_.jsx(Uv,{record:r.current,setTargetNode:i,node:s,handelOpenPorts:()=>o(!0),children:_.jsx(L.SchemaComponent,{scope:Xn,schema:{type:"object",properties:{create:{type:"void","x-action":"create","x-component":"AddFieldAction","x-visible":"{{isInheritField}}","x-component-props":{item:$e(re({},e),{title:a}),database:g}},update:{type:"void","x-action":"update","x-component":"EditFieldAction","x-visible":"{{isInheritField}}","x-component-props":{item:$e(re({},e),{title:a,__parent:r.current})}},delete:{type:"void","x-action":"destroy","x-component":"Action.Link","x-visible":"{{isInheritField}}","x-component-props":{component:ue.DeleteOutlined,icon:"DeleteOutlined",className:"btn-del",confirm:{getContainer:tt,title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:()=>iR({collectionName:e.collectionName,name:e.name})}},override:{type:"void","x-action":"create","x-visible":"{{!isInheritField}}","x-component":"OverrideFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a,__parent:r.current,targetCollection:l})}},view:{type:"void","x-action":"view","x-visible":"{{!isInheritField}}","x-component":"ViewFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a,__parent:r.current})}},connectAssociation:{type:"void","x-action":"view","x-visible":"{{isShowAssocition}}","x-component":"ConnectAssociationAction","x-component-props":{item:$e(re({},e),{title:a,__parent:r.current}),targetGraph:c}}}}})})})})}),PM=Z.forwardRef((n,e)=>{var v,w,x,C;const y=n,{property:t,node:r}=y,i=Wy(y,["property","node"]),{store:{data:{title:s,name:o,sourcePort:a,associated:l,targetPort:c}}}=r,u=L.useCompile(),{styles:h}=Fy(),{getInterface:f}=L.useCollectionManager(),[d,g]=Z.useState(!1),p=Z.useCallback(S=>{const{type:E,name:A,primaryKey:M,allowNull:O,autoIncrement:I}=S;return _.jsxs("div",{className:h.collectionPopoverClass,children:[_.jsxs("div",{className:"field-content",children:[_.jsxs("div",{children:[_.jsx("span",{children:"name"}),": ",_.jsx("span",{className:"field-type",children:A})]}),_.jsxs("div",{children:[_.jsx("span",{children:"type"}),": ",_.jsx("span",{className:"field-type",children:E})]})]}),_.jsxs("p",{children:[M&&_.jsx(ce.Tag,{color:"green",children:"PRIMARY"}),O&&_.jsx(ce.Tag,{color:"geekblue",children:"ALLOWNULL"}),I&&_.jsx(ce.Tag,{color:"purple",children:"AUTOINCREMENT"})]})]})},[]),b=re({title:s,name:o,node:r},i),m=S=>{if(S.isForeignKey||S.primaryKey||S.interface==="id")return"red";if(["obo","oho","o2o","o2m","m2o","m2m","linkTo"].includes(S.interface))return"orange"};return _.jsx("div",{children:_.jsxs("div",{className:"body-item",id:t.id,style:{background:c||a===t.id||l!=null&&l.includes(t.name)?"#e6f7ff":null},onMouseEnter:()=>{g(!0)},onMouseLeave:()=>g(!1),children:[_.jsx(L.StablePopover,{content:p(t),getPopupContainer:tt,mouseLeaveDelay:0,title:_.jsxs("div",{children:[u((v=t.uiSchema)==null?void 0:v.title),_.jsx("span",{style:{color:"#ffa940",float:"right"},children:u((w=f(t.interface))==null?void 0:w.title)})]}),placement:"right",children:_.jsxs("div",{className:"name",children:[_.jsx(ce.Badge,{color:m(t)}),u((x=t.uiSchema)==null?void 0:x.title)]})},t.id),_.jsx("div",{className:"type field_type",children:u((C=f(t.interface))==null?void 0:C.title)}),d&&_.jsx(TY,re({property:t},b))]},t.id)})}),_Y=Z.memo(({targetGraph:n,collectionData:e,setTargetNode:t,node:r,loadCollections:i})=>{var p,b;const{store:{data:{item:s,ports:o,data:a}}}=r,[l,c]=Z.useState(!1),{t:u}=li(),h=Wu.groupBy(o.items,m=>m.isForeignKey||m.primaryKey||["obo","oho","o2o","o2m","m2o","m2m","linkTo","id"].includes(m.interface)?"initPorts":"morePorts"),f=m=>{var v;(v=n.getCellById(s.name))==null||v.toFront(),c(m);const y=n.collapseNodes||[];y.push({[s.name]:m}),n.collapseNodes=y,n.getCellById(s.name).setData({collapse:!0})},d=l&&(a==null?void 0:a.collapse),g={collectionData:e,setTargetNode:t,loadCollections:i,handelOpenPorts:f,node:r,targetGraph:n};return _.jsxs("div",{className:"body",children:[(p=h.initPorts)==null?void 0:p.map(m=>m.uiSchema&&Z.createElement(PM,$e(re({},g),{property:m,key:m.id}))),_.jsx("div",{className:"morePorts",children:d&&((b=h.morePorts)==null?void 0:b.map(m=>m.uiSchema&&Z.createElement(PM,$e(re({},g),{property:m,key:m.id}))))}),_.jsx("a",{className:Cr.css`
713
713
  display: block;
714
714
  color: #958f8f;
715
715
  padding: 10px 5px;
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "@ant-design/icons": "5.2.6",
3
3
  "@formily/shared": "2.3.0",
4
- "@nocobase/client": "0.19.0-alpha.1",
4
+ "@nocobase/client": "0.19.0-alpha.3",
5
5
  "react": "18.2.0",
6
6
  "@emotion/css": "11.11.2",
7
7
  "@formily/react": "2.3.0",
@@ -9,9 +9,9 @@ module.exports = {
9
9
  "lodash": "4.17.21",
10
10
  "react-router-dom": "6.21.0",
11
11
  "@formily/reactive": "2.3.0",
12
- "@nocobase/utils": "0.19.0-alpha.1",
12
+ "@nocobase/utils": "0.19.0-alpha.3",
13
13
  "react-i18next": "11.18.6",
14
- "@nocobase/server": "0.19.0-alpha.1",
14
+ "@nocobase/server": "0.19.0-alpha.3",
15
15
  "ahooks": "3.7.8",
16
- "@nocobase/database": "0.19.0-alpha.1"
16
+ "@nocobase/database": "0.19.0-alpha.3"
17
17
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "可视化的数据表管理",
5
5
  "description": "An ER diagram-like tool",
6
6
  "description.zh-CN": "类似 ER 图的工具",
7
- "version": "0.19.0-alpha.1",
7
+ "version": "0.19.0-alpha.3",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "devDependencies": {
@@ -33,5 +33,5 @@
33
33
  "@nocobase/test": "0.x",
34
34
  "@nocobase/utils": "0.x"
35
35
  },
36
- "gitHead": "64601944412fc4d2e2bd05f4b982118dd28247dc"
36
+ "gitHead": "3cee597df101a3f8f0f1e2a6f75fc2dddd02ac74"
37
37
  }