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