@nocobase/plugin-graph-collection-manager 1.2.11-alpha → 1.2.12-alpha

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.
@@ -718,7 +718,7 @@ Error generating stack: `+s.message+`
718
718
  `,children:[_.jsxs("div",{className:L.css``,children:[i("Field interface"),": ",_.jsx(ce.Tag,{children:r(s.title)})]}),s.description?_.jsx("div",{className:L.css`
719
719
  margin-top: 8px;
720
720
  color: rgba(0, 0, 0, 0.45);
721
- `,children:r(s.description)}):null]}):null},{displayName:"FieldSummary"}),_Y=n=>{const e=n.targetCollection,{run:t}=Yv(e);return{run(){return Be(this,null,function*(){yield t()})}}},NY=({item:n,parentItem:e})=>_.jsx(L.OverridingFieldAction,{item:re({},n),parentItem:e,scope:{useCancelAction:Yn,useOverridingCollectionField:()=>_Y(n)},getContainer:nt,children:_.jsx(ue.CopyOutlined,{className:"btn-override"})}),kY=({item:n,parentItem:e})=>_.jsx(L.ViewFieldAction,{item:re({},n),parentItem:e,getContainer:nt,children:_.jsx(ue.EyeOutlined,{className:"btn-view"})}),AM=ee.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=ee.useContext(Ft.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||""}${go.uid()}`,b=()=>{const m=L.useRecord(),{getCollectionFields:v}=L.useCollectionManager_deprecated();return v(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:nt})),FieldSummary:TY,AddFieldAction:xY,OverrideFieldAction:NY,ViewFieldAction:kY,EditFieldAction:MY,ConnectAssociationAction:CY},h.components),scope:re({useAsyncDataSource:uh,loadCollections:t,useCancelAction:Yn,useNewId:p,useCurrentFields:b,useValuesFromRecord:rR,useUpdateCollectionActionAndRefreshCM:ml,isInheritField:u,isShowAssocition:d},h.scope),children:_.jsx(Wv,{record:r.current,setTargetNode:i,node:s,handelOpenPorts:()=>o(!0),children:_.jsx(L.SchemaComponent,{scope:Yn,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}),parentItem: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:nt,title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:()=>lR({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,targetCollection:l}),parentItem:r.current}},view:{type:"void","x-action":"view","x-visible":"{{!isInheritField}}","x-component":"ViewFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a}),parentItem: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}}}}})})})})});AM.displayName="OperationButton";const qy=ee.forwardRef((n,e)=>{var y,w,x,C;const v=n,{property:t,node:r}=v,i=Xy(v,["property","node"]),{store:{data:{title:s,name:o,sourcePort:a,associated:l,targetPort:c}}}=r,u=L.useCompile(),{styles:h}=Vy(),{getInterface:f}=L.useCollectionManager_deprecated(),[d,g]=ee.useState(!1),p=ee.useCallback(S=>{const{type:E,name:A,primaryKey:M,allowNull:O,autoIncrement:$}=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"}),$&&_.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:nt,mouseLeaveDelay:0,title:_.jsxs("div",{children:[u((y=t.uiSchema)==null?void 0:y.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(AM,re({property:t},b))]},t.id)})});qy.displayName="PopoverContent";const $Y=ee.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]=ee.useState(!1),{t:u}=ui(),h=Xu.groupBy(o.items,m=>m.isForeignKey||m.primaryKey||["obo","oho","o2o","o2m","m2o","m2m","linkTo","id"].includes(m.interface)?"initPorts":"morePorts"),f=m=>{var y;(y=n.getCellById(s.name))==null||y.toFront(),c(m);const v=n.collapseNodes||[];v.push({[s.name]:m}),n.collapseNodes=v,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&&ee.createElement(qy,$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&&ee.createElement(qy,$e(re({},g),{property:m,key:m.id}))))}),_.jsx("a",{className:Sr.css`
721
+ `,children:r(s.description)}):null]}):null},{displayName:"FieldSummary"}),_Y=n=>{const e=n.targetCollection,{run:t}=Yv(e);return{run(){return Be(this,null,function*(){yield t()})}}},NY=({item:n,parentItem:e})=>_.jsx(L.OverridingFieldAction,{item:re({},n),parentItem:e,scope:{useCancelAction:Yn,useOverridingCollectionField:()=>_Y(n)},getContainer:nt,children:_.jsx(ue.CopyOutlined,{className:"btn-override"})}),kY=({item:n,parentItem:e})=>_.jsx(L.ViewFieldAction,{item:re({},n),parentItem:e,getContainer:nt,children:_.jsx(ue.EyeOutlined,{className:"btn-view"})}),AM=ee.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=ee.useContext(Ft.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||""}${go.uid()}`,b=()=>{const m=L.useRecord(),{getCollectionFields:v}=L.useCollectionManager_deprecated();return v(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:nt})),FieldSummary:TY,AddFieldAction:xY,OverrideFieldAction:NY,ViewFieldAction:kY,EditFieldAction:MY,ConnectAssociationAction:CY},h.components),scope:re({useAsyncDataSource:uh,loadCollections:t,useCancelAction:Yn,useNewId:p,useCurrentFields:b,useValuesFromRecord:rR,useUpdateCollectionActionAndRefreshCM:ml,isInheritField:u,isShowAssocition:d},h.scope),children:_.jsx(Wv,{record:r.current,setTargetNode:i,node:s,handelOpenPorts:()=>o(!0),children:_.jsx(L.SchemaComponent,{scope:Yn,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}),parentItem: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:nt,title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:()=>lR({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,targetCollection:l}),parentItem:r.current}},view:{type:"void","x-action":"view","x-visible":"{{!isInheritField}}","x-component":"ViewFieldAction","x-component-props":{icon:"ReconciliationOutlined",item:$e(re({},e),{title:a}),parentItem: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}}}}})})})})});AM.displayName="OperationButton";const qy=ee.forwardRef((n,e)=>{var y,w,x,C;const v=n,{property:t,node:r}=v,i=Xy(v,["property","node"]),{store:{data:{title:s,name:o,sourcePort:a,associated:l,targetPort:c}}}=r,u=L.useCompile(),{styles:h}=Vy(),{getInterface:f}=L.useCollectionManager_deprecated(),[d,g]=ee.useState(!1),p=ee.useCallback(S=>{const{type:E,name:A,primaryKey:M,allowNull:O,autoIncrement:$}=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"}),$&&_.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===t.id||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:nt,mouseLeaveDelay:0,title:_.jsxs("div",{children:[u((y=t.uiSchema)==null?void 0:y.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(AM,re({property:t},b))]},t.id)})});qy.displayName="PopoverContent";const $Y=ee.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]=ee.useState(!1),{t:u}=ui(),h=Xu.groupBy(o.items,m=>m.isForeignKey||m.primaryKey||["obo","oho","o2o","o2m","m2o","m2m","linkTo","id"].includes(m.interface)?"initPorts":"morePorts"),f=m=>{var y;(y=n.getCellById(s.name))==null||y.toFront(),c(m);const v=n.collapseNodes||[];v.push({[s.name]:m}),n.collapseNodes=v,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&&ee.createElement(qy,$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&&ee.createElement(qy,$e(re({},g),{property:m,key:m.id}))))}),_.jsx("a",{className:Sr.css`
722
722
  display: block;
