@nocobase/plugin-field-attachment-url 2.1.0-beta.37 → 2.1.0-beta.40

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.
@@ -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("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url/client-v2",["@emotion/css","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2","@formily/antd-v5","react","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url/client-v2"]=t(require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url/client-v2"]=t(e["@emotion/css"],e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"],e["@formily/antd-v5"],e.react,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,a,c,l){return function(){"use strict";var u={724:function(e,t,n){n.r(t),n.d(t,{AttachmentURLFieldModel:function(){return w}});var r=n(375),o=n(477),i=n(418),a=n(230),c=n(694),l=n(936),u=n(773),s=n(155),p=n.n(s),f=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}');function b(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 y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function g(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var O=function(e){var t,n=e.showFileName,c=e.value,l=e.onChange,f=(0,a.useField)(),y=function(e){if(Array.isArray(e))return e}(t=(0,s.useState)((0,u.castArray)(c||[]).map(function(e){return{url:e}})))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return b(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,2)}}(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.")}(),v=y[0],h=y[1];return(0,s.useEffect)(function(){h((0,u.castArray)(c||[]).map(function(e){return{url:e}}))},[c]),p().createElement(a.FieldContext.Provider,{value:m(d({},f),{value:v})},p().createElement("div",{style:{display:"flex"},className:(0,o.css)(g(),n?"8px 0px":"0px",n?"8px 0px":"0px")},p().createElement(i.Upload,m(d({},e),{listType:"picture-card",fileList:v,onChange:function(e){h(e);var t=e[0];if(!t){null==l||l(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==l||l(r)}else"removed"===t.status&&(null==l||l(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return p().createElement(p().Fragment,null,e,n&&p().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),p().createElement(r.UploadOutlined,{style:{fontSize:20}}))))},w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=y(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(e,t||[],y(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&v(n,e),t=[{key:"render",value:function(){return p().createElement(O,this.props)}}],function(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)}}(n.prototype,t),n}(l.UploadFieldModel);w.define({label:(0,c.tExpr)("AttachmentURL",{ns:[f.UU,"client"]})}),c.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),c.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0})},375:function(e){e.exports=a},477:function(t){t.exports=e},418:function(e){e.exports=r},230:function(e){e.exports=i},485:function(e){e.exports=n},694:function(e){e.exports=c},936:function(e){e.exports=t},773:function(e){e.exports=l},155:function(e){e.exports=o}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return u[e](n,n.exports,p),n.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(f=p.g.location+"");var f,b=p.g.document;if(!f&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(f=b.currentScript.src),!f)){var y=b.getElementsByTagName("script");if(y.length)for(var d=y.length-1;d>-1&&(!f||!/^http(s?):/.test(f));)f=y[d--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");p.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var m={};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 n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/"}p.p=e}(),!function(){p.r(m),p.d(m,{AttachmentURLFieldInterface:function(){return l},default:function(){return g},PluginFieldAttachmentUrlClient:function(){return h},AttachmentURLFieldModel:function(){return u.AttachmentURLFieldModel}});var e=p(485),t=p(230);function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return(r=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 i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}var a=[{label:'{{t("contains")}}',value:"$includes",selected:!0,schema:{type:"string","x-component":"Input"}},{label:'{{t("does not contain")}}',value:"$notIncludes",schema:{type:"string","x-component":"Input"}},{label:'{{t("is")}}',value:"$eq",schema:{type:"string","x-component":"Input"}},{label:'{{t("is not")}}',value:"$ne",schema:{type:"string","x-component":"Input"}},{label:'{{t("is empty")}}',value:"$empty",noValue:!0,schema:{type:"string","x-component":"Input"}},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0,schema:{type:"string","x-component":"Input"}}],c=function(){var e=(0,t.useField)();return{service:{resource:"collections:listFileCollectionsWithPublicStorage",params:{paginate:!1}},manual:!1,fieldNames:{label:"title",value:"name"},onSuccess:function(t){e.data=e.data||{},e.data.options=null==t?void 0:t.data}}},l=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function l(){var e,t,o;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return t=l,o=arguments,t=r(t),n(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,i()?Reflect.construct(t,o||[],r(this).constructor):t.apply(this,o)),"name","attachmentURL"),n(e,"type","object"),n(e,"group","media"),n(e,"title",'{{t("Attachment (URL)")}}'),n(e,"default",{interface:"attachmentURL",type:"string",uiSchema:{type:"string","x-component":"Input"}}),n(e,"availableTypes",["string","text"]),n(e,"validationType","string"),n(e,"availableValidationOptions",["min","max","length","pattern"]),n(e,"properties",{target:{required:!0,type:"string",title:'{{t("Which file collection should it be uploaded to")}}',"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":c,"x-reactions":function(e){var t;((null==(t=e.data)?void 0:t.options)||[]).some(function(e){return(null==e?void 0:e.name)==="attachments"})&&!e.initialValue&&e.setInitialValue("attachments")}},targetKey:{type:"string",default:"id","x-hidden":!0}}),n(e,"filterable",{nested:!0,operators:a}),n(e,"titleUsable",!0),e}return l.prototype=Object.create(e&&e.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),e&&o(l,e),t=[{key:"schemaInitialize",value:function(e,t){var n=t.block;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].mode="AttachmentUrl",["Table","Kanban"].includes(n)&&(e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}}],function(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)}}(l.prototype,t),l}(e.CollectionFieldInterface),u=p(724);function s(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function f(e,t,n){return(f=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}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(e){var t="function"==typeof Map?new Map:void 0;return(d=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,n)}function n(){return f(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}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;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=b(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(e,t||[],b(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&y(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,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),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces([l]),this.flowEngine.registerModelLoaders({AttachmentURLFieldModel:{loader:function(){return Promise.resolve().then(p.bind(p,724))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){s(i,r,o,a,c,"next",e)}function c(e){s(i,r,o,a,c,"throw",e)}a(void 0)})}).call(this)}}],function(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)}}(n.prototype,t),n}(d(e.Plugin)),g=h}(),m}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url/client-v2",["@emotion/css","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2","@formily/antd-v5","react","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url/client-v2"]=t(require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url/client-v2"]=t(e["@emotion/css"],e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"],e["@formily/antd-v5"],e.react,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,c,a,l){return function(){"use strict";var u={724:function(e,t,n){n.r(t),n.d(t,{AttachmentURLFieldModel:function(){return w}});var r=n(375),o=n(477),i=n(418),c=n(230),a=n(694),l=n(936),u=n(773),f=n(155),s=n.n(f),p=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}');function b(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 y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function m(e,t){return(m=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})()}function g(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var O=function(e){var t,n=e.showFileName,a=e.value,l=e.onChange,p=(0,c.useField)(),y=function(e){if(Array.isArray(e))return e}(t=(0,f.useState)((0,u.castArray)(a||[]).map(function(e){return{url:e}})))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return b(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,2)}}(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.")}(),m=y[0],v=y[1];return(0,f.useEffect)(function(){v((0,u.castArray)(a||[]).map(function(e){return{url:e}}))},[a]),s().createElement(c.FieldContext.Provider,{value:h(d({},p),{value:m})},s().createElement("div",{style:{display:"flex"},className:(0,o.css)(g(),n?"8px 0px":"0px",n?"8px 0px":"0px")},s().createElement(i.Upload,h(d({},e),{listType:"picture-card",fileList:m,onChange:function(e){v(e);var t=e[0];if(!t){null==l||l(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==l||l(r)}else"removed"===t.status&&(null==l||l(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return s().createElement(s().Fragment,null,e,n&&s().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),s().createElement(r.UploadOutlined,{style:{fontSize:20}}))))},w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=y(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(e,t||[],y(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&m(n,e),t=[{key:"render",value:function(){return s().createElement(O,this.props)}}],function(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)}}(n.prototype,t),n}(l.UploadFieldModel);w.define({label:(0,a.tExpr)("AttachmentURL",{ns:[p.UU,"client"]})}),a.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),a.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0})},375:function(e){e.exports=c},477:function(t){t.exports=e},418:function(e){e.exports=r},230:function(e){e.exports=i},485:function(e){e.exports=n},694:function(e){e.exports=a},936:function(e){e.exports=t},773:function(e){e.exports=l},155:function(e){e.exports=o}},f={};function s(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return u[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var p,b=s.g.document;if(!p&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(p=b.currentScript.src),!p)){var y=b.getElementsByTagName("script");if(y.length)for(var d=y.length-1;d>-1&&(!p||!/^http(s?):/.test(p));)p=y[d--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var h={};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 n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/"}s.p=e}(),!function(){s.r(h),s.d(h,{AttachmentURLFieldInterface:function(){return i},default:function(){return d},PluginFieldAttachmentUrlClient:function(){return y},AttachmentURLFieldModel:function(){return c.AttachmentURLFieldModel}});var e=s(485);function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o=function(){return!!e})()}var i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,r,c;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return r=i,c=arguments,r=n(r),t(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,o()?Reflect.construct(r,c||[],n(this).constructor):r.apply(this,c)),"name","attachmentURL"),t(e,"type","object"),t(e,"group","media"),t(e,"title",'{{t("Attachment (URL)")}}'),t(e,"default",{interface:"attachmentURL",type:"string",uiSchema:{type:"string","x-component":"Input"}}),t(e,"availableTypes",["string","text"]),t(e,"validationType","string"),t(e,"availableValidationOptions",["min","max","length","pattern"]),t(e,"configure",{items:[{name:"target",title:'{{t("Which file collection should it be uploaded to")}}',component:"Select",required:!0,defaultValue:"attachments",schema:{enum:"{{fileCollections}}"}},{name:"targetKey",defaultValue:"id",hidden:!0}]}),t(e,"filterable",{operators:"bigField",nested:!0}),t(e,"titleUsable",!0),e}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&r(i,e),i}(e.CollectionFieldInterface),c=s(724);function a(e,t,n,r,o,i,c){try{var a=e[i](c),l=a.value}catch(e){n(e);return}a.done?t(l):Promise.resolve(l).then(r,o)}function l(e,t,n){return(l=b()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&f(o,n.prototype),o}).apply(null,arguments)}function u(e){return(u=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 p(e){var t="function"==typeof Map?new Map:void 0;return(p=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,n)}function n(){return l(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,e)})(e)}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}var y=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=u(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,b()?Reflect.construct(e,t||[],u(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&f(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,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:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces([i]),this.flowEngine.registerModelLoaders({AttachmentURLFieldModel:{loader:function(){return Promise.resolve().then(s.bind(s,724))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){a(i,r,o,c,l,"next",e)}function l(e){a(i,r,o,c,l,"throw",e)}c(void 0)})}).call(this)}}],function(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)}}(n.prototype,t),n}(p(e.Plugin)),d=y}(),h}()});
@@ -6,7 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import type { ISchema } from '@formily/react';
10
9
  import { CollectionFieldInterface } from '@nocobase/client-v2';
