@nocobase/plugin-file-manager 1.0.0-alpha.9 → 1.0.1-alpha.2
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/FileSizeField.d.ts +10 -0
- package/dist/client/hooks/index.d.ts +1 -0
- package/dist/client/hooks/useStorageRules.d.ts +14 -0
- package/dist/client/hooks/useUploadFiles.d.ts +1 -5
- package/dist/client/index.js +1 -1
- package/dist/client/interfaces/attachment.d.ts +4 -2
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +28 -1
- package/dist/client/schemas/storageTypes/common.d.ts +68 -0
- package/dist/client/schemas/storageTypes/index.d.ts +107 -1
- package/dist/client/schemas/storageTypes/local.d.ts +25 -0
- package/dist/client/schemas/storageTypes/s3.d.ts +27 -0
- package/dist/client/schemas/storageTypes/tx-cos.d.ts +27 -0
- package/dist/client/templates/file.d.ts +3 -3
- package/dist/{server/constants.d.ts → constants.d.ts} +3 -1
- package/dist/{server/constants.js → constants.js} +9 -3
- package/dist/externalVersion.js +7 -7
- package/dist/locale/zh-CN.json +10 -2
- 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/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/server/FileModel.js +1 -5
- package/dist/server/actions/attachments.js +14 -9
- package/dist/server/actions/index.js +5 -0
- package/dist/server/actions/storages.d.ts +1 -0
- package/dist/server/actions/storages.js +62 -0
- package/dist/server/collections/attachments.js +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/interfaces/attachment-interface.d.ts +18 -0
- package/dist/server/interfaces/attachment-interface.js +63 -0
- package/dist/server/migrations/20240523152854-change-attachment-field-props.d.ts +14 -0
- package/dist/server/migrations/20240523152854-change-attachment-field-props.js +65 -0
- package/dist/server/rules/mimetype.js +5 -1
- package/dist/server/server.d.ts +5 -2
- package/dist/server/server.js +31 -23
- package/dist/server/storages/ali-oss.d.ts +3 -4
- package/dist/server/storages/ali-oss.js +8 -10
- package/dist/server/storages/index.d.ts +11 -8
- package/dist/server/storages/index.js +3 -27
- package/dist/server/storages/local.d.ts +6 -4
- package/dist/server/storages/local.js +9 -5
- package/dist/server/storages/s3.d.ts +3 -4
- package/dist/server/storages/s3.js +9 -11
- package/dist/server/storages/tx-cos.d.ts +3 -4
- package/dist/server/storages/tx-cos.js +15 -14
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +6 -1
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import React from 'react';
|
|
10
|
+
export declare function FileSizeField(props: any): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 function useStorageRules(storage: any): any;
|
|
10
|
+
export declare function useAttachmentFieldProps(): {
|
|
11
|
+
rules: any;
|
|
12
|
+
action: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFileCollectionStorageRules(): any;
|
|
@@ -6,12 +6,8 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export declare const FILE_LIMIT_SIZE: number;
|
|
10
9
|
export declare const useUploadFiles: () => {
|
|
11
10
|
action: string;
|
|
12
|
-
/**
|
|
13
|
-
* 返回 false 会阻止上传,返回 true 会继续上传
|
|
14
|
-
*/
|
|
15
|
-
beforeUpload(file: any): boolean;
|
|
16
11
|
onChange(fileList: any): void;
|
|
12
|
+
rules: any;
|
|
17
13
|
};
|
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(r,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("antd"),require("react"),require("react-i18next"),require("@ant-design/icons"),require("@formily/shared"),require("lodash"),require("@formily/antd-v5"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","antd","react","react-i18next","@ant-design/icons","@formily/shared","lodash","@formily/antd-v5","@formily/react"],t):(r=typeof globalThis!="undefined"?globalThis:r||self,t(r["@nocobase/plugin-file-manager"]={},r["@nocobase/client"],r.jsxRuntime,r.antd,r.react,r["react-i18next"],r["@ant-design/icons"],r["@formily/shared"],r.lodash,r["@formily/antd-v5"],r["@formily/react"]))})(this,function(r,t,o,F,m,b,q,u,x,A,S){"use strict";var Y=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var D=(r,t,o)=>t in r?Y(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,f=(r,t)=>{for(var o in t||(t={}))oe.call(t,o)&&D(r,o,t[o]);if(k)for(var o of k(t))ne.call(t,o)&&D(r,o,t[o]);return r},h=(r,t)=>ee(r,te(t));var a=(r,t,o)=>(D(r,typeof t!="symbol"?t+"":t,o),o);var _=(r,t,o)=>new Promise((F,m)=>{var b=x=>{try{u(o.next(x))}catch(A){m(A)}},q=x=>{try{u(o.throw(x))}catch(A){m(A)}},u=x=>x.done?F(x.value):Promise.resolve(x.value).then(b,q);u((o=o.apply(r,t)).next())});const e="file-manager";function M(){return b.useTranslation(e)}const T=1024*1024*1024,O=Object.freeze(Object.defineProperty({__proto__:null,FILE_LIMIT_SIZE:T,useUploadFiles:()=>{const{service:s}=t.useBlockRequestContext(),{t:c}=M(),{setVisible:n}=t.useActionContext(),{props:i}=t.useBlockRequestContext(),p=t.useCollection(),d=t.useSourceIdFromParentRecord(),C=m.useMemo(()=>{let I=`${p.name}:create`;if(i!=null&&i.association){const[g,w]=i.association.split(".");I=`${g}/${d}/${w}:create`}return I},[p.name,i==null?void 0:i.association,d]),{setSelectedRows:y}=m.useContext(t.RecordPickerContext)||{},l={};let $=0;return{action:C,beforeUpload(I){return I.size>T?(F.notification.error({message:`${c("File size cannot exceed")} ${T/1024/1024}M`}),I.status="error",!1):!0},onChange(I){I.forEach(g=>{var w;g.status==="uploading"&&!l[g.uid]&&($++,l[g.uid]=!0),g.status!=="uploading"&&l[g.uid]&&(delete l[g.uid],--$===0&&((w=s==null?void 0:s.refresh)==null||w.call(s),y==null||y(X=>[...X,...I.filter(P=>P.status==="done").map(P=>P.response.data)])))}),I.every(g=>g.status==="done")&&n(!1)}}}},Symbol.toStringTag,{value:"Module"})),U=s=>{t.useCollection_deprecated();const c={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 o.jsx(t.ActionInitializer,h(f({},s),{schema:c}))},E=s=>o.jsx(t.SchemaComponentOptions,{scope:O,components:{UploadActionInitializer:U},children:s.children}),j={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input"}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}}},z=S.observer(s=>{const c=S.useForm(),n=S.useField(),[i,p]=m.useState(new S.Schema({}));return m.useEffect(()=>{p(new S.Schema(j[c.values.type]||{}))},[c.values.type]),o.jsx(A.FormLayout,{layout:"vertical",children:o.jsx(S.RecursionField,{basePath:n.address,onlyRenderProperties:!0,schema:i},c.values.type||"local")})},{displayName:"StorageOptions"}),K={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: "${e}" })}}`,descriptions:`{{t("Will be used for API", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Storage type", { ns: "${e}" })}}`,type:"string","x-component":"Select",required:!0,enum:"{{ storageTypes }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:`{{t("Storage base URL", { ns: "${e}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]},B={type:"object",properties:{[u.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:K,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:K},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: "${e}" })}}`,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}}"}}}}}}}}}}}},N=()=>{const[s,c]=m.useState({}),n=t.usePlugin(v),i=t.useCompile(),[p,d]=m.useState(!1),{t:C}=b.useTranslation();return o.jsx("div",{children:o.jsxs(t.ActionContext.Provider,{value:{visible:p,setVisible:d},children:[o.jsx(F.Dropdown,{menu:{onClick(y){const l=n.storageTypes.get(y.key);d(!0),c({type:"object",properties:{[u.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:l.name}},title:i("{{t('Add new')}}")+" - "+i(l.title),properties:h(f({},x.cloneDeep(l.properties)),{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:[...n.storageTypes.values()].map(y=>({key:y.name,label:i(y.title)}))},children:o.jsxs(F.Button,{type:"primary",icon:o.jsx(q.PlusOutlined,{}),children:[C("Add new")," ",o.jsx(q.DownOutlined,{})]})}),o.jsx(t.SchemaComponent,{scope:{createOnly:!0},schema:s})]})})},V=()=>{const s=t.useRecord(),[c,n]=m.useState({}),i=t.usePlugin(v),p=t.useCompile(),[d,C]=m.useState(!1),{t:y}=b.useTranslation();return o.jsx("div",{children:o.jsxs(t.ActionContext.Provider,{value:{visible:d,setVisible:C},children:[o.jsx("a",{onClick:()=>{C(!0);const l=i.storageTypes.get(s.type);l.properties.default&&(l.properties.default["x-reactions"]=$=>{$.initialValue?$.disabled=!0:$.disabled=!1}),n({type:"object",properties:{[u.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:f({},s)},title:p("{{t('Edit')}}")+" - "+p(l.title),properties:h(f({},x.cloneDeep(l.properties)),{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 }}"}}}}})}}})},children:y("Edit")}),o.jsx(t.SchemaComponent,{scope:{createOnly:!1},schema:c})]})})},R=()=>{const{t:s}=b.useTranslation(),c=t.useCompile(),i=[...t.usePlugin(v).storageTypes.values()].map(d=>({value:d.name,label:c(d.title)})),p=o.jsxs("div",{children:[s("See more")," ",o.jsx("a",{target:"_blank",href:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",rel:"noreferrer",children:"x-oss-process"})]});return o.jsx(F.Card,{bordered:!1,children:o.jsx(t.SchemaComponent,{components:{StorageOptions:z,CreateStorage:N,EditStorage:V},scope:{useNewId:d=>`${d}${u.uid()}`,storageTypes:i,xStyleProcessDesc:p},schema:B})})},L={title:`{{t("Aliyun OSS", { ns: "${e}" })}}`,name:"ali-oss",properties:{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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},default:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90",description:"{{ xStyleProcessDesc }}"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},W={title:`{{t("Local storage", { ns: "${e}" })}}`,name:"local",properties:{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","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,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/"}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},Z={title:`{{t("Amazon S3", { ns: "${e}" })}}`,name:"s3",properties:{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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},G={title:`{{t("Tencent COS", { ns: "${e}" })}}`,name:"tx-cos",properties:{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"},options:{type:"object","x-component":"div",properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},H={local:W,"ali-oss":L,s3:Z,"tx-cos":G};class J extends t.CollectionFieldInterface{constructor(){super(...arguments);a(this,"name","attachment");a(this,"type","object");a(this,"group","media");a(this,"title",`{{t("Attachment", { ns: "${e}" })}}`);a(this,"isAssociation",!0);a(this,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-component-props":{}}});a(this,"availableTypes",["belongsToMany"]);a(this,"properties",h(f({},t.interfacesProperties.defaultProps),{"uiSchema.x-component-props.accept":{type:"string",title:`{{t("MIME type", { ns: "${e}" })}}`,"x-component":"Input","x-decorator":"FormItem",description:"Example: image/png",default:"image/*"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":`{{t('Allow uploading multiple files', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,description:`{{t('Default storage will be used when not selected', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}));a(this,"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: "${e}" })}}`,operators:t.interfacesProperties.operators.string,schema:{title:`{{t("Filename", { ns: "${e}" })}}`,type:"string","x-component":"Input"}}]})}schemaInitialize(n,{block:i,field:p}){["Table","Kanban"].includes(i)&&(n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].size="small"),n["x-component-props"]||(n["x-component-props"]={}),n["x-component-props"].action=`${p.target}:create${p.storage?`?attachmentField=${p.collectionName}.${p.name}`:""}`}initialize(n){n.through||(n.through=`t_${u.uid()}`),n.foreignKey||(n.foreignKey=`f_${u.uid()}`),n.otherKey||(n.otherKey=`f_${u.uid()}`),n.sourceKey||(n.sourceKey="id"),n.targetKey||(n.targetKey="id")}}class Q extends t.CollectionTemplate{constructor(){super(...arguments);a(this,"name","file");a(this,"title",`{{t("File collection", { ns: "${e}" })}}`);a(this,"order",3);a(this,"color","blue");a(this,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:`{{t("Extension name", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:`{{t("Size", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"path",deletable:!1,uiSchema:{type:"string",title:`{{t("Path", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"string",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:`{{t("Preview", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]});a(this,"presetFieldsDisabled",!0);a(this,"configurableProperties",f(h(f(h(f({},t.getConfigurableProperties("title","name")),{inherits:h(f({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage","x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}}),t.getConfigurableProperties("presetFields")))}}class v extends t.Plugin{constructor(){super(...arguments);a(this,"storageTypes",new Map)}load(){return _(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([J]),this.app.dataSourceManager.addCollectionTemplates([Q]),this.app.use(E),this.app.pluginSettingsManager.add(e,{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",Component:R,aclSnippet:"pm.file-manager.storages"}),Object.values(H).forEach(i=>{this.registerStorageType(i.name,i)});const n=this.app.schemaInitializerManager.get("table:configureActions");n==null||n.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return t.useCollection_deprecated().template==="file"}})})}registerStorageType(n,i){this.storageTypes.set(n,i)}}r.PluginFileManagerClient=v,r.default=v,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
10
|
+
(function(a,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("@formily/shared"),require("antd"),require("lodash"),require("react-i18next"),require("@formily/antd-v5"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","@ant-design/icons","@formily/shared","antd","lodash","react-i18next","@formily/antd-v5","@formily/react"],t):(a=typeof globalThis!="undefined"?globalThis:a||self,t(a["@nocobase/plugin-file-manager"]={},a["@nocobase/client"],a.jsxRuntime,a.react,a["@ant-design/icons"],a["@formily/shared"],a.antd,a.lodash,a["react-i18next"],a["@formily/antd-v5"],a["@formily/react"]))})(this,function(a,t,r,g,T,b,F,$,f,P,A){"use strict";var ce=Object.defineProperty,le=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var k=(a,t,r)=>t in a?ce(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,I=(a,t)=>{for(var r in t||(t={}))me.call(t,r)&&k(a,r,t[r]);if(L)for(var r of L(t))de.call(t,r)&&k(a,r,t[r]);return a},C=(a,t)=>le(a,ue(t));var l=(a,t,r)=>(k(a,typeof t!="symbol"?t+"":t,r),r);var V=(a,t,r)=>new Promise((g,T)=>{var b=f=>{try{$(r.next(f))}catch(P){T(P)}},F=f=>{try{$(r.throw(f))}catch(P){T(P)}},$=f=>f.done?g(f.value):Promise.resolve(f.value).then(b,F);$((r=r.apply(a,t)).next())});function M(n){const s=n!=null?n:"",{loading:o,data:i}=t.useRequest({url:`storages:getRules/${s}`},{refreshDeps:[s]});return!o&&(i==null?void 0:i.data)||null}function E(){const n=t.useCollectionField();return{rules:M(n==null?void 0:n.storage),action:`${n.target}:create${n.storage?`?attachmentField=${n.collectionName}.${n.name}`:""}`}}function O(){const n=t.useCollectionField(),o=t.useCollectionManager().getCollection(n==null?void 0:n.target);return M(o==null?void 0:o.getOption("storage"))}const N=Object.freeze(Object.defineProperty({__proto__:null,useAttachmentFieldProps:E,useFileCollectionStorageRules:O,useStorageRules:M,useUploadFiles:()=>{const{service:n}=t.useBlockRequestContext(),{setVisible:s}=t.useActionContext(),{props:o}=t.useBlockRequestContext(),i=t.useCollection(),c=t.useSourceIdFromParentRecord(),x=M(i==null?void 0:i.getOption("storage")),y=g.useMemo(()=>{let h=`${i.name}:create`;if(o!=null&&o.association){const[d,v]=o.association.split(".");h=`${d}/${c}/${v}:create`}return h},[i.name,o==null?void 0:o.association,c]),{setSelectedRows:m}=g.useContext(t.RecordPickerContext)||{},u={};let S=0;return{action:y,onChange(h){h.forEach(d=>{var v;d.status==="uploading"&&!u[d.uid]&&(S++,u[d.uid]=!0),d.status!=="uploading"&&u[d.uid]&&(delete u[d.uid],--S===0&&((v=n==null?void 0:n.refresh)==null||v.call(n),m==null||m(U=>[...U,...h.filter(q=>q.status==="done").map(q=>q.response.data)])))}),h.every(d=>d.status==="done")&&s(!1)},rules:x}}},Symbol.toStringTag,{value:"Module"})),R=n=>{t.useCollection_deprecated();const s={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 r.jsx(t.ActionInitializerItem,C(I({},n),{schema:s}))},Z=n=>r.jsx(t.SchemaComponentOptions,{scope:N,components:{UploadActionInitializer:R},children:n.children}),e="file-manager",G={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input"}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}}},W=A.observer(n=>{const s=A.useForm(),o=A.useField(),[i,c]=g.useState(new A.Schema({}));return g.useEffect(()=>{c(new A.Schema(G[s.values.type]||{}))},[s.values.type]),r.jsx(P.FormLayout,{layout:"vertical",children:r.jsx(A.RecursionField,{basePath:o.address,onlyRenderProperties:!0,schema:i},s.values.type||"local")})},{displayName:"StorageOptions"}),_={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: "${e}" })}}`,descriptions:`{{t("Will be used for API", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Storage type", { ns: "${e}" })}}`,type:"string","x-component":"Select",required:!0,enum:"{{ storageTypes }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:`{{t("Access base URL", { ns: "${e}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]},X={type:"object",properties:{[b.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:_,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:_},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: "${e}" })}}`,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}}"}}}}}}}}}}}},H=()=>{const[n,s]=g.useState({}),o=t.usePlugin(D),i=t.useCompile(),[c,x]=g.useState(!1),{t:y}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:c,setVisible:x},children:[r.jsx(F.Dropdown,{menu:{onClick(m){const u=o.storageTypes.get(m.key);x(!0),s({type:"object",properties:{[b.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:u.name}},title:i("{{t('Add new')}}")+" - "+i(u.title),properties:C(I({},$.cloneDeep(u.properties)),{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:[...o.storageTypes.values()].map(m=>({key:m.name,label:i(m.title)}))},children:r.jsxs(F.Button,{type:"primary",icon:r.jsx(T.PlusOutlined,{}),children:[y("Add new")," ",r.jsx(T.DownOutlined,{})]})}),r.jsx(t.SchemaComponent,{scope:{createOnly:!0},schema:n})]})})},J=()=>{const n=t.useRecord(),[s,o]=g.useState({}),i=t.usePlugin(D),c=t.useCompile(),[x,y]=g.useState(!1),{t:m}=f.useTranslation();return r.jsx("div",{children:r.jsxs(t.ActionContext.Provider,{value:{visible:x,setVisible:y},children:[r.jsx("a",{onClick:()=>{y(!0);const u=i.storageTypes.get(n.type);u.properties.default&&(u.properties.default["x-reactions"]=S=>{S.initialValue?S.disabled=!0:S.disabled=!1}),o({type:"object",properties:{[b.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:I({},n)},title:c("{{t('Edit')}}")+" - "+c(u.title),properties:C(I({},$.cloneDeep(u.properties)),{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 }}"}}}}})}}})},children:m("Edit")}),r.jsx(t.SchemaComponent,{scope:{createOnly:!1},schema:s})]})})},Q=()=>{const{t:n}=f.useTranslation(),s=t.useCompile(),i=[...t.usePlugin(D).storageTypes.values()].map(x=>({value:x.name,label:s(x.title)})),c=r.jsxs("div",{children:[n("See more")," ",r.jsx("a",{target:"_blank",href:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",rel:"noreferrer",children:"x-oss-process"})]});return r.jsx(F.Card,{bordered:!1,children:r.jsx(t.SchemaComponent,{components:{StorageOptions:W,CreateStorage:H,EditStorage:J},scope:{useNewId:x=>`${x}${b.uid()}`,storageTypes:i,xStyleProcessDesc:c},schema:X})})},Y=1,ee=1024*1024*1024,B=1024*1024*20,p={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: "${e}" })}}`},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: "${e}" })}}`},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:`{{t("File size limit", { ns: "${e}" })}}`,description:`{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:B},mimetype:{type:"string",title:`{{t("File type (in MIME type format)", { ns: "${e}" })}}`,description:`{{t('Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}},te={title:`{{t("Aliyun OSS", { ns: "${e}" })}}`,name:"ali-oss",properties:{title:p.title,name:p.name,baseUrl:p.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",description:`{{t('Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".', { ns: "${e}" })}}`,required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},description:"{{ xStyleProcessDesc }}"}}},path:p.path,rules:p.rules,default:p.default,paranoid:p.paranoid}},oe={title:`{{t("Local storage", { ns: "${e}" })}}`,name:"local",properties:{title:p.title,name:p.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: "${e}" })}}`,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:p.rules,default:p.default,paranoid:p.paranoid}},ne={title:`{{t("Amazon S3", { ns: "${e}" })}}`,name:"s3",properties:{title:p.title,name:p.name,baseUrl:p.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},path:p.path,rules:p.rules,default:p.default,paranoid:p.paranoid}},re={title:`{{t("Tencent COS", { ns: "${e}" })}}`,name:"tx-cos",properties:{title:p.title,name:p.name,baseUrl:p.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},path:p.path,rules:p.rules,default:p.default,paranoid:p.paranoid}},ie={local:oe,"ali-oss":te,s3:ne,"tx-cos":re};class se extends t.CollectionFieldInterface{constructor(){super(...arguments);l(this,"name","attachment");l(this,"type","object");l(this,"group","media");l(this,"title",`{{t("Attachment", { ns: "${e}" })}}`);l(this,"isAssociation",!0);l(this,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}});l(this,"availableTypes",["belongsToMany"]);l(this,"properties",C(I({},t.interfacesProperties.defaultProps),{"uiSchema.x-component-props.accept":{type:"string",title:`{{t("MIME type", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,description:`{{t('Default storage will be used when not selected', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}));l(this,"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: "${e}" })}}`,operators:t.interfacesProperties.operators.string,schema:{title:`{{t("Filename", { ns: "${e}" })}}`,type:"string","x-component":"Input"}}]})}schemaInitialize(o,{block:i,field:c}){o["x-component-props"]||(o["x-component-props"]={}),["Table","Kanban"].includes(i)&&(o["x-component-props"].size="small"),o["x-use-component-props"]="useAttachmentFieldProps"}initialize(o){o.through||(o.through=`t_${b.uid()}`),o.foreignKey||(o.foreignKey=`f_${b.uid()}`),o.otherKey||(o.otherKey=`f_${b.uid()}`),o.sourceKey||(o.sourceKey="id"),o.targetKey||(o.targetKey="id")}}class ae extends t.CollectionTemplate{constructor(){super(...arguments);l(this,"name","file");l(this,"title",`{{t("File collection", { ns: "${e}" })}}`);l(this,"order",3);l(this,"color","blue");l(this,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:`{{t("Extension name", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:`{{t("Size", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"path",deletable:!1,uiSchema:{type:"string",title:`{{t("Path", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"url",type:"string",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"string",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:`{{t("Preview", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]});l(this,"presetFieldsDisabled",!0);l(this,"configurableProperties",I(C(I(C(I({},t.getConfigurableProperties("title","name")),{inherits:C(I({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage","x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}}),t.getConfigurableProperties("presetFields")))}}const K=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1024*1024,label:"MB"},{value:1024*1024*1024,label:"GB"}];function j(n,s=1024*1024){const o=n||s;for(let i=K.length-1;i>=0;i--){const c=K[i];if(o%c.value===0)return c}return K[0]}function z(n,s,o){return Math.min(Math.max(s,n),o)}function pe(n){var q;const{value:s,defaultUnit:o=1024*1024,min:i=Y,max:c=ee,step:x=1,onChange:y}=n,m=(q=n.defaultValue)!=null?q:B,u=j(m,o),S=m/u.value,h=j(s!=null?s:m,o),d=s==null?s:s/h.value,v=g.useCallback(w=>{y==null||y(z(w==null?w:w*h.value,i,c))},[h.value]),U=g.useCallback(w=>{y==null||y(z(d*w,i,c))},[d]);return r.jsxs(F.Space.Compact,{children:[r.jsx(F.InputNumber,{value:d,onChange:v,defaultValue:`${S}`,step:x}),r.jsx(F.Select,{options:K,value:h.value,onChange:U,className:"auto-width"})]})}class D extends t.Plugin{constructor(){super(...arguments);l(this,"storageTypes",new Map)}load(){return V(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([se]),this.app.dataSourceManager.addCollectionTemplates([ae]),this.app.use(Z),this.app.pluginSettingsManager.add(e,{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",Component:Q,aclSnippet:"pm.file-manager.storages"}),Object.values(ie).forEach(i=>{this.registerStorageType(i.name,i)});const o=this.app.schemaInitializerManager.get("table:configureActions");o==null||o.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){return t.useCollection().template==="file"}}),this.app.addScopes({useAttachmentFieldProps:E,useFileCollectionStorageRules:O}),this.app.addComponents({FileSizeField:pe})})}registerStorageType(o,i){this.storageTypes.set(o,i)}}a.PluginFileManagerClient=D,a.default=D,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -20,7 +20,7 @@ export declare class AttachmentFieldInterface extends CollectionFieldInterface {
|
|
|
20
20
|
uiSchema: {
|
|
21
21
|
type: string;
|
|
22
22
|
'x-component': string;
|
|
23
|
-
'x-component-props':
|
|
23
|
+
'x-use-component-props': string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
availableTypes: string[];
|
|
@@ -34,9 +34,11 @@ export declare class AttachmentFieldInterface extends CollectionFieldInterface {
|
|
|
34
34
|
type: string;
|
|
35
35
|
title: string;
|
|
36
36
|
'x-component': string;
|
|
37
|
+
'x-component-props': {
|
|
38
|
+
placeholder: string;
|
|
39
|
+
};
|
|
37
40
|
'x-decorator': string;
|
|
38
41
|
description: string;
|
|
39
|
-
default: string;
|
|
40
42
|
};
|
|
41
43
|
'uiSchema.x-component-props.multiple': {
|
|
42
44
|
type: string;
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
baseUrl: {
|
|
26
26
|
'x-component': string;
|
|
27
27
|
'x-decorator': string;
|
|
28
|
+
description: string;
|
|
28
29
|
};
|
|
29
30
|
options: {
|
|
30
31
|
type: string;
|
|
@@ -35,6 +36,7 @@ declare const _default: {
|
|
|
35
36
|
type: string;
|
|
36
37
|
'x-decorator': string;
|
|
37
38
|
'x-component': string;
|
|
39
|
+
description: string;
|
|
38
40
|
required: boolean;
|
|
39
41
|
};
|
|
40
42
|
accessKeyId: {
|
|
@@ -66,7 +68,6 @@ declare const _default: {
|
|
|
66
68
|
'x-component-props': {
|
|
67
69
|
placeholder: string;
|
|
68
70
|
};
|
|
69
|
-
default: string;
|
|
70
71
|
description: string;
|
|
71
72
|
};
|
|
72
73
|
};
|
|
@@ -74,6 +75,32 @@ declare const _default: {
|
|
|
74
75
|
path: {
|
|
75
76
|
'x-component': string;
|
|
76
77
|
'x-decorator': string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
rules: {
|
|
81
|
+
type: string;
|
|
82
|
+
'x-component': string;
|
|
83
|
+
properties: {
|
|
84
|
+
size: {
|
|
85
|
+
type: string;
|
|
86
|
+
title: string;
|
|
87
|
+
description: string;
|
|
88
|
+
'x-decorator': string;
|
|
89
|
+
'x-component': string;
|
|
90
|
+
required: boolean;
|
|
91
|
+
default: number;
|
|
92
|
+
};
|
|
93
|
+
mimetype: {
|
|
94
|
+
type: string;
|
|
95
|
+
title: string;
|
|
96
|
+
description: string;
|
|
97
|
+
'x-decorator': string;
|
|
98
|
+
'x-component': string;
|
|
99
|
+
'x-component-props': {
|
|
100
|
+
placeholder: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
77
104
|
};
|
|
78
105
|
default: {
|
|
79
106
|
'x-component': string;
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
title: {
|
|
11
|
+
'x-component': string;
|
|
12
|
+
'x-decorator': string;
|
|
13
|
+
};
|
|
14
|
+
name: {
|
|
15
|
+
'x-component': string;
|
|
16
|
+
'x-decorator': string;
|
|
17
|
+
'x-disabled': string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
default: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
baseUrl: {
|
|
23
|
+
'x-component': string;
|
|
24
|
+
'x-decorator': string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
path: {
|
|
28
|
+
'x-component': string;
|
|
29
|
+
'x-decorator': string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
rules: {
|
|
33
|
+
type: string;
|
|
34
|
+
'x-component': string;
|
|
35
|
+
properties: {
|
|
36
|
+
size: {
|
|
37
|
+
type: string;
|
|
38
|
+
title: string;
|
|
39
|
+
description: string;
|
|
40
|
+
'x-decorator': string;
|
|
41
|
+
'x-component': string;
|
|
42
|
+
required: boolean;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
45
|
+
mimetype: {
|
|
46
|
+
type: string;
|
|
47
|
+
title: string;
|
|
48
|
+
description: string;
|
|
49
|
+
'x-decorator': string;
|
|
50
|
+
'x-component': string;
|
|
51
|
+
'x-component-props': {
|
|
52
|
+
placeholder: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
default: {
|
|
58
|
+
'x-component': string;
|
|
59
|
+
'x-decorator': string;
|
|
60
|
+
'x-content': string;
|
|
61
|
+
};
|
|
62
|
+
paranoid: {
|
|
63
|
+
'x-component': string;
|
|
64
|
+
'x-decorator': string;
|
|
65
|
+
'x-content': string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
@@ -50,6 +50,31 @@ export declare const storageTypes: {
|
|
|
50
50
|
addonBefore: string;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
+
rules: {
|
|
54
|
+
type: string;
|
|
55
|
+
'x-component': string;
|
|
56
|
+
properties: {
|
|
57
|
+
size: {
|
|
58
|
+
type: string;
|
|
59
|
+
title: string;
|
|
60
|
+
description: string;
|
|
61
|
+
'x-decorator': string;
|
|
62
|
+
'x-component': string;
|
|
63
|
+
required: boolean;
|
|
64
|
+
default: number;
|
|
65
|
+
};
|
|
66
|
+
mimetype: {
|
|
67
|
+
type: string;
|
|
68
|
+
title: string;
|
|
69
|
+
description: string;
|
|
70
|
+
'x-decorator': string;
|
|
71
|
+
'x-component': string;
|
|
72
|
+
'x-component-props': {
|
|
73
|
+
placeholder: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
53
78
|
default: {
|
|
54
79
|
'x-component': string;
|
|
55
80
|
'x-decorator': string;
|
|
@@ -81,6 +106,7 @@ export declare const storageTypes: {
|
|
|
81
106
|
baseUrl: {
|
|
82
107
|
'x-component': string;
|
|
83
108
|
'x-decorator': string;
|
|
109
|
+
description: string;
|
|
84
110
|
};
|
|
85
111
|
options: {
|
|
86
112
|
type: string;
|
|
@@ -91,6 +117,7 @@ export declare const storageTypes: {
|
|
|
91
117
|
type: string;
|
|
92
118
|
'x-decorator': string;
|
|
93
119
|
'x-component': string;
|
|
120
|
+
description: string;
|
|
94
121
|
required: boolean;
|
|
95
122
|
};
|
|
96
123
|
accessKeyId: {
|
|
@@ -122,7 +149,6 @@ export declare const storageTypes: {
|
|
|
122
149
|
'x-component-props': {
|
|
123
150
|
placeholder: string;
|
|
124
151
|
};
|
|
125
|
-
default: string;
|
|
126
152
|
description: string;
|
|
127
153
|
};
|
|
128
154
|
};
|
|
@@ -130,6 +156,32 @@ export declare const storageTypes: {
|
|
|
130
156
|
path: {
|
|
131
157
|
'x-component': string;
|
|
132
158
|
'x-decorator': string;
|
|
159
|
+
description: string;
|
|
160
|
+
};
|
|
161
|
+
rules: {
|
|
162
|
+
type: string;
|
|
163
|
+
'x-component': string;
|
|
164
|
+
properties: {
|
|
165
|
+
size: {
|
|
166
|
+
type: string;
|
|
167
|
+
title: string;
|
|
168
|
+
description: string;
|
|
169
|
+
'x-decorator': string;
|
|
170
|
+
'x-component': string;
|
|
171
|
+
required: boolean;
|
|
172
|
+
default: number;
|
|
173
|
+
};
|
|
174
|
+
mimetype: {
|
|
175
|
+
type: string;
|
|
176
|
+
title: string;
|
|
177
|
+
description: string;
|
|
178
|
+
'x-decorator': string;
|
|
179
|
+
'x-component': string;
|
|
180
|
+
'x-component-props': {
|
|
181
|
+
placeholder: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
133
185
|
};
|
|
134
186
|
default: {
|
|
135
187
|
'x-component': string;
|
|
@@ -162,6 +214,7 @@ export declare const storageTypes: {
|
|
|
162
214
|
baseUrl: {
|
|
163
215
|
'x-component': string;
|
|
164
216
|
'x-decorator': string;
|
|
217
|
+
description: string;
|
|
165
218
|
};
|
|
166
219
|
options: {
|
|
167
220
|
type: string;
|
|
@@ -206,6 +259,32 @@ export declare const storageTypes: {
|
|
|
206
259
|
path: {
|
|
207
260
|
'x-component': string;
|
|
208
261
|
'x-decorator': string;
|
|
262
|
+
description: string;
|
|
263
|
+
};
|
|
264
|
+
rules: {
|
|
265
|
+
type: string;
|
|
266
|
+
'x-component': string;
|
|
267
|
+
properties: {
|
|
268
|
+
size: {
|
|
269
|
+
type: string;
|
|
270
|
+
title: string;
|
|
271
|
+
description: string;
|
|
272
|
+
'x-decorator': string;
|
|
273
|
+
'x-component': string;
|
|
274
|
+
required: boolean;
|
|
275
|
+
default: number;
|
|
276
|
+
};
|
|
277
|
+
mimetype: {
|
|
278
|
+
type: string;
|
|
279
|
+
title: string;
|
|
280
|
+
description: string;
|
|
281
|
+
'x-decorator': string;
|
|
282
|
+
'x-component': string;
|
|
283
|
+
'x-component-props': {
|
|
284
|
+
placeholder: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
};
|
|
209
288
|
};
|
|
210
289
|
default: {
|
|
211
290
|
'x-component': string;
|
|
@@ -238,6 +317,7 @@ export declare const storageTypes: {
|
|
|
238
317
|
baseUrl: {
|
|
239
318
|
'x-component': string;
|
|
240
319
|
'x-decorator': string;
|
|
320
|
+
description: string;
|
|
241
321
|
};
|
|
242
322
|
options: {
|
|
243
323
|
type: string;
|
|
@@ -276,6 +356,32 @@ export declare const storageTypes: {
|
|
|
276
356
|
path: {
|
|
277
357
|
'x-component': string;
|
|
278
358
|
'x-decorator': string;
|
|
359
|
+
description: string;
|
|
360
|
+
};
|
|
361
|
+
rules: {
|
|
362
|
+
type: string;
|
|
363
|
+
'x-component': string;
|
|
364
|
+
properties: {
|
|
365
|
+
size: {
|
|
366
|
+
type: string;
|
|
367
|
+
title: string;
|
|
368
|
+
description: string;
|
|
369
|
+
'x-decorator': string;
|
|
370
|
+
'x-component': string;
|
|
371
|
+
required: boolean;
|
|
372
|
+
default: number;
|
|
373
|
+
};
|
|
374
|
+
mimetype: {
|
|
375
|
+
type: string;
|
|
376
|
+
title: string;
|
|
377
|
+
description: string;
|
|
378
|
+
'x-decorator': string;
|
|
379
|
+
'x-component': string;
|
|
380
|
+
'x-component-props': {
|
|
381
|
+
placeholder: string;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
279
385
|
};
|
|
280
386
|
default: {
|
|
281
387
|
'x-component': string;
|
|
@@ -49,6 +49,31 @@ declare const _default: {
|
|
|
49
49
|
addonBefore: string;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
rules: {
|
|
53
|
+
type: string;
|
|
54
|
+
'x-component': string;
|
|
55
|
+
properties: {
|
|
56
|
+
size: {
|
|
57
|
+
type: string;
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
'x-decorator': string;
|
|
61
|
+
'x-component': string;
|
|
62
|
+
required: boolean;
|
|
63
|
+
default: number;
|
|
64
|
+
};
|
|
65
|
+
mimetype: {
|
|
66
|
+
type: string;
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
'x-decorator': string;
|
|
70
|
+
'x-component': string;
|
|
71
|
+
'x-component-props': {
|
|
72
|
+
placeholder: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
52
77
|
default: {
|
|
53
78
|
'x-component': string;
|
|
54
79
|
'x-decorator': string;
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
baseUrl: {
|
|
26
26
|
'x-component': string;
|
|
27
27
|
'x-decorator': string;
|
|
28
|
+
description: string;
|
|
28
29
|
};
|
|
29
30
|
options: {
|
|
30
31
|
type: string;
|
|
@@ -69,6 +70,32 @@ declare const _default: {
|
|
|
69
70
|
path: {
|
|
70
71
|
'x-component': string;
|
|
71
72
|
'x-decorator': string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
rules: {
|
|
76
|
+
type: string;
|
|
77
|
+
'x-component': string;
|
|
78
|
+
properties: {
|
|
79
|
+
size: {
|
|
80
|
+
type: string;
|
|
81
|
+
title: string;
|
|
82
|
+
description: string;
|
|
83
|
+
'x-decorator': string;
|
|
84
|
+
'x-component': string;
|
|
85
|
+
required: boolean;
|
|
86
|
+
default: number;
|
|
87
|
+
};
|
|
88
|
+
mimetype: {
|
|
89
|
+
type: string;
|
|
90
|
+
title: string;
|
|
91
|
+
description: string;
|
|
92
|
+
'x-decorator': string;
|
|
93
|
+
'x-component': string;
|
|
94
|
+
'x-component-props': {
|
|
95
|
+
placeholder: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
72
99
|
};
|
|
73
100
|
default: {
|
|
74
101
|
'x-component': string;
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
baseUrl: {
|
|
26
26
|
'x-component': string;
|
|
27
27
|
'x-decorator': string;
|
|
28
|
+
description: string;
|
|
28
29
|
};
|
|
29
30
|
options: {
|
|
30
31
|
type: string;
|
|
@@ -63,6 +64,32 @@ declare const _default: {
|
|
|
63
64
|
path: {
|
|
64
65
|
'x-component': string;
|
|
65
66
|
'x-decorator': string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
rules: {
|
|
70
|
+
type: string;
|
|
71
|
+
'x-component': string;
|
|
72
|
+
properties: {
|
|
73
|
+
size: {
|
|
74
|
+
type: string;
|
|
75
|
+
title: string;
|
|
76
|
+
description: string;
|
|
77
|
+
'x-decorator': string;
|
|
78
|
+
'x-component': string;
|
|
79
|
+
required: boolean;
|
|
80
|
+
default: number;
|
|
81
|
+
};
|
|
82
|
+
mimetype: {
|
|
83
|
+
type: string;
|
|
84
|
+
title: string;
|
|
85
|
+
description: string;
|
|
86
|
+
'x-decorator': string;
|
|
87
|
+
'x-component': string;
|
|
88
|
+
'x-component-props': {
|
|
89
|
+
placeholder: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
66
93
|
};
|
|
67
94
|
default: {
|
|
68
95
|
'x-component': string;
|
|
@@ -122,13 +122,13 @@ export declare class FileCollectionTemplate extends CollectionTemplate {
|
|
|
122
122
|
createdAt: any;
|
|
123
123
|
updatedAt: any;
|
|
124
124
|
title: any;
|
|
125
|
-
description: any;
|
|
126
125
|
inherits: any;
|
|
127
|
-
|
|
126
|
+
sortable: any;
|
|
128
127
|
autoGenId: any;
|
|
128
|
+
description: any;
|
|
129
|
+
category: any;
|
|
129
130
|
createdBy: any;
|
|
130
131
|
updatedBy: any;
|
|
131
|
-
sortable: any;
|
|
132
132
|
presetFields: any;
|
|
133
133
|
storage: {
|
|
134
134
|
title: string;
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const FILE_FIELD_NAME = "file";
|
|
10
10
|
export declare const LIMIT_FILES = 1;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const FILE_SIZE_LIMIT_MIN = 1;
|
|
12
|
+
export declare const FILE_SIZE_LIMIT_MAX: number;
|
|
13
|
+
export declare const FILE_SIZE_LIMIT_DEFAULT: number;
|
|
12
14
|
export declare const STORAGE_TYPE_LOCAL = "local";
|
|
13
15
|
export declare const STORAGE_TYPE_ALI_OSS = "ali-oss";
|
|
14
16
|
export declare const STORAGE_TYPE_S3 = "s3";
|