@nocobase/plugin-field-attachment-url 2.4.0-alpha.6 → 2.4.0-alpha.7

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("react-i18next"),require("@nocobase/plugin-file-manager/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@nocobase/plugin-file-manager/client-v2","@emotion/css","@formily/antd-v5","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@nocobase/plugin-file-manager/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@nocobase/plugin-file-manager/client-v2"],e["@emotion/css"],e["@formily/antd-v5"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,u,c,l,a){return function(){"use strict";var s,p,f,d={233:function(e,t,n){n.d(t,{S8:function(){return y},uF:function(){return h},uR:function(){return v}});var r=n(230),o=n(342),i=n(936),u=n(773),c=n(155),l=n(953);function a(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 s(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}var p=function(e){return!!e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&!Array.isArray(e)},f=function(e){if(!p(e))return null;var t=p(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},d=function(e,t){var n,r,u,c="string"==typeof e.preview?e.preview:(0,i.getPermanentFilePreviewUrl)(t),l="string"==typeof e.mimetype?e.mimetype:void 0,p=(0,o.matchMimetype)(s(a({},e),{uid:String(null!=(n=e.id)?n:t),name:"string"==typeof e.filename?e.filename:t,url:t}),"image/*");return a(s(a({},e,l?{type:l}:{}),{uid:null!=(r=e.id)?r:t,id:null!=(u=e.id)?u:t,url:t}),p&&c?{preview:c,thumbUrl:c}:{})},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;if("string"==typeof e){var n=t.get(e);if(n)return d(n,e);var r=(0,i.getPermanentFilePreviewUrl)(e);if(!r)return e;var u=(0,o.matchMimetype)({uid:e,name:e,url:e},"image/*");return a({uid:e,id:e,url:e},u&&r?{preview:r,thumbUrl:r}:{})}return e},b=function(e){var t=f(e);if(t){var n=t.thumbnailRule?"".concat(t.url).concat(t.thumbnailRule):t.url;if("string"==typeof n)return n}};function y(e){var t,n,r,u,l,p,d=(0,o.useCollectionField)(),y=(0,o.useDataSourceKey)(),v=(n=null!=(t=null==d?void 0:d.storage)?t:"",u=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,l=r.data,!u&&(null==l?void 0:l.data)||null),h=(0,c.useRef)(new Map);return s(a({},e),{value:m(e.value,h.current),rules:v,action:"".concat(d.target,":create").concat(d.storage?"?attachmentField=".concat(d.collectionName,".").concat(d.name):""),fileCollection:(p=null==d?void 0:d.target,p?{dataSourceKey:y||"main",collectionName:p}:void 0),toValueItem:function(e){var t=b(e),n=f(e);return t&&n&&h.current.set(t,n),t},getThumbnailURL:function(e){return(null==e?void 0:e.thumbUrl)||(null==e?void 0:e.preview)||(0,i.getPermanentFilePreviewUrl)(null==e?void 0:e.url)||(null==e?void 0:e.url)}})}var v=function(e){var t=(0,r.useFieldSchema)(),n=(0,o.useDesignable)().insertAfterBegin;return(0,c.useCallback)(function(r){t.reduceProperties(function(t,n){return n["x-component"]==="AssociationField."+e?n:t},null)||n((0,u.cloneDeep)(r))},[e,t,n])},h=function(){(0,l.useTranslation)().t;var e=(0,r.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}}}},375:function(e){e.exports=c},477:function(e){e.exports=n},418:function(e){e.exports=r},230:function(e){e.exports=u},342:function(e){e.exports=i},694:function(e){e.exports=l},936:function(e){e.exports=t},773:function(e){e.exports=a},155:function(e){e.exports=o},953:function(t){t.exports=e}},m={};function b(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return d[e](n,n.exports,b),n.exports}b.m=d,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+".aca7595ba197ec73.js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},b.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),y[e]=[t];var a=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(a.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=a.bind(null,o.onerror),o.onload=a.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(v=b.g.location+"");var y,v,h=b.g.document;if(!v&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(v=h.currentScript.src),!v)){var g=h.getElementsByTagName("script");if(g.length)for(var O=g.length-1;O>-1&&(!v||!/^http(s?):/.test(v));)v=g[O--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");b.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},b.f.j=function(e,t){var n=b.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);u&&u(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(f=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(p.bind(null,0)),f.push=p.bind(null,f.push.bind(f));var w={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-field-attachment-url/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-attachment-url/dist/client/"}b.p=e}(),!function(){b.r(w),b.d(w,{default:function(){return Z},PluginFieldAttachmentUrlClient:function(){return Y},AttachmentURLFieldModel:function(){return N}});var e,t,n=b(342),r=b(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=b(953);function u(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.UU,"', 'client'], nsMode: 'fallback' })}}")}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var p=n.interfacesProperties.defaultProps,f=n.interfacesProperties.operators,d=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,o,i,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=l(t),c(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,s()?Reflect.construct(t,o||[],l(this).constructor):t.apply(this,o)),"name","attachmentURL"),c(e,"type","object"),c(e,"group","media"),c(e,"title",u("Attachment (URL)")),c(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),c(e,"availableTypes",["string","text"]),c(e,"properties",(i=function(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){c(e,t,n[t])})}return e}({},p),a=a={target:{required:!0,type:"string",title:u("Which file collection should it be uploaded to"),"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":r.uF,"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:{"x-hidden":!0,default:"id",type:"string"}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i)),c(e,"filterable",{nested:!0,operators:f.bigField}),c(e,"titleUsable",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&a(n,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)}}(n.prototype,t),n}(n.CollectionFieldInterface),m=b(375),y=b(477),v=b(418),h=b(230),g=b(694),O=b(936),P=b(773),j=b(155),x=b.n(j);function S(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 _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(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 U(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 k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{u||null==o.return||o.return()}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(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 S(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.")}()}function C(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}function R(){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 R=function(){return n},n}var T=function(e){return!!e&&(void 0===e?"undefined":C(e))==="object"&&!Array.isArray(e)},q=function(e){if(!T(e))return null;var t=T(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},D=function(e){if("string"==typeof e){var t=(0,O.getPermanentFilePreviewUrl)(e),n=F({uid:e,url:e},t?{preview:t}:{}),r=(0,O.getPreviewThumbnailUrl)(n);return F({},n,r?{thumbUrl:r}:{})}var o=q(null==e?void 0:e.response),i=o?U(F({},e,o),{response:e.response,originFileObj:e.originFileObj}):e,u=(null==i?void 0:i.preview)||(0,O.getPermanentFilePreviewUrl)(null==i?void 0:i.url),c=(null==i?void 0:i.mimetype)||(null==i?void 0:i.type),l=F(U(F({},i,!c||(null==i?void 0:i.type)?{}:{type:c}),{uid:(null==i?void 0:i.uid)||(null==i?void 0:i.url)||(null==i?void 0:i.id)}),u?{preview:u}:{}),a=(0,O.getPreviewThumbnailUrl)(l);return F({},l,a?{thumbUrl:a}:{})},M=function(e){var t,n,r;return"string"==typeof e?e:(null==e?void 0:e.url)||(null==e||null==(t=e.response)?void 0:t.url)||(null==e||null==(r=e.response)||null==(n=r.data)?void 0:n.url)||""},I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e){return[M(e),e]}).filter(function(e){return!!E(e,1)[0]}));return(0,P.castArray)(e||[]).filter(Boolean).map(function(e){var t=D(e),r=n.get(M(t));return r?D(F({},r,t)):t})},L=function(e){var t=e.showFileName,n=e.value,r=e.onChange,o=(0,h.useField)(),i=E((0,j.useState)(function(){return I(n)}),2),u=i[0],c=i[1];return(0,j.useEffect)(function(){c(function(e){return I(n,e)})},[n]),x().createElement(h.FieldContext.Provider,{value:U(F({},o),{value:u})},x().createElement("div",{style:{display:"flex"},className:(0,y.css)(R(),t?"8px 0px":"0px",t?"8px 0px":"0px")},x().createElement(v.Upload,U(F({},e),{listType:"picture-card",fileList:u,onChange:function(e){var t=I(e);c(t);var n=t[0];if(!n){null==r||r(void 0);return}if("done"===n.status){var o,i,u,l=n.url||(null==(o=n.response)?void 0:o.url)||(null==(u=n.response)||null==(i=u.data)?void 0:i.url);null==r||r(l)}else"removed"===n.status&&(null==r||r(void 0))},itemRender:function(e,n){var r,o=n.name||n.filename||(null==(r=n.url)?void 0:r.split("/").pop())||"",i=o?decodeURIComponent(o):"";return x().createElement(x().Fragment,null,e,t&&x().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:i},i))}}),x().createElement(m.UploadOutlined,{style:{fontSize:20}}))))},N=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=_(e),function(e,t){if(t&&("object"===C(t)||"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(e,t||[],_(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&k(n,e),t=[{key:"render",value:function(){return x().createElement(L,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}(O.UploadFieldModel);function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}N.define({label:(0,g.tExpr)("AttachmentURL",{ns:[o.UU,"client"]})}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var $=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,h.useField)(),o=(0,n.useColumnSchema)().fieldSchema,u=(0,h.useFieldSchema)(),c=o||u,l=(0,n.useDesignable)(),a=l.dn,s=l.refresh;return{title:t("Quick upload"),checked:(null==(e=c["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=B({},"x-uid",c["x-uid"]);r.componentProps.quickUpload=e,c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].quickUpload=e,t["x-component-props"]=c["x-component-props"],a.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,h.useField)(),r=(0,h.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"selectFile",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,h.useField)(),o=(0,n.useColumnSchema)().fieldSchema,u=(0,h.useFieldSchema)(),c=o||u,l=(0,n.useDesignable)(),a=l.dn,s=l.refresh;return{title:t("Select file"),checked:(null==(e=c["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=B({},"x-uid",c["x-uid"]);r.componentProps.selectFile=e,c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].selectFile=e,t["x-component-props"]=c["x-component-props"],a.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,h.useField)(),r=(0,h.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"fieldComponent",type:"select",useComponentProps:function(){var e=(0,i.useTranslation)().t,t=(0,h.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,h.useFieldSchema)(),u=r||o,c=(0,n.useDesignable)().dn;return{title:e("Field component"),options:[{label:e("URL"),value:"url"},{label:e("Preview"),value:"preview"}],value:u["x-component-props"].componentMode||"preview",onChange:function(e){var n=B({},"x-uid",u["x-uid"]);u["x-component-props"]=u["x-component-props"]||{},u["x-component-props"].componentMode=e,n["x-component-props"]=u["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.componentMode=e,c.emit("patch",{schema:n}),c.refresh()}}},useVisible:function(){var e=(0,n.useIsFieldReadPretty)();return(0,n.useColumnSchema)().fieldSchema,e}},(e=function(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){B(e,t,n[t])})}return e}({},n.fileSizeSetting),t=t={useVisible:function(){var e=(0,n.useIsFieldReadPretty)(),t=(0,n.useColumnSchema)().fieldSchema;return e&&!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 z(e,t,n,r,o,i,u){try{var c=e[i](u),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function V(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){z(i,r,o,u,c,"next",e)}function c(e){z(i,r,o,u,c,"throw",e)}u(void 0)})}}function K(e,t,n){return(K=Q()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&W(o,n.prototype),o}).apply(null,arguments)}function J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=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){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 K(e,arguments,J(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),W(n,e)})(e)}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!e})()}function H(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:l(0)}),c(u,"throw",{value:l(1)}),c(u,"return",{value:l(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function l(c){return function(l){var a=[c,l];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var X=(0,n.lazy)(function(){return b.e("749").then(b.bind(b,172))},"AttachmentUrl").AttachmentUrl,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=J(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,Q()?Reflect.construct(e,t||[],J(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&W(n,e),t=[{key:"afterAdd",value:function(){return V(function(){return H(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return V(function(){return H(this,function(e){return[2]})})()}},{key:"load",value:function(){return V(function(){return H(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:X}),this.app.schemaSettingsManager.add($),this.flowEngine.registerModels({AttachmentURLFieldModel:N}),[2]})}).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}(G(n.Plugin)),Z=Y}(),w}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-file-manager/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@nocobase/plugin-file-manager/client-v2","@emotion/css","@formily/antd-v5","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@nocobase/plugin-file-manager/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@nocobase/plugin-file-manager/client-v2"],e["@emotion/css"],e["@formily/antd-v5"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,u,a,l,c,s){return function(){"use strict";var p,f,d,m={233:function(e,t,n){n.d(t,{S8:function(){return y},uF:function(){return h},uR:function(){return v}});var r=n(230),o=n(342),i=n(936),u=n(773),a=n(155),l=n(953);function c(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 s(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}var p=function(e){return!!e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&!Array.isArray(e)},f=function(e){if(!p(e))return null;var t=p(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},d=function(e,t){var n,r,u,a="string"==typeof e.preview?e.preview:(0,i.getPermanentFilePreviewUrl)(t),l="string"==typeof e.mimetype?e.mimetype:void 0,p=(0,o.matchMimetype)(s(c({},e),{uid:String(null!=(n=e.id)?n:t),name:"string"==typeof e.filename?e.filename:t,url:t}),"image/*");return c(s(c({},e,l?{type:l}:{}),{uid:null!=(r=e.id)?r:t,id:null!=(u=e.id)?u:t,url:t}),p&&a?{preview:a,thumbUrl:a}:{})},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;if("string"==typeof e){var n=t.get(e);if(n)return d(n,e);var r=(0,i.getPermanentFilePreviewUrl)(e);if(!r)return e;var u=(0,o.matchMimetype)({uid:e,name:e,url:e},"image/*");return c({uid:e,id:e,url:e},u&&r?{preview:r,thumbUrl:r}:{})}return e},b=function(e){var t=f(e);if(t){var n=t.thumbnailRule?"".concat(t.url).concat(t.thumbnailRule):t.url;if("string"==typeof n)return n}};function y(e){var t,n,r,u,l,p,d=(0,o.useCollectionField)(),y=(0,o.useDataSourceKey)(),v=(n=null!=(t=null==d?void 0:d.storage)?t:"",u=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,l=r.data,!u&&(null==l?void 0:l.data)||null),h=(0,a.useRef)(new Map);return s(c({},e),{value:m(e.value,h.current),rules:v,action:"".concat(d.target,":create").concat(d.storage?"?attachmentField=".concat(d.collectionName,".").concat(d.name):""),fileCollection:(p=null==d?void 0:d.target,p?{dataSourceKey:y||"main",collectionName:p}:void 0),toValueItem:function(e){var t=b(e),n=f(e);return t&&n&&h.current.set(t,n),t},getThumbnailURL:function(e){return(null==e?void 0:e.thumbUrl)||(null==e?void 0:e.preview)||(0,i.getPermanentFilePreviewUrl)(null==e?void 0:e.url)||(null==e?void 0:e.url)}})}var v=function(e){var t=(0,r.useFieldSchema)(),n=(0,o.useDesignable)().insertAfterBegin;return(0,a.useCallback)(function(r){t.reduceProperties(function(t,n){return n["x-component"]==="AssociationField."+e?n:t},null)||n((0,u.cloneDeep)(r))},[e,t,n])},h=function(){(0,l.useTranslation)().t;var e=(0,r.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}}}},375:function(e){e.exports=l},477:function(e){e.exports=n},418:function(e){e.exports=r},230:function(e){e.exports=a},342:function(e){e.exports=u},694:function(e){e.exports=c},936:function(e){e.exports=t},59:function(e){e.exports=i},773:function(e){e.exports=s},155:function(e){e.exports=o},953:function(t){t.exports=e}},b={};function y(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.m=m,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+".aca7595ba197ec73.js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},y.l=function(e,t,n,r){if(v[e])return void v[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var l=u[a];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),v[e]=[t];var c=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(h=y.g.location+"");var v,h,g=y.g.document;if(!h&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(h=g.currentScript.src),!h)){var O=g.getElementsByTagName("script");if(O.length)for(var w=O.length-1;w>-1&&(!h||!/^http(s?):/.test(h));)h=O[w--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");y.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),p={889:0},y.f.j=function(e,t){var n=y.o(p,e)?p[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=p[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(p,e)&&(0!==(n=p[e])&&(p[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},f=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==p[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);u&&u(y)}for(e&&e(t);a<o.length;a++)r=o[a],y.o(p,r)&&p[r]&&p[r][0](),p[r]=0},(d=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(f.bind(null,0)),d.push=f.bind(null,d.push.bind(d));var P={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-field-attachment-url/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",a=u.indexOf(i);e=a>=0?u.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-attachment-url/dist/client/"}y.p=e}(),!function(){y.r(P),y.d(P,{default:function(){return ee},PluginFieldAttachmentUrlClient:function(){return Z},AttachmentURLFieldModel:function(){return B}});var e,t,n=y(342),r=y(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=y(953);function u(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.UU,"', 'client'], nsMode: 'fallback' })}}")}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var p=n.interfacesProperties.defaultProps,f=n.interfacesProperties.operators,d=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,o,i,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=l(t),a(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,s()?Reflect.construct(t,o||[],l(this).constructor):t.apply(this,o)),"name","attachmentURL"),a(e,"type","object"),a(e,"group","media"),a(e,"title",u("Attachment (URL)")),a(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),a(e,"availableTypes",["string","text"]),a(e,"properties",(i=function(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){a(e,t,n[t])})}return e}({},p),c=c={target:{required:!0,type:"string",title:u("Which file collection should it be uploaded to"),"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":r.uF,"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:{"x-hidden":!0,default:"id",type:"string"}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(c)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))}),i)),a(e,"filterable",{nested:!0,operators:f.bigField}),a(e,"titleUsable",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&c(n,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)}}(n.prototype,t),n}(n.CollectionFieldInterface),m=y(375),b=y(477),v=y(418),h=y(230),g=y(694),O=y(936),w=y(59),j=y(773),x=y(155),S=y.n(x);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 F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(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 k(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 E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">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.")}()}function A(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function T(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n position: relative;\n\n /* 删除按钮独立放到卡片右上角,与居中的预览按钮拉开距离,避免预览时误触删除。 */\n .nb-upload-item-remove {\n position: absolute;\n top: 4px;\n right: 4px;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n min-width: 22px;\n height: 22px;\n padding: 0;\n color: rgba(255, 255, 255, 0.85);\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n }\n\n .nb-upload-item-remove:hover,\n .nb-upload-item-remove:focus-visible {\n color: #fff;\n background: rgba(0, 0, 0, 0.75);\n }\n\n &:hover .nb-upload-item-remove,\n &:focus-within .nb-upload-item-remove {\n opacity: 1;\n pointer-events: auto;\n }\n\n /* 触屏设备没有 hover 态,常驻显示删除按钮。 */\n @media (hover: none) {\n .nb-upload-item-remove {\n opacity: 1;\n pointer-events: auto;\n }\n }\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 T=function(){return n},n}var D=function(e){return!!e&&(void 0===e?"undefined":A(e))==="object"&&!Array.isArray(e)},q=function(e){if(!D(e))return null;var t=D(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},M=function(e){if("string"==typeof e){var t=(0,O.getPermanentFilePreviewUrl)(e),n=U({uid:e,url:e},t?{preview:t}:{}),r=(0,O.getPreviewThumbnailUrl)(n);return U({},n,r?{thumbUrl:r}:{})}var o=q(null==e?void 0:e.response),i=o?k(U({},e,o),{response:e.response,originFileObj:e.originFileObj}):e,u=(null==i?void 0:i.preview)||(0,O.getPermanentFilePreviewUrl)(null==i?void 0:i.url),a=(null==i?void 0:i.mimetype)||(null==i?void 0:i.type),l=U(k(U({},i,!a||(null==i?void 0:i.type)?{}:{type:a}),{uid:(null==i?void 0:i.uid)||(null==i?void 0:i.url)||(null==i?void 0:i.id)}),u?{preview:u}:{}),c=(0,O.getPreviewThumbnailUrl)(l);return U({},l,c?{thumbUrl:c}:{})},I=function(e){var t,n,r;return"string"==typeof e?e:(null==e?void 0:e.url)||(null==e||null==(t=e.response)?void 0:t.url)||(null==e||null==(r=e.response)||null==(n=r.data)?void 0:n.url)||""},L=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e){return[I(e),e]}).filter(function(e){return!!C(e,1)[0]}));return(0,j.castArray)(e||[]).filter(Boolean).map(function(e){var t=M(e),r=n.get(I(t));return r?M(U({},r,t)):t})},N=function(e){var t=e.showFileName,n=e.value,r=e.onChange,o=e.disabled,u=(0,i.useTranslation)().t,a=(0,h.useField)(),l=C((0,x.useState)(function(){return L(n)}),2),c=l[0],s=l[1];return(0,x.useEffect)(function(){s(function(e){return L(n,e)})},[n]),S().createElement(h.FieldContext.Provider,{value:k(U({},a),{value:c})},S().createElement("div",{style:{display:"flex"},className:(0,b.css)(T(),t?"8px 0px":"0px",t?"8px 0px":"0px")},S().createElement(v.Upload,k(U({},e),{listType:"picture-card",fileList:c,onChange:function(e){var t=L(e);s(t);var n=t[0];if(!n){null==r||r(void 0);return}if("done"===n.status){var o,i,u,a=n.url||(null==(o=n.response)?void 0:o.url)||(null==(u=n.response)||null==(i=u.data)?void 0:i.url);null==r||r(a)}else"removed"===n.status&&(null==r||r(void 0))},showUploadList:{showRemoveIcon:!1},itemRender:function(e,n,r,i){var a,l=!o&&"uploading"!==n.status,c=n.name||n.filename||(null==(a=n.url)?void 0:a.split("/").pop())||"",s=c?decodeURIComponent(c):"";return S().createElement(S().Fragment,null,e,l&&S().createElement(w.Button,{className:"nb-upload-item-remove",type:"text",size:"small",icon:S().createElement(m.DeleteOutlined,null),title:u("Delete"),"aria-label":u("Delete"),onClick:function(){return i.remove()}}),t&&S().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:s},s))}}),S().createElement(m.UploadOutlined,{style:{fontSize:20}}))))},B=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=F(e),function(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,R()?Reflect.construct(e,t||[],F(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&E(n,e),t=[{key:"render",value:function(){return S().createElement(N,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}(O.UploadFieldModel);function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}B.define({label:(0,g.tExpr)("AttachmentURL",{ns:[o.UU,"client"]})}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var $=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,h.useField)(),o=(0,n.useColumnSchema)().fieldSchema,u=(0,h.useFieldSchema)(),a=o||u,l=(0,n.useDesignable)(),c=l.dn,s=l.refresh;return{title:t("Quick upload"),checked:(null==(e=a["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=z({},"x-uid",a["x-uid"]);r.componentProps.quickUpload=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].quickUpload=e,t["x-component-props"]=a["x-component-props"],c.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,h.useField)(),r=(0,h.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"selectFile",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,h.useField)(),o=(0,n.useColumnSchema)().fieldSchema,u=(0,h.useFieldSchema)(),a=o||u,l=(0,n.useDesignable)(),c=l.dn,s=l.refresh;return{title:t("Select file"),checked:(null==(e=a["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=z({},"x-uid",a["x-uid"]);r.componentProps.selectFile=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].selectFile=e,t["x-component-props"]=a["x-component-props"],c.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,h.useField)(),r=(0,h.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"fieldComponent",type:"select",useComponentProps:function(){var e=(0,i.useTranslation)().t,t=(0,h.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,h.useFieldSchema)(),u=r||o,a=(0,n.useDesignable)().dn;return{title:e("Field component"),options:[{label:e("URL"),value:"url"},{label:e("Preview"),value:"preview"}],value:u["x-component-props"].componentMode||"preview",onChange:function(e){var n=z({},"x-uid",u["x-uid"]);u["x-component-props"]=u["x-component-props"]||{},u["x-component-props"].componentMode=e,n["x-component-props"]=u["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.componentMode=e,a.emit("patch",{schema:n}),a.refresh()}}},useVisible:function(){var e=(0,n.useIsFieldReadPretty)();return(0,n.useColumnSchema)().fieldSchema,e}},(e=function(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){z(e,t,n[t])})}return e}({},n.fileSizeSetting),t=t={useVisible:function(){var e=(0,n.useIsFieldReadPretty)(),t=(0,n.useColumnSchema)().fieldSchema;return e&&!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,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 K(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){V(i,r,o,u,a,"next",e)}function a(e){V(i,r,o,u,a,"throw",e)}u(void 0)})}}function J(e,t,n){return(J=H()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&G(o,n.prototype),o}).apply(null,arguments)}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(e,t){return(G=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Q(e){var t="function"==typeof Map?new Map:void 0;return(Q=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 J(e,arguments,W(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),G(n,e)})(e)}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!e})()}function X(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:l(0)}),a(u,"throw",{value:l(1)}),a(u,"return",{value:l(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var Y=(0,n.lazy)(function(){return y.e("749").then(y.bind(y,172))},"AttachmentUrl").AttachmentUrl,Z=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=W(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||[],W(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&G(n,e),t=[{key:"afterAdd",value:function(){return K(function(){return X(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return K(function(){return X(this,function(e){return[2]})})()}},{key:"load",value:function(){return K(function(){return X(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:Y}),this.app.schemaSettingsManager.add($),this.flowEngine.registerModels({AttachmentURLFieldModel:B}),[2]})}).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}(Q(n.Plugin)),ee=Z}(),P}()});
@@ -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,l,u,a){return function(){"use strict";var c={724:function(e,t,n){n.r(t),n.d(t,{normalizeAttachmentURLFile:function(){return _},getPermanentFilePreviewUrl:function(){return a.getPermanentFilePreviewUrl},isAttachmentURLImage:function(){return U},normalizeAttachmentURLFileList:function(){return S},AttachmentURLFieldModel:function(){return E}});var r=n(375),o=n(477),i=n(418),l=n(230),u=n(694),a=n(936),c=n(773),f=n(155),s=n.n(f),p=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}');function d(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 b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(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 v(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 h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(u)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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 d(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.")}()}function g(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function O(){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 O=function(){return n},n}var j=function(e){return!!e&&(void 0===e?"undefined":g(e))==="object"&&!Array.isArray(e)},P=function(e){if(!j(e))return null;var t=j(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},_=function(e){if("string"==typeof e){var t=(0,a.getPermanentFilePreviewUrl)(e),n=y({uid:e,url:e},t?{preview:t}:{}),r=(0,a.getPreviewThumbnailUrl)(n);return y({},n,r?{thumbUrl:r}:{})}var o=P(null==e?void 0:e.response),i=o?v(y({},e,o),{response:e.response,originFileObj:e.originFileObj}):e,l=(null==i?void 0:i.preview)||(0,a.getPermanentFilePreviewUrl)(null==i?void 0:i.url),u=(null==i?void 0:i.mimetype)||(null==i?void 0:i.type),c=y(v(y({},i,!u||(null==i?void 0:i.type)?{}:{type:u}),{uid:(null==i?void 0:i.uid)||(null==i?void 0:i.url)||(null==i?void 0:i.id)}),l?{preview:l}:{}),f=(0,a.getPreviewThumbnailUrl)(c);return y({},c,f?{thumbUrl:f}:{})},x=function(e){var t,n,r;return"string"==typeof e?e:(null==e?void 0:e.url)||(null==e||null==(t=e.response)?void 0:t.url)||(null==e||null==(r=e.response)||null==(n=r.data)?void 0:n.url)||""},S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e){return[x(e),e]}).filter(function(e){return!!h(e,1)[0]}));return(0,c.castArray)(e||[]).filter(Boolean).map(function(e){var t=_(e),r=n.get(x(t));return r?_(y({},r,t)):t})},U=function(e){var t=_(e);return(0,a.matchMimetype)(t,"image/*")},R=function(e){var t=e.showFileName,n=e.value,u=e.onChange,a=(0,l.useField)(),c=h((0,f.useState)(function(){return S(n)}),2),p=c[0],d=c[1];return(0,f.useEffect)(function(){d(function(e){return S(n,e)})},[n]),s().createElement(l.FieldContext.Provider,{value:v(y({},a),{value:p})},s().createElement("div",{style:{display:"flex"},className:(0,o.css)(O(),t?"8px 0px":"0px",t?"8px 0px":"0px")},s().createElement(i.Upload,v(y({},e),{listType:"picture-card",fileList:p,onChange:function(e){var t=S(e);d(t);var n=t[0];if(!n){null==u||u(void 0);return}if("done"===n.status){var r,o,i,l=n.url||(null==(r=n.response)?void 0:r.url)||(null==(i=n.response)||null==(o=i.data)?void 0:o.url);null==u||u(l)}else"removed"===n.status&&(null==u||u(void 0))},itemRender:function(e,n){var r,o=n.name||n.filename||(null==(r=n.url)?void 0:r.split("/").pop())||"",i=o?decodeURIComponent(o):"";return s().createElement(s().Fragment,null,e,t&&s().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:i},i))}}),s().createElement(r.UploadOutlined,{style:{fontSize:20}}))))},E=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){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,w()?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&&m(n,e),t=[{key:"render",value:function(){return s().createElement(R,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}(a.UploadFieldModel);E.define({label:(0,u.tExpr)("AttachmentURL",{ns:[p.UU,"client"]})}),u.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),u.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0})},375:function(e){e.exports=l},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=u},936:function(e){e.exports=t},773:function(e){e.exports=a},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 c[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,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var y=b.length-1;y>-1&&(!p||!/^http(s?):/.test(p));)p=b[y--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",u=l.indexOf(i);e=u>=0?l.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),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(v),s.d(v,{AttachmentURLFieldInterface:function(){return l},default:function(){return m},PluginFieldAttachmentUrlClient:function(){return y},AttachmentURLFieldModel:function(){return u.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})()}function i(e){var t;return(null==e?void 0:e.name)!=="attachments"&&"file"===((null==e?void 0:e.template)||(null==e||null==(t=e.options)?void 0:t.template))}var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function l(){var e,r,u;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return r=l,u=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,u||[],n(this).constructor):r.apply(this,u)),"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,componentProps:{filter:i},schema:{enum:"{{fileCollections}}"}},{name:"targetKey",defaultValue:"id",hidden:!0}]}),t(e,"filterable",{operators:"bigField",nested:!0}),t(e,"titleUsable",!0),e}return l.prototype=Object.create(e&&e.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),e&&r(l,e),l}(e.CollectionFieldInterface),u=s(724);function a(e,t,n,r,o,i,l){try{var u=e[i](l),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function c(e,t,n){return(c=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&&p(o,n.prototype),o}).apply(null,arguments)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=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 c(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(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=f(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||[],f(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&p(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:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:a(0)}),u(l,"throw",{value:a(1)}),u(l,"return",{value:a(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function a(u){return function(a){var c=[u,a];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces([l]),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 l(e){a(i,r,o,l,u,"next",e)}function u(e){a(i,r,o,l,u,"throw",e)}l(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)),m=y}(),v}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("antd"),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",["react-i18next","@emotion/css","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2","@formily/antd-v5","react","antd","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url/client-v2"]=t(require("react-i18next"),require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url/client-v2"]=t(e["react-i18next"],e["@emotion/css"],e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"],e["@formily/antd-v5"],e.react,e.antd,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,l,a,u,c,f){return function(){"use strict";var s={724:function(e,t,n){n.r(t),n.d(t,{normalizeAttachmentURLFile:function(){return S},getPermanentFilePreviewUrl:function(){return u.getPermanentFilePreviewUrl},isAttachmentURLImage:function(){return R},normalizeAttachmentURLFileList:function(){return E},AttachmentURLFieldModel:function(){return A}});var r=n(375),o=n(477),i=n(418),l=n(230),a=n(694),u=n(936),c=n(59),f=n(773),s=n(953),p=n(155),d=n.n(p),b=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}');function v(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 m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(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 g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(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 v(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.")}()}function O(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function j(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n position: relative;\n\n /* 删除按钮独立放到卡片右上角,与居中的预览按钮拉开距离,避免预览时误触删除。 */\n .nb-upload-item-remove {\n position: absolute;\n top: 4px;\n right: 4px;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n min-width: 22px;\n height: 22px;\n padding: 0;\n color: rgba(255, 255, 255, 0.85);\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n }\n\n .nb-upload-item-remove:hover,\n .nb-upload-item-remove:focus-visible {\n color: #fff;\n background: rgba(0, 0, 0, 0.75);\n }\n\n &:hover .nb-upload-item-remove,\n &:focus-within .nb-upload-item-remove {\n opacity: 1;\n pointer-events: auto;\n }\n\n /* 触屏设备没有 hover 态,常驻显示删除按钮。 */\n @media (hover: none) {\n .nb-upload-item-remove {\n opacity: 1;\n pointer-events: auto;\n }\n }\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 j=function(){return n},n}var P=function(e){return!!e&&(void 0===e?"undefined":O(e))==="object"&&!Array.isArray(e)},_=function(e){if(!P(e))return null;var t=P(e.data)?e.data:e;return["id","url","preview","filename","extname","mimetype"].some(function(e){return e in t})?t:null},S=function(e){if("string"==typeof e){var t=(0,u.getPermanentFilePreviewUrl)(e),n=y({uid:e,url:e},t?{preview:t}:{}),r=(0,u.getPreviewThumbnailUrl)(n);return y({},n,r?{thumbUrl:r}:{})}var o=_(null==e?void 0:e.response),i=o?h(y({},e,o),{response:e.response,originFileObj:e.originFileObj}):e,l=(null==i?void 0:i.preview)||(0,u.getPermanentFilePreviewUrl)(null==i?void 0:i.url),a=(null==i?void 0:i.mimetype)||(null==i?void 0:i.type),c=y(h(y({},i,!a||(null==i?void 0:i.type)?{}:{type:a}),{uid:(null==i?void 0:i.uid)||(null==i?void 0:i.url)||(null==i?void 0:i.id)}),l?{preview:l}:{}),f=(0,u.getPreviewThumbnailUrl)(c);return y({},c,f?{thumbUrl:f}:{})},U=function(e){var t,n,r;return"string"==typeof e?e:(null==e?void 0:e.url)||(null==e||null==(t=e.response)?void 0:t.url)||(null==e||null==(r=e.response)||null==(n=r.data)?void 0:n.url)||""},E=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e){return[U(e),e]}).filter(function(e){return!!w(e,1)[0]}));return(0,f.castArray)(e||[]).filter(Boolean).map(function(e){var t=S(e),r=n.get(U(t));return r?S(y({},r,t)):t})},R=function(e){var t=S(e);return(0,u.matchMimetype)(t,"image/*")},F=function(e){var t=e.showFileName,n=e.value,a=e.onChange,u=e.disabled,f=(0,s.useTranslation)().t,b=(0,l.useField)(),v=w((0,p.useState)(function(){return E(n)}),2),m=v[0],g=v[1];return(0,p.useEffect)(function(){g(function(e){return E(n,e)})},[n]),d().createElement(l.FieldContext.Provider,{value:h(y({},b),{value:m})},d().createElement("div",{style:{display:"flex"},className:(0,o.css)(j(),t?"8px 0px":"0px",t?"8px 0px":"0px")},d().createElement(i.Upload,h(y({},e),{listType:"picture-card",fileList:m,onChange:function(e){var t=E(e);g(t);var n=t[0];if(!n){null==a||a(void 0);return}if("done"===n.status){var r,o,i,l=n.url||(null==(r=n.response)?void 0:r.url)||(null==(i=n.response)||null==(o=i.data)?void 0:o.url);null==a||a(l)}else"removed"===n.status&&(null==a||a(void 0))},showUploadList:{showRemoveIcon:!1},itemRender:function(e,n,o,i){var l,a=!u&&"uploading"!==n.status,s=n.name||n.filename||(null==(l=n.url)?void 0:l.split("/").pop())||"",p=s?decodeURIComponent(s):"";return d().createElement(d().Fragment,null,e,a&&d().createElement(c.Button,{className:"nb-upload-item-remove",type:"text",size:"small",icon:d().createElement(r.DeleteOutlined,null),title:f("Delete"),"aria-label":f("Delete"),onClick:function(){return i.remove()}}),t&&d().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:p},p))}}),d().createElement(r.UploadOutlined,{style:{fontSize:20}}))))},A=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=m(e),function(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,x()?Reflect.construct(e,t||[],m(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&g(n,e),t=[{key:"render",value:function(){return d().createElement(F,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}(u.UploadFieldModel);A.define({label:(0,a.tExpr)("AttachmentURL",{ns:[b.UU,"client"]})}),a.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),a.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0})},375:function(e){e.exports=u},477:function(e){e.exports=t},418:function(e){e.exports=o},230:function(e){e.exports=a},485:function(e){e.exports=r},694:function(e){e.exports=c},936:function(e){e.exports=n},59:function(e){e.exports=l},773:function(e){e.exports=f},155:function(e){e.exports=i},953:function(t){t.exports=e}},p={};function d(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return s[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(b=d.g.location+"");var b,v=d.g.document;if(!b&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(b=v.currentScript.src),!b)){var m=v.getElementsByTagName("script");if(m.length)for(var y=m.length-1;y>-1&&(!b||!/^http(s?):/.test(b));)b=m[y--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");d.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",a=l.indexOf(i);e=a>=0?l.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-attachment-url/dist/client-v2/"}d.p=e}(),!function(){d.r(h),d.d(h,{AttachmentURLFieldInterface:function(){return l},default:function(){return m},PluginFieldAttachmentUrlClient:function(){return v},AttachmentURLFieldModel:function(){return a.AttachmentURLFieldModel}});var e=d(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})()}function i(e){var t;return(null==e?void 0:e.name)!=="attachments"&&"file"===((null==e?void 0:e.template)||(null==e||null==(t=e.options)?void 0:t.template))}var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function l(){var e,r,a;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return r=l,a=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,a||[],n(this).constructor):r.apply(this,a)),"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,componentProps:{filter:i},schema:{enum:"{{fileCollections}}"}},{name:"targetKey",defaultValue:"id",hidden:!0}]}),t(e,"filterable",{operators:"bigField",nested:!0}),t(e,"titleUsable",!0),e}return l.prototype=Object.create(e&&e.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),e&&r(l,e),l}(e.CollectionFieldInterface),a=d(724);function u(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function c(e,t,n){return(c=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&&s(o,n.prototype),o}).apply(null,arguments)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=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 c(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)})(e)}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}var v=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=f(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||[],f(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&s(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:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces([l]),this.flowEngine.registerModelLoaders({AttachmentURLFieldModel:{loader:function(){return Promise.resolve().then(d.bind(d,724))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){u(i,r,o,l,a,"next",e)}function a(e){u(i,r,o,l,a,"throw",e)}l(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)),m=v}(),h}()});
@@ -8,18 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.4.0-alpha.6",
11
+ "@nocobase/client": "2.4.0-alpha.7",
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.4.0-alpha.6",
18
- "@nocobase/plugin-file-manager": "2.4.0-alpha.6",
17
+ "@nocobase/flow-engine": "2.4.0-alpha.7",
18
+ "@nocobase/plugin-file-manager": "2.4.0-alpha.7",
19
+ "antd": "5.24.2",
19
20
  "lodash": "4.18.1",
20
21
  "react": "18.2.0",
21
- "@nocobase/client-v2": "2.4.0-alpha.6",
22
- "@nocobase/server": "2.4.0-alpha.6",
23
- "@nocobase/test": "2.4.0-alpha.6",
22
+ "@nocobase/client-v2": "2.4.0-alpha.7",
23
+ "@nocobase/server": "2.4.0-alpha.7",
24
+ "@nocobase/test": "2.4.0-alpha.7",
24
25
  "@formily/core": "2.3.7"
25
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-attachment-url",
3
- "version": "2.4.0-alpha.6",
3
+ "version": "2.4.0-alpha.7",
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": "1fc4fcd17a0cd79912a642600bdc2103e2104bdb"
22
+ "gitHead": "bb018bfc8bdcc0f399244d2f248c55e51ceb2d1e"
23
23
  }