@nocobase/plugin-data-source-manager 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
@@ -44,7 +44,7 @@
44
44
  }
45
45
  `,Mo="Default title for each record",Qy=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{t:n}=B.useTranslation(),{setState:s}=r.useResourceActionContext(),{resource:i,targetKey:c}=e.collectionResource||{},l=r.useRecord(),[p,u]=d.useState(null),{refreshCM:y,isTitleField:m,getTemplate:b}=r.useCollectionManager_deprecated(),{[c]:_,titleField:A,template:C}=l,v=b(C),g=[{dataIndex:["uiSchema","title"],title:n("Field display name"),render:f=>a.jsx("div",{style:{marginLeft:7},children:t(f)})},{dataIndex:"name",title:n("Field name")},{dataIndex:"interface",title:n("Field interface"),render:f=>{var h;return a.jsx(x.Tag,{children:t((h=o(f))==null?void 0:h.title)})}},{dataIndex:"titleField",title:n("Title field"),render:function(h,S){const P=N=>{u(S),i.update({filterByTk:_,values:{titleField:N?S.name:"id"}}).then(()=>w(this,null,function*(){yield e.refreshAsync(),u(null),y()})).catch(j=>{u(null),console.error(j)})};return m(S)?a.jsx(x.Tooltip,{title:n(Mo),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(x.Switch,{"aria-label":`switch-title-field-${S.name}`,size:"small",loading:S.name===(p==null?void 0:p.name),checked:S.name===(A||"id"),onChange:P})}):null}},{dataIndex:"description",title:n("Descriptio "),render:f=>a.jsx(r.Input.ReadPretty,{value:f,ellipsis:!0})},{dataIndex:"actions",title:n("Actions"),render:(f,h)=>{const S={confirm:{title:n("Delete record"),content:n("Are you sure you want to delete it?")},useAction:r.useDestroyActionAndRefreshCM,disabled:r.isDeleteButtonDisabled(h)||(v==null?void 0:v.forbidDeletion),title:n("Delete")};return a.jsx(r.RecordProvider,{record:h,parent:l,children:a.jsxs(x.Space,{children:[a.jsx(r.EditCollectionField,{role:"button","aria-label":`edit-button-${h.name}`,type:"primary"}),a.jsx(r.Action.Link,T({},S))]})})}}];return a.jsx(x.Table,{rowKey:"name",columns:g,showHeader:!1,pagination:!1,dataSource:e.fields,rowSelection:{type:"checkbox",getCheckboxProps(f){return{"aria-label":`checkbox-${f.name}`}},onChange:f=>{s(h=>K(T({},h),{selectedRowKeys:f}))}},className:Hy})},Yy=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{resource:n,targetKey:s}=e.collectionResource||{},i=r.useRecord(),[c,l]=d.useState(null),{t:p}=B.useTranslation(),{refreshCM:u,isTitleField:y}=r.useCollectionManager_deprecated(),{[s]:m,titleField:b,name:_}=i,A=[{dataIndex:["uiSchema","rawTitle"],title:p("Field display name"),render:C=>a.jsx("div",{style:{marginLeft:1},children:t(C)})},{dataIndex:"name",title:p("Field name")},{dataIndex:"interface",title:p("Field interface"),render:C=>{var v;return a.jsx(x.Tag,{children:t((v=o(C))==null?void 0:v.title)})}},{dataIndex:"titleField",title:p("Title field"),render(C,v){const g=f=>{l(v),n.update({filterByTk:m,values:{titleField:f?v.name:"id"}}).then(()=>w(this,null,function*(){yield e.refreshAsync(),l(null),u()})).catch(h=>{l(null),console.error(h)})};return y(v)?a.jsx(x.Tooltip,{title:p(Mo),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(x.Switch,{size:"small",loading:v.name===(c==null?void 0:c.name),checked:v.name===(b||"id"),onChange:g})}):null}},{dataIndex:"actions",title:p("Actions"),render:function(v,g){const f={type:"primary",currentCollection:_},h={type:"primary"};return a.jsx(r.RecordProvider,{record:g,parent:i,children:a.jsxs(x.Space,{children:[a.jsx(r.OverridingCollectionField,T({},f)),a.jsx(r.ViewCollectionField,T({},h))]})})}}];return a.jsx(x.Table,{rowKey:"name",columns:A,showHeader:!1,pagination:!1,dataSource:e.fields.filter(C=>C.interface)})},Jy=()=>{const e=r.useCompile(),t=F.useField(),{name:o,template:n}=r.useRecord(),{data:{database:s}}=r.useCurrentAppInfo(),{getInterface:i,getInheritCollections:c,getCollection:l,getTemplate:p}=r.useCollectionManager_deprecated(),u=d.useMemo(()=>ye.createForm(),[]),y=r.useAttach(u.createArrayField(K(T({},t.props),{basePath:""}))),{t:m}=B.useTranslation(),b=r.useResourceContext(),{refreshAsync:_,data:A}=d.useContext(r.ResourceActionContext),C=p(n),v=c(o),g=[{dataIndex:"title",title:m("Field display name"),render:D=>a.jsx("div",{className:fe.css`
46
46
  font-weight: 500;
