@nocobase/plugin-field-m2m-array 2.1.0-beta.8 → 2.2.0-alpha.1

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/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -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("react"),require("@formily/react"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-m2m-array",["react","@formily/react","@nocobase/client","@nocobase/utils/client","react-router-dom","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-field-m2m-array"]=t(require("react"),require("@formily/react"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("antd")):e["@nocobase/plugin-field-m2m-array"]=t(e.react,e["@formily/react"],e["@nocobase/client"],e["@nocobase/utils/client"],e["react-router-dom"],e.antd)}(self,function(e,t,r,n,o,i){return function(){"use strict";var a={505:function(e){e.exports=t},772:function(e){e.exports=r},584:function(e){e.exports=n},721:function(e){e.exports=i},156:function(t){t.exports=e},128:function(e){e.exports=o}},u={};function l(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return a[e](r,r.exports,l),r.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 r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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={};return!function(){l.r(c),l.d(c,{default:function(){return A},PluginM2MArrayClient:function(){return q}});var e=l(772),t=l(584),r="field-m2m-array";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(u){var l;if("function"!=typeof u&&null!==u)throw TypeError("Super expression must either be null or a function");function c(){var e,i,u;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,u=arguments,i=o(i),n(e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(i,u||[],o(this).constructor):i.apply(this,u)),"name","mbm"),n(e,"type","object"),n(e,"group","relation"),n(e,"order",6),n(e,"title",(0,t.tval)("Many to many (array)",{ns:r})),n(e,"description",(0,t.tval)("Many to many (array) description",{ns:r})),n(e,"isAssociation",!0),n(e,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}),n(e,"availableTypes",["belongsToArray"]),n(e,"validationType","object"),n(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.')}}"}}}}}}}}),n(e,"filterable",{nested:!0,children:[]}),e}return c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),u&&i(c,u),l=[{key:"schemaInitialize",value:function(t,r){r.field;var n,o=r.block,i=(r.readPretty,r.targetCollection);t["x-component-props"]=t["x-component-props"]||{},t["x-component-props"].fieldNames=t["x-component-props"].fieldNames||{value:(0,e.getUniqueKeyFromCollection)(i)},t["x-component-props"].fieldNames.label=(null==(n=t["x-component-props"].fieldNames)?void 0:n.label)||(null==i?void 0:i.titleField)||(0,e.getUniqueKeyFromCollection)(i),["Table","Kanban"].includes(o)&&(t["x-component-props"]=t["x-component-props"]||{},t["x-component-props"].ellipsis=!0,t["x-component-props"].size="small")}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(c.prototype,l),c}(e.CollectionFieldInterface),f=l(505),s=l(721),p=l(156),d=l.n(p),y=l(128),m=function(){var t=(0,e.useRecord)(),r=t.collectionName,n=t.name,o=(0,y.useParams)().name,i=(0,e.useCollectionManager_deprecated)().getCollection,a=((0,f.useForm)().values||{}).target,u=(0,p.useMemo)(function(){var e;return null==(e=i(r||n,o))?void 0:e.fields},[r,o]),l=(0,p.useMemo)(function(){var e;return null==(e=i(a,o))?void 0:e.fields},[a,o]);return{targetKeys:(0,p.useMemo)(function(){return null==l?void 0:l.filter(function(e){return(e.primaryKey||e.unique)&&e.interface})},[l]),foreignKeys:(0,p.useMemo)(function(){return null==u?void 0:u.filter(function(e){return["set","array"].includes(e.type)&&"json"===e.interface})},[u])}};function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(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 g=(0,f.observer)(function(t){var r,n,o=t.disabled,i=h((0,p.useState)([]),2),a=i[0],u=i[1],l=(0,e.useRecord)(),c=(0,f.useField)(),y=l.type,b=l.template,g=l[c.props.name],x=(0,e.useCompile)(),w=h((0,p.useState)(g||("view"===b?null:c.initialValue)),2),S=w[0],O=w[1],j=m().foreignKeys;(0,p.useEffect)(function(){if(j){var e=j.map(function(e){var t;return{value:e.name,label:x((null==(t=e.uiSchema)?void 0:t.title)||e.name)}});if(u(e),g){var t=e.find(function(e){return e.value===g});O((null==t?void 0:t.label)||g)}}},[y]);var M="view"===b?s.Select:s.AutoComplete;return d().createElement("div",null,d().createElement(M,{disabled:o,value:S,options:a,showSearch:!0,onDropdownVisibleChange:(r=function(e){var t;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var l=[i,u];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return(t=j)&&e&&u(t.map(function(e){var t;return{value:e.name,label:x((null==(t=e.uiSchema)?void 0:t.title)||e.name)}})),[2]})},n=function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){v(i,n,o,a,u,"next",e)}function u(e){v(i,n,o,a,u,"throw",e)}a(void 0)})},function(e){return n.apply(this,arguments)}),onChange:function(e,r){var n;null==t||null==(n=t.onChange)||n.call(t,e),O(r.label||e)}}))},{displayName:"MBMForeignKey"});function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(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 O=(0,f.observer)(function(t){var r,n,o=t.value,i=t.disabled,a=(0,e.useRecord)().targetKey,u=S((0,p.useState)([]),2),l=u[0],c=u[1],y=S((0,p.useState)(o||a),2),b=y[0],v=y[1],h=(0,e.useCompile)();(0,f.useField)().required=!0;var g=m().targetKeys;return(0,p.useEffect)(function(){g&&c(g.map(function(e){var t;return{value:e.name,label:h((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}}))},[g]),d().createElement("div",null,d().createElement(s.Select,{showSearch:!0,options:l,onDropdownVisibleChange:(r=function(e){return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var l=[i,u];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return g&&e&&c(g.map(function(e){var t;return{value:e.name,label:h((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}})),[2]})},n=function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){w(i,n,o,a,u,"next",e)}function u(e){w(i,n,o,a,u,"throw",e)}a(void 0)})},function(e){return n.apply(this,arguments)}),onChange:function(e){var r;null==t||null==(r=t.onChange)||r.call(t,e),v(e)},value:b,disabled:i}))},{displayName:"MBMTargetKey"});function j(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function M(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){j(i,n,o,a,u,"next",e)}function u(e){j(i,n,o,a,u,"throw",e)}a(void 0)})}}function C(e,t,r){return(C=_()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&F(o,r.prototype),o}).apply(null,arguments)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t="function"==typeof Map?new Map:void 0;return(T=function(e){if(null===e||-1===Function.toString.call(e).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 C(e,arguments,P(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),F(r,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function k(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var l=[i,u];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var q=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=P(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],P(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&F(r,e),t=[{key:"afterAdd",value:function(){return M(function(){return k(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return M(function(){return k(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return M(function(){return k(this,function(t){return e.app.addComponents({MBMForeignKey:g,MBMTargetKey:O}),e.app.dataSourceManager.addFieldInterfaces([u]),[2]})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(T(e.Plugin)),A=q}(),c}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("@nocobase/client"),require("@formily/react"),require("react"),require("react-router-dom"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-m2m-array",["antd","@nocobase/client","@formily/react","react","react-router-dom","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-field-m2m-array"]=t(require("antd"),require("@nocobase/client"),require("@formily/react"),require("react"),require("react-router-dom"),require("@nocobase/utils/client")):e["@nocobase/plugin-field-m2m-array"]=t(e.antd,e["@nocobase/client"],e["@formily/react"],e.react,e["react-router-dom"],e["@nocobase/utils/client"])}(self,function(e,t,r,n,o,i){return function(){"use strict";var a={230:function(e){e.exports=r},342:function(e){e.exports=t},768:function(e){e.exports=i},59:function(t){t.exports=e},155:function(e){e.exports=n},442:function(e){e.exports=o}},u={};function l(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return a[e](r,r.exports,l),r.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 r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.g.importScripts&&(c=l.g.location+"");var c,p=l.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var s=p.getElementsByTagName("script");if(s.length)for(var f=s.length-1;f>-1&&(!c||!/^http(s?):/.test(c));)c=s[f--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");l.p=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-m2m-array/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",o="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",a=i.indexOf(o);e=a>=0?i.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-m2m-array/dist/client/"}l.p=e}(),!function(){l.r(d),l.d(d,{PluginM2MArrayClient:function(){return A},default:function(){return k}});var e=l(342),t=l(768),r="field-m2m-array";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(u){var l;if("function"!=typeof u&&null!==u)throw TypeError("Super expression must either be null or a function");function c(){var e,i,u;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,u=arguments,i=o(i),n(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(i,u||[],o(this).constructor):i.apply(this,u)),"name","mbm"),n(e,"type","object"),n(e,"group","relation"),n(e,"order",6),n(e,"title",(0,t.tval)("Many to many (array)",{ns:r})),n(e,"description",(0,t.tval)("Many to many (array) description",{ns:r})),n(e,"isAssociation",!0),n(e,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}),n(e,"availableTypes",["belongsToArray"]),n(e,"validationType","object"),n(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.')}}"}}}}}}}}),n(e,"filterable",{nested:!0,children:[]}),e}return c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),u&&i(c,u),l=[{key:"schemaInitialize",value:function(t,r){r.field;var n,o=r.block,i=(r.readPretty,r.targetCollection);t["x-component-props"]=t["x-component-props"]||{},t["x-component-props"].fieldNames=t["x-component-props"].fieldNames||{value:(0,e.getUniqueKeyFromCollection)(i)},t["x-component-props"].fieldNames.label=(null==(n=t["x-component-props"].fieldNames)?void 0:n.label)||(null==i?void 0:i.titleField)||(0,e.getUniqueKeyFromCollection)(i),["Table","Kanban"].includes(o)&&(t["x-component-props"]=t["x-component-props"]||{},t["x-component-props"].ellipsis=!0,t["x-component-props"].size="small")}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(c.prototype,l),c}(e.CollectionFieldInterface),c=l(230),p=l(59),s=l(155),f=l.n(s),y=l(442),b=function(){var t=(0,e.useRecord)(),r=t.collectionName,n=t.name,o=(0,y.useParams)().name,i=(0,e.useCollectionManager_deprecated)().getCollection,a=((0,c.useForm)().values||{}).target,u=(0,s.useMemo)(function(){var e;return null==(e=i(r||n,o))?void 0:e.fields},[r,o]),l=(0,s.useMemo)(function(){var e;return null==(e=i(a,o))?void 0:e.fields},[a,o]);return{targetKeys:(0,s.useMemo)(function(){return null==l?void 0:l.filter(function(e){return(e.primaryKey||e.unique)&&e.interface})},[l]),foreignKeys:(0,s.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 r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))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 g=(0,c.observer)(function(t){var r=t.disabled,n=h((0,s.useState)([]),2),o=n[0],i=n[1],a=(0,e.useRecord)(),u=(0,c.useField)(),l=a.type,d=a.template,y=a[u.props.name],m=(0,e.useCompile)(),g=h((0,s.useState)(y||("view"===d?null:u.initialValue)),2),w=g[0],x=g[1],S=b().foreignKeys;(0,s.useEffect)(function(){if(S){var e=S.map(function(e){var t;return{value:e.name,label:m((null==(t=e.uiSchema)?void 0:t.title)||e.name)}});if(i(e),y){var t=e.find(function(e){return e.value===y});x((null==t?void 0:t.label)||y)}}},[l]);var O="view"===d?p.Select:p.AutoComplete;return f().createElement("div",null,f().createElement(O,{disabled:r,value:w,options:o,showSearch:!0,onDropdownVisibleChange:function(e){var t;return(t=function(){var t;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){return(t=S)&&e&&i(t.map(function(e){var t;return{value:e.name,label:m((null==(t=e.uiSchema)?void 0:t.title)||e.name)}})),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){v(i,n,o,a,u,"next",e)}function u(e){v(i,n,o,a,u,"throw",e)}a(void 0)})})()},onChange:function(e,r){var n;null==t||null==(n=t.onChange)||n.call(t,e),x(r.label||e)}}))},{displayName:"MBMForeignKey"});function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function x(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(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 O=(0,c.observer)(function(t){var r=t.value,n=t.disabled,o=(0,e.useRecord)().targetKey,i=S((0,s.useState)([]),2),a=i[0],u=i[1],l=S((0,s.useState)(r||o),2),d=l[0],y=l[1],m=(0,e.useCompile)();(0,c.useField)().required=!0;var v=b().targetKeys;return(0,s.useEffect)(function(){v&&u(v.map(function(e){var t;return{value:e.name,label:m((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}}))},[v]),f().createElement("div",null,f().createElement(p.Select,{showSearch:!0,options:a,onDropdownVisibleChange:function(e){var t;return(t=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){return v&&e&&u(v.map(function(e){var t;return{value:e.name,label:m((null==e||null==(t=e.uiSchema)?void 0:t.title)||e.title||e.name)}})),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){x(i,n,o,a,u,"next",e)}function u(e){x(i,n,o,a,u,"throw",e)}a(void 0)})})()},onChange:function(e){var r;null==t||null==(r=t.onChange)||r.call(t,e),y(e)},value:d,disabled:n}))},{displayName:"MBMTargetKey"});function j(e,t,r,n,o,i,a){try{var u=e[i](a),l=u.value}catch(e){r(e);return}u.done?t(l):Promise.resolve(l).then(n,o)}function _(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){j(i,n,o,a,u,"next",e)}function u(e){j(i,n,o,a,u,"throw",e)}a(void 0)})}}function P(e,t,r){return(P=F()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&M(o,r.prototype),o}).apply(null,arguments)}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t="function"==typeof Map?new Map:void 0;return(T=function(e){if(null===e||-1===Function.toString.call(e).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 P(e,arguments,C(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),M(r,e)})(e)}function F(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(F=function(){return!!e})()}function I(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var A=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=C(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,F()?Reflect.construct(e,t||[],C(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&M(r,e),t=[{key:"afterAdd",value:function(){return _(function(){return I(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return _(function(){return I(this,function(e){return[2]})})()}},{key:"load",value:function(){return _(function(){return I(this,function(e){return this.app.addComponents({MBMForeignKey:g,MBMTargetKey:O}),this.app.dataSourceManager.addFieldInterfaces([u]),[2]})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(T(e.Plugin)),k=A}(),d}()});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FieldConfigurePropertyComponentProps } from '@nocobase/client-v2';
10
+ import React from 'react';
11
+ export declare function ForeignKeyConfigureField(props: FieldConfigurePropertyComponentProps): React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { ReactNode } from 'react';
10
+ type TFunction = (key: string, options?: Record<string, unknown>) => string;
11
+ export declare function compileLegacyTemplate(value: ReactNode, t: TFunction): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
12
+ export declare function getFieldTitle(field: Record<string, unknown>, t: TFunction): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { default } from './plugin';
10
+ export * from './interface';
11
+ export * from './plugin';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("antd"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-m2m-array/client-v2",["react","antd","@nocobase/client-v2","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-field-m2m-array/client-v2"]=t(require("react"),require("antd"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):e["@nocobase/plugin-field-m2m-array/client-v2"]=t(e.react,e.antd,e["@nocobase/client-v2"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n){return function(){"use strict";var o={485:function(e){e.exports=r},694:function(e){e.exports=n},59:function(e){e.exports=t},155:function(t){t.exports=e}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(a=c.g.location+"");var a,u=c.g.document;if(!a&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(a=u.currentScript.src),!a)){var l=u.getElementsByTagName("script");if(l.length)for(var f=l.length-1;f>-1&&(!a||!/^http(s?):/.test(a));)a=l[f--].src}if(!a)throw Error("Automatic publicPath is not supported in this browser");c.p=a.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-m2m-array/dist/client-v2/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",o="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",a=i.indexOf(o);e=a>=0?i.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-m2m-array/dist/client-v2/"}c.p=e}(),!function(){c.r(p),c.d(p,{PluginM2MArrayClient:function(){return P},MBMFieldInterface:function(){return m},default:function(){return _}});var e=c(485),t=c(59),r=c(155),n=c.n(r),o=c(694),i="@nocobase/plugin-field-m2m-array";function a(e){return(0,o.tExpr)(e,{ns:[i,"client"]})}var u=/^\s*\{\{\s*t\s*\(\s*(['"])(.*?)\1(?:\s*,[\s\S]*?)?\)\s*\}\}\s*$/;function l(e){return["set","array"].includes(String(e.type))&&"json"===e.interface}function f(e){var c,a,f,p,s,b=(f=(0,o.useFlowEngine)(),function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return f.context.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},n),r=r={ns:[i,"client"]},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t))}),y=t.Form.useWatch("template",e.form),d=e.componentProps||{},m=(0,r.useMemo)(function(){var t;return((null==(t=e.collection)?void 0:t.fields)||[]).filter(l).map(function(e){return{value:String(e.name),label:function(e,t){var r=e.uiSchema,n=(null==r?void 0:r.title)||e.title||e.name;if("string"!=typeof n)return n;var o=n.match(u);return(null==o?void 0:o[2])?t(o[2]):n}(e,b)}})},[null==(p=e.collection)?void 0:p.fields,b]),v="view"===y?t.Select:t.AutoComplete;return n().createElement(t.Form.Item,{name:e.namePath,label:e.title,tooltip:e.tooltip,rules:(null==(s=e.schema)?void 0:s.required)?[{required:!0}]:void 0},n().createElement(v,(c=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},d),a=a={disabled:e.disabled,options:m,showSearch:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(a)).forEach(function(e){Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(a,e))}),c)))}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}var m=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,r,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return r=t,n=arguments,r=b(r),s(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,d()?Reflect.construct(r,n||[],b(this).constructor):r.apply(this,n)),"name","mbm"),s(e,"type","object"),s(e,"group","relation"),s(e,"order",6),s(e,"title",a("Many to many (array)")),s(e,"description",a("Many to many (array) description")),s(e,"isAssociation",!0),s(e,"default",{type:"belongsToArray",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!0}}}),s(e,"availableTypes",["belongsToArray"]),s(e,"validationType","object"),s(e,"configure",{items:[{name:"source",title:'{{t("Source collection")}}',component:"SourceCollection",layout:{row:"collections",column:"source",span:12}},{name:"target",title:'{{t("Target collection")}}',component:"Select",required:!0,disabled:"{{ !createOnly }}",layout:{row:"collections",column:"target",span:12}},{name:"foreignKey",title:'{{t("Foreign key")}}',Component:f,required:!0,defaultValue:'{{ useNewId("f_") }}',description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",disabled:"{{ !createOnly }}",layout:{row:"keys",column:"foreignKey",span:12}},{name:"targetKey",title:'{{t("Target key")}}',component:"TargetKey",required:!0,description:"{{t('Field values must be unique.')}}",disabled:"{{ !createOnly }}",layout:{row:"keys",column:"targetKey",span:12}}]}),s(e,"filterable",{nested:!0,children:[]}),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e),t}(e.CollectionFieldInterface);function v(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){r(e);return}a.done?t(u):Promise.resolve(u).then(n,o)}function g(e,t,r){return(g=j()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&O(o,r.prototype),o}).apply(null,arguments)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).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 g(e,arguments,h(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),O(r,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}var P=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=h(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(e,t||[],h(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&O(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces([m]),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){v(i,n,o,c,a,"next",e)}function a(e){v(i,n,o,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(w(e.Plugin)),_=P}(),p}()});
@@ -0,0 +1,34 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { CollectionFieldInterface, type FieldInterfaceConfigure } from '@nocobase/client-v2';
10
+ export declare class MBMFieldInterface extends CollectionFieldInterface {
11
+ name: string;
12
+ type: string;
13
+ group: string;
14
+ order: number;
15
+ title: string;
16
+ description: string;
17
+ isAssociation: boolean;
18
+ default: {
19
+ type: string;
20
+ uiSchema: {
21
+ 'x-component': string;
22
+ 'x-component-props': {
23
+ multiple: boolean;
24
+ };
25
+ };
26
+ };
27
+ availableTypes: string[];
28
+ validationType: string;
29
+ configure: FieldInterfaceConfigure;
30
+ filterable: {
31
+ nested: boolean;
32
+ children: any[];
33
+ };
34
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare function useT(): (str: string, options?: {}) => string;
10
+ export declare function tExpr(key: string): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application, Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginM2MArrayClient extends Plugin<unknown, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginM2MArrayClient;
@@ -11,11 +11,13 @@ module.exports = {
11
11
  "@formily/react": "2.3.7",
12
12
  "antd": "5.24.2",
13
13
  "react": "18.2.0",
14
- "@nocobase/client": "2.1.0-beta.8",
14
+ "@nocobase/client": "2.2.0-alpha.1",
15
15
  "react-router-dom": "6.30.1",
16
- "@nocobase/utils": "2.1.0-beta.8",
17
- "@nocobase/database": "2.1.0-beta.8",
18
- "lodash": "4.17.21",
19
- "@nocobase/server": "2.1.0-beta.8",
20
- "@nocobase/data-source-manager": "2.1.0-beta.8"
16
+ "@nocobase/utils": "2.2.0-alpha.1",
17
+ "@nocobase/client-v2": "2.2.0-alpha.1",
18
+ "@nocobase/flow-engine": "2.2.0-alpha.1",
19
+ "@nocobase/database": "2.2.0-alpha.1",
20
+ "lodash": "4.18.1",
21
+ "@nocobase/server": "2.2.0-alpha.1",
22
+ "@nocobase/data-source-manager": "2.2.0-alpha.1"
21
23
  };
package/package.json CHANGED
@@ -6,10 +6,11 @@
6
6
  "description": "Allows to create many to many relationships between two models by storing an array of unique keys of the target model.",
7
7
  "description.ru-RU": "Позволяет создавать отношения «многие ко многим» между двумя моделями, сохраняя массив уникальных ключей целевой модели.",
8
8
  "description.zh-CN": "支持通过在数组中存储目标表唯一键的方式建立多对多关系。",
9
- "version": "2.1.0-beta.8",
9
+ "version": "2.2.0-alpha.1",
10
10
  "main": "dist/server/index.js",
11
11
  "peerDependencies": {
12
12
  "@nocobase/client": "2.x",
13
+ "@nocobase/client-v2": "2.x",
13
14
  "@nocobase/server": "2.x",
14
15
  "@nocobase/test": "2.x"
15
16
  },
@@ -17,5 +18,5 @@
17
18
  "Collection fields"
18
19
  ],
19
20
  "license": "Apache-2.0",
20
- "gitHead": "5099d561c5467292414c1e77ad6bad3730d97344"
21
+ "gitHead": "303663aba6c6eefa27e6a6435b4c0352074ec40f"
21
22
  }