@nocobase/plugin-file-manager 1.6.10 → 1.7.0-alpha.10

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.
@@ -13,5 +13,18 @@ export declare class PluginFileManagerClient extends Plugin {
13
13
  load(): Promise<void>;
14
14
  registerStorageType(name: string, options: any): void;
15
15
  getStorageType(name: string): any;
16
+ uploadFile(options?: {
17
+ file: File;
18
+ fileCollectionName?: string;
19
+ storageType?: string;
20
+ /** 后面可能会废弃这个参数 */
21
+ storageId?: number;
22
+ storageRules?: {
23
+ size: number;
24
+ };
25
+ }): Promise<{
26
+ errorMessage?: string;
27
+ data?: any;
28
+ }>;
16
29
  }
17
30
  export default PluginFileManagerClient;
@@ -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("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-i18next"),require("@formily/shared"),require("lodash"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["@nocobase/client","@ant-design/icons","@formily/react","react","react-i18next","@formily/shared","lodash","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-i18next"),require("@formily/shared"),require("lodash"),require("antd")):e["@nocobase/plugin-file-manager"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["react-i18next"],e["@formily/shared"],e.lodash,e.antd)}(self,function(e,t,n,o,r,i,a,c){return function(){"use strict";var l,u,p,s={482:function(e){e.exports=t},505:function(e){e.exports=n},875:function(e){e.exports=i},772:function(t){t.exports=e},721:function(e){e.exports=c},467:function(e){e.exports=a},156:function(e){e.exports=o},238:function(e){e.exports=r}},m={};function f(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return s[e](n,n.exports,f),n.exports}f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};f.r(d),f.d(d,{default:function(){return eC},PluginFileManagerClient:function(){return eA}});var y={};f.r(y),f.d(y,{useAttachmentFieldProps:function(){return C},useFileCollectionStorageRules:function(){return I},useStorageRules:function(){return A},useUploadFiles:function(){return w}});var b=f("772"),g=f("156"),x=f.n(g);function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}function v(e){var t,n,o,r,i,a,c,l,u,p,s,m,f,d=(t=(0,b.useCollectionField)(),n=(0,b.useCollectionManager)().getCollection(null==t?void 0:t.target),o=(0,b.useCollection)(),r=(0,b.usePlugin)(eC),m=(a=null!=(i=(null==t?void 0:t.storage)||(null==o?void 0:o.getOption("storage"))||(null==n?void 0:n.getOption("storage")))?i:"",c="storages:getBasicInfo/".concat(a),u=(l=(0,b.useRequest)({url:c},{manual:!0,refreshDeps:[a],cacheKey:c})).loading,p=l.data,s=l.run,(0,g.useEffect)(function(){s()},[s]),!u&&(null==p?void 0:p.data)||null),f=r.getStorageType(null==m?void 0:m.type),{storage:m,storageType:f}),y=d.storage,x=d.storageType,v=null==x?void 0:x.useUploadProps,O=(null==v?void 0:v(h({storage:y,rules:y.rules},e)))||{};return h({rules:null==y?void 0:y.rules},O)}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function S(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return O(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 O(e,t)}}var w=function(){var e=(0,b.useDataBlockRequestGetter)().getDataBlockRequest,t=(0,b.useDataBlockProps)().association,n=(0,b.useActionContext)().setVisible,o=(0,b.useCollection)(),r=(0,b.useSourceId)(),i=(0,g.useMemo)(function(){var e="".concat(o.name,":create");if(t){var n,i,a=(n=t.split("."),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return i}}(n,2)||j(n,i)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1];e="".concat(c,"/").concat(r,"/").concat(l,":create")}return e},[o.name,t,r]),a=((0,g.useContext)(b.RecordPickerContext)||{}).setSelectedRows,c={},l=0,u={action:i,onChange:function(t){t.forEach(function(n){if("uploading"===n.status&&!c[n.uid]&&(l++,c[n.uid]=!0),"uploading"!==n.status&&c[n.uid]&&(delete c[n.uid],0==--l)){var o,r;null===(r=e())||void 0===r||null===(o=r.refresh)||void 0===o||o.call(r),null==a||a(function(e){return S(e).concat(S(t.filter(function(e){return"done"===e.status}).map(function(e){return e.response.data})))})}}),t.every(function(e){return"done"===e.status})&&n(!1)}},p=v(u);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({},u,p)},P=f("505");function A(e){var t,n=null!=e?e:"";(0,b.useAPIClient)();var o=(0,P.useField)(),r=(0,b.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),i=r.loading,a=r.data,c=r.run;return(0,g.useEffect)(function(){if("editable"===o.pattern)c()},[o.pattern,c]),!i&&(null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.rules)||null}function C(){var e=(0,b.useCollectionField)(),t="".concat(e.target,":create").concat(e.storage?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=v({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({action:t},n)}function I(){var e=(0,b.useCollectionField)(),t=(0,b.useCollectionManager)().getCollection(null==e?void 0:e.target);return A(null==t?void 0:t.getOption("storage"))}var F=function(e){var t,n;return x().createElement(b.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({},e),n=(n={schema:{type:"void","x-action":"create",title:"{{t('Upload')}}","x-designer":"Action.Designer","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",icon:"UploadOutlined"},properties:{drawer:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Action.Container",properties:{upload:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Upload.DraggerV2","x-use-component-props":"useUploadFiles","x-component-props":{height:"50vh",multiple:!0,listType:"picture"}}}}}}},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},T=function(e){return x().createElement(b.SchemaComponentOptions,{scope:y,components:{UploadActionInitializer:F}},e.children)},E=f("482"),D=f("875"),k=f("721"),R=f("467"),q=f.n(R),_=f("238"),M="file-manager",U={name:"storages",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Storage name", { ns: "'.concat(M,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Access base URL", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]};var B={type:"object",properties:(l={},u=(0,D.uid)(),p={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:U,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:U},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateStorage","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Default storage", { ns: "'.concat(M,'" })}}'),properties:{default:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage","x-component-props":{type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}},u in l?Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[u]=p,l)},K=Number.POSITIVE_INFINITY,G={title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",required:!0,default:'{{ useNewId("s_") }}',description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".\', { ns: "'.concat(M,'" })}}')},path:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".\', { ns: "'.concat(M,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(M,'" })}}'),description:'{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "'.concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type (in MIME type format)", { ns: "'.concat(M,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(M,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy record", { ns: "'.concat(M,'" })}}')}},W={title:'{{t("Aliyun OSS", { ns: "'.concat(M,'" })}}'),name:"ali-oss",fieldset:{title:G.title,name:G.name,baseUrl:G.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(M,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},description:'{{ renderThumbnailRuleDesc("ali-oss") }}'}}},path:G.path,rules:G.rules,default:G.default,paranoid:G.paranoid},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},z={local:{title:'{{t("Local storage", { ns: "'.concat(M,'" })}}'),name:"local",fieldset:{title:G.title,name:G.name,baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:'{{t("Destination", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Input","x-display":"hidden",default:"storage/uploads"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{addonBefore:"storage/uploads/"}},rules:G.rules,default:G.default,paranoid:G.paranoid}},"ali-oss":W,s3:{title:'{{t("Amazon S3", { ns: "'.concat(M,'" })}}'),name:"s3",fieldset:{title:G.title,name:G.name,baseUrl:G.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:G.path,rules:G.rules,default:G.default,paranoid:G.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(M,'" })}}'),name:"tx-cos",fieldset:{title:G.title,name:G.name,baseUrl:G.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?imageMogr2/thumbnail/!50p"},description:'{{ renderThumbnailRuleDesc("tx-cos") }}'}}},path:G.path,rules:G.rules,default:G.default,paranoid:G.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function L(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){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){L(e,t,n[t])})}return e}function $(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return i}}(e,t)||J(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 H(e){return function(e){if(Array.isArray(e))return V(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||J(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(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)}}var Q=function(){var e=Y((0,g.useState)({}),2),t=e[0],n=e[1],o=(0,b.usePlugin)(eC),r=(0,b.useCompile)(),i=Y((0,g.useState)(!1),2),a=i[0],c=i[1],l=(0,_.useTranslation)().t;return x().createElement("div",null,x().createElement(b.ActionContext.Provider,{value:{visible:a,setVisible:c}},x().createElement(k.Dropdown,{menu:{onClick:function(e){var t=o.storageTypes.get(e.key);c(!0),n({type:"object",properties:L({},(0,D.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:r("{{t('Add new')}}")+" - "+r(t.title),properties:$(N({},q().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}})})})},items:H(o.storageTypes.values()).map(function(e){return{key:e.name,label:r(e.title)}})}},x().createElement(k.Button,{type:"primary",icon:x().createElement(E.PlusOutlined,null)},l("Add new")," ",x().createElement(E.DownOutlined,null))),x().createElement(b.SchemaComponent,{scope:{createOnly:!0},schema:t})))},X=function(){var e=(0,b.useRecord)(),t=Y((0,g.useState)({}),2),n=t[0],o=t[1],r=(0,b.usePlugin)(eC),i=(0,b.useCompile)(),a=Y((0,g.useState)(!1),2),c=a[0],l=a[1],u=(0,_.useTranslation)().t;return x().createElement("div",null,x().createElement(b.ActionContext.Provider,{value:{visible:c,setVisible:l}},x().createElement("a",{onClick:function(){l(!0);var t=r.storageTypes.get(e.type);t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),o({type:"object",properties:L({},(0,D.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:N({},e)},title:i("{{t('Edit')}}")+" - "+i(t.title),properties:$(N({},q().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}})})})}},u("Edit")),x().createElement(b.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function Z(e){var t=z[e];return(null==t?void 0:t.thumbnailRule)?x().createElement("div",null,x().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},b.i18n.t("See more"))):null}var ee=function(){var e=(0,b.useCompile)(),t=H((0,b.usePlugin)(eC).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return x().createElement(k.Card,{bordered:!1},x().createElement(b.SchemaComponent,{components:{CreateStorage:Q,EditStorage:X},scope:{useNewId:function(e){return"".concat(e).concat((0,D.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:Z},schema:B}))};function et(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e,t){return(er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ei(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ei=function(){return!!e})()}var ea=function(e){var t,n,o;function r(){var e,t,n,o,i,a;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),t=this,n=r,o=arguments,n=eo(n),en(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,ei()?Reflect.construct(n,o||[],eo(t).constructor):n.apply(t,o)),"name","attachment"),en(e,"type","object"),en(e,"group","media"),en(e,"title",'{{t("Attachment", { ns: "'.concat(M,'" })}}')),en(e,"isAssociation",!0),en(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),en(e,"availableTypes",["belongsToMany"]),en(e,"properties",(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){en(e,t,n[t])})}return e}({},b.interfacesProperties.defaultProps),a=(a={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(M,'" })}}'),"x-component":"Input","x-component-props":{placeholder:"image/*"},"x-decorator":"FormItem",description:"Example: image/png"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":"{{t('Allow uploading multiple files', { ns: \"".concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(M,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},a),Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i)),en(e,"filterable",{children:[{name:"id",title:'{{t("Exists")}}',operators:[{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}],schema:{title:'{{t("Exists")}}',type:"string","x-component":"Input"}},{name:"filename",title:'{{t("Filename", { ns: "'.concat(M,'" })}}'),operators:b.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"Input"}}]}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&er(e,t)}(r,e),t=r,n=[{key:"schemaInitialize",value:function(e,t){var n=t.block;t.field,!e["x-component-props"]&&(e["x-component-props"]={}),["Table","Kanban"].includes(n)&&(e["x-component-props"].size="small"),e["x-use-component-props"]="useAttachmentFieldProps"}},{key:"initialize",value:function(e){!e.through&&(e.through="t_".concat((0,D.uid)())),!e.foreignKey&&(e.foreignKey="f_".concat((0,D.uid)())),!e.otherKey&&(e.otherKey="f_".concat((0,D.uid)())),!e.sourceKey&&(e.sourceKey="id"),!e.targetKey&&(e.targetKey="id")}}],et(t.prototype,n),r}(b.CollectionFieldInterface);function ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){ec(e,t,n[t])})}return e}function ep(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function es(e,t){return(es=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function em(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(em=function(){return!!e})()}var ef=function(e){function t(){var e,n,o,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,o=t,r=arguments,o=el(o),ec(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,em()?Reflect.construct(o,r||[],el(n).constructor):o.apply(n,r)),"name","file"),ec(e,"title",'{{t("File collection", { ns: "'.concat(M,'" })}}')),ec(e,"order",3),ec(e,"color","blue"),ec(e,"default",{createdBy:!0,updatedBy:!0,fields:[{interface:"input",type:"string",name:"title",deletable:!1,uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"filename",deletable:!1,uiSchema:{type:"string",title:'{{t("File name", { ns: "'.concat(M,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(M,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(M,'" })}}'),"x-component":"InputNumber","x-read-pretty":!0,"x-component-props":{stringMode:!0,step:"0"}}},{interface:"input",type:"string",name:"mimetype",deletable:!1,uiSchema:{type:"string",title:'{{t("MIME type", { ns: "'.concat(M,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(M,'" })}}'),"x-component":"TextAreaWithGlobalScope","x-read-pretty":!0}},{interface:"url",type:"text",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"text",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview", { ns: "'.concat(M,'" })}}'),"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,uiSchema:{type:"string",title:'{{t("Storage", { ns: "'.concat(M,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),ec(e,"presetFieldsDisabled",!0),ec(e,"configurableProperties",eu(ep(eu(ep(eu({},(0,b.getConfigurableProperties)("title","name")),{inherits:ep(eu({},(0,b.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,b.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,b.getConfigurableProperties)("presetFields"))),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&es(e,t)}(t,e),t}(b.CollectionTemplate),ed=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function ey(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,o=ed.length-1;o>=0;o--){var r=ed[o];if(n%r.value==0)return r}return ed[0]}function eb(e,t,n){return Math.min(Math.max(t,e),n)}function eg(e){var t,n=e.value,o=e.defaultUnit,r=void 0===o?1048576:o,i=e.min,a=void 0===i?1:i,c=e.max,l=void 0===c?K:c,u=e.step,p=e.onChange,s=null!==(t=e.defaultValue)&&void 0!==t?t:0x1400000,m=ey(s,r),f=s/m.value,d=ey(null!=n?n:s,r),y=null==n?n:n/d.value,b=(0,g.useCallback)(function(e){null==p||p(eb(null==e?e:e*d.value,a,l))},[d.value]),h=(0,g.useCallback)(function(e){null==p||p(eb(y*e,a,l))},[y]);return x().createElement(k.Space.Compact,null,x().createElement(k.InputNumber,{value:y,onChange:b,defaultValue:"".concat(f),step:void 0===u?1:u}),x().createElement(k.Select,{options:ed,value:d.value,onChange:h,className:"auto-width"}))}function ex(e,t,n,o,r,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function eh(e,t,n){return(eh=eP()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&ej(r,n.prototype),r}).apply(null,arguments)}function ev(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function eO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eS(e){return(eS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ej(e,t){return(ej=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ew(e){var t="function"==typeof Map?new Map:void 0;return(ew=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return eh(e,arguments,eS(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),ej(o,e)})(e)}function eP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eP=function(){return!!e})()}var eA=function(e){var t,n,o;function r(){var e,t,n,o;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),t=this,n=r,o=arguments,n=eS(n),eO(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,eP()?Reflect.construct(n,o||[],eS(t).constructor):n.apply(t,o)),"storageTypes",new Map),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ej(e,t)}(r,e),t=r,n=[{key:"load",value:function(){var e,t=this;return(e=function(){var e;return function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(n){return t.app.dataSourceManager.addFieldInterfaces([ea]),t.app.dataSourceManager.addCollectionTemplates([ef]),t.app.use(T),t.app.pluginSettingsManager.add(M,{title:'{{t("File manager", { ns: "'.concat(M,'" })}}'),icon:"FileOutlined",Component:ee,aclSnippet:"pm.file-manager.storages"}),Object.values(z).forEach(function(e){t.registerStorageType(e.name,e)}),null==(e=t.app.schemaInitializerManager.get("table:configureActions"))||e.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return"file"===(0,b.useCollection)().template}}),t.app.addScopes({useAttachmentFieldProps:C,useFileCollectionStorageRules:I}),t.app.addComponents({FileSizeField:eg}),[2]})},function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function a(e){ex(i,o,r,a,c,"next",e)}function c(e){ex(i,o,r,a,c,"throw",e)}a(void 0)})})()}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,t)}},{key:"getStorageType",value:function(e){return this.storageTypes.get(e)}}],ev(t.prototype,n),r}(ew(b.Plugin));eO(eA,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var eC=eA;return d}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-i18next"),require("@formily/shared"),require("lodash"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["@nocobase/client","@ant-design/icons","@formily/react","react","react-i18next","@formily/shared","lodash","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-i18next"),require("@formily/shared"),require("lodash"),require("antd")):e["@nocobase/plugin-file-manager"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["react-i18next"],e["@formily/shared"],e.lodash,e.antd)}(self,function(e,t,n,o,r,i,a,c){return function(){"use strict";var l,u,p,s={482:function(e){e.exports=t},505:function(e){e.exports=n},875:function(e){e.exports=i},772:function(t){t.exports=e},721:function(e){e.exports=c},467:function(e){e.exports=a},156:function(e){e.exports=o},238:function(e){e.exports=r}},m={};function f(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return s[e](n,n.exports,f),n.exports}f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};f.r(d),f.d(d,{default:function(){return eT},PluginFileManagerClient:function(){return eF}});var y={};f.r(y),f.d(y,{useAttachmentFieldProps:function(){return F},useFileCollectionStorageRules:function(){return T},useStorageRules:function(){return I},useUploadFiles:function(){return A}});var b=f("772"),g=Number.POSITIVE_INFINITY,x=f("156"),h=f.n(x);function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}function O(){var e,t,n,o,r,i,a,c=(0,b.useCollectionField)(),l=(0,b.useCollectionManager)().getCollection(null==c?void 0:c.target),u=(0,b.useCollection)(),p=(0,b.usePlugin)(eT);var s=(t=null!=(e=(null==c?void 0:c.storage)||(null==u?void 0:u.getOption("storage"))||(null==l?void 0:l.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),r=(o=(0,b.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,i=o.data,a=o.run,(0,x.useEffect)(function(){a()},[a]),!r&&(null==i?void 0:i.data)||null),m=p.getStorageType(null==s?void 0:s.type);return{storage:s,storageType:m}}function S(e){var t=O(),n=t.storage,o=t.storageType,r=null==o?void 0:o.useUploadProps,i=(null==r?void 0:r(v({storage:n,rules:n.rules},e)))||{};return v({rules:null==n?void 0:n.rules},i)}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function w(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||P(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){if(e){if("string"==typeof e)return j(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 j(e,t)}}var A=function(){var e=(0,b.useDataBlockRequestGetter)().getDataBlockRequest,t=(0,b.useDataBlockProps)().association,n=(0,b.useActionContext)().setVisible,o=(0,b.useCollection)(),r=(0,b.useSourceId)(),i=(0,x.useMemo)(function(){var e="".concat(o.name,":create");if(t){var n,i,a=(n=t.split("."),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return i}}(n,2)||P(n,i)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],l=a[1];e="".concat(c,"/").concat(r,"/").concat(l,":create")}return e},[o.name,t,r]),a=((0,x.useContext)(b.RecordPickerContext)||{}).setSelectedRows,c={},l=0,u={action:i,onChange:function(t){t.forEach(function(n){if("uploading"===n.status&&!c[n.uid]&&(l++,c[n.uid]=!0),"uploading"!==n.status&&c[n.uid]&&(delete c[n.uid],0==--l)){var o,r;null===(r=e())||void 0===r||null===(o=r.refresh)||void 0===o||o.call(r),null==a||a(function(e){return w(e).concat(w(t.filter(function(e){return"done"===e.status}).map(function(e){return e.response.data})))})}}),t.every(function(e){return"done"===e.status})&&n(!1)}},p=S(u);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({},u,p)},C=f("505");function I(e){var t,n=null!=e?e:"";(0,b.useAPIClient)();var o=(0,C.useField)(),r=(0,b.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),i=r.loading,a=r.data,c=r.run;return(0,x.useEffect)(function(){if("editable"===o.pattern)c()},[o.pattern,c]),!i&&(null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.rules)||null}function F(){var e=(0,b.useCollectionField)(),t="".concat(e.target,":create").concat(e.storage?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=S({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({action:t},n)}function T(){var e=(0,b.useCollectionField)(),t=(0,b.useCollectionManager)().getCollection(null==e?void 0:e.target);return I(null==t?void 0:t.getOption("storage"))}var E=function(e){var t,n;return h().createElement(b.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o,r,i;o=e,r=t,i=n[t],r in o?Object.defineProperty(o,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[r]=i})}return e}({},e),n=(n={schema:{type:"void","x-action":"create",title:"{{t('Upload')}}","x-designer":"Action.Designer","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",icon:"UploadOutlined"},properties:{drawer:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Action.Container",properties:{upload:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Upload.DraggerV2","x-use-component-props":"useUploadFiles","x-component-props":{height:"50vh",multiple:!0,listType:"picture"}}}}}}},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},D=function(e){return h().createElement(b.SchemaComponentOptions,{scope:y,components:{UploadActionInitializer:E}},e.children)},k=f("721"),R=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function q(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,o=R.length-1;o>=0;o--){var r=R[o];if(n%r.value==0)return r}return R[0]}function _(e,t,n){return Math.min(Math.max(t,e),n)}function M(e){var t,n=e.value,o=e.defaultUnit,r=void 0===o?1048576:o,i=e.min,a=void 0===i?1:i,c=e.max,l=void 0===c?g:c,u=e.step,p=e.onChange,s=null!==(t=e.defaultValue)&&void 0!==t?t:0x1400000,m=q(s,r),f=s/m.value,d=q(null!=n?n:s,r),y=null==n?n:n/d.value,b=(0,x.useCallback)(function(e){null==p||p(_(null==e?e:e*d.value,a,l))},[d.value]),v=(0,x.useCallback)(function(e){null==p||p(_(y*e,a,l))},[y]);return h().createElement(k.Space.Compact,null,h().createElement(k.InputNumber,{value:y,onChange:b,defaultValue:"".concat(f),step:void 0===u?1:u}),h().createElement(k.Select,{options:R,value:d.value,onChange:v,className:"auto-width"}))}var U=f("482"),B=f("875"),K=f("467"),G=f.n(K),W=f("238"),z="file-manager",N={name:"storages",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Storage name", { ns: "'.concat(z,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(z,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(z,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Base URL", { ns: "'.concat(z,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(z,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]};var V={type:"object",properties:(l={},u=(0,B.uid)(),p={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:N,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:N},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateStorage","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Default storage", { ns: "'.concat(z,'" })}}'),properties:{default:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage","x-component-props":{type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}},u in l?Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[u]=p,l)},L={title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",required:!0,default:'{{ useNewId("s_") }}',description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".\', { ns: "'.concat(z,'" })}}')},path:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".\', { ns: "'.concat(z,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(z,'" })}}'),description:'{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "'.concat(z,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type (in MIME type format)", { ns: "'.concat(z,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(z,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(z,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy record", { ns: "'.concat(z,'" })}}')}},$={title:'{{t("Aliyun OSS", { ns: "'.concat(z,'" })}}'),name:"ali-oss",fieldset:{title:L.title,name:L.name,baseUrl:L.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(z,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},description:'{{ renderThumbnailRuleDesc("ali-oss") }}'}}},path:L.path,rules:L.rules,default:L.default,paranoid:L.paranoid},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},Y={local:{title:'{{t("Local storage", { ns: "'.concat(z,'" })}}'),name:"local",fieldset:{title:L.title,name:L.name,baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:'{{t("Destination", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Input","x-display":"hidden",default:"storage/uploads"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{addonBefore:"storage/uploads/"}},rules:L.rules,default:L.default,paranoid:L.paranoid}},"ali-oss":$,s3:{title:'{{t("Amazon S3", { ns: "'.concat(z,'" })}}'),name:"s3",fieldset:{title:L.title,name:L.name,baseUrl:L.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:L.path,rules:L.rules,default:L.default,paranoid:L.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(z,'" })}}'),name:"tx-cos",fieldset:{title:L.title,name:L.name,baseUrl:L.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(z,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?imageMogr2/thumbnail/!50p"},description:'{{ renderThumbnailRuleDesc("tx-cos") }}'}}},path:L.path,rules:L.rules,default:L.default,paranoid:L.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){J(e,t,n[t])})}return e}function X(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{!a&&null!=r.return&&r.return()}finally{if(c)throw o}}return i}}(e,t)||et(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 ee(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||et(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function et(e,t){if(e){if("string"==typeof e)return H(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 H(e,t)}}var en=function(){var e=Z((0,x.useState)({}),2),t=e[0],n=e[1],o=(0,b.usePlugin)(eT),r=(0,b.useCompile)(),i=Z((0,x.useState)(!1),2),a=i[0],c=i[1],l=(0,W.useTranslation)().t;return h().createElement("div",null,h().createElement(b.ActionContext.Provider,{value:{visible:a,setVisible:c}},h().createElement(k.Dropdown,{menu:{onClick:function(e){var t=o.storageTypes.get(e.key);c(!0),n({type:"object",properties:J({},(0,B.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:r("{{t('Add new')}}")+" - "+r(t.title),properties:X(Q({},G().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}})})})},items:ee(o.storageTypes.values()).map(function(e){return{key:e.name,label:r(e.title)}})}},h().createElement(k.Button,{type:"primary",icon:h().createElement(U.PlusOutlined,null)},l("Add new")," ",h().createElement(U.DownOutlined,null))),h().createElement(b.SchemaComponent,{scope:{createOnly:!0},schema:t})))},eo=function(){var e=(0,b.useRecord)(),t=Z((0,x.useState)({}),2),n=t[0],o=t[1],r=(0,b.usePlugin)(eT),i=(0,b.useCompile)(),a=Z((0,x.useState)(!1),2),c=a[0],l=a[1],u=(0,W.useTranslation)().t;return h().createElement("div",null,h().createElement(b.ActionContext.Provider,{value:{visible:c,setVisible:l}},h().createElement("a",{onClick:function(){l(!0);var t=r.storageTypes.get(e.type);t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),o({type:"object",properties:J({},(0,B.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:Q({},e)},title:i("{{t('Edit')}}")+" - "+i(t.title),properties:X(Q({},G().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}})})})}},u("Edit")),h().createElement(b.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function er(e){var t=Y[e];return(null==t?void 0:t.thumbnailRule)?h().createElement("div",null,h().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},b.i18n.t("See more"))):null}var ei=function(){var e=(0,b.useCompile)(),t=ee((0,b.usePlugin)(eT).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return h().createElement(k.Card,{bordered:!1},h().createElement(b.SchemaComponent,{components:{CreateStorage:en,EditStorage:eo},scope:{useNewId:function(e){return"".concat(e).concat((0,B.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:er},schema:V}))};function ea(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eu(e,t){return(eu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ep(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ep=function(){return!!e})()}var es=function(e){var t,n,o;function r(){var e,t,n,o,i,a;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),t=this,n=r,o=arguments,n=el(n),ec(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,ep()?Reflect.construct(n,o||[],el(t).constructor):n.apply(t,o)),"name","attachment"),ec(e,"type","object"),ec(e,"group","media"),ec(e,"title",'{{t("Attachment", { ns: "'.concat(z,'" })}}')),ec(e,"isAssociation",!0),ec(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),ec(e,"availableTypes",["belongsToMany"]),ec(e,"properties",(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){ec(e,t,n[t])})}return e}({},b.interfacesProperties.defaultProps),a=(a={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(z,'" })}}'),"x-component":"Input","x-component-props":{placeholder:"image/*"},"x-decorator":"FormItem",description:"Example: image/png"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":"{{t('Allow uploading multiple files', { ns: \"".concat(z,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(z,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(z,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},a),Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i)),ec(e,"filterable",{children:[{name:"id",title:'{{t("Exists")}}',operators:[{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}],schema:{title:'{{t("Exists")}}',type:"string","x-component":"Input"}},{name:"filename",title:'{{t("Filename", { ns: "'.concat(z,'" })}}'),operators:b.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(z,'" })}}'),type:"string","x-component":"Input"}}]}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eu(e,t)}(r,e),t=r,n=[{key:"schemaInitialize",value:function(e,t){var n=t.block;t.field,!e["x-component-props"]&&(e["x-component-props"]={}),["Table","Kanban"].includes(n)&&(e["x-component-props"].size="small"),e["x-use-component-props"]="useAttachmentFieldProps"}},{key:"initialize",value:function(e){!e.through&&(e.through="t_".concat((0,B.uid)())),!e.foreignKey&&(e.foreignKey="f_".concat((0,B.uid)())),!e.otherKey&&(e.otherKey="f_".concat((0,B.uid)())),!e.sourceKey&&(e.sourceKey="id"),!e.targetKey&&(e.targetKey="id")}}],ea(t.prototype,n),r}(b.CollectionFieldInterface);function em(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e){return(ef=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ed(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){em(e,t,n[t])})}return e}function ey(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eb(e,t){return(eb=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eg=function(){return!!e})()}var ex=function(e){function t(){var e,n,o,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,o=t,r=arguments,o=ef(o),em(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,eg()?Reflect.construct(o,r||[],ef(n).constructor):o.apply(n,r)),"name","file"),em(e,"title",'{{t("File collection", { ns: "'.concat(z,'" })}}')),em(e,"order",3),em(e,"color","blue"),em(e,"default",{createdBy:!0,updatedBy:!0,fields:[{interface:"input",type:"string",name:"title",deletable:!1,uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"filename",deletable:!1,uiSchema:{type:"string",title:'{{t("File name", { ns: "'.concat(z,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(z,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(z,'" })}}'),"x-component":"InputNumber","x-read-pretty":!0,"x-component-props":{stringMode:!0,step:"0"}}},{interface:"input",type:"string",name:"mimetype",deletable:!1,uiSchema:{type:"string",title:'{{t("MIME type", { ns: "'.concat(z,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(z,'" })}}'),"x-component":"TextAreaWithGlobalScope","x-read-pretty":!0}},{interface:"url",type:"text",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"text",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview", { ns: "'.concat(z,'" })}}'),"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,uiSchema:{type:"string",title:'{{t("Storage", { ns: "'.concat(z,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),em(e,"presetFieldsDisabled",!0),em(e,"configurableProperties",ed(ey(ed(ey(ed({},(0,b.getConfigurableProperties)("title","name")),{inherits:ey(ed({},(0,b.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,b.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(z,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,b.getConfigurableProperties)("presetFields"))),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eb(e,t)}(t,e),t}(b.CollectionTemplate);function eh(e,t,n,o,r,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function ev(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function a(e){eh(i,o,r,a,c,"next",e)}function c(e){eh(i,o,r,a,c,"throw",e)}a(void 0)})}}function eO(e,t,n){return(eO=eC()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&eP(r,n.prototype),r}).apply(null,arguments)}function eS(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ej(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ew(e){return(ew=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eP(e,t){return(eP=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eA(e){var t="function"==typeof Map?new Map:void 0;return(eA=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return eO(e,arguments,ew(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),eP(o,e)})(e)}function eC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eC=function(){return!!e})()}function eI(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var eF=function(e){var t,n,o;function r(){var e,t,n,o;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),t=this,n=r,o=arguments,n=ew(n),ej(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,eC()?Reflect.construct(n,o||[],ew(t).constructor):n.apply(t,o)),"storageTypes",new Map),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&eP(e,t)}(r,e),t=r,n=[{key:"load",value:function(){var e=this;return ev(function(){var t;return eI(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([es]),e.app.dataSourceManager.addCollectionTemplates([ex]),e.app.use(D),e.app.pluginSettingsManager.add(z,{title:'{{t("File manager", { ns: "'.concat(z,'" })}}'),icon:"FileOutlined",Component:ei,aclSnippet:"pm.file-manager.storages"}),Object.values(Y).forEach(function(t){e.registerStorageType(t.name,t)}),null==(t=e.app.schemaInitializerManager.get("table:configureActions"))||t.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return"file"===(0,b.useCollection)().template}}),e.app.addScopes({useAttachmentFieldProps:F,useFileCollectionStorageRules:T,useStorageCfg:O}),e.app.addComponents({FileSizeField:M}),[2]})})()}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,t)}},{key:"getStorageType",value:function(e){return this.storageTypes.get(e)}},{key:"uploadFile",value:function(e){var t=this;return ev(function(){var n,o,r;return eI(this,function(i){switch(i.label){case 0:if(!(null==(n=t.getStorageType(null==e?void 0:e.storageType))?void 0:n.upload))return[3,2];return[4,n.upload({file:e.file,apiClient:t.app.apiClient,storageType:e.storageType,storageId:e.storageId,storageRules:e.storageRules,fileCollectionName:e.fileCollectionName})];case 1:return[2,i.sent()];case 2:return i.trys.push([2,4,,5]),(r=new FormData).append("file",e.file),[4,t.app.apiClient.request({url:"".concat(e.fileCollectionName||"attachments",":create"),method:"post",data:r})];case 3:return[2,{data:null===(o=i.sent().data)||void 0===o?void 0:o.data}];case 4:return[2,{errorMessage:i.sent().message}];case 5:return[2]}})})()}}],eS(t.prototype,n),r}(eA(b.Plugin));ej(eF,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var eT=eF;return d}()});
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const INVALID_FILENAME_CHARS = "<>?*~\\/";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var constants_exports = {};
28
+ __export(constants_exports, {
29
+ INVALID_FILENAME_CHARS: () => INVALID_FILENAME_CHARS
30
+ });
31
+ module.exports = __toCommonJS(constants_exports);
32
+ const INVALID_FILENAME_CHARS = "<>?*~\\/";
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ INVALID_FILENAME_CHARS
36
+ });
@@ -8,22 +8,22 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.10",
11
+ "@nocobase/client": "1.7.0-alpha.10",
12
12
  "react": "18.2.0",
13
- "antd": "5.12.8",
13
+ "antd": "5.24.2",
14
14
  "@ant-design/icons": "5.6.1",
15
15
  "@formily/shared": "2.3.2",
16
16
  "lodash": "4.17.21",
17
17
  "react-i18next": "11.18.6",
18
- "@formily/antd-v5": "1.1.9",
18
+ "@formily/antd-v5": "1.2.3",
19
19
  "@formily/core": "2.3.0",
20
20
  "@formily/react": "2.3.0",
21
21
  "multer": "1.4.4",
22
- "@nocobase/server": "1.6.10",
23
- "@nocobase/utils": "1.6.10",
24
- "@nocobase/database": "1.6.10",
25
- "@nocobase/test": "1.6.10",
26
- "@nocobase/actions": "1.6.10",
22
+ "@nocobase/database": "1.7.0-alpha.10",
23
+ "@nocobase/server": "1.7.0-alpha.10",
24
+ "@nocobase/utils": "1.7.0-alpha.10",
25
+ "@nocobase/test": "1.7.0-alpha.10",
26
+ "@nocobase/actions": "1.7.0-alpha.10",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/plugin-data-source-main": "1.6.10"
28
+ "@nocobase/plugin-data-source-main": "1.7.0-alpha.10"
29
29
  };
@@ -20,7 +20,7 @@
20
20
  "Storage type": "Speichertyp",
21
21
  "Default storage": "Standardspeicher",
22
22
  "Storage base URL": "Basis-URL des Speichers",
23
- "Access base URL": "Basis-URL für den Zugriff",
23
+ "Base URL": "Basis-URL",
24
24
  "Base URL for file access, could be your CDN base URL. For example: \"https://cdn.nocobase.com\".": "Basis-URL für den Dateizugriff, könnte Ihre CDN-Basis-URL sein. Zum Beispiel: \"https://cdn.nocobase.com\".",
25
25
  "Destination": "Ziel",
26
26
  "Use the built-in static file server": "Den integrierten statischen Dateiserver verwenden",
@@ -30,7 +30,7 @@
30
30
  "Allow uploading multiple files": "Consenti caricamento di più file",
31
31
  "Storage": "Spazio di archiviazione",
32
32
  "Storages": "Spazi di archiviazione",
33
- "Access base URL": "URL base accesso",
33
+ "Base URL": "URL base",
34
34
  "Base URL for file access, could be your CDN base URL. For example: \"https://cdn.nocobase.com\".": "URL base per l'accesso ai file, potrebbe essere l'URL base del tuo CDN. Ad esempio: \"https://cdn.nocobase.com\".",
35
35
  "Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes \"/\" will be ignored. For example: \"user/avatar\".": "Percorso relativo in cui verrà salvato il file. Lasciare vuoto per il percorso radice. Le barre iniziali e finali \"/\" verranno ignorate. Ad esempio: \"user/avatar\".",
36
36
  "Default storage will be used when not selected": "Se non selezionato verrà utilizzato lo spazio di archiviazione predefinito",
@@ -32,7 +32,7 @@
32
32
  "Allow uploading multiple files": "複数ファイルのアップロードを許可する",
33
33
  "Storage": "ストレージ",
34
34
  "Storages": "ストレージ",
35
- "Access base URL": "アクセスURLのベース",
35
+ "Base URL": "ベースURL",
36
36
  "Base URL for file access, could be your CDN base URL. For example: \"https://cdn.nocobase.com\".": "术语调整,“基礎URL”改为“ベースURL”",
37
37
  "Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes \"/\" will be ignored. For example: \"user/avatar\".": "更清晰的表达方式,符合技术描述",
38
38
  "Default storage will be used when not selected": "空欄の場合はデフォルトのストレージが使用されます。",
@@ -0,0 +1,40 @@
1
+ {
2
+ "File collection": "Bestandcollectie",
3
+ "File name": "Bestandsnaam",
4
+ "Extension name": "Extensienaam",
5
+ "Size": "Grootte",
6
+ "File size limit": "Bestandsgrootte limiet",
7
+ "Minimum from 1 byte, maximum up to 1GB.": "Minimaal vanaf 1 byte, maximaal tot 1 GB.",
8
+ "MIME type": "MIME type",
9
+ "File type (in MIME type format)": "Bestandstype (in MIME type formaat)",
10
+ "Multi-types seperated with comma, for example: \"image/*\", \"image/png\", \"image/*, application/pdf\" etc.": "Meerdere typen gescheiden door een komma, bijvoorbeeld: \"image/*\", \"image/png\", \"image/*, application/pdf\" enz.",
11
+ "URL": "URL",
12
+ "File storage": "Bestandsopslag",
13
+ "File manager": "Bestandsbeheerder",
14
+ "Attachment": "Bijlage",
15
+ "Allow uploading multiple files": "Meerdere bestanden uploaden toestaan",
16
+ "Storage": "Opslagruimte",
17
+ "Storages": "Opslagruimtes",
18
+ "Storage name": "Opslagnaam",
19
+ "Storage type": "Opslagtype",
20
+ "Default storage": "Standaard opslagruimte",
21
+ "Access base URL": "Toegangsbasis-URL",
22
+ "Base URL for file access, could be your CDN base URL. For example: \"https://cdn.nocobase.com\".": "Basis-URL voor bestandstoegang, kan uw CDN-basis-URL zijn. Bijvoorbeeld: \"https://cdn.nocobase.com\".",
23
+ "Destination": "Bestemmingsmap",
24
+ "Use the built-in static file server": "Gebruik de ingebouwde statische bestandsserver",
25
+ "Local storage": "Lokale opslag",
26
+ "Aliyun OSS": "Aliyun OSS",
27
+ "Amazon S3": "Amazon S3",
28
+ "Tencent COS": "Tencent COS",
29
+ "Region": "Regio",
30
+ "Bucket": "Bucket",
31
+ "Path": "Pad",
32
+ "Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes \"/\" will be ignored. For example: \"user/avatar\".": "Relatief pad waar het bestand zal worden opgeslagen. Laat leeg als hoofdmap. De voorloop- en achterloop-slashes \"/\" worden genegeerd. Bijvoorbeeld: \"gebruiker/avatar\".",
33
+ "Filename": "Bestandsnaam",
34
+ "Will be used for API": "Zal worden gebruikt voor API",
35
+ "Default storage will be used when not selected": "Standaard opslagruimte wordt gebruikt wanneer niet geselecteerd",
36
+ "Keep file in storage when destroy record": "Bestand in opslag houden bij vernietiging van record",
37
+ "See more": "Bekijk meer",
38
+ "Aliyun OSS region part of the bucket. For example: \"oss-cn-beijing\".": "Aliyun OSS regio-onderdeel van de bucket. Bijvoorbeeld: \"oss-cn-beijing\"."
39
+ }
40
+
@@ -18,7 +18,7 @@
18
18
  "Storage name": "存储空间标识",
19
19
  "Storage type": "存储类型",
20
20
  "Default storage": "默认存储空间",
21
- "Access base URL": "访问 URL 基础",
21
+ "Base URL": "基础 URL",
22
22
  "Base URL for file access, could be your CDN base URL. For example: \"https://cdn.nocobase.com\".": "文件访问的基础 URL,可以是你的 CDN 基础 URL。例如:\"https://cdn.nocobase.com\"。",
23
23
  "Destination": "上传目标文件夹",
24
24
  "Use the built-in static file server": "使用内置静态文件服务",
@@ -1 +1 @@
1
- {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-03-25T07:04:45.503Z"}
1
+ {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-03-27T04:32:38.901Z"}
@@ -1 +1 @@
1
- {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2025-03-25T07:04:39.665Z"}
1
+ {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2025-03-27T04:32:32.283Z"}
@@ -1 +1 @@
1
- {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2025-03-25T07:04:44.119Z"}
1
+ {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2025-03-27T04:32:37.329Z"}
@@ -1 +1 @@
1
- {"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-03-25T07:04:44.036Z"}
1
+ {"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-03-27T04:32:37.244Z"}
@@ -1 +1 @@
1
- {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-03-25T07:04:50.920Z"}
1
+ {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-03-27T04:32:44.634Z"}
@@ -1 +1 @@
1
- {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-03-25T07:04:47.049Z"}
1
+ {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-03-27T04:32:40.576Z"}
@@ -1 +1 @@
1
- {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2025-03-25T07:04:39.577Z"}
1
+ {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2025-03-27T04:32:32.195Z"}
@@ -7,5 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Context, Next } from '@nocobase/actions';
10
- export declare function getFileData(ctx: Context): Promise<any>;
11
10
  export declare function createMiddleware(ctx: Context, next: Next): Promise<any>;
@@ -36,12 +36,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var attachments_exports = {};
38
38
  __export(attachments_exports, {
39
- createMiddleware: () => createMiddleware,
40
- getFileData: () => getFileData
39
+ createMiddleware: () => createMiddleware
41
40
  });
42
41
  module.exports = __toCommonJS(attachments_exports);
43
42
  var import_utils = require("@nocobase/utils");
44
- var import_path = __toESM(require("path"));
45
43
  var import__ = __toESM(require(".."));
46
44
  var import_constants = require("../../constants");
47
45
  var Rules = __toESM(require("../rules"));
@@ -53,37 +51,6 @@ function getFileFilter(storage) {
53
51
  cb(null, result);
54
52
  };
55
53
  }
56
- async function getFileData(ctx) {
57
- var _a;
58
- const { [import_constants.FILE_FIELD_NAME]: file, storage } = ctx;
59
- if (!file) {
60
- return ctx.throw(400, "file validation failed");
61
- }
62
- const plugin = ctx.app.pm.get(import__.default);
63
- const StorageType = plugin.storageTypes.get(storage.type);
64
- const { [StorageType.filenameKey || "filename"]: name } = file;
65
- const filename = import_path.default.basename(name);
66
- const extname = import_path.default.extname(filename);
67
- const path = (storage.path || "").replace(/^\/|\/$/g, "");
68
- let storageInstance = plugin.storagesCache.get(storage.id);
69
- if (!storageInstance) {
70
- await plugin.loadStorages();
71
- storageInstance = plugin.storagesCache.get(storage.id);
72
- }
73
- const data = {
74
- title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
75
- filename,
76
- extname,
77
- // TODO(feature): 暂时两者相同,后面 storage.path 模版化以后,这里只是 file 实际的 path
78
- path,
79
- size: file.size,
80
- mimetype: file.mimetype,
81
- meta: ctx.request.body,
82
- storageId: storage.id,
83
- ...(_a = StorageType == null ? void 0 : StorageType["getFileData"]) == null ? void 0 : _a.call(StorageType, file)
84
- };
85
- return data;
86
- }
87
54
  async function multipart(ctx, next) {
88
55
  const { storage } = ctx;
89
56
  if (!storage) {
@@ -116,7 +83,11 @@ async function multipart(ctx, next) {
116
83
  ctx.logger.error(err);
117
84
  return ctx.throw(500, err);
118
85
  }
119
- const values = await getFileData(ctx);
86
+ const { [import_constants.FILE_FIELD_NAME]: file } = ctx;
87
+ if (!file) {
88
+ return ctx.throw(400, "file validation failed");
89
+ }
90
+ const values = storageInstance.getFileData(file, ctx.request.body);
120
91
  ctx.action.mergeParams({
121
92
  values
122
93
  });
@@ -130,11 +101,10 @@ async function createMiddleware(ctx, next) {
130
101
  if (((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) !== "file" || !["upload", "create"].includes(actionName)) {
131
102
  return next();
132
103
  }
133
- const storageName = ((_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage) || collection.options.storage;
134
- const StorageRepo = ctx.db.getRepository("storages");
135
- const storage = await StorageRepo.findOne({ filter: storageName ? { name: storageName } : { default: true } });
136
104
  const plugin = ctx.app.pm.get(import__.default);
137
- ctx.storage = plugin.parseStorage(storage);
105
+ const storageName = ((_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage) || collection.options.storage;
106
+ const storages = Array.from(plugin.storagesCache.values());
107
+ ctx.storage = storages.find((item) => item.name === storageName) || storages.find((item) => item.default);
138
108
  if (ctx == null ? void 0 : ctx.request.is("multipart/*")) {
139
109
  await multipart(ctx, next);
140
110
  } else {
@@ -143,6 +113,5 @@ async function createMiddleware(ctx, next) {
143
113
  }
144
114
  // Annotate the CommonJS export names for ESM import in node:
145
115
  0 && (module.exports = {
146
- createMiddleware,
147
- getFileData
116
+ createMiddleware
148
117
  });
@@ -41,6 +41,7 @@ __export(storages_exports, {
41
41
  module.exports = __toCommonJS(storages_exports);
42
42
  var import__ = __toESM(require(".."));
43
43
  async function getBasicInfo(context, next) {
44
+ var _a, _b;
44
45
  const { storagesCache } = context.app.pm.get(import__.default);
45
46
  let result;
46
47
  const { filterByTk } = context.action.params;
@@ -58,7 +59,9 @@ async function getBasicInfo(context, next) {
58
59
  title: result.title,
59
60
  name: result.name,
60
61
  type: result.type,
61
- rules: result.rules
62
+ rules: result.rules,
63
+ baseUrl: (_a = result.options) == null ? void 0 : _a.baseUrl,
64
+ public: (_b = result.options) == null ? void 0 : _b.public
62
65
  };
63
66
  next();
64
67
  }
@@ -6,9 +6,9 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import { Model, Transactionable } from '@nocobase/database';
9
10
  import { Plugin } from '@nocobase/server';
10
11
  import { Registry } from '@nocobase/utils';
11
- import { Model, Transactionable } from '@nocobase/database';
12
12
  import { AttachmentModel, StorageClassType, StorageModel } from './storages';
13
13
  export type * from './storages';
14
14
  export type FileRecordOptions = {
@@ -29,7 +29,16 @@ export declare class PluginFileManagerServer extends Plugin {
29
29
  registerStorageType(type: string, Type: StorageClassType): void;
30
30
  createFileRecord(options: FileRecordOptions): Promise<any>;
31
31
  parseStorage(instance: any): any;
32
- uploadFile(options: UploadFileOptions): Promise<any>;
32
+ uploadFile(options: UploadFileOptions): Promise<{
33
+ title: string;
34
+ filename: string;
35
+ extname: string;
36
+ path: string;
37
+ size: any;
38
+ mimetype: any;
39
+ meta: {};
40
+ storageId: number;
41
+ }>;
33
42
  loadStorages(options?: {
34
43
  transaction: any;
35
44
  }): Promise<void>;
@@ -40,14 +40,13 @@ __export(server_exports, {
40
40
  default: () => server_default
41
41
  });
42
42
  module.exports = __toCommonJS(server_exports);
43
- var import_server = require("@nocobase/server");
44
- var import_utils = require("@nocobase/utils");
43
+ var import_fs = __toESM(require("fs"));
45
44
  var import_path = require("path");
46
45
  var import_database = require("@nocobase/database");
47
- var import_fs = __toESM(require("fs"));
46
+ var import_server = require("@nocobase/server");
47
+ var import_utils = require("@nocobase/utils");
48
48
  var import_constants = require("../constants");
49
49
  var import_actions = __toESM(require("./actions"));
50
- var import_attachments = require("./actions/attachments");
51
50
  var import_attachment_interface = require("./interfaces/attachment-interface");
52
51
  var import_ali_oss = __toESM(require("./storages/ali-oss"));
53
52
  var import_local = __toESM(require("./storages/local"));
@@ -111,29 +110,24 @@ class PluginFileManagerServer extends import_server.Plugin {
111
110
  }
112
111
  async uploadFile(options) {
113
112
  const { storageName, filePath, documentRoot } = options;
114
- const storageRepository = this.db.getRepository("storages");
115
- let storageInstance;
116
- storageInstance = await storageRepository.findOne({
117
- filter: storageName ? {
118
- name: storageName
119
- } : {
120
- default: true
121
- }
122
- });
123
- const fileStream = import_fs.default.createReadStream(filePath);
124
- if (!storageInstance) {
113
+ if (!this.storagesCache.size) {
114
+ await this.loadStorages();
115
+ }
116
+ const storages = Array.from(this.storagesCache.values());
117
+ const storage = storages.find((item) => item.name === storageName) || storages.find((item) => item.default);
118
+ if (!storage) {
125
119
  throw new Error("[file-manager] no linked or default storage provided");
126
120
  }
127
- storageInstance = this.parseStorage(storageInstance);
121
+ const fileStream = import_fs.default.createReadStream(filePath);
128
122
  if (documentRoot) {
129
- storageInstance.options["documentRoot"] = documentRoot;
123
+ storage.options["documentRoot"] = documentRoot;
130
124
  }
131
- const storageType = this.storageTypes.get(storageInstance.type);
132
- const storage = new storageType(storageInstance);
133
- if (!storage) {
134
- throw new Error(`[file-manager] storage type "${storageInstance.type}" is not defined`);
125
+ const StorageType = this.storageTypes.get(storage.type);
126
+ const storageInstance = new StorageType(storage);
127
+ if (!storageInstance) {
128
+ throw new Error(`[file-manager] storage type "${storage.type}" is not defined`);
135
129
  }
136
- const engine = storage.make();
130
+ const engine = storageInstance.make();
137
131
  const file = {
138
132
  originalname: (0, import_path.basename)(filePath),
139
133
  path: filePath,
@@ -148,7 +142,7 @@ class PluginFileManagerServer extends import_server.Plugin {
148
142
  resolve(info);
149
143
  });
150
144
  });
151
- return (0, import_attachments.getFileData)({ app: this.app, file, storage: storageInstance, request: { body: {} } });
145
+ return storageInstance.getFileData(file, {});
152
146
  }
153
147
  async loadStorages(options) {
154
148
  const repository = this.db.getRepository("storages");
@@ -181,17 +175,8 @@ class PluginFileManagerServer extends import_server.Plugin {
181
175
  }
182
176
  }
183
177
  async handleSyncMessage(message) {
184
- if (message.type === "storageChange") {
185
- const storage = await this.db.getRepository("storages").findOne({
186
- filterByTk: message.storageId
187
- });
188
- if (storage) {
189
- this.storagesCache.set(storage.id, this.parseStorage(storage));
190
- }
191
- }
192
- if (message.type === "storageRemove") {
193
- const id = message.storageId;
194
- this.storagesCache.delete(id);
178
+ if (message.type === "reloadStorages") {
179
+ await this.loadStorages();
195
180
  }
196
181
  }
197
182
  async beforeLoad() {
@@ -226,17 +211,11 @@ class PluginFileManagerServer extends import_server.Plugin {
226
211
  this.storageTypes.register(import_constants.STORAGE_TYPE_S3, import_s3.default);
227
212
  this.storageTypes.register(import_constants.STORAGE_TYPE_TX_COS, import_tx_cos.default);
228
213
  const Storage = this.db.getModel("storages");
229
- Storage.afterSave((m, { transaction }) => {
230
- this.storagesCache.set(m.id, m.toJSON());
231
- this.sendSyncMessage(
232
- {
233
- type: "storageChange",
234
- storageId: m.id
235
- },
236
- { transaction }
237
- );
214
+ Storage.afterSave(async (m, { transaction }) => {
215
+ await this.loadStorages({ transaction });
216
+ this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
238
217
  });
239
- Storage.afterDestroy((m, { transaction }) => {
218
+ Storage.afterDestroy(async (m, { transaction }) => {
240
219
  var _a, _b;
241
220
  for (const collection of this.db.collections.values()) {
242
221
  if (((_a = collection == null ? void 0 : collection.options) == null ? void 0 : _a.template) === "file" && ((_b = collection == null ? void 0 : collection.options) == null ? void 0 : _b.storage) === m.name) {
@@ -247,14 +226,8 @@ class PluginFileManagerServer extends import_server.Plugin {
247
226
  );
248
227
  }
249
228
  }
250
- this.storagesCache.delete(m.id);
251
- this.sendSyncMessage(
252
- {
253
- type: "storageRemove",
254
- storageId: m.id
255
- },
256
- { transaction }
257
- );
229
+ await this.loadStorages({ transaction });
230
+ this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
258
231
  });
259
232
  this.app.acl.registerSnippet({
260
233
  name: `pm.${this.name}.storages`,
@@ -34,10 +34,15 @@ export declare abstract class StorageType {
34
34
  abstract make(): StorageEngine;
35
35
  abstract delete(records: AttachmentModel[]): [number, AttachmentModel[]] | Promise<[number, AttachmentModel[]]>;
36
36
  getFileKey(record: AttachmentModel): any;
37
- getFileData?(file: {
38
- [key: string]: any;
39
- }): {
40
- [key: string]: any;
37
+ getFileData(file: any, meta?: {}): {
38
+ title: string;
39
+ filename: string;
40
+ extname: string;
41
+ path: string;
42
+ size: any;
43
+ mimetype: any;
44
+ meta: {};
45
+ storageId: number;
41
46
  };
42
47
  getFileURL(file: AttachmentModel, preview?: boolean): string | Promise<string>;
43
48
  }
@@ -39,8 +39,9 @@ __export(storages_exports, {
39
39
  StorageType: () => StorageType
40
40
  });
41
41
  module.exports = __toCommonJS(storages_exports);
42
- var import_utils = require("@nocobase/utils");
42
+ var import_path = __toESM(require("path"));
43
43
  var import_url_join = __toESM(require("url-join"));
44
+ var import_utils = require("@nocobase/utils");
44
45
  var import_utils2 = require("../utils");
45
46
  class StorageType {
46
47
  constructor(storage) {
@@ -53,6 +54,24 @@ class StorageType {
53
54
  getFileKey(record) {
54
55
  return (0, import_utils2.getFileKey)(record);
55
56
  }
57
+ getFileData(file, meta = {}) {
58
+ const { [this.constructor.filenameKey || "filename"]: name } = file;
59
+ const filename = import_path.default.basename(name);
60
+ const extname = import_path.default.extname(filename);
61
+ const path = (this.storage.path || "").replace(/^\/|\/$/g, "");
62
+ const data = {
63
+ title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
64
+ filename,
65
+ extname,
66
+ // TODO(feature): 暂时两者相同,后面 storage.path 模版化以后,这里只是 file 实际的 path
67
+ path,
68
+ size: file.size,
69
+ mimetype: file.mimetype,
70
+ meta,
71
+ storageId: this.storage.id
72
+ };
73
+ return data;
74
+ }
56
75
  getFileURL(file, preview) {
57
76
  if (file.url && (0, import_utils.isURL)(file.url)) {
58
77
  if (preview) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "1.6.10",
3
+ "version": "1.7.0-alpha.10",
4
4
  "displayName": "File manager",
5
5
  "displayName.zh-CN": "文件管理器",
6
6
  "description": "Provides files storage services with files collection template and attachment field.",
@@ -44,5 +44,5 @@
44
44
  "Collections",
45
45
  "Collection fields"
46
46
  ],
47
- "gitHead": "e60f706756ba6e0d11a6b9a752c02531db8500bc"
47
+ "gitHead": "d2c8d0194316b2d1bf42af6f466cf4b29af84778"
48
48
  }