@nocobase/plugin-file-manager 1.7.0-beta.9 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +13 -0
- package/dist/client/index.js +1 -1
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +8 -0
- package/dist/client/schemas/storageTypes/index.d.ts +8 -0
- package/dist/common/collections/attachments.d.ts +37 -0
- package/dist/common/collections/attachments.js +97 -0
- package/dist/common/collections/storages.d.ts +79 -0
- package/dist/common/collections/storages.js +98 -0
- package/dist/common/constants.d.ts +9 -0
- package/dist/common/constants.js +36 -0
- package/dist/externalVersion.js +9 -8
- package/dist/locale/de-DE.json +1 -1
- package/dist/locale/en-US.json +25 -6
- package/dist/locale/it-IT.json +1 -1
- package/dist/locale/ja-JP.json +1 -1
- package/dist/locale/nl-NL.json +27 -9
- package/dist/locale/zh-CN.json +4 -2
- package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +834 -834
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-aliyun-oss/index.js +3 -3
- package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
- package/dist/node_modules/multer-cos/index.js +5 -5
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/index.js +837 -837
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.d.ts +0 -1
- package/dist/server/actions/attachments.js +21 -41
- package/dist/server/actions/storages.js +4 -1
- package/dist/server/collections/attachments.d.ts +2 -2
- package/dist/server/collections/attachments.js +12 -67
- package/dist/server/collections/storages.d.ts +2 -2
- package/dist/server/collections/storages.js +12 -64
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +3 -0
- package/dist/server/server.d.ts +19 -3
- package/dist/server/server.js +70 -53
- package/dist/server/storages/ali-oss.js +1 -1
- package/dist/server/storages/index.d.ts +17 -5
- package/dist/server/storages/index.js +41 -3
- package/dist/server/storages/local.d.ts +6 -0
- package/dist/server/storages/local.js +13 -2
- package/dist/server/utils.d.ts +1 -1
- package/dist/server/utils.js +8 -4
- package/package.json +6 -5
package/dist/client/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/client/index.js
CHANGED
|
@@ -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("react"),require("lodash"),require("@nocobase/client"),require("@formily/shared"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["react","lodash","@nocobase/client","@formily/shared","@formily/react","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("react"),require("lodash"),require("@nocobase/client"),require("@formily/shared"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-file-manager"]=t(e.react,e.lodash,e["@nocobase/client"],e["@formily/shared"],e["@formily/react"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,n,o,r,a,i,c){return function(){"use strict";var l={482:function(e){e.exports=a},505:function(e){e.exports=r},875:function(e){e.exports=o},772:function(e){e.exports=n},721:function(e){e.exports=i},467:function(e){e.exports=t},156:function(t){t.exports=e},238:function(e){e.exports=c}},u={};function p(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return l[e](n,n.exports,p),n.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return!function(){p.r(s),p.d(s,{PluginFileManagerClient:function(){return eh},default:function(){return ex}});var e,t,n,o={};p.r(o),p.d(o,{useAttachmentFieldProps:function(){return x},useFileCollectionStorageRules:function(){return v},useStorageRules:function(){return h},useUploadFiles:function(){return b}});var r=p(772),a=Number.POSITIVE_INFINITY,i=p(156),c=p.n(i);function l(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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function u(){var e,t,n,o,a,c,l,u=(0,r.useCollectionField)(),p=(0,r.useCollectionManager)().getCollection(null==u?void 0:u.target),s=(0,r.useCollection)(),m=(0,r.usePlugin)(ex),f=(t=null!=(e=(null==u?void 0:u.storage)||(null==s?void 0:s.getOption("storage"))||(null==p?void 0:p.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),a=(o=(0,r.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,c=o.data,l=o.run,(0,i.useEffect)(function(){l()},[l]),!a&&(null==c?void 0:c.data)||null),d=m.getStorageType(null==f?void 0:f.type);return{storage:f,storageType:d}}function m(e){var t=u(),n=t.storage,o=t.storageType,r=null==o?void 0:o.useUploadProps,a=(null==r?void 0:r(l({storage:n,rules:n.rules},e)))||{};return l({rules:null==n?void 0:n.rules},a)}function f(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 d(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(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 y(e,t){if(e){if("string"==typeof e)return f(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 f(e,t)}}var b=function(){var e=(0,r.useDataBlockRequestGetter)().getDataBlockRequest,t=((0,r.useDataBlockProps)()||{}).association,n=(0,r.useActionContext)().setVisible,o=(0,r.useCollection)(),a=(0,r.useSourceId)(),c=(0,i.useMemo)(function(){var e="".concat(o.name,":create");if(t){var n,r=(n=t.split("."),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 a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(n,2)||y(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=r[0],c=r[1];e="".concat(i,"/").concat(a,"/").concat(c,":create")}return e},[o.name,t,a]),l=((0,i.useContext)(r.RecordPickerContext)||{}).setSelectedRows,u={},p=0,s={action:c,onChange:function(t){t.forEach(function(n){if("uploading"!==n.status||u[n.uid]||(p++,u[n.uid]=!0),"uploading"!==n.status&&u[n.uid]&&(delete u[n.uid],0==--p)){var o,r;null==(r=e())||null==(o=r.refresh)||o.call(r),null==l||l(function(e){return d(e).concat(d(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)}},f=m(s);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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},s,f)},g=p(505);function h(e){var t,n=null!=e?e:"";(0,r.useAPIClient)();var o=(0,g.useField)(),a=(0,r.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),c=a.loading,l=a.data,u=a.run;return(0,i.useEffect)(function(){"editable"===o.pattern&&u()},[o.pattern,u]),!c&&(null==l||null==(t=l.data)?void 0:t.rules)||null}function x(){var e=(0,r.useCollectionField)(),t="".concat(e.target,":create").concat(e.storage?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=m({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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({action:t},n)}function v(){var e=(0,r.useCollectionField)(),t=(0,r.useCollectionManager)().getCollection(null==e?void 0:e.target);return h(null==t?void 0:t.getOption("storage"))}var O=function(e){var t,n,o={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"}}}}}};return c().createElement(r.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;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},e),n=n={schema:o},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))},S={dumpRules:{group:"user"},migrationRules:["schema-only","overwrite"],asStrategyResource:!0,shared:!0,name:"attachments",createdBy:!0,updatedBy:!0,template:"file",fields:[{comment:"用户文件名(不含扩展名)",type:"string",name:"title"},{comment:"系统文件名(含扩展名)",type:"string",name:"filename"},{comment:"扩展名(含“.”)",type:"string",name:"extname"},{comment:"文件体积(字节)",type:"integer",name:"size"},{type:"string",name:"mimetype"},{comment:"存储引擎",type:"belongsTo",name:"storage"},{comment:"相对路径(含“/”前缀)",type:"text",name:"path"},{comment:"其他文件信息(如图片的宽高)",type:"jsonb",name:"meta",defaultValue:{}},{comment:"网络访问地址",type:"text",name:"url"}]},j=function(e){return c().createElement(r.ExtendCollectionsProvider,{collections:[S]},c().createElement(r.SchemaComponentOptions,{scope:o,components:{UploadActionInitializer:O}},e.children))},w=p(721),P=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function A(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,o=P.length-1;o>=0;o--){var r=P[o];if(n%r.value==0)return r}return P[0]}function C(e,t,n){return Math.min(Math.max(t,e),n)}function I(e){var t,n=e.value,o=e.defaultUnit,r=void 0===o?1048576:o,l=e.min,u=void 0===l?1:l,p=e.max,s=void 0===p?a:p,m=e.step,f=e.onChange,d=null!=(t=e.defaultValue)?t:0x1400000,y=A(d,r),b=d/y.value,g=A(null!=n?n:d,r),h=null==n?n:n/g.value,x=(0,i.useCallback)(function(e){null==f||f(C(null==e?e:e*g.value,u,s))},[g.value]),v=(0,i.useCallback)(function(e){null==f||f(C(h*e,u,s))},[h]);return c().createElement(w.Space.Compact,null,c().createElement(w.InputNumber,{value:h,onChange:x,defaultValue:"".concat(b),step:void 0===m?1:m}),c().createElement(w.Select,{options:P,value:g.value,onChange:v,className:"auto-width"}))}var F=p(482),T=p(875),E=p(467),D=p.n(E),k=p(238),R="file-manager",q={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(R,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Base URL", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(R,'" })}}'),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"}}]},_={type:"object",properties:(e={},t=(0,T.uid)(),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:q,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:q},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(R,'" })}}'),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}}"}}}}}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},M={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(R,'" })}}')},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(R,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(R,'" })}}'),description:'{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type (in MIME type format)", { ns: "'.concat(R,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(R,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy record", { ns: "'.concat(R,'" })}}')}},B={title:'{{t("Aliyun OSS", { ns: "'.concat(R,'" })}}'),name:"ali-oss",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(R,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},timeout:{title:'{{t("Timeout", { ns: "'.concat(R,'" })}}'),description:"{{t('Upload timeout for a single file in milliseconds. Default is 600000.', { ns: \"".concat(R,'" })}}'),type:"number","x-decorator":"FormItem","x-component":"InputNumber",default:6e5},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:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},U={local:{title:'{{t("Local storage", { ns: "'.concat(R,'" })}}'),name:"local",fieldset:{title:M.title,name:M.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(R,'" })}}'),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:M.rules,default:M.default,paranoid:M.paranoid}},"ali-oss":B,s3:{title:'{{t("Amazon S3", { ns: "'.concat(R,'" })}}'),name:"s3",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(R,'" })}}'),name:"tx-cos",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),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:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function K(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 G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(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){G(e,t,n[t])})}return e}function W(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 N(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 a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||L(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 V(e){return function(e){if(Array.isArray(e))return K(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(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 L(e,t){if(e){if("string"==typeof e)return K(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 K(e,t)}}var $=function(){var e=N((0,i.useState)({}),2),t=e[0],n=e[1],o=(0,r.usePlugin)(ex),a=(0,r.useCompile)(),l=N((0,i.useState)(!1),2),u=l[0],p=l[1],s=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:u,setVisible:p}},c().createElement(w.Dropdown,{menu:{onClick:function(e){var t=o.storageTypes.get(e.key);p(!0),n({type:"object",properties:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:a("{{t('Add new')}}")+" - "+a(t.title),properties:W(z({},D().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:V(o.storageTypes.values()).map(function(e){return{key:e.name,label:a(e.title)}})}},c().createElement(w.Button,{type:"primary",icon:c().createElement(F.PlusOutlined,null)},s("Add new")," ",c().createElement(F.DownOutlined,null))),c().createElement(r.SchemaComponent,{scope:{createOnly:!0},schema:t})))},Y=function(){var e=(0,r.useRecord)(),t=N((0,i.useState)({}),2),n=t[0],o=t[1],a=(0,r.usePlugin)(ex),l=(0,r.useCompile)(),u=N((0,i.useState)(!1),2),p=u[0],s=u[1],m=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:p,setVisible:s}},c().createElement("a",{onClick:function(){s(!0);var t=a.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:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:z({},e)},title:l("{{t('Edit')}}")+" - "+l(t.title),properties:W(z({},D().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 }}"}}}}})})})}},m("Edit")),c().createElement(r.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function H(e){var t=U[e];return(null==t?void 0:t.thumbnailRule)?c().createElement("div",null,c().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},r.i18n.t("See more"))):null}var J=function(){var e=(0,r.useCompile)(),t=V((0,r.usePlugin)(ex).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return c().createElement(w.Card,{bordered:!1},c().createElement(r.SchemaComponent,{components:{CreateStorage:$,EditStorage:Y},scope:{useNewId:function(e){return"".concat(e).concat((0,T.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:H},schema:_}))};function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var et=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=X(t),Q(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ee()?Reflect.construct(t,o||[],X(this).constructor):t.apply(this,o)),"name","attachment"),Q(e,"type","object"),Q(e,"group","media"),Q(e,"title",'{{t("Attachment", { ns: "'.concat(R,'" })}}')),Q(e,"isAssociation",!0),Q(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),Q(e,"availableTypes",["belongsToMany"]),Q(e,"properties",(a=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){Q(e,t,n[t])})}return e}({},r.interfacesProperties.defaultProps),i=i={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(R,'" })}}'),"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(R,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(R,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))}),a)),Q(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(R,'" })}}'),operators:r.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}}]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&Z(n,e),t=[{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,T.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,T.uid)())),e.otherKey||(e.otherKey="f_".concat((0,T.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}}],function(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)}}(n.prototype,t),n}(r.CollectionFieldInterface);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){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}function ea(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 ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ec=function(){return!!e})()}var el=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,o;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return n=t,o=arguments,n=eo(n),en(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ec()?Reflect.construct(n,o||[],eo(this).constructor):n.apply(this,o)),"name","file"),en(e,"title",'{{t("File collection", { ns: "'.concat(R,'" })}}')),en(e,"order",3),en(e,"color","blue"),en(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(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(R,'" })}}'),"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(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(R,'" })}}'),"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(R,'" })}}'),"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(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),en(e,"presetFieldsDisabled",!0),en(e,"configurableProperties",er(ea(er(ea(er({},(0,r.getConfigurableProperties)("title","name")),{inherits:ea(er({},(0,r.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,r.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,r.getConfigurableProperties)("presetFields"))),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ei(t,e),t}(r.CollectionTemplate);function eu(e,t,n,o,r,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function ep(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function i(e){eu(a,o,r,i,c,"next",e)}function c(e){eu(a,o,r,i,c,"throw",e)}i(void 0)})}}function es(e,t,n){return(es=eb()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&ed(r,n.prototype),r}).apply(null,arguments)}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,t){return(ed=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ey(e){var t="function"==typeof Map?new Map:void 0;return(ey=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return es(e,arguments,ef(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ed(n,e)})(e)}function eb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eb=function(){return!!e})()}function eg(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,o=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(6===l[0]&&i.label<r[1]){i.label=r[1],r=l;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(l);break}r[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],o=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var eh=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=ef(t),em(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eb()?Reflect.construct(t,o||[],ef(this).constructor):t.apply(this,o)),"storageTypes",new Map),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ed(n,e),t=[{key:"load",value:function(){var e=this;return ep(function(){var t;return eg(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([et]),e.app.dataSourceManager.addCollectionTemplates([el]),e.app.use(j),e.app.pluginSettingsManager.add(R,{title:'{{t("File manager", { ns: "'.concat(R,'" })}}'),icon:"FileOutlined",Component:J,aclSnippet:"pm.file-manager.storages"}),Object.values(U).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,r.useCollection)().template}}),e.app.addScopes({useAttachmentFieldProps:x,useFileCollectionStorageRules:v,useStorageCfg:u}),e.app.addComponents({FileSizeField:I}),[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 ep(function(){var n,o,r;return eg(this,function(a){switch(a.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,a.sent()];case 2:return a.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=a.sent().data)?void 0:o.data}];case 4:return[2,{errorMessage:a.sent().message}];case 5:return[2]}})})()}}],function(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)}}(n.prototype,t),n}(ey(r.Plugin));em(eh,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var ex=eh}(),s}()});
|
|
@@ -63,6 +63,14 @@ declare const _default: {
|
|
|
63
63
|
'x-component': string;
|
|
64
64
|
required: boolean;
|
|
65
65
|
};
|
|
66
|
+
timeout: {
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
type: string;
|
|
70
|
+
'x-decorator': string;
|
|
71
|
+
'x-component': string;
|
|
72
|
+
default: number;
|
|
73
|
+
};
|
|
66
74
|
thumbnailRule: {
|
|
67
75
|
title: string;
|
|
68
76
|
type: string;
|
|
@@ -144,6 +144,14 @@ export declare const storageTypes: {
|
|
|
144
144
|
'x-component': string;
|
|
145
145
|
required: boolean;
|
|
146
146
|
};
|
|
147
|
+
timeout: {
|
|
148
|
+
title: string;
|
|
149
|
+
description: string;
|
|
150
|
+
type: string;
|
|
151
|
+
'x-decorator': string;
|
|
152
|
+
'x-component': string;
|
|
153
|
+
default: number;
|
|
154
|
+
};
|
|
147
155
|
thumbnailRule: {
|
|
148
156
|
title: string;
|
|
149
157
|
type: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
declare const _default: {
|
|
10
|
+
dumpRules: {
|
|
11
|
+
group: string;
|
|
12
|
+
};
|
|
13
|
+
migrationRules: string[];
|
|
14
|
+
asStrategyResource: boolean;
|
|
15
|
+
shared: boolean;
|
|
16
|
+
name: string;
|
|
17
|
+
createdBy: boolean;
|
|
18
|
+
updatedBy: boolean;
|
|
19
|
+
template: string;
|
|
20
|
+
fields: ({
|
|
21
|
+
comment: string;
|
|
22
|
+
type: string;
|
|
23
|
+
name: string;
|
|
24
|
+
defaultValue?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
comment?: undefined;
|
|
29
|
+
defaultValue?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
comment: string;
|
|
32
|
+
type: string;
|
|
33
|
+
name: string;
|
|
34
|
+
defaultValue: {};
|
|
35
|
+
})[];
|
|
36
|
+
};
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 attachments_exports = {};
|
|
28
|
+
__export(attachments_exports, {
|
|
29
|
+
default: () => attachments_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(attachments_exports);
|
|
32
|
+
var attachments_default = {
|
|
33
|
+
dumpRules: {
|
|
34
|
+
group: "user"
|
|
35
|
+
},
|
|
36
|
+
migrationRules: ["schema-only", "overwrite"],
|
|
37
|
+
asStrategyResource: true,
|
|
38
|
+
shared: true,
|
|
39
|
+
name: "attachments",
|
|
40
|
+
createdBy: true,
|
|
41
|
+
updatedBy: true,
|
|
42
|
+
template: "file",
|
|
43
|
+
fields: [
|
|
44
|
+
{
|
|
45
|
+
comment: "\u7528\u6237\u6587\u4EF6\u540D\uFF08\u4E0D\u542B\u6269\u5C55\u540D\uFF09",
|
|
46
|
+
type: "string",
|
|
47
|
+
name: "title"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
comment: "\u7CFB\u7EDF\u6587\u4EF6\u540D\uFF08\u542B\u6269\u5C55\u540D\uFF09",
|
|
51
|
+
type: "string",
|
|
52
|
+
name: "filename"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
comment: "\u6269\u5C55\u540D\uFF08\u542B\u201C.\u201D\uFF09",
|
|
56
|
+
type: "string",
|
|
57
|
+
name: "extname"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
comment: "\u6587\u4EF6\u4F53\u79EF\uFF08\u5B57\u8282\uFF09",
|
|
61
|
+
type: "integer",
|
|
62
|
+
name: "size"
|
|
63
|
+
},
|
|
64
|
+
// TODO: 使用暂不明确,以后再考虑
|
|
65
|
+
// {
|
|
66
|
+
// comment: '文件类型(mimetype 前半段,通常用于预览)',
|
|
67
|
+
// type: 'string',
|
|
68
|
+
// name: 'type',
|
|
69
|
+
// },
|
|
70
|
+
{
|
|
71
|
+
type: "string",
|
|
72
|
+
name: "mimetype"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
comment: "\u5B58\u50A8\u5F15\u64CE",
|
|
76
|
+
type: "belongsTo",
|
|
77
|
+
name: "storage"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
comment: "\u76F8\u5BF9\u8DEF\u5F84\uFF08\u542B\u201C/\u201D\u524D\u7F00\uFF09",
|
|
81
|
+
type: "text",
|
|
82
|
+
name: "path"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
comment: "\u5176\u4ED6\u6587\u4EF6\u4FE1\u606F\uFF08\u5982\u56FE\u7247\u7684\u5BBD\u9AD8\uFF09",
|
|
86
|
+
type: "jsonb",
|
|
87
|
+
name: "meta",
|
|
88
|
+
defaultValue: {}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
comment: "\u7F51\u7EDC\u8BBF\u95EE\u5730\u5740",
|
|
92
|
+
type: "text",
|
|
93
|
+
name: "url"
|
|
94
|
+
// formula: '{{ storage.baseUrl }}{{ path }}/{{ filename }}'
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
declare const _default: {
|
|
10
|
+
dumpRules: string;
|
|
11
|
+
migrationRules: string[];
|
|
12
|
+
name: string;
|
|
13
|
+
shared: boolean;
|
|
14
|
+
fields: ({
|
|
15
|
+
title: string;
|
|
16
|
+
comment: string;
|
|
17
|
+
type: string;
|
|
18
|
+
name: string;
|
|
19
|
+
translation: boolean;
|
|
20
|
+
trim: boolean;
|
|
21
|
+
unique?: undefined;
|
|
22
|
+
defaultValue?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
title: string;
|
|
25
|
+
type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
unique: boolean;
|
|
28
|
+
trim: boolean;
|
|
29
|
+
comment?: undefined;
|
|
30
|
+
translation?: undefined;
|
|
31
|
+
defaultValue?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
comment: string;
|
|
34
|
+
type: string;
|
|
35
|
+
name: string;
|
|
36
|
+
title?: undefined;
|
|
37
|
+
translation?: undefined;
|
|
38
|
+
trim?: undefined;
|
|
39
|
+
unique?: undefined;
|
|
40
|
+
defaultValue?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
comment: string;
|
|
43
|
+
type: string;
|
|
44
|
+
name: string;
|
|
45
|
+
defaultValue: {};
|
|
46
|
+
title?: undefined;
|
|
47
|
+
translation?: undefined;
|
|
48
|
+
trim?: undefined;
|
|
49
|
+
unique?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
comment: string;
|
|
52
|
+
type: string;
|
|
53
|
+
name: string;
|
|
54
|
+
defaultValue: string;
|
|
55
|
+
trim: boolean;
|
|
56
|
+
title?: undefined;
|
|
57
|
+
translation?: undefined;
|
|
58
|
+
unique?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
comment: string;
|
|
61
|
+
type: string;
|
|
62
|
+
name: string;
|
|
63
|
+
defaultValue: boolean;
|
|
64
|
+
title?: undefined;
|
|
65
|
+
translation?: undefined;
|
|
66
|
+
trim?: undefined;
|
|
67
|
+
unique?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
type: string;
|
|
70
|
+
name: string;
|
|
71
|
+
defaultValue: boolean;
|
|
72
|
+
title?: undefined;
|
|
73
|
+
comment?: undefined;
|
|
74
|
+
translation?: undefined;
|
|
75
|
+
trim?: undefined;
|
|
76
|
+
unique?: undefined;
|
|
77
|
+
})[];
|
|
78
|
+
};
|
|
79
|
+
export default _default;
|
|
@@ -0,0 +1,98 @@
|
|
|
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 storages_exports = {};
|
|
28
|
+
__export(storages_exports, {
|
|
29
|
+
default: () => storages_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(storages_exports);
|
|
32
|
+
var storages_default = {
|
|
33
|
+
dumpRules: "required",
|
|
34
|
+
migrationRules: ["overwrite", "schema-only"],
|
|
35
|
+
name: "storages",
|
|
36
|
+
shared: true,
|
|
37
|
+
fields: [
|
|
38
|
+
{
|
|
39
|
+
title: "\u5B58\u50A8\u5F15\u64CE\u540D\u79F0",
|
|
40
|
+
comment: "\u5B58\u50A8\u5F15\u64CE\u540D\u79F0",
|
|
41
|
+
type: "string",
|
|
42
|
+
name: "title",
|
|
43
|
+
translation: true,
|
|
44
|
+
trim: true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "\u82F1\u6587\u6807\u8BC6",
|
|
48
|
+
// comment: '英文标识,用于代码层面配置',
|
|
49
|
+
type: "uid",
|
|
50
|
+
name: "name",
|
|
51
|
+
unique: true,
|
|
52
|
+
trim: true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
comment: "\u7C7B\u578B\u6807\u8BC6\uFF0C\u5982 local/ali-oss \u7B49",
|
|
56
|
+
type: "string",
|
|
57
|
+
name: "type"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
comment: "\u914D\u7F6E\u9879",
|
|
61
|
+
type: "jsonb",
|
|
62
|
+
name: "options",
|
|
63
|
+
defaultValue: {}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
comment: "\u6587\u4EF6\u89C4\u5219",
|
|
67
|
+
type: "jsonb",
|
|
68
|
+
name: "rules",
|
|
69
|
+
defaultValue: {}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
comment: "\u5B58\u50A8\u76F8\u5BF9\u8DEF\u5F84\u6A21\u677F",
|
|
73
|
+
type: "text",
|
|
74
|
+
name: "path",
|
|
75
|
+
defaultValue: "",
|
|
76
|
+
trim: true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
comment: "\u8BBF\u95EE\u5730\u5740\u524D\u7F00",
|
|
80
|
+
type: "string",
|
|
81
|
+
name: "baseUrl",
|
|
82
|
+
defaultValue: "",
|
|
83
|
+
trim: true
|
|
84
|
+
},
|
|
85
|
+
// TODO(feature): 需要使用一个实现了可设置默认值的字段
|
|
86
|
+
{
|
|
87
|
+
comment: "\u9ED8\u8BA4\u5F15\u64CE",
|
|
88
|
+
type: "radio",
|
|
89
|
+
name: "default",
|
|
90
|
+
defaultValue: false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "boolean",
|
|
94
|
+
name: "paranoid",
|
|
95
|
+
defaultValue: false
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
};
|
|
@@ -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
|
+
});
|