11
10
  export declare class AttachmentURLFieldInterface extends CollectionFieldInterface {
12
11
  name: string;
@@ -24,68 +23,30 @@ export declare class AttachmentURLFieldInterface extends CollectionFieldInterfac
24
23
  availableTypes: string[];
25
24
  validationType: string;
26
25
  availableValidationOptions: string[];
27
- properties: {
28
- target: {
29
- required: boolean;
30
- type: string;
26
+ configure: {
27
+ items: ({
28
+ name: string;
31
29
  title: string;
32
- 'x-decorator': string;
33
- 'x-component': string;
34
- 'x-use-component-props': () => {
35
- service: {
36
- resource: string;
37
- params: {
38
- paginate: boolean;
39
- };
40
- };
41
- manual: boolean;
42
- fieldNames: {
43
- label: string;
44
- value: string;
45
- };
46
- onSuccess: (data: any) => void;
47
- };
48
- 'x-reactions': (field: any) => void;
49
- };
50
- targetKey: {
51
- type: string;
52
- default: string;
53
- 'x-hidden': boolean;
54
- };
55
- };
56
- filterable: {
57
- nested: boolean;
58
- operators: ({
59
- label: string;
60
- value: string;
61
- selected: boolean;
62
- schema: {
63
- type: string;
64
- 'x-component': string;
65
- };
66
- noValue?: undefined;
67
- } | {
68
- label: string;
69
- value: string;
30
+ component: string;
31
+ required: boolean;
32
+ defaultValue: string;
70
33
  schema: {
71
- type: string;
72
- 'x-component': string;
34
+ enum: string;
73
35
  };
74
- selected?: undefined;
75
- noValue?: undefined;
36
+ hidden?: undefined;
76
37
  } | {
77
- label: string;
78
- value: string;
79
- noValue: boolean;
80
- schema: {
81
- type: string;
82
- 'x-component': string;
83
- };
84
- selected?: undefined;
38
+ name: string;
39
+ defaultValue: string;
40
+ hidden: boolean;
41
+ title?: undefined;
42
+ component?: undefined;
43
+ required?: undefined;
44
+ schema?: undefined;
85
45
  })[];
86
46
  };
47
+ filterable: {
48
+ operators: string;
49
+ nested: boolean;
50
+ };
87
51
  titleUsable: boolean;
88
- schemaInitialize(schema: ISchema, { block }: {
89
- block: any;
90
- }): void;
91
52
  }
@@ -8,18 +8,18 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.37",
11
+ "@nocobase/client": "2.1.0-beta.40",
12
12
  "react-i18next": "11.18.6",
13
13
  "@ant-design/icons": "5.6.1",
14
14
  "@emotion/css": "11.13.0",
15
15
  "@formily/antd-v5": "1.2.3",
16
16
  "@formily/react": "2.3.7",
17
- "@nocobase/flow-engine": "2.1.0-beta.37",
18
- "@nocobase/plugin-file-manager": "2.1.0-beta.37",
17
+ "@nocobase/flow-engine": "2.1.0-beta.40",
18
+ "@nocobase/plugin-file-manager": "2.1.0-beta.40",
19
19
  "lodash": "4.18.1",
20
20
  "react": "18.2.0",
21
- "@nocobase/client-v2": "2.1.0-beta.37",
22
- "@nocobase/server": "2.1.0-beta.37",
23
- "@nocobase/test": "2.1.0-beta.37",
21
+ "@nocobase/client-v2": "2.1.0-beta.40",
22
+ "@nocobase/server": "2.1.0-beta.40",
23
+ "@nocobase/test": "2.1.0-beta.40",
24
24
  "@formily/core": "2.3.7"
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-attachment-url",
3
- "version": "2.1.0-beta.37",
3
+ "version": "2.1.0-beta.40",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Collection field: Attachment(URL)",
6
6
  "displayName.ru-RU": "Поле коллекции: Вложение (URL)",
@@ -19,5 +19,5 @@
19
19
  "Collection fields"
20
20
  ],
21
21
  "license": "Apache-2.0",
22
- "gitHead": "7132e5b83ecc0e42b54715eaf1429c72bcef34ae"
22
+ "gitHead": "36e906138f6305723abbef676a61006058feb5ea"
23
23
  }