@nocobase/plugin-field-m2m-array 1.3.47-beta → 1.3.49-beta
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/README.md +30 -1
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NocoBase
|
|
2
|
+
|
|
3
|
+
<video width="100%" controls>
|
|
4
|
+
<source src="https://static-docs.nocobase.com/NocoBase0510.mp4" type="video/mp4">
|
|
5
|
+
</video>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## What is NocoBase
|
|
9
|
+
|
|
10
|
+
NocoBase is a scalability-first, open-source no-code development platform.
|
|
11
|
+
Instead of investing years of time and millions of dollars in research and development, deploy NocoBase in a few minutes and you'll have a private, controllable, and extremely scalable no-code development platform!
|
|
12
|
+
|
|
13
|
+
Homepage:
|
|
14
|
+
https://www.nocobase.com/
|
|
15
|
+
|
|
16
|
+
Online Demo:
|
|
17
|
+
https://demo.nocobase.com/new
|
|
18
|
+
|
|
19
|
+
Documents:
|
|
20
|
+
https://docs.nocobase.com/
|
|
21
|
+
|
|
22
|
+
Commericial license & plugins:
|
|
23
|
+
https://www.nocobase.com/en/commercial
|
|
24
|
+
|
|
25
|
+
License agreement:
|
|
26
|
+
https://www.nocobase.com/en/agreement
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Contact Us:
|
|
30
|
+
hello@nocobase.com
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("@nocobase/client"),require("@nocobase/utils/client"),require("react/jsx-runtime"),require("@formily/react"),require("antd"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/utils/client","react/jsx-runtime","@formily/react","antd","react","react-router-dom"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t["@nocobase/plugin-field-m2m-array"]={},t["@nocobase/client"],t["@nocobase/utils"],t.jsxRuntime,t["@formily/react"],t.antd,t.react,t["react-router-dom"]))})(this,function(t,n,u,F,x,q,l,I){"use strict";var P=Object.defineProperty;var G=(t,n,u)=>n in t?P(t,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[n]=u;var m=(t,n,u)=>(G(t,typeof n!="symbol"?n+"":n,u),u);var T=(t,n,u)=>new Promise((F,x)=>{var q=p=>{try{I(u.next(p))}catch(K){x(K)}},l=p=>{try{I(u.throw(p))}catch(K){x(K)}},I=p=>p.done?F(p.value):Promise.resolve(p.value).then(q,l);I((u=u.apply(t,n)).next())});const p="field-m2m-array";function K(e){return(e==null?void 0:e.filterTargetKey)||(e==null?void 0:e.getPrimaryKey())||"id"}class j extends n.CollectionFieldInterface{constructor(){super(...arguments);m(this,"name","mbm");m(this,"type","object");m(this,"group","relation");m(this,"order",6);m(this,"title",u.tval("Many to many (array)",{ns:p}));m(this,"description",u.tval("Many to many (array) description",{ns:p}));m(this,"isAssociation",!0);m(this,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}});m(this,"availableTypes",["belongsToArray"]);m(this,"properties",{"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection"}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-reactions":[
|
|
10
|
+
(function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("@nocobase/client"),require("@nocobase/utils/client"),require("react/jsx-runtime"),require("@formily/react"),require("antd"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/utils/client","react/jsx-runtime","@formily/react","antd","react","react-router-dom"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t["@nocobase/plugin-field-m2m-array"]={},t["@nocobase/client"],t["@nocobase/utils"],t.jsxRuntime,t["@formily/react"],t.antd,t.react,t["react-router-dom"]))})(this,function(t,n,u,F,x,q,l,I){"use strict";var P=Object.defineProperty;var G=(t,n,u)=>n in t?P(t,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[n]=u;var m=(t,n,u)=>(G(t,typeof n!="symbol"?n+"":n,u),u);var T=(t,n,u)=>new Promise((F,x)=>{var q=p=>{try{I(u.next(p))}catch(K){x(K)}},l=p=>{try{I(u.throw(p))}catch(K){x(K)}},I=p=>p.done?F(p.value):Promise.resolve(p.value).then(q,l);I((u=u.apply(t,n)).next())});const p="field-m2m-array";function K(e){return(e==null?void 0:e.filterTargetKey)||(e==null?void 0:e.getPrimaryKey())||"id"}class j extends n.CollectionFieldInterface{constructor(){super(...arguments);m(this,"name","mbm");m(this,"type","object");m(this,"group","relation");m(this,"order",6);m(this,"title",u.tval("Many to many (array)",{ns:p}));m(this,"description",u.tval("Many to many (array) description",{ns:p}));m(this,"isAssociation",!0);m(this,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}});m(this,"availableTypes",["belongsToArray"]);m(this,"properties",{"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},grid:{type:"void","x-component":"Grid",properties:{row1:{type:"void","x-component":"Grid.Row",properties:{col11:{type:"void","x-component":"Grid.Col",properties:{source:{type:"void",title:'{{t("Source collection")}}',"x-decorator":"FormItem","x-component":"SourceCollection"}}},col12:{type:"void","x-component":"Grid.Col",properties:{target:{type:"string",title:'{{t("Target collection")}}',required:!0,"x-reactions":["{{useAsyncDataSource(loadCollections)}}"],"x-decorator":"FormItem","x-component":"Select","x-disabled":"{{ !createOnly }}"}}}}},row2:{type:"void","x-component":"Grid.Row",properties:{col21:{type:"void","x-component":"Grid.Col",properties:{foreignKey:{type:"string",title:'{{t("Foreign key")}}',required:!0,default:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}","x-decorator":"FormItem","x-component":"MBMForeignKey","x-validator":"uid","x-disabled":"{{ !createOnly }}"}}},col22:{type:"void","x-component":"Grid.Col",properties:{targetKey:{type:"string",title:'{{t("Target key")}}',"x-decorator":"FormItem","x-component":"MBMTargetKey","x-disabled":"{{ !createOnly }}",description:"{{t('Field values must be unique.')}}"}}}}}}}});m(this,"filterable",{nested:!0,children:[]})}schemaInitialize(o,{field:g,block:b,readPretty:y,targetCollection:s}){var c;o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].fieldNames=o["x-component-props"].fieldNames||{value:K(s)},o["x-component-props"].fieldNames.label=((c=o["x-component-props"].fieldNames)==null?void 0:c.label)||(s==null?void 0:s.titleField)||K(s),["Table","Kanban"].includes(b)&&(o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].ellipsis=!0,o["x-component-props"].size="small")}}const A=()=>{const{collectionName:e,name:h}=n.useRecord(),{name:o}=I.useParams(),{getCollection:g}=n.useCollectionManager_deprecated(),b=x.useForm(),{target:y}=b.values||{},s=l.useMemo(()=>{var r;return(r=g(e||h,o))==null?void 0:r.fields},[e,o]),c=l.useMemo(()=>{var r;return(r=g(y,o))==null?void 0:r.fields},[y,o]),f=l.useMemo(()=>c==null?void 0:c.filter(r=>(r.primaryKey||r.unique)&&r.interface),[c]),C=l.useMemo(()=>s==null?void 0:s.filter(r=>["set","array"].includes(r.type)&&r.interface==="json"),[s]);return{targetKeys:f,foreignKeys:C}},B=x.observer(e=>{const{disabled:h}=e,[o,g]=l.useState([]),b=n.useRecord(),y=x.useField(),{type:s,template:c}=b,f=b[y.props.name],C=n.useCompile(),[r,i]=l.useState(f||(c==="view"?null:y.initialValue)),{foreignKeys:a}=A();l.useEffect(()=>{const M=a;if(M){const v=M.map(d=>{var S;return{value:d.name,label:C(((S=d.uiSchema)==null?void 0:S.title)||d.name)}});if(g(v),f){const d=v.find(S=>S.value===f);i((d==null?void 0:d.label)||f)}}},[s]);const w=c==="view"?q.Select:q.AutoComplete;return F.jsx("div",{children:F.jsx(w,{disabled:h,value:r,options:o,showSearch:!0,onDropdownVisibleChange:M=>T(this,null,function*(){const v=a;v&&M&&g(v.map(d=>{var S;return{value:d.name,label:C(((S=d.uiSchema)==null?void 0:S.title)||d.name)}}))}),onChange:(M,v)=>{var d;(d=e==null?void 0:e.onChange)==null||d.call(e,M),i(v.label||M)}})})},{displayName:"MBMForeignKey"}),O=x.observer(e=>{const{value:h,disabled:o}=e,{targetKey:g}=n.useRecord(),[b,y]=l.useState([]),[s,c]=l.useState(h||g),f=n.useCompile(),C=x.useField();C.required=!0;const{targetKeys:r}=A();return l.useEffect(()=>{r&&y(r.map(i=>{var a;return{value:i.name,label:f(((a=i==null?void 0:i.uiSchema)==null?void 0:a.title)||i.title||i.name)}}))},[r]),F.jsx("div",{children:F.jsx(q.Select,{showSearch:!0,options:b,onDropdownVisibleChange:i=>T(this,null,function*(){r&&i&&y(r.map(a=>{var w;return{value:a.name,label:f(((w=a==null?void 0:a.uiSchema)==null?void 0:w.title)||a.title||a.name)}}))}),onChange:i=>{var a;(a=e==null?void 0:e.onChange)==null||a.call(e,i),c(i)},value:s,disabled:o})})},{displayName:"MBMTargetKey"});class N extends n.Plugin{afterAdd(){return T(this,null,function*(){})}beforeLoad(){return T(this,null,function*(){})}load(){return T(this,null,function*(){this.app.addComponents({MBMForeignKey:B,MBMTargetKey:O}),this.app.dataSourceManager.addFieldInterfaces([j])})}}t.PluginM2MArrayClient=N,t.default=N,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,10 +11,10 @@ module.exports = {
|
|
|
11
11
|
"@formily/react": "2.3.0",
|
|
12
12
|
"antd": "5.12.8",
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"@nocobase/client": "1.3.
|
|
14
|
+
"@nocobase/client": "1.3.49-beta",
|
|
15
15
|
"react-router-dom": "6.21.0",
|
|
16
|
-
"@nocobase/utils": "1.3.
|
|
17
|
-
"@nocobase/database": "1.3.
|
|
18
|
-
"@nocobase/server": "1.3.
|
|
19
|
-
"@nocobase/data-source-manager": "1.3.
|
|
16
|
+
"@nocobase/utils": "1.3.49-beta",
|
|
17
|
+
"@nocobase/database": "1.3.49-beta",
|
|
18
|
+
"@nocobase/server": "1.3.49-beta",
|
|
19
|
+
"@nocobase/data-source-manager": "1.3.49-beta"
|
|
20
20
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据表字段:多对多 (数组)",
|
|
5
5
|
"description": "Allows to create many to many relationships between two models by storing an array of unique keys of the target model.",
|
|
6
6
|
"description.zh-CN": "支持通过在数组中存储目标表唯一键的方式建立多对多关系。",
|
|
7
|
-
"version": "1.3.
|
|
7
|
+
"version": "1.3.49-beta",
|
|
8
8
|
"main": "dist/server/index.js",
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"@nocobase/client": "1.x",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"keywords": [
|
|
15
15
|
"Collection fields"
|
|
16
16
|
],
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "46dde74e2c220ae19bc275bb40be9ddf52485fa9"
|
|
18
18
|
}
|