@nocobase/plugin-field-m2m-array 1.6.0-alpha.3 → 1.6.0-alpha.30
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/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Updated Date:
|
|
1
|
+
Updated Date: February 20, 2025
|
|
2
2
|
|
|
3
3
|
NocoBase License Agreement
|
|
4
4
|
|
|
@@ -78,7 +78,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
78
78
|
|
|
79
79
|
6.1 Obtain a permanent commercial license of the Software.
|
|
80
80
|
|
|
81
|
-
6.2 Get
|
|
81
|
+
6.2 Get software upgrades and exclusive technical support during the upgrade validity period.
|
|
82
82
|
|
|
83
83
|
6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
|
|
84
84
|
|
|
@@ -88,7 +88,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
88
88
|
|
|
89
89
|
6.6 Can sell plugins developed for Software in the Marketplace.
|
|
90
90
|
|
|
91
|
-
6.7 The User with
|
|
91
|
+
6.7 The User with an Enterprise Edition License can sell Upper Layer Application to their clients.
|
|
92
92
|
|
|
93
93
|
6.8 Not restricted by the AGPL-3.0 agreement.
|
|
94
94
|
|
|
@@ -106,13 +106,15 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
106
106
|
|
|
107
107
|
7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
|
|
108
108
|
|
|
109
|
-
7.5 It is not allowed for the User
|
|
109
|
+
7.5 It is not allowed for the User withot an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
|
|
110
110
|
|
|
111
|
-
7.6 It is not allowed to
|
|
111
|
+
7.6 It is not allowed for the User with an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
|
|
112
112
|
|
|
113
|
-
7.7
|
|
113
|
+
7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
|
|
114
114
|
|
|
115
|
-
7.8 If there
|
|
115
|
+
7.8 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
116
|
+
|
|
117
|
+
7.9 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
116
118
|
|
|
117
119
|
======================================
|
|
118
120
|
8. Rights of Commercial Plugin License
|
|
@@ -120,11 +122,11 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
|
|
|
120
122
|
|
|
121
123
|
8.1 Obtain a permanent Commercial Plugin License for the Commercial Plugin.
|
|
122
124
|
|
|
123
|
-
8.2
|
|
125
|
+
8.2 Get plugins upgrades and exclusive technical support during the upgrade validity period.
|
|
124
126
|
|
|
125
127
|
8.3 Can be used for commercial purposes without restrictions on the number of applications or users.
|
|
126
128
|
|
|
127
|
-
8.4 The User with
|
|
129
|
+
8.4 The User with an Enterprise Edition License can use the Commercial Plugin in Upper Layer Applications sold to their customers.
|
|
128
130
|
|
|
129
131
|
8.5 Not restricted by the AGPL-3.0 agreement.
|
|
130
132
|
|
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(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("@formily/react"),require("@nocobase/utils/client"),require("react-router-dom"),require("@nocobase/client"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-m2m-array",["antd","@formily/react","@nocobase/utils/client","react-router-dom","@nocobase/client","react"],t):"object"==typeof exports?exports["@nocobase/plugin-field-m2m-array"]=t(require("antd"),require("@formily/react"),require("@nocobase/utils/client"),require("react-router-dom"),require("@nocobase/client"),require("react")):e["@nocobase/plugin-field-m2m-array"]=t(e.antd,e["@formily/react"],e["@nocobase/utils/client"],e["react-router-dom"],e["@nocobase/client"],e.react)}(self,function(e,t,n,r,o,i){return function(){"use strict";var u={505:function(e){e.exports=t},772:function(e){e.exports=o},584:function(e){e.exports=n},721:function(t){t.exports=e},156:function(e){e.exports=i},128:function(e){e.exports=r}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return u[e](n,n.exports,l),n.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};l.r(c),l.d(c,{PluginM2MArrayClient:function(){return D},default:function(){return V}});var f=l("772"),s=l("584"),p="field-m2m-array";function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var h=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=m(n),y(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,v()?Reflect.construct(n,r||[],m(t).constructor):n.apply(t,r)),"name","mbm"),y(e,"type","object"),y(e,"group","relation"),y(e,"order",6),y(e,"title",(0,s.tval)("Many to many (array)",{ns:p})),y(e,"description",(0,s.tval)("Many to many (array) description",{ns:p})),y(e,"isAssociation",!0),y(e,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}),y(e,"availableTypes",["belongsToArray"]),y(e,"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.')}}"}}}}}}}}),y(e,"filterable",{nested:!0,children:[]}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(o,e),t=o,n=[{key:"schemaInitialize",value:function(e,t){t.field;var n,r=t.block,o=(t.readPretty,t.targetCollection);e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:(0,f.getUniqueKeyFromCollection)(o)},e["x-component-props"].fieldNames.label=(null===(n=e["x-component-props"].fieldNames)||void 0===n?void 0:n.label)||(null==o?void 0:o.titleField)||(0,f.getUniqueKeyFromCollection)(o),["Table","Kanban"].includes(r)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}}],d(t.prototype,n),o}(f.CollectionFieldInterface),g=l("505"),x=l("721"),w=l("156"),S=l.n(w),O=l("128"),j=function(){var e=(0,f.useRecord)(),t=e.collectionName,n=e.name,r=(0,O.useParams)().name,o=(0,f.useCollectionManager_deprecated)().getCollection,i=((0,g.useForm)().values||{}).target,u=(0,w.useMemo)(function(){var e;return null===(e=o(t||n,r))||void 0===e?void 0:e.fields},[t,r]),a=(0,w.useMemo)(function(){var e;return null===(e=o(i,r))||void 0===e?void 0:e.fields},[i,r]);return{targetKeys:(0,w.useMemo)(function(){return null==a?void 0:a.filter(function(e){return(e.primaryKey||e.unique)&&e.interface})},[a]),foreignKeys:(0,w.useMemo)(function(){return null==u?void 0:u.filter(function(e){return["set","array"].includes(e.type)&&"json"===e.interface})},[u])}};function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function C(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=(0,g.observer)(function(e){var t,n,r=e.disabled,o=P((0,w.useState)([]),2),i=o[0],u=o[1],a=(0,f.useRecord)(),l=(0,g.useField)(),c=a.type,s=a.template,p=a[l.props.name],d=(0,f.useCompile)(),y=P((0,w.useState)(p||("view"===s?null:l.initialValue)),2),m=y[0],b=y[1],v=j().foreignKeys;(0,w.useEffect)(function(){if(v){var e=v.map(function(e){var t;return{value:e.name,label:d((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name)}});if(u(e),p){var t=e.find(function(e){return e.value===p});b((null==t?void 0:t.label)||p)}}},[c]);var h="view"===s?x.Select:x.AutoComplete;return S().createElement("div",null,S().createElement(h,{disabled:r,value:m,options:i,showSearch:!0,onDropdownVisibleChange:(n=(t=function(e){var t;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(n){return(t=v)&&e&&u(t.map(function(e){var t;return{value:e.name,label:d((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name)}})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(e){C(i,r,o,u,a,"next",e)}function a(e){C(i,r,o,u,a,"throw",e)}u(void 0)})}),function(e){return n.apply(this,arguments)}),onChange:function(t,n){var r;null==e||null===(r=e.onChange)||void 0===r||r.call(e,t),b(n.label||t)}}))},{displayName:"MBMForeignKey"});function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var T=(0,g.observer)(function(e){var t,n,r=e.value,o=e.disabled,i=(0,f.useRecord)().targetKey,u=q((0,w.useState)([]),2),a=u[0],l=u[1],c=q((0,w.useState)(r||i),2),s=c[0],p=c[1],d=(0,f.useCompile)();(0,g.useField)().required=!0;var y=j().targetKeys;return(0,w.useEffect)(function(){y&&l(y.map(function(e){var t;return{value:e.name,label:d((null==e?void 0:null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.title||e.name)}}))},[y]),S().createElement("div",null,S().createElement(x.Select,{showSearch:!0,options:a,onDropdownVisibleChange:(n=(t=function(e){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(t){return y&&e&&l(y.map(function(e){var t;return{value:e.name,label:d((null==e?void 0:null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.title||e.name)}})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(e){k(i,r,o,u,a,"next",e)}function a(e){k(i,r,o,u,a,"throw",e)}u(void 0)})}),function(e){return n.apply(this,arguments)}),onChange:function(t){var n;null==e||null===(n=e.onChange)||void 0===n||n.call(e,t),p(t)},value:s,disabled:o}))},{displayName:"MBMTargetKey"});function A(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function E(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){A(i,r,o,u,a,"next",e)}function a(e){A(i,r,o,u,a,"throw",e)}u(void 0)})}}function I(e,t,n){return(I=N()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&B(o,n.prototype),o}).apply(null,arguments)}function K(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t="function"==typeof Map?new Map:void 0;return(G=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return I(e,arguments,R(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),B(r,e)})(e)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function U(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var D=function(e){var t,n,r;function o(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),e=this,t=o,n=arguments,t=R(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,N()?Reflect.construct(t,n||[],R(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(o,e),t=o,n=[{key:"afterAdd",value:function(){return E(function(){return U(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return E(function(){return U(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return E(function(){return U(this,function(t){return e.app.addComponents({MBMForeignKey:F,MBMTargetKey:T}),e.app.dataSourceManager.addFieldInterfaces([h]),[2]})})()}}],K(t.prototype,n),o}(G(f.Plugin)),V=D;return c}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/react"),require("@nocobase/utils/client"),require("react-router-dom"),require("@nocobase/client"),require("react"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-m2m-array",["@formily/react","@nocobase/utils/client","react-router-dom","@nocobase/client","react","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-field-m2m-array"]=t(require("@formily/react"),require("@nocobase/utils/client"),require("react-router-dom"),require("@nocobase/client"),require("react"),require("antd")):e["@nocobase/plugin-field-m2m-array"]=t(e["@formily/react"],e["@nocobase/utils/client"],e["react-router-dom"],e["@nocobase/client"],e.react,e.antd)}(self,function(e,t,n,r,o,i){return function(){"use strict";var u={505:function(t){t.exports=e},772:function(e){e.exports=r},584:function(e){e.exports=t},721:function(e){e.exports=i},156:function(e){e.exports=o},128:function(e){e.exports=n}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return u[e](n,n.exports,l),n.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};l.r(c),l.d(c,{PluginM2MArrayClient:function(){return D},default:function(){return V}});var f=l("772"),s=l("584"),p="field-m2m-array";function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var h=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=m(n),y(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,v()?Reflect.construct(n,r||[],m(t).constructor):n.apply(t,r)),"name","mbm"),y(e,"type","object"),y(e,"group","relation"),y(e,"order",6),y(e,"title",(0,s.tval)("Many to many (array)",{ns:p})),y(e,"description",(0,s.tval)("Many to many (array) description",{ns:p})),y(e,"isAssociation",!0),y(e,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}),y(e,"availableTypes",["belongsToArray"]),y(e,"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.')}}"}}}}}}}}),y(e,"filterable",{nested:!0,children:[]}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(o,e),t=o,n=[{key:"schemaInitialize",value:function(e,t){t.field;var n,r=t.block,o=(t.readPretty,t.targetCollection);e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].fieldNames=e["x-component-props"].fieldNames||{value:(0,f.getUniqueKeyFromCollection)(o)},e["x-component-props"].fieldNames.label=(null===(n=e["x-component-props"].fieldNames)||void 0===n?void 0:n.label)||(null==o?void 0:o.titleField)||(0,f.getUniqueKeyFromCollection)(o),["Table","Kanban"].includes(r)&&(e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}}],d(t.prototype,n),o}(f.CollectionFieldInterface),g=l("505"),x=l("721"),w=l("156"),S=l.n(w),O=l("128"),j=function(){var e=(0,f.useRecord)(),t=e.collectionName,n=e.name,r=(0,O.useParams)().name,o=(0,f.useCollectionManager_deprecated)().getCollection,i=((0,g.useForm)().values||{}).target,u=(0,w.useMemo)(function(){var e;return null===(e=o(t||n,r))||void 0===e?void 0:e.fields},[t,r]),a=(0,w.useMemo)(function(){var e;return null===(e=o(i,r))||void 0===e?void 0:e.fields},[i,r]);return{targetKeys:(0,w.useMemo)(function(){return null==a?void 0:a.filter(function(e){return(e.primaryKey||e.unique)&&e.interface})},[a]),foreignKeys:(0,w.useMemo)(function(){return null==u?void 0:u.filter(function(e){return["set","array"].includes(e.type)&&"json"===e.interface})},[u])}};function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function C(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=(0,g.observer)(function(e){var t,n,r=e.disabled,o=P((0,w.useState)([]),2),i=o[0],u=o[1],a=(0,f.useRecord)(),l=(0,g.useField)(),c=a.type,s=a.template,p=a[l.props.name],d=(0,f.useCompile)(),y=P((0,w.useState)(p||("view"===s?null:l.initialValue)),2),m=y[0],b=y[1],v=j().foreignKeys;(0,w.useEffect)(function(){if(v){var e=v.map(function(e){var t;return{value:e.name,label:d((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name)}});if(u(e),p){var t=e.find(function(e){return e.value===p});b((null==t?void 0:t.label)||p)}}},[c]);var h="view"===s?x.Select:x.AutoComplete;return S().createElement("div",null,S().createElement(h,{disabled:r,value:m,options:i,showSearch:!0,onDropdownVisibleChange:(n=(t=function(e){var t;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(n){return(t=v)&&e&&u(t.map(function(e){var t;return{value:e.name,label:d((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name)}})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(e){C(i,r,o,u,a,"next",e)}function a(e){C(i,r,o,u,a,"throw",e)}u(void 0)})}),function(e){return n.apply(this,arguments)}),onChange:function(t,n){var r;null==e||null===(r=e.onChange)||void 0===r||r.call(e,t),b(n.label||t)}}))},{displayName:"MBMForeignKey"});function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var T=(0,g.observer)(function(e){var t,n,r=e.value,o=e.disabled,i=(0,f.useRecord)().targetKey,u=q((0,w.useState)([]),2),a=u[0],l=u[1],c=q((0,w.useState)(r||i),2),s=c[0],p=c[1],d=(0,f.useCompile)();(0,g.useField)().required=!0;var y=j().targetKeys;return(0,w.useEffect)(function(){y&&l(y.map(function(e){var t;return{value:e.name,label:d((null==e?void 0:null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.title||e.name)}}))},[y]),S().createElement("div",null,S().createElement(x.Select,{showSearch:!0,options:a,onDropdownVisibleChange:(n=(t=function(e){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(t){return y&&e&&l(y.map(function(e){var t;return{value:e.name,label:d((null==e?void 0:null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.title||e.name)}})),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(e){k(i,r,o,u,a,"next",e)}function a(e){k(i,r,o,u,a,"throw",e)}u(void 0)})}),function(e){return n.apply(this,arguments)}),onChange:function(t){var n;null==e||null===(n=e.onChange)||void 0===n||n.call(e,t),p(t)},value:s,disabled:o}))},{displayName:"MBMTargetKey"});function A(e,t,n,r,o,i,u){try{var a=e[i](u),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function E(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){A(i,r,o,u,a,"next",e)}function a(e){A(i,r,o,u,a,"throw",e)}u(void 0)})}}function I(e,t,n){return(I=N()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&B(o,n.prototype),o}).apply(null,arguments)}function K(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t="function"==typeof Map?new Map:void 0;return(G=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return I(e,arguments,R(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),B(r,e)})(e)}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function U(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var D=function(e){var t,n,r;function o(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),e=this,t=o,n=arguments,t=R(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,N()?Reflect.construct(t,n||[],R(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(o,e),t=o,n=[{key:"afterAdd",value:function(){return E(function(){return U(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return E(function(){return U(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return E(function(){return U(this,function(t){return e.app.addComponents({MBMForeignKey:F,MBMTargetKey:T}),e.app.dataSourceManager.addFieldInterfaces([h]),[2]})})()}}],K(t.prototype,n),o}(G(f.Plugin)),V=D;return c}()});
|
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.6.0-alpha.
|
|
15
|
-
"react-router-dom": "6.
|
|
16
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
17
|
-
"@nocobase/database": "1.6.0-alpha.
|
|
18
|
-
"@nocobase/server": "1.6.0-alpha.
|
|
19
|
-
"@nocobase/data-source-manager": "1.6.0-alpha.
|
|
14
|
+
"@nocobase/client": "1.6.0-alpha.30",
|
|
15
|
+
"react-router-dom": "6.28.1",
|
|
16
|
+
"@nocobase/utils": "1.6.0-alpha.30",
|
|
17
|
+
"@nocobase/database": "1.6.0-alpha.30",
|
|
18
|
+
"@nocobase/server": "1.6.0-alpha.30",
|
|
19
|
+
"@nocobase/data-source-manager": "1.6.0-alpha.30"
|
|
20
20
|
};
|
|
@@ -15,7 +15,6 @@ export declare const elementTypeMap: {
|
|
|
15
15
|
export declare class BelongsToArrayField extends RelationField {
|
|
16
16
|
get dataType(): string;
|
|
17
17
|
private setForeignKeyArray;
|
|
18
|
-
init(): void;
|
|
19
18
|
checkTargetCollection(): boolean;
|
|
20
19
|
checkAssociationKeys(): void;
|
|
21
20
|
bind(): boolean;
|
|
@@ -73,16 +73,6 @@ class BelongsToArrayField extends import_database.RelationField {
|
|
|
73
73
|
tks.push(...newInstances.map((instance) => instance[targetKey]));
|
|
74
74
|
model.set(foreignKey, tks);
|
|
75
75
|
};
|
|
76
|
-
init() {
|
|
77
|
-
super.init();
|
|
78
|
-
const { name, ...opts } = this.options;
|
|
79
|
-
this.collection.model.associations[name] = new import_database.BelongsToArrayAssociation({
|
|
80
|
-
db: this.database,
|
|
81
|
-
source: this.collection.model,
|
|
82
|
-
as: name,
|
|
83
|
-
...opts
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
76
|
checkTargetCollection() {
|
|
87
77
|
const { target } = this.options;
|
|
88
78
|
if (!target) {
|
|
@@ -127,6 +117,13 @@ class BelongsToArrayField extends import_database.RelationField {
|
|
|
127
117
|
return false;
|
|
128
118
|
}
|
|
129
119
|
this.checkAssociationKeys();
|
|
120
|
+
const { name, ...opts } = this.options;
|
|
121
|
+
this.collection.model.associations[name] = new import_database.BelongsToArrayAssociation({
|
|
122
|
+
db: this.database,
|
|
123
|
+
source: this.collection.model,
|
|
124
|
+
as: name,
|
|
125
|
+
...opts
|
|
126
|
+
});
|
|
130
127
|
this.on("beforeSave", this.setForeignKeyArray);
|
|
131
128
|
}
|
|
132
129
|
unbind() {
|
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.6.0-alpha.
|
|
7
|
+
"version": "1.6.0-alpha.30",
|
|
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": "4d092cae372fada3df9b57c55705ea3b7dfa6786"
|
|
18
18
|
}
|