723
723
  color: #958f8f;
724
724
  padding: 10px 5px;
@@ -10,7 +10,7 @@
10
10
  module.exports = {
11
11
  "@ant-design/icons": "5.2.6",
12
12
  "@formily/shared": "2.3.0",
13
- "@nocobase/client": "1.2.11-alpha",
13
+ "@nocobase/client": "1.2.12-alpha",
14
14
  "react": "18.2.0",
15
15
  "@emotion/css": "11.11.2",
16
16
  "@formily/react": "2.3.0",
@@ -18,9 +18,9 @@ module.exports = {
18
18
  "lodash": "4.17.21",
19
19
  "react-router-dom": "6.21.0",
20
20
  "@formily/reactive": "2.3.0",
21
- "@nocobase/utils": "1.2.11-alpha",
21
+ "@nocobase/utils": "1.2.12-alpha",
22
22
  "react-i18next": "11.18.6",
23
- "@nocobase/server": "1.2.11-alpha",
23
+ "@nocobase/server": "1.2.12-alpha",
24
24
  "ahooks": "3.7.8",
25
- "@nocobase/database": "1.2.11-alpha"
25
+ "@nocobase/database": "1.2.12-alpha"
26
26
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "可视化数据表管理",
5
5
  "description": "An ER diagram-like tool. Currently only the Master database is supported.",
6
6
  "description.zh-CN": "类似 ER 图的工具,目前只支持主数据库。",
7
- "version": "1.2.11-alpha",
7
+ "version": "1.2.12-alpha",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/graph-collection-manager",
@@ -35,7 +35,7 @@
35
35
  "@nocobase/test": "1.x",
36
36
  "@nocobase/utils": "1.x"
37
37
  },
38
- "gitHead": "251ff80e1ae6c0a9b4892fc6986dcdc0f5518fe8",
38
+ "gitHead": "553231d4882496cb7f1f17fa7541899ce82a27ab",
39
39
  "keywords": [
40
40
  "Data model tools"
41
41
  ]