47
- `,children:D})},{dataIndex:"name",title:m("Field name")},{dataIndex:"interface",title:m("Field interface")},{dataIndex:"titleField",title:m("Title field")},{dataIndex:"description",title:m("Description")},{dataIndex:"actions",title:m("Actions")}],f=(A==null?void 0:A.data)||[],h={pf:[],association:[],general:[],system:[]};f.forEach(D=>{if(D.primaryKey||D.isForeignKey)h.pf.push(D);else if(D.interface){const E=i(D.interface);(E==null?void 0:E.group)==="systemInfo"?h.system.push(D):(E==null?void 0:E.group)==="relation"?h.association.push(D):h.general.push(D)}});const S=[{key:"pf",title:m("PK & FK fields"),fields:h.pf},{key:"association",title:m("Association fields"),fields:h.association},{key:"general",title:m("General fields"),fields:h.general},{key:"system",title:m("System fields"),fields:h.system}];S.push(...v.map(D=>{const E=l(D);if(E)return{key:D,title:`${m("Inherited fields")} - `+e(E==null?void 0:E.title),inherit:!0,fields:(E==null?void 0:E.fields)||[]}}).filter(Boolean));const P=d.useMemo(()=>({useAction:r.useBulkDestroyActionAndRefreshCM,title:m("Delete"),icon:"DeleteOutlined",disabled:C==null?void 0:C.forbidDeletion,confirm:{title:m("Delete record"),content:m("Are you sure you want to delete it?")}}),[m]),N={type:"primary",database:s},j={type:"primary"};return a.jsx(F.FormContext.Provider,{value:u,children:a.jsxs(F.FieldContext.Provider,{value:y,children:[a.jsxs(x.Space,{align:"end",className:fe.css`
47
+ `,children:D})},{dataIndex:"name",title:m("Field name")},{dataIndex:"interface",title:m("Field interface")},{dataIndex:"titleField",title:m("Title field")},{dataIndex:"description",title:m("Description")},{dataIndex:"actions",title:m("Actions")}],f=(A==null?void 0:A.data)||[],h={pf:[],association:[],general:[],system:[]};f.forEach(D=>{if(D.primaryKey||D.isForeignKey)h.pf.push(D);else if(D.interface){const E=i(D.interface);(E==null?void 0:E.group)==="systemInfo"?h.system.push(D):(E==null?void 0:E.group)==="relation"?h.association.push(D):h.general.push(D)}});const S=[{key:"pf",title:m("PK & FK fields"),fields:h.pf},{key:"association",title:m("Association fields"),fields:h.association},{key:"general",title:m("General fields"),fields:h.general},{key:"system",title:m("System fields"),fields:h.system}];S.push(...v.map(D=>{const E=l(D);if(E)return{key:D,title:`${m("Inherited fields")} - `+e(E==null?void 0:E.title),inherit:!0,fields:(E==null?void 0:E.fields)||[]}}).filter(Boolean));const P=d.useMemo(()=>({useAction:()=>r.useBulkDestroyActionAndRefreshCM(!0),title:m("Delete"),icon:"DeleteOutlined",disabled:C==null?void 0:C.forbidDeletion,confirm:{title:m("Delete record"),content:m("Are you sure you want to delete it?")}}),[m]),N={type:"primary",database:s},j={type:"primary"};return a.jsx(F.FormContext.Provider,{value:u,children:a.jsxs(F.FieldContext.Provider,{value:y,children:[a.jsxs(x.Space,{align:"end",className:fe.css`
48
48
  justify-content: flex-end;
49
49
  display: flex;
50
50
  margin-bottom: 16px;
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.0.0-alpha.5",
11
+ "@nocobase/client": "1.0.0-alpha.6",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "1.0.0-alpha.5",
13
+ "@nocobase/server": "1.0.0-alpha.6",
14
14
  "lodash": "4.17.21",
15
15
  "@ant-design/icons": "5.2.6",
16
16
  "antd": "5.12.8",
@@ -19,10 +19,10 @@ module.exports = {
19
19
  "react-i18next": "11.18.6",
20
20
  "@formily/react": "2.3.0",
21
21
  "@emotion/css": "11.11.2",
22
- "@nocobase/database": "1.0.0-alpha.5",
23
- "@nocobase/utils": "1.0.0-alpha.5",
24
- "@nocobase/plugin-acl": "1.0.0-alpha.5",
25
- "@nocobase/acl": "1.0.0-alpha.5",
22
+ "@nocobase/database": "1.0.0-alpha.6",
23
+ "@nocobase/utils": "1.0.0-alpha.6",
24
+ "@nocobase/plugin-acl": "1.0.0-alpha.6",
25
+ "@nocobase/acl": "1.0.0-alpha.6",
26
26
  "sequelize": "6.35.2",
27
27
  "@formily/antd-v5": "1.1.9",
28
28
  "@formily/core": "2.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.zh-CN": "数据源管理",
@@ -16,5 +16,5 @@
16
16
  "keywords": [
17
17
  "Data model tools"
18
18
  ],
19
- "gitHead": "c85c3e8af1b57d7078aa0df4d4cdecb73269f2eb"
19
+ "gitHead": "cbba77fb83a4ee114002234a15d339054b092de8"
20
20
  }