@nocobase/plugin-field-attachment-url 2.1.0-alpha.15 → 2.1.0-alpha.17

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("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@emotion/css","@formily/antd-v5","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-file-manager/client","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/antd-v5"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-file-manager/client"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,c,a,u,l){return function(){"use strict";var s,p,f,d={233:function(e,t,n){n.d(t,{S8:function(){return u},uF:function(){return s},uR:function(){return l}});var r=n(230),o=n(342),i=n(773),c=n(155),a=n(953);function u(e){var t,n,r,i,c,a,u,l=(0,o.useCollectionField)(),s=(n=null!=(t=null==l?void 0:l.storage)?t:"",i=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,c=r.data,!i&&(null==c?void 0:c.data)||null);return a=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){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}({},e),u=u={rules:s,action:"".concat(l.target,":create").concat(l.storage?"?attachmentField=".concat(l.collectionName,".").concat(l.name):""),toValueItem:function(e){return(null==e?void 0:e.thumbnailRule)?"".concat(null==e?void 0:e.url).concat(null==e?void 0:e.thumbnailRule):null==e?void 0:e.url},getThumbnailURL:function(e){return null==e?void 0:e.url}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(u,e))}),a}var l=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,i.cloneDeep)(r))},[e,t,n])},s=function(){(0,a.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=t},418:function(e){e.exports=n},230:function(e){e.exports=i},342:function(e){e.exports=o},694:function(e){e.exports=u},609:function(e){e.exports=a},773:function(e){e.exports=l},155:function(e){e.exports=r},953:function(t){t.exports=e}},b={};function m(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,m),n.exports}m.m=d,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.u=function(e){return"f1dd2e4e276ad528.js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},m.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,m.nc&&o.setAttribute("nonce",m.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),y[e]=[t];var l=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(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},m.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.g.importScripts&&(h=m.g.location+"");var y,h,v=m.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var O=g.length-1;O>-1&&(!h||!/^http(s?):/.test(h));)h=g[O--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");m.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},m.f.j=function(e,t){var n=m.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=m.p+m.u(e),i=Error();m.l(o,function(t){if(m.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],c=t[2],a=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);c&&c(m)}for(e&&e(t);a<o.length;a++)r=o[a],m.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&&(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/")}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/"}m.p=e}(),!function(){m.r(w),m.d(w,{PluginFieldAttachmentUrlClient:function(){return J},default:function(){return K}});var e,t,n=m(342),r=m(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=m(953);function c(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 u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=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,l;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=u(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||[],u(this).constructor):t.apply(this,o)),"name","attachmentURL"),a(e,"type","object"),a(e,"group","media"),a(e,"title",c("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),l=l={target:{required:!0,type:"string",title:c("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(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,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&&l(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),b=m(609),y=m(418),h=m(477),v=m(375),g=m(694),O=m(155),j=m.n(O),P=m(230),x=m(773);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 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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function U(){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 U=function(){return n},n}var A=function(e){var t,n=e.showFileName,r=e.value,o=e.onChange,i=(0,P.useField)(),c=function(e){if(Array.isArray(e))return e}(t=(0,O.useState)((0,x.castArray)(r||[]).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 S(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 S(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.")}(),a=c[0],u=c[1];return(0,O.useEffect)(function(){u((0,x.castArray)(r||[]).map(function(e){return{url:e}}))},[r]),j().createElement(P.FieldContext.Provider,{value:k(F({},i),{value:a})},j().createElement("div",{style:{display:"flex"},className:(0,h.css)(U(),n?"8px 0px":"0px",n?"8px 0px":"0px")},j().createElement(y.Upload,k(F({},e),{listType:"picture-card",fileList:a,onChange:function(e){u(e);var t=e[0];if(!t){null==o||o(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==o||o(r)}else"removed"===t.status&&(null==o||o(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return j().createElement(j().Fragment,null,e,n&&j().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),j().createElement(v.UploadOutlined,{style:{fontSize:20}}))))},R=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){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,C()?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&&E(n,e),t=[{key:"render",value:function(){return j().createElement(A,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}(b.UploadFieldModel);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}R.define({label:(0,g.tExpr)("AttachmentURL")}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var q=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Quick upload"),checked:(null==(e=a["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=T({},"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"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Select file"),checked:(null==(e=a["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=T({},"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"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,P.useFieldSchema)(),c=r||o,a=(0,n.useDesignable)().dn;return{title:e("Field component"),options:[{label:e("URL"),value:"url"},{label:e("Preview"),value:"preview"}],value:c["x-component-props"].componentMode||"preview",onChange:function(e){var n=T({},"x-uid",c["x-uid"]);c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].componentMode=e,n["x-component-props"]=c["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){T(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 D(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function I(e,t,n){return(I=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&N(o,n.prototype),o}).apply(null,arguments)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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 I(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),N(n,e)})(e)}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(z=function(){return!!e})()}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:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var V=(0,n.lazy)(function(){return m.e("749").then(m.bind(m,172))},"AttachmentUrl").AttachmentUrl,J=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=L(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,z()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&N(n,e),t=[{key:"afterAdd",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"load",value:function(){return M(function(){return $(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:V}),this.app.schemaSettingsManager.add(q),this.flowEngine.registerModels({AttachmentURLFieldModel:R}),[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}(B(n.Plugin)),K=J}(),w}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@emotion/css","@formily/antd-v5","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-file-manager/client","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/antd-v5"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-file-manager/client"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,c,a,u,l){return function(){"use strict";var s,p,f,d={233:function(e,t,n){n.d(t,{S8:function(){return u},uF:function(){return s},uR:function(){return l}});var r=n(230),o=n(342),i=n(773),c=n(155),a=n(953);function u(e){var t,n,r,i,c,a,u,l=(0,o.useCollectionField)(),s=(n=null!=(t=null==l?void 0:l.storage)?t:"",i=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,c=r.data,!i&&(null==c?void 0:c.data)||null);return a=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){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}({},e),u=u={rules:s,action:"".concat(l.target,":create").concat(l.storage?"?attachmentField=".concat(l.collectionName,".").concat(l.name):""),toValueItem:function(e){return(null==e?void 0:e.thumbnailRule)?"".concat(null==e?void 0:e.url).concat(null==e?void 0:e.thumbnailRule):null==e?void 0:e.url},getThumbnailURL:function(e){return null==e?void 0:e.url}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(u,e))}),a}var l=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,i.cloneDeep)(r))},[e,t,n])},s=function(){(0,a.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=t},418:function(e){e.exports=n},230:function(e){e.exports=i},342:function(e){e.exports=o},694:function(e){e.exports=u},609:function(e){e.exports=a},773:function(e){e.exports=l},155:function(e){e.exports=r},953:function(t){t.exports=e}},b={};function m(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,m),n.exports}m.m=d,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.u=function(e){return""+e+".aca7595ba197ec73.js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},m.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,m.nc&&o.setAttribute("nonce",m.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),y[e]=[t];var l=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(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},m.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.g.importScripts&&(h=m.g.location+"");var y,h,v=m.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var O=g.length-1;O>-1&&(!h||!/^http(s?):/.test(h));)h=g[O--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");m.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},m.f.j=function(e,t){var n=m.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=m.p+m.u(e),i=Error();m.l(o,function(t){if(m.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],c=t[2],a=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);c&&c(m)}for(e&&e(t);a<o.length;a++)r=o[a],m.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&&(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/")}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/"}m.p=e}(),!function(){m.r(w),m.d(w,{PluginFieldAttachmentUrlClient:function(){return J},default:function(){return K}});var e,t,n=m(342),r=m(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=m(953);function c(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 u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=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,l;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=u(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||[],u(this).constructor):t.apply(this,o)),"name","attachmentURL"),a(e,"type","object"),a(e,"group","media"),a(e,"title",c("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),l=l={target:{required:!0,type:"string",title:c("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(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,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&&l(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),b=m(609),y=m(418),h=m(477),v=m(375),g=m(694),O=m(155),j=m.n(O),P=m(230),x=m(773);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 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(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function U(){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 U=function(){return n},n}var A=function(e){var t,n=e.showFileName,r=e.value,o=e.onChange,i=(0,P.useField)(),c=function(e){if(Array.isArray(e))return e}(t=(0,O.useState)((0,x.castArray)(r||[]).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 S(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 S(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.")}(),a=c[0],u=c[1];return(0,O.useEffect)(function(){u((0,x.castArray)(r||[]).map(function(e){return{url:e}}))},[r]),j().createElement(P.FieldContext.Provider,{value:k(F({},i),{value:a})},j().createElement("div",{style:{display:"flex"},className:(0,h.css)(U(),n?"8px 0px":"0px",n?"8px 0px":"0px")},j().createElement(y.Upload,k(F({},e),{listType:"picture-card",fileList:a,onChange:function(e){u(e);var t=e[0];if(!t){null==o||o(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==o||o(r)}else"removed"===t.status&&(null==o||o(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return j().createElement(j().Fragment,null,e,n&&j().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),j().createElement(v.UploadOutlined,{style:{fontSize:20}}))))},R=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){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,C()?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&&E(n,e),t=[{key:"render",value:function(){return j().createElement(A,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}(b.UploadFieldModel);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}R.define({label:(0,g.tExpr)("AttachmentURL")}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var q=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Quick upload"),checked:(null==(e=a["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=T({},"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"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Select file"),checked:(null==(e=a["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=T({},"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"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,P.useFieldSchema)(),c=r||o,a=(0,n.useDesignable)().dn;return{title:e("Field component"),options:[{label:e("URL"),value:"url"},{label:e("Preview"),value:"preview"}],value:c["x-component-props"].componentMode||"preview",onChange:function(e){var n=T({},"x-uid",c["x-uid"]);c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].componentMode=e,n["x-component-props"]=c["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){T(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 D(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function I(e,t,n){return(I=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&N(o,n.prototype),o}).apply(null,arguments)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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 I(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),N(n,e)})(e)}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(z=function(){return!!e})()}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:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var V=(0,n.lazy)(function(){return m.e("749").then(m.bind(m,172))},"AttachmentUrl").AttachmentUrl,J=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=L(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,z()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&N(n,e),t=[{key:"afterAdd",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"load",value:function(){return M(function(){return $(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:V}),this.app.schemaSettingsManager.add(q),this.flowEngine.registerModels({AttachmentURLFieldModel:R}),[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}(B(n.Plugin)),K=J}(),w}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.15",
11
+ "@nocobase/client": "2.1.0-alpha.17",
12
12
  "react-i18next": "11.18.6",
13
- "@nocobase/server": "2.1.0-alpha.15",
14
- "@nocobase/plugin-file-manager": "2.1.0-alpha.15",
15
- "@nocobase/test": "2.1.0-alpha.15",
13
+ "@nocobase/server": "2.1.0-alpha.17",
14
+ "@nocobase/plugin-file-manager": "2.1.0-alpha.17",
15
+ "@nocobase/test": "2.1.0-alpha.17",
16
16
  "@formily/react": "2.3.7",
17
17
  "react": "18.2.0",
18
18
  "@formily/antd-v5": "1.2.3",
19
19
  "@emotion/css": "11.13.0",
20
20
  "@ant-design/icons": "5.6.1",
21
- "@nocobase/flow-engine": "2.1.0-alpha.15",
21
+ "@nocobase/flow-engine": "2.1.0-alpha.17",
22
22
  "lodash": "4.17.21",
23
23
  "@formily/core": "2.3.7"
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-attachment-url",
3
- "version": "2.1.0-alpha.15",
3
+ "version": "2.1.0-alpha.17",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Collection field: Attachment(URL)",
6
6
  "displayName.ru-RU": "Поле коллекции: Вложение (URL)",
@@ -18,5 +18,5 @@
18
18
  "Collection fields"
19
19
  ],
20
20
  "license": "Apache-2.0",
21
- "gitHead": "7c86e75b0af4b9f532c8ebf5ef96a7423b0ab60e"
21
+ "gitHead": "586cb00f56557e66168b9720d0e0193a1b752067"
22
22
  }