@nocobase/plugin-file-manager 2.1.0-alpha.1 → 2.1.0-alpha.11
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/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +1 -1
- package/dist/client/models/UploadFieldModel.d.ts +22 -0
- package/dist/client/models/uploadFieldUtils.d.ts +56 -0
- package/dist/client/previewer/filePreviewTypes.d.ts +39 -0
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +19 -0
- package/dist/client/schemas/storageTypes/common.d.ts +19 -0
- package/dist/client/schemas/storageTypes/index.d.ts +19 -0
- package/dist/client/templates/file.d.ts +2 -2
- package/dist/common/collections/storages.d.ts +11 -0
- package/dist/common/collections/storages.js +5 -0
- package/dist/externalVersion.js +9 -8
- package/dist/locale/en-US.json +2 -0
- package/dist/locale/zh-CN.json +3 -0
- package/dist/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +7858 -7858
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js +7858 -7858
- package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.d.ts +186 -0
- package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/index.js +1794 -0
- package/dist/node_modules/@aws-sdk/lib-storage/node_modules/buffer/package.json +82 -0
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
- package/dist/node_modules/ali-oss/lib/client.js +3 -3
- package/dist/node_modules/ali-oss/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/attachments.js +21 -1
- package/dist/server/flow-schema-contributions/index.d.ts +10 -0
- package/dist/server/flow-schema-contributions/index.js +115 -0
- package/dist/server/server.d.ts +2 -0
- package/dist/server/server.js +4 -0
- package/dist/server/storages/index.d.ts +1 -0
- package/dist/server/storages/index.js +2 -0
- package/dist/server/storages/local.d.ts +2 -0
- package/dist/server/storages/local.js +27 -5
- package/dist/server/storages/s3.d.ts +0 -1
- package/dist/server/storages/s3.js +0 -27
- package/dist/server/utils.js +20 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
package/dist/client/index.d.ts
CHANGED
|
@@ -27,4 +27,7 @@ export declare class PluginFileManagerClient extends Plugin {
|
|
|
27
27
|
data?: any;
|
|
28
28
|
}>;
|
|
29
29
|
}
|
|
30
|
+
export { filePreviewTypes, wrapWithModalPreviewer } from './previewer/filePreviewTypes';
|
|
31
|
+
export type { FilePreviewType, FilePreviewerProps } from './previewer/filePreviewTypes';
|
|
32
|
+
export { CardUpload, UploadFieldModel } from './models/UploadFieldModel';
|
|
30
33
|
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("react"),require("@nocobase/flow-engine"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["react","@nocobase/flow-engine","lodash","@formily/shared","@nocobase/client","@formily/react","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("react"),require("@nocobase/flow-engine"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-file-manager"]=t(e.react,e["@nocobase/flow-engine"],e.lodash,e["@formily/shared"],e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,a,l,c){var u={371:function(e,t,n){var r=n(275),o=/[\/\+\.]/;e.exports=function(e,t){function n(t){var n=r(t,e,o);return n&&n.length>=2}return t?n(t.split(";")[0]):n}},275:function(e){"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(t=0,n=(e||"").split(this.separator);r&&t<i;t++)if("*"===o[t])continue;else r=t<n.length&&o[t]===n[t];r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var a in r={},e)this.match(a)&&(r[a]=e[a]);return r},e.exports=function(e,n,r){var o=new t(e,r||/[\/\.]/);return void 0!==n?o.match(n):o}},482:function(e){"use strict";e.exports=a},505:function(e){"use strict";e.exports=i},875:function(e){"use strict";e.exports=r},772:function(e){"use strict";e.exports=o},667:function(e){"use strict";e.exports=t},721:function(e){"use strict";e.exports=l},467:function(e){"use strict";e.exports=n},156:function(t){"use strict";t.exports=e},238:function(e){"use strict";e.exports=c}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return u[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 d={};return!function(){"use strict";p.r(d),p.d(d,{PluginFileManagerClient:function(){return eJ},default:function(){return eQ}});var e,t,n,r={};p.r(r),p.d(r,{useAttachmentFieldProps:function(){return v},useFileCollectionStorageRules:function(){return x},useStorageRules:function(){return h},useUploadFiles:function(){return b}});var o=p(772),i=Number.POSITIVE_INFINITY,a=p(156),l=p.n(a);function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function u(){var e,t,n,r,i,l,c,u=(0,o.useCollectionField)(),s=(0,o.useCollectionManager)().getCollection(null==u?void 0:u.target),p=(0,o.useCollection)(),d=(0,o.usePlugin)(eQ),f=(t=null!=(e=(null==u?void 0:u.storage)||(null==p?void 0:p.getOption("storage"))||(null==s?void 0:s.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),i=(r=(0,o.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,l=r.data,c=r.run,(0,a.useEffect)(function(){c()},[c]),!i&&(null==l?void 0:l.data)||null),m=d.getStorageType(null==f?void 0:f.type);return{storage:f,storageType:m}}function s(e){var t=u(),n=t.storage,r=t.storageType,o=null==r?void 0:r.useUploadProps,i=(null==o?void 0:o(c({storage:n,rules:n.rules},e)))||{};return c({rules:null==n?void 0:n.rules},i)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){return 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,o.useDataBlockRequestGetter)().getDataBlockRequest,t=((0,o.useDataBlockProps)()||{}).association,n=(0,o.useActionContext)().setVisible,r=(0,o.useCollection)(),i=(0,o.useSourceId)(),l=(0,a.useMemo)(function(){var e="".concat(r.name,":create");if(t){var n,o=(n=t.split("."),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(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.")}()),a=o[0],l=o[1];e="".concat(a,"/").concat(i,"/").concat(l,":create")}return e},[r.name,t,i]),c=((0,a.useContext)(o.RecordPickerContext)||{}).setSelectedRows,u={},p=0,d={action:l,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 r,o;null==(o=e())||null==(r=o.refresh)||r.call(o),null==c||c(function(e){return m(e).concat(m(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=s(d);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},d,f)},g=p(505);function h(e){var t,n=null!=e?e:"";(0,o.useAPIClient)();var r=(0,g.useField)(),i=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),l=i.loading,c=i.data,u=i.run;return(0,a.useEffect)(function(){"editable"===r.pattern&&u()},[r.pattern,u]),!l&&(null==c||null==(t=c.data)?void 0:t.rules)||null}function v(){var e=(0,o.useCollectionField)(),t="".concat(null==e?void 0:e.target,":create").concat((null==e?void 0:e.storage)?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=s({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({action:t},n)}function x(){var e=(0,o.useCollectionField)(),t=(0,o.useCollectionManager)().getCollection(null==e?void 0:e.target);return h(null==t?void 0:t.getOption("storage"))}var O=function(e){var t,n,r={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 l().createElement(o.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={schema:r},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},w={dumpRules:{group:"user"},migrationRules:["schema-only","overwrite"],asStrategyResource:!0,shared:!0,name:"attachments",createdBy:!0,updatedBy:!0,template:"file",filterTargetKey:"id",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"},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:"{{t('Storage', { ns: '".concat("file-manager","' })}}"),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{comment:"相对路径(含“/”前缀)",type:"text",name:"path"},{comment:"其他文件信息(如图片的宽高)",type:"jsonb",name:"meta",defaultValue:{}},{comment:"网络访问地址",type:"text",name:"url"}]},S={dumpRules:"required",migrationRules:["overwrite","schema-only"],name:"storages",shared:!0,fields:[{name:"id",type:"snowflakeId",primaryKey:!0,allowNull:!1},{title:"存储引擎名称",comment:"存储引擎名称",type:"string",name:"title",translation:!0,trim:!0},{title:"英文标识",type:"uid",name:"name",unique:!0,trim:!0},{comment:"类型标识,如 local/ali-oss 等",type:"string",name:"type"},{comment:"配置项",type:"jsonb",name:"options",defaultValue:{}},{comment:"文件规则",type:"jsonb",name:"rules",defaultValue:{}},{comment:"存储相对路径模板",type:"text",name:"path",defaultValue:"",trim:!0},{comment:"访问地址前缀",type:"string",name:"baseUrl",defaultValue:"",trim:!0},{comment:"重命名模式",type:"string",name:"renameMode",defaultValue:"appendRandomID"},{comment:"默认引擎",type:"radio",name:"default",defaultValue:!1},{type:"boolean",name:"paranoid",defaultValue:!1}]},j=function(e){return l().createElement(o.ExtendCollectionsProvider,{collections:[w,S]},l().createElement(o.SchemaComponentOptions,{scope:r,components:{UploadActionInitializer:O}},e.children))},P=p(721),E=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function C(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,r=E.length-1;r>=0;r--){var o=E[r];if(n%o.value==0)return o}return E[0]}function A(e,t,n){return Math.min(Math.max(t,e),n)}function I(e){var t,n=e.value,r=e.defaultUnit,o=void 0===r?1048576:r,c=e.min,u=void 0===c?1:c,s=e.max,p=void 0===s?i:s,d=e.step,f=e.onChange,m=null!=(t=e.defaultValue)?t:0x1400000,y=C(m,o),b=m/y.value,g=C(null!=n?n:m,o),h=null==n?n:n/g.value,v=(0,a.useCallback)(function(e){null==f||f(A(null==e?e:e*g.value,u,p))},[g.value]),x=(0,a.useCallback)(function(e){null==f||f(A(h*e,u,p))},[h]);return l().createElement(P.Space.Compact,null,l().createElement(P.InputNumber,{value:h,onChange:v,defaultValue:"".concat(b),step:void 0===d?1:d}),l().createElement(P.Select,{options:E,value:g.value,onChange:x,className:"auto-width"}))}var F=p(482),T=p(875),k=p(467),R=p.n(k),D=p(238),M="file-manager",B={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("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"}}]},_={type:"object",properties:(e={},t=(0,T.uid)(),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:B,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:B},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}}"}}}}}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},U={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.", { ns: "'.concat(M,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type allowed (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 the file record", { ns: "'.concat(M,'" })}}'),description:'{{t("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.", { ns: "'.concat(M,'" })}}')},renameMode:{title:'{{t("Renaming", { ns: "'.concat(M,'" })}}'),description:'{{t("Renaming strategy to avoid filename conflicts when uploading files.", { ns: "'.concat(M,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Append random ID", { ns: "'.concat(M,'" })}}'),value:"appendRandomID"},{label:'{{t("Random string", { ns: "'.concat(M,'" })}}'),value:"random"},{label:'{{t("Keep original filename (will be overwrite if filename is existed)", { ns: "'.concat(M,'" })}}'),value:"none"}],default:"appendRandomID"}},q={title:'{{t("Aliyun OSS", { ns: "'.concat(M,'" })}}'),name:"ali-oss",fieldset:{title:U.title,name:U.name,baseUrl:U.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},timeout:{title:'{{t("Timeout", { ns: "'.concat(M,'" })}}'),description:"{{t('Upload timeout for a single file in milliseconds. Default is 600000.', { ns: \"".concat(M,'" })}}'),type:"number","x-decorator":"FormItem","x-component":"InputNumber",default:6e5},thumbnailRule:{title:'{{t("File pre-process parameters", { ns: "'.concat(M,'" })}}'),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:U.path,renameMode:U.renameMode,rules:U.rules,default:U.default,paranoid:U.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:U.title,name:U.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/"}},renameMode:U.renameMode,rules:U.rules,default:U.default,paranoid:U.paranoid}},"ali-oss":q,s3:{title:'{{t("Amazon S3", { ns: "'.concat(M,'" })}}'),name:"s3",fieldset:{title:U.title,name:U.name,baseUrl:U.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:U.path,renameMode:U.renameMode,rules:U.rules,default:U.default,paranoid:U.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(M,'" })}}'),name:"tx-cos",fieldset:{title:U.title,name:U.name,baseUrl:U.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:U.path,renameMode:U.renameMode,rules:U.rules,default:U.default,paranoid:U.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){K(e,t,n[t])})}return e}function G(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 r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||$(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||$(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 $(e,t){if(e){if("string"==typeof e)return N(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 N(e,t)}}var Y=function(){var e=V((0,a.useState)({}),2),t=e[0],n=e[1],r=(0,o.usePlugin)(eQ),i=(0,o.useCompile)(),c=V((0,a.useState)(!1),2),u=c[0],s=c[1],p=(0,D.useTranslation)().t;return l().createElement("div",null,l().createElement(o.ActionContext.Provider,{value:{visible:u,setVisible:s}},l().createElement(P.Dropdown,{menu:{onClick:function(e){var t=r.storageTypes.get(e.key);s(!0),n({type:"object",properties:K({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:i("{{t('Add new')}}")+" - "+i(t.title),properties:G(L({},R().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:W(r.storageTypes.values()).map(function(e){return{key:e.name,label:i(e.title)}})}},l().createElement(P.Button,{type:"primary",icon:l().createElement(F.PlusOutlined,null)},p("Add new")," ",l().createElement(F.DownOutlined,null))),l().createElement(o.SchemaComponent,{scope:{createOnly:!0},schema:t})))},Z=function(){var e=(0,o.useRecord)(),t=V((0,a.useState)({}),2),n=t[0],r=t[1],i=(0,o.usePlugin)(eQ),c=(0,o.useCompile)(),u=V((0,a.useState)(!1),2),s=u[0],p=u[1],d=(0,D.useTranslation)().t,f=V(P.message.useMessage(),2),m=f[0],y=f[1],b=(0,a.useCallback)(function(){var t=i.storageTypes.get(e.type);if(!t)return void m.error(d("Storage type {{type}} is not registered, please check if related plugin is enabled.",{ns:M,type:e.type}));p(!0),t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),r({type:"object",properties:K({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:L({},e)},title:c("{{t('Edit')}}")+" - "+c(t.title),properties:G(L({},R().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 }}"}}}}})})})},[c,i.storageTypes,e]);return l().createElement("div",null,y,l().createElement(o.ActionContext.Provider,{value:{visible:s,setVisible:p}},l().createElement("a",{onClick:b},d("Edit")),l().createElement(o.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function H(e){var t=z[e];return(null==t?void 0:t.thumbnailRule)?l().createElement("div",null,l().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},o.i18n.t("See more"))):null}var X=function(){var e=(0,o.useCompile)(),t=W((0,o.usePlugin)(eQ).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return l().createElement(P.Card,{bordered:!1},l().createElement(o.SchemaComponent,{components:{CreateStorage:Y,EditStorage:Z},scope:{useNewId:function(e){return"".concat(e).concat((0,T.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:H},schema:_}))};function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function et(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(et=function(){return!!e})()}var en=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,r,i,a;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=Q(t),J(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,et()?Reflect.construct(t,r||[],Q(this).constructor):t.apply(this,r)),"name","attachment"),J(e,"type","object"),J(e,"group","media"),J(e,"title",'{{t("Attachment", { ns: "'.concat(M,'" })}}')),J(e,"isAssociation",!0),J(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),J(e,"availableTypes",["belongsToMany"]),J(e,"properties",(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){J(e,t,n[t])})}return e}({},o.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"}}}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i)),J(e,"filterable",{children:[{name:"id",value:"id",title:'{{t("Exists")}}',label:'{{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",value:"filename",title:'{{t("Filename", { ns: "'.concat(M,'" })}}'),label:'{{t("Filename", { ns: "'.concat(M,'" })}}'),operators:o.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(M,'" })}}'),type:"string","x-component":"Input"}}]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ee(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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.CollectionFieldInterface),er=p(667);function eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ea(e){return(ea=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function el(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ec(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ei(e,t,n[t])})}return e}function eu(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 r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}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 ep(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ed(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ed=function(){return!!e})()}function ef(){var e,t,n=(e=["\n .ant-image-img {\n border: 1px solid #d9d9d9;\n padding: 2px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return ef=function(){return n},n}var em=function(e){var t,n,r=e.file,i=e.size,a=e.showFileName,c="string"==typeof r?r:(null==r?void 0:r.preview)||(null==r?void 0:r.url);if(c){var u="string"==typeof r?c.split("/").pop():(null==r?void 0:r.name)||(null==r?void 0:r.filename)||(null==r||null==(t=r.url)?void 0:t.split("/").pop());null==(n=c.split(".").pop())||n.toLowerCase();var s={pdf:"/file-placeholder/pdf-200-200.png",mp4:"/file-placeholder/video-200-200.png",mov:"/file-placeholder/video-200-200.png",doc:"/file-placeholder/docx-200-200.png",docx:"/file-placeholder/docx-200-200.png",word:"/file-placeholder/docx-200-200.png",xls:"/file-placeholder/xlsx-200-200.png",xlsx:"/file-placeholder/xlsx-200-200.png",excel:"/file-placeholder/xlsx-200-200.png",ppt:"/file-placeholder/ppt-200-200.png",pptx:"/file-placeholder/ppt-200-200.png",jpg:"/file-placeholder/image-200-200.png",jpeg:"/file-placeholder/image-200-200.png",png:"/file-placeholder/image-200-200.png",gif:"/file-placeholder/image-200-200.png",default:"/file-placeholder/unknown-200-200.png"},p=s[function(e){var t="",n="",r=function(e){var t=e.split("?")[0].split("#")[0],n=t.lastIndexOf(".");return -1!==n?t.slice(n).toLowerCase():""};if("string"==typeof e?n=r(e):e&&(void 0===e?"undefined":ep(e))==="object"&&(t=e.mimetype||"",(n=(e.extname||"").toLowerCase())||!e.url||(n=r(e.url))),t){if(t.startsWith("image/"))return"image";if(t.startsWith("video/"))return"video";if(t.startsWith("audio/"))return"audio";if("application/pdf"===t)return"pdf";if(t.includes("spreadsheet"))return"excel";if(t.includes("word"))return"word";if(t.includes("presentation"))return"ppt"}return[".png",".jpg",".jpeg",".webp",".gif",".bmp"].includes(n)?"image":[".mp4",".avi",".mov",".wmv",".flv",".mkv"].includes(n)?"video":[".mp3",".wav",".aac",".ogg"].includes(n)?"audio":[".pdf"].includes(n)?"pdf":[".xls",".xlsx",".csv"].includes(n)?"excel":[".doc",".docx"].includes(n)?"word":[".ppt",".pptx"].includes(n)?"ppt":n?"file":"unknown"}(r)]||s.default,d=l().createElement("div",{className:(0,o.css)(ef())},l().createElement(P.Image,{src:c,fallback:p,width:i,height:i,preview:{mask:l().createElement(F.EyeOutlined,null)},style:{borderRadius:4,objectFit:"cover",boxShadow:"0 0 0 2px #fff"}}));return l().createElement("div",{style:{textAlign:"center",width:i,wordBreak:"break-all"}},d,a&&l().createElement(P.Tooltip,{title:u},l().createElement("div",{style:{fontSize:12,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},u)))}},ey=function(e){var t,n=e.value,r=void 0===n?[]:n,i=e.size,a=void 0===i?28:i,c=e.showFileName,u=(t=l().useState(0),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return eo(e,2);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 eo(e,t)}}(t,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.")}()),s=u[0],p=u[1],d=(0,D.useTranslation)().t,f=function(e){var t,n=r[s].url||r[s],o=n.split("?")[0].split("#")[0],i=o?o.substring(o.lastIndexOf("/")+1):n,a=i.slice(i.lastIndexOf(".")),l="".concat(Date.now(),"_").concat(null==(t=r[s])?void 0:t.filename).concat(a);fetch(n).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(new Blob([e])),n=document.createElement("a");n.href=t,n.download=l,document.body.appendChild(n),n.click(),URL.revokeObjectURL(t),n.remove()})};return l().createElement(P.Image.PreviewGroup,{preview:{toolbarRender:function(e,t){var n=t.transform.scale,o=t.actions,i=o.onActive,a=o.onFlipY,c=o.onFlipX,u=o.onRotateLeft,p=o.onRotateRight,d=o.onZoomOut,m=o.onZoomIn,y=o.onReset;return l().createElement(P.Space,{size:14,className:"toolbar-wrapper",style:{fontSize:"20px"}},l().createElement(F.LeftOutlined,{disabled:0===s,onClick:function(){return null==i?void 0:i(-1)}}),l().createElement(F.RightOutlined,{disabled:s===r.length-1,onClick:function(){return null==i?void 0:i(1)}}),l().createElement(F.DownloadOutlined,{onClick:f}),l().createElement(F.SwapOutlined,{rotate:90,onClick:a}),l().createElement(F.SwapOutlined,{onClick:c}),l().createElement(F.RotateLeftOutlined,{onClick:u}),l().createElement(F.RotateRightOutlined,{onClick:p}),l().createElement(F.ZoomOutOutlined,{disabled:1===n,onClick:d}),l().createElement(F.ZoomInOutlined,{disabled:50===n,onClick:m}),l().createElement(F.UndoOutlined,{onClick:y}))},onChange:function(e){p(e)},imageRender:function(e,t){p(t.current);var n=t.image;if((0,o.matchMimetype)(n,"application/pdf"))return l().createElement("iframe",{src:n.url||n.preview,width:"100%",height:"600px",style:{border:"none"}});if((0,o.matchMimetype)(n,"audio/*"))return l().createElement("audio",{controls:!0},l().createElement("source",{src:n.url||n.preview,type:n.type}),d("Your browser does not support the audio tag."));if((0,o.matchMimetype)(n,"video/*"))return l().createElement("video",{controls:!0,width:"100%"},l().createElement("source",{src:n.url||n.preview,type:n.type}),d("Your browser does not support the video tag."));if((0,o.matchMimetype)(n,"text/plain"))return l().createElement("iframe",{src:n.url||n.preview,width:"100%",height:"600px",style:{border:"none"}});if((0,o.matchMimetype)(n,"image/*"))return e;else return l().createElement(P.Alert,{type:"warning",description:l().createElement("span",null,d("File type is not supported for previewing,"),l().createElement("a",{onClick:f,style:{textDecoration:"underline",cursor:"pointer"}},d("download it to preview"))),showIcon:!0})}}},l().createElement(P.Space,{size:5,wrap:!0},Array.isArray(r)&&r.map(function(e,t){return l().createElement(em,{file:e,size:a,key:t,showFileName:c})})))},eb=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=ea(t),ei(e=function(e,t){if(t&&("object"===ep(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ed()?Reflect.construct(t,r||[],ea(this).constructor):t.apply(this,r)),"disableTitleField",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&es(n,e),t=[{key:"render",value:function(){var e=this,t=this.props,n=t.value,r=t.titleField,o=t.template,i=t.target;return r&&"file"!==o&&"attachments"!==i?(0,k.castArray)(n).flatMap(function(t,n){var o=null==t?void 0:t[r],i=o?l().createElement(ey,eu(ec({key:n},e.props),{value:(0,k.castArray)(o).filter(Boolean)})):l().createElement("span",{key:n},"N/A");return 0===n?[i]:[l().createElement("span",{key:"sep-".concat(n)},", "),i]}):l().createElement(ey,eu(ec({},this.props),{value:(0,k.castArray)(n).filter(Boolean)}))}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.FieldModel);eb.registerFlow({key:"previewReadPrettySetting",sort:500,title:(0,er.tExpr)("Preview Settings"),steps:{size:{title:(0,er.tExpr)("Size"),uiMode:function(e){var t=e.t;return{type:"select",key:"size",props:{options:[{value:300,label:t("Large")},{value:100,label:t("Middle")},{value:28,label:t("Small")}]}}},hideInSettings:function(e){return el(e.model.parent,o.TableColumnModel)},defaultParams:function(e){return{size:el(e.model.parent,o.DetailsItemModel)?100:28}},handler:function(e,t){e.model.setProps("size",t.size)}},showFileName:{title:(0,er.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},hideInSettings:function(e){return el(e.model.parent,o.TableColumnModel)},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}}}}),eb.define({label:(0,er.tExpr)("Preview")}),er.DisplayItemModel.bindModelToInterface("DisplayPreviewFieldModel",["url","attachment","attachmentURL","m2m","m2o","o2o","o2m","oho","obo","mbm"],{isDefault:!0,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}});let eg="bits",eh="bytes",ev="jedec",ex={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};var eO=p(371),ew=p.n(eO);function eS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ej(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eP(e,t,n){return(eP="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=eE(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function eE(e){return(eE=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ej(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 r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}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 eF(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eS(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 eS(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eT=function(){return!!e})()}var ek=function(e){var t,n,r=(0,er.useFlowContext)(),i=(0,a.useMemo)(function(){var t="".concat(e.context.collection.name,":create");if(null==(o=r.view)||null==(n=o.inputArgs)?void 0:n.sourceId){var n,o,i,a=eF(e.context.blockModel.association.resourceName.split("."),2),l=a[0],c=a[1];t="".concat(l,"/").concat(null==(i=r.view)?void 0:i.inputArgs.sourceId,"/").concat(c,":create")}return t},[e.context.collection.name,null==(n=r.view)||null==(t=n.inputArgs)?void 0:t.sourceId]),l={},c=0,u={action:i,onChange:function(t){var n=t.fileList;n.forEach(function(t){if("uploading"!==t.status||l[t.uid]||(c++,l[t.uid]=!0),"uploading"!==t.status&&l[t.uid]&&(delete l[t.uid],0==--c)){var n,r;null==(n=(r=e.context.blockModel.resource).refresh)||n.call(r)}}),n.every(function(e){return"done"===e.status})&&r.view.close()}},s=function(e,t){var n,r,i,l,c,u,s,p,d,f,m,y,b,g,h,v=(i=(r=(0,er.useFlowContext)()).collectionField,l=null==(n=r.collectionField)?void 0:n.targetCollection,c=(0,o.usePlugin)(eQ),u=t.context.blockModel.collection,p=null!=(s=(null==i?void 0:i.storage)||u.storage||l.storage)?s:"",d="storages:getBasicInfo/".concat(p),m=(f=(0,o.useRequest)({url:d},{manual:!0,refreshDeps:[p],cacheKey:d})).loading,y=f.data,b=f.run,(0,a.useEffect)(function(){b()},[b]),g=!m&&(null==y?void 0:y.data)||null,h=c.getStorageType(null==g?void 0:g.type),{storage:g,storageType:h}),x=v.storage,O=v.storageType,w=null==O?void 0:O.useUploadProps,S=(null==w?void 0:w(eC({storage:x,rules:x.rules},e)))||{};return eC({rules:null==x?void 0:x.rules},S)}(u,e);return eC({},u,s)},eR={size:function(e,t){var n=null!=t?t:0x1400000;return 0===n||e.size<=n?null:"File size exceeds the limit"},mimetype:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=t.toString().trim();return n&&"*"!==n?n.split(",").filter(Boolean).some(ew()(e.type))?null:"File type is not allowed":null}};function eD(e){var t,n,r,o,i,c,u,s=e.model,p=(0,er.useFlowContext)(),d=ek(s),f=d.rules,m=null!=f?f:{},y=m.size;m.mimetype;var b=(t=null!=y?y:0x1400000,r=(n=(0,D.useTranslation)()).t,o=function(e,{bits:t=!1,pad:n=!1,base:r=-1,round:o=2,locale:i="",localeOptions:a={},separator:l="",spacer:c=" ",symbols:u={},standard:s="",output:p="string",fullform:d=!1,fullforms:f=[],exponent:m=-1,roundingMethod:y="round",precision:b=0}={}){let g=m,h=Number(e),v=[],x=0,O="";"si"===s?(r=10,s=ev):"iec"===s||s===ev?r=2:2===r?s="iec":(r=10,s=ev);let w=10===r?1e3:1024,S=h<0,j=Math[y];if("bigint"!=typeof e&&isNaN(e))throw TypeError("Invalid number");if("function"!=typeof j)throw TypeError("Invalid rounding method");if(S&&(h=-h),(-1===g||isNaN(g))&&(g=Math.floor(Math.log(h)/Math.log(w)))<0&&(g=0),g>8&&(b>0&&(b+=8-g),g=8),"exponent"===p)return g;if(0===h)v[0]=0,O=v[1]=ex.symbol[s][t?eg:eh][g];else{x=h/(2===r?Math.pow(2,10*g):Math.pow(1e3,g)),t&&(x*=8)>=w&&g<8&&(x/=w,g++);let e=Math.pow(10,g>0?o:0);v[0]=j(x*e)/e,v[0]===w&&g<8&&-1===m&&(v[0]=1,g++),O=v[1]=10===r&&1===g?t?"kbit":"kB":ex.symbol[s][t?eg:eh][g]}if(S&&(v[0]=-v[0]),b>0&&(v[0]=v[0].toPrecision(b)),v[1]=u[v[1]]||v[1],!0===i?v[0]=v[0].toLocaleString():i.length>0?v[0]=v[0].toLocaleString(i,a):l.length>0&&(v[0]=v[0].toString().replace(".",l)),n&&o>0){let e=v[0].toString(),t=l||(e.match(/(\D)/g)||[]).pop()||".",n=e.toString().split(t),r=n[1]||"",i=r.length;v[0]=`${n[0]}${t}${r.padEnd(i+(o-i),"0")}`}return!0===d&&(v[1]=f[g]?f[g]:ex.fullform[s][g]+(t?"bit":"byte")+(1===v[0]?"":"s")),"array"===p?v:"object"===p?{value:v[0],symbol:v[1],exponent:g,unit:O}:v.join(c)}(t,{base:2,standard:"jedec",locale:n.i18n.language}),0!==t?r("File size should not exceed {{size}}.",{size:o}):""),g=eF((0,a.useState)(!1),2),h=g[0],v=g[1],x=(0,a.useCallback)(function(e){e.fileList.some(function(e){return"uploading"===e.status})?v(!0):v(!1)},[]),O=p.view.Header,w=(i=(0,D.useTranslation)().t,(0,a.useCallback)(function(e,t){var n=function(e,t){if(!t)return null;var n=Object.keys(t);if(!n.length)return null;var r=!0,o=!1,i=void 0;try{for(var a,l=n[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value,u=eR[c](e,t[c]);if(u)return u}}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return null}(e,f);return n?(e.status="error",e.response=i(n)):"error"===e.status&&(delete e.status,delete e.response),!n&&Promise.resolve(e)},[f]));return l().createElement("div",null,l().createElement(O,{title:p.t("Upload file")}),l().createElement("div",{style:{height:"50vh"},onClick:function(e){return e.stopPropagation()}},l().createElement(P.Upload.Dragger,eC({multiple:!0,listType:"picture"},(c=eA(eC({},d),{handleChange:x,beforeUpload:w}),u=(0,er.useFlowContext)(),eC({customRequest:function(e){var t=e.action,n=e.data,r=e.file,o=e.filename,i=e.headers,a=e.onError,l=e.onProgress,c=e.onSuccess,s=e.withCredentials,p=new FormData;return n&&Object.keys(n).forEach(function(e){p.append(e,n[e])}),p.append(o,r),u.api.axios.post(t,p,{withCredentials:s,headers:i,onUploadProgress:function(e){var t=e.total;l({percent:Math.round(e.loaded/t*100).toFixed(2)},r)}}).then(function(e){c(e.data,r)}).catch(a).finally(function(){}),{abort:function(){console.log("upload progress is aborted.")}}}},c))),l().createElement("p",{className:"ant-upload-drag-icon"},h?l().createElement(F.LoadingOutlined,{style:{fontSize:36},spin:!0}):l().createElement(F.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},p.t("Click or drag file to this area to upload")),l().createElement("ul",{style:{listStyleType:"none"}},l().createElement("li",{className:"ant-upload-hint"},p.t("Support for a single or bulk upload.")),l().createElement("li",{className:"ant-upload-hint"},b)))))}var eM=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eE(t),ej(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,eT()?Reflect.construct(t,r||[],eE(this).constructor):t.apply(this,r)),"defaultProps",{type:"primary",title:(0,er.escapeT)("Upload"),icon:"UploadOutlined"}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eI(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onInit",value:function(e){var t=this;eP(eE(n.prototype),"onInit",this).call(this,e),this.onUploadClick=function(e){t.dispatchEvent("openView",{event:e})}}},{key:"onUploadClick",set:function(e){this.setProps({onUploadClick:e})}},{key:"render",value:function(){var e=this.props,t=e.icon?l().createElement(o.Icon,{type:e.icon}):void 0;return l().createElement(P.Button,eA(eC({},e),{onClick:this.props.onUploadClick,icon:t}),e.children||e.title)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.ActionModel);function eB(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e_(e){return(e_=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]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){eB(e,t,n[t])})}return e}function eq(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 r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ez(e,t){return(ez=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eN=function(){return!!e})()}ej(eM,"scene",o.ActionSceneEnum.collection),eM.define({label:(0,er.escapeT)("Upload"),hide:function(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="file"}}),eM.registerFlow({key:"selectExitRecordSettings",title:(0,er.escapeT)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,er.escapeT)("Edit popup"),uiSchema:function(e){return{mode:{type:"string",title:(0,er.escapeT)("Open mode"),enum:[{label:(0,er.escapeT)("Drawer"),value:"drawer"},{label:(0,er.escapeT)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,er.escapeT)("Popup size"),enum:[{label:(0,er.escapeT)("Small"),value:"small"},{label:(0,er.escapeT)("Medium"),value:"medium"},{label:(0,er.escapeT)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){var n,r=e.inputArgs.mode||t.mode||"drawer",o=e.inputArgs.size||t.size||"medium";e.viewer.open({type:r,width:{drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}}[r][o],inheritContext:!1,target:e.layoutContentElement,inputArgs:{sourceId:null==(n=e.resource)?void 0:n.getSourceId()},content:function(){return l().createElement(eD,{model:e.model})},styles:{content:eC({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===r?{position:"absolute",top:0,left:0,right:0,bottom:0}:{})}})}}}});var eK=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return n=t,r=arguments,n=e_(n),eB(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,eN()?Reflect.construct(n,r||[],e_(this).constructor):n.apply(this,r)),"name","file"),eB(e,"title",'{{t("File collection", { ns: "'.concat(M,'" })}}')),eB(e,"order",3),eB(e,"color","blue"),eB(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}},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:'{{t("Storage", { ns: "'.concat(M,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),eB(e,"presetFieldsDisabled",!0),eB(e,"events",{filterPrimaryKeyCandidate:function(e){return"input"!==e.name},initPrimaryKeyFiledInterface:function(e){e.autoFill&&(e.autoFill["x-disabled"]=!0),e.autoIncrement&&(e.autoIncrement["x-disabled"]=!0)}}),eB(e,"configurableProperties",eU(eq(eU(eq(eU({},(0,o.getConfigurableProperties)("title","name")),{inherits:eq(eU({},(0,o.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,o.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,o.getConfigurableProperties)("presetFields"))),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ez(t,e),t}(o.CollectionTemplate);function eL(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eG(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){eL(i,r,o,a,l,"next",e)}function l(e){eL(i,r,o,a,l,"throw",e)}a(void 0)})}}function eV(e,t,n){return(eV=eH()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&eY(o,n.prototype),o}).apply(null,arguments)}function eW(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e$(e){return(e$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eY(e,t){return(eY=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eZ(e){var t="function"==typeof Map?new Map:void 0;return(eZ=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 eV(e,arguments,e$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eY(n,e)})(e)}function eH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eH=function(){return!!e})()}function eX(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var eJ=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=e$(t),eW(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,eH()?Reflect.construct(t,r||[],e$(this).constructor):t.apply(this,r)),"storageTypes",new Map),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eY(n,e),t=[{key:"load",value:function(){var e=this;return eG(function(){var t;return eX(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([en]),e.app.dataSourceManager.addCollectionTemplates([eK]),e.app.use(j),e.app.pluginSettingsManager.add(M,{title:'{{t("File manager", { ns: "'.concat(M,'" })}}'),icon:"FileOutlined",Component:X,aclSnippet:"pm.file-manager.storages"}),Object.values(z).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,o.useCollection)().template}}),e.app.addScopes({useAttachmentFieldProps:v,useFileCollectionStorageRules:x,useStorageCfg:u}),e.app.addComponents({FileSizeField:I}),e.flowEngine.registerModels({DisplayPreviewFieldModel:eb,UploadActionModel:eM}),[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 eG(function(){var n,r,o,i,a,l,c,u,s,p,d,f,m,y;return eX(this,function(b){switch(b.label){case 0:if(!(null==e?void 0:e.file))return[2,{errorMessage:"Missing file"}];if(n=e.file,r=e.storageType,o=e.storageId,i=e.storageRules,l=void 0===(a=e.query)?{}:a,c=(null==e?void 0:e.fileCollectionName)||"attachments",!(null==(u=t.getStorageType(r))?void 0:u.upload))return[3,2];return[4,u.upload({file:n,apiClient:t.app.apiClient,storageType:r,storageId:o,storageRules:i,fileCollectionName:c,query:l})];case 1:return[2,b.sent()];case 2:return b.trys.push([2,4,,5]),(p=new FormData).append("file",n),f=(d=new URLSearchParams(l).toString())?"".concat(c,":create?").concat(d):"".concat(c,":create"),[4,t.app.apiClient.request({url:f,method:"post",data:p})];case 3:return[2,{data:null==(s=b.sent().data)?void 0:s.data}];case 4:return[2,{errorMessage:null!=(y=null==(m=b.sent())?void 0:m.message)?y:"Upload failed"}];case 5:return[2]}})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(eZ(o.Plugin));eW(eJ,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var eQ=eJ}(),d});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["react-i18next","@emotion/css","@formily/antd-v5","@formily/react","@ant-design/icons","@nocobase/flow-engine","@formily/shared","react","antd","@nocobase/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("lodash")):e["@nocobase/plugin-file-manager"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e.lodash)}(self,function(e,t,n,r,o,i,l,a,c,u,s){return function(){var p={484:function(e,t,n){var r=n(986),o=/[\/\+\.]/;e.exports=function(e,t){function n(t){var n=r(t,e,o);return n&&n.length>=2}return t?n(t.split(";")[0]):n}},986:function(e){"use strict";function t(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}t.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(t=0,n=(e||"").split(this.separator);r&&t<i;t++)if("*"===o[t])continue;else r=t<n.length&&o[t]===n[t];r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var l in r={},e)this.match(l)&&(r[l]=e[l]);return r},e.exports=function(e,n,r){var o=new t(e,r||/[\/\.]/);return void 0!==n?o.match(n):o}},375:function(e){"use strict";e.exports=o},477:function(e){"use strict";e.exports=t},418:function(e){"use strict";e.exports=n},230:function(e){"use strict";e.exports=r},166:function(e){"use strict";e.exports=l},342:function(e){"use strict";e.exports=u},694:function(e){"use strict";e.exports=i},59:function(e){"use strict";e.exports=c},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=a},953:function(t){"use strict";t.exports=e}},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return p[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(m=d.g.location+"");var m,y=d.g.document;if(!m&&y&&(y.currentScript&&"SCRIPT"===y.currentScript.tagName.toUpperCase()&&(m=y.currentScript.src),!m)){var b=y.getElementsByTagName("script");if(b.length)for(var g=b.length-1;g>-1&&(!m||!/^http(s?):/.test(m));)m=b[g--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");d.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var h={};return!function(){"use strict";var e=window.__nocobase_public_path__||"";if(!e&&window.location&&window.location.pathname){var t=window.location.pathname||"/",n=t.indexOf("/v2/");e=n>=0?t.slice(0,n+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),d.p=e+"static/plugins/@nocobase/plugin-file-manager/dist/client/"}(),!function(){"use strict";d.r(h),d.d(h,{UploadFieldModel:function(){return e0},default:function(){return tF},PluginFileManagerClient:function(){return tC},filePreviewTypes:function(){return eo},wrapWithModalPreviewer:function(){return eg},CardUpload:function(){return eX}});var e,t,n,r={};d.r(r),d.d(r,{useAttachmentFieldProps:function(){return g},useFileCollectionStorageRules:function(){return v},useStorageRules:function(){return b},useUploadFiles:function(){return m}});var o=d(342),i=d(155),l=d.n(i);function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function c(){var e,t,n,r,l,a,c,u=(0,o.useCollectionField)(),s=(0,o.useCollectionManager)().getCollection(null==u?void 0:u.target),p=(0,o.useCollection)(),f=(0,o.usePlugin)(tF),d=(t=null!=(e=(null==u?void 0:u.storage)||(null==p?void 0:p.getOption("storage"))||(null==s?void 0:s.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),l=(r=(0,o.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,a=r.data,c=r.run,(0,i.useEffect)(function(){c()},[c]),!l&&(null==a?void 0:a.data)||null),m=f.getStorageType(null==d?void 0:d.type);return{storage:d,storageType:m}}function u(e){var t=c(),n=t.storage,r=t.storageType,o=null==r?void 0:r.useUploadProps,i=(null==o?void 0:o(a({storage:n,rules:n.rules},e)))||{};return a({rules:null==n?void 0:n.rules},i)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(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 f(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}var m=function(){var e=(0,o.useDataBlockRequestGetter)().getDataBlockRequest,t=((0,o.useDataBlockProps)()||{}).association,n=(0,o.useActionContext)().setVisible,r=(0,o.useCollection)(),l=(0,o.useSourceId)(),a=(0,i.useMemo)(function(){var e="".concat(r.name,":create");if(t){var n,o=function(e){if(Array.isArray(e))return e}(n=t.split("."))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(n)||f(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=o[0],a=o[1];e="".concat(i,"/").concat(l,"/").concat(a,":create")}return e},[r.name,t,l]),c=((0,i.useContext)(o.RecordPickerContext)||{}).setSelectedRows,s={},d=0,m={action:a,onChange:function(t){t.forEach(function(n){if("uploading"!==n.status||s[n.uid]||(d++,s[n.uid]=!0),"uploading"!==n.status&&s[n.uid]&&(delete s[n.uid],0==--d)){var r,o;null==(o=e())||null==(r=o.refresh)||r.call(o),null==c||c(function(e){return p(e).concat(p(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)}},y=u(m);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},m,y)},y=d(230);function b(e){var t,n=null!=e?e:"";(0,o.useAPIClient)();var r=(0,y.useField)(),l=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),a=l.loading,c=l.data,u=l.run;return(0,i.useEffect)(function(){"editable"===r.pattern&&u()},[r.pattern,u]),!a&&(null==c||null==(t=c.data)?void 0:t.rules)||null}function g(){var e=(0,o.useCollectionField)(),t="".concat(null==e?void 0:e.target,":create").concat((null==e?void 0:e.storage)?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=u({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({action:t},n)}function v(){var e=(0,o.useCollectionField)(),t=(0,o.useCollectionManager)().getCollection(null==e?void 0:e.target);return b(null==t?void 0:t.getOption("storage"))}var x=function(e){var t,n,r={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 l().createElement(o.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={schema:r},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},w={dumpRules:{group:"user"},migrationRules:["schema-only","overwrite"],asStrategyResource:!0,shared:!0,name:"attachments",createdBy:!0,updatedBy:!0,template:"file",filterTargetKey:"id",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"},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:"{{t('Storage', { ns: '".concat("file-manager","' })}}"),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{comment:"相对路径(含“/”前缀)",type:"text",name:"path"},{comment:"其他文件信息(如图片的宽高)",type:"jsonb",name:"meta",defaultValue:{}},{comment:"网络访问地址",type:"text",name:"url"}]},O={dumpRules:"required",migrationRules:["overwrite","schema-only"],name:"storages",shared:!0,fields:[{name:"id",type:"snowflakeId",primaryKey:!0,allowNull:!1},{title:"存储引擎名称",comment:"存储引擎名称",type:"string",name:"title",translation:!0,trim:!0},{title:"英文标识",type:"uid",name:"name",unique:!0,trim:!0},{comment:"类型标识,如 local/ali-oss 等",type:"string",name:"type"},{comment:"配置项",type:"jsonb",name:"options",defaultValue:{}},{comment:"文件规则",type:"jsonb",name:"rules",defaultValue:{}},{comment:"存储相对路径模板",type:"text",name:"path",defaultValue:"",trim:!0},{comment:"访问地址前缀",type:"string",name:"baseUrl",defaultValue:"",trim:!0},{comment:"重命名模式",type:"string",name:"renameMode",defaultValue:"appendRandomID"},{comment:"默认引擎",type:"radio",name:"default",defaultValue:!1},{type:"boolean",name:"paranoid",defaultValue:!1},{type:"json",name:"settings",defaultValue:{}}]},S=function(e){return l().createElement(o.ExtendCollectionsProvider,{collections:[w,O]},l().createElement(o.SchemaComponentOptions,{scope:r,components:{UploadActionInitializer:x}},e.children))},j=d(59),P=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function E(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,r=P.length-1;r>=0;r--){var o=P[r];if(n%o.value==0)return o}return P[0]}function C(e,t,n){return Math.min(Math.max(t,e),n)}function F(e){var t,n=e.value,r=e.defaultUnit,o=void 0===r?1048576:r,a=e.min,c=void 0===a?1:a,u=e.max,s=void 0===u?1/0:u,p=e.step,f=e.onChange,d=null!=(t=e.defaultValue)?t:0x1400000,m=E(d,o),y=d/m.value,b=E(null!=n?n:d,o),g=null==n?n:n/b.value,h=(0,i.useCallback)(function(e){null==f||f(C(null==e?e:e*b.value,c,s))},[b.value]),v=(0,i.useCallback)(function(e){null==f||f(C(g*e,c,s))},[g]);return l().createElement(j.Space.Compact,null,l().createElement(j.InputNumber,{value:g,onChange:h,defaultValue:"".concat(y),step:void 0===p?1:p}),l().createElement(j.Select,{options:P,value:b.value,onChange:v,className:"auto-width"}))}var k=d(375),A=d(166),I=d(773),T=d.n(I),R=d(953),D="file-manager",M={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(D,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(D,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(D,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Base URL", { ns: "'.concat(D,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(D,'" })}}'),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"}}]},U={type:"object",properties:(e={},t=(0,A.uid)(),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:M,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:M},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(D,'" })}}'),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)},_={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(D,'" })}}')},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(D,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(D,'" })}}'),description:'{{t("Minimum from 1 byte.", { ns: "'.concat(D,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type allowed (in MIME type format)", { ns: "'.concat(D,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(D,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(D,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy the file record", { ns: "'.concat(D,'" })}}'),description:'{{t("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.", { ns: "'.concat(D,'" })}}')},renameMode:{title:'{{t("Renaming", { ns: "'.concat(D,'" })}}'),description:'{{t("Renaming strategy to avoid filename conflicts when uploading files.", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Append random ID", { ns: "'.concat(D,'" })}}'),value:"appendRandomID"},{label:'{{t("Random string", { ns: "'.concat(D,'" })}}'),value:"random"},{label:'{{t("Keep original filename (will be overwrite if filename is existed)", { ns: "'.concat(D,'" })}}'),value:"none"}],default:"appendRandomID"},settings:{type:"object",title:'{{t("Advanced Settings", { ns: "'.concat(D,'" })}}'),"x-component":"fieldset",properties:{requestOptions:{type:"object",title:'{{t("Request options", { ns: "'.concat(D,'" })}}'),description:'{{t("Additional options for HTTP requests when fetching files from remote storage on server side, such as headers.", { ns: "'.concat(D,'" })}}'),"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5}}}}}},B={title:'{{t("Aliyun OSS", { ns: "'.concat(D,'" })}}'),name:"ali-oss",fieldset:{title:_.title,name:_.name,baseUrl:_.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(D,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},timeout:{title:'{{t("Timeout", { ns: "'.concat(D,'" })}}'),description:"{{t('Upload timeout for a single file in milliseconds. Default is 600000.', { ns: \"".concat(D,'" })}}'),type:"number","x-decorator":"FormItem","x-component":"InputNumber",default:6e5},thumbnailRule:{title:'{{t("File pre-process parameters", { ns: "'.concat(D,'" })}}'),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:_.path,renameMode:_.renameMode,rules:_.rules,default:_.default,paranoid:_.paranoid,settings:_.settings},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},q={local:{title:'{{t("Local storage", { ns: "'.concat(D,'" })}}'),name:"local",fieldset:{title:_.title,name:_.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(D,'" })}}'),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/"}},renameMode:_.renameMode,rules:_.rules,default:_.default,paranoid:_.paranoid}},"ali-oss":B,s3:{title:'{{t("Amazon S3", { ns: "'.concat(D,'" })}}'),name:"s3",fieldset:{title:_.title,name:_.name,baseUrl:_.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:_.path,renameMode:_.renameMode,rules:_.rules,default:_.default,paranoid:_.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(D,'" })}}'),name:"tx-cos",fieldset:{title:_.title,name:_.name,baseUrl:_.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(D,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(D,'" })}}'),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:_.path,renameMode:_.renameMode,rules:_.rules,default:_.default,paranoid:_.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){N(e,t,n[t])})}return e}function K(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||W(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||W(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 W(e,t){if(e){if("string"==typeof e)return z(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 z(e,t)}}var $=function(){var e=V((0,i.useState)({}),2),t=e[0],n=e[1],r=(0,o.usePlugin)(tF),a=(0,o.useCompile)(),c=V((0,i.useState)(!1),2),u=c[0],s=c[1],p=(0,R.useTranslation)().t;return l().createElement("div",null,l().createElement(o.ActionContext.Provider,{value:{visible:u,setVisible:s}},l().createElement(j.Dropdown,{menu:{onClick:function(e){var t=r.storageTypes.get(e.key);s(!0),n({type:"object",properties:N({},(0,A.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:K(L({},T().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:G(r.storageTypes.values()).map(function(e){return{key:e.name,label:a(e.title)}})}},l().createElement(j.Button,{type:"primary",icon:l().createElement(k.PlusOutlined,null)},p("Add new")," ",l().createElement(k.DownOutlined,null))),l().createElement(o.SchemaComponent,{scope:{createOnly:!0},schema:t})))},Y=function(){var e=(0,o.useRecord)(),t=V((0,i.useState)({}),2),n=t[0],r=t[1],a=(0,o.usePlugin)(tF),c=(0,o.useCompile)(),u=V((0,i.useState)(!1),2),s=u[0],p=u[1],f=(0,R.useTranslation)().t,d=V(j.message.useMessage(),2),m=d[0],y=d[1],b=(0,i.useCallback)(function(){var t=a.storageTypes.get(e.type);t?(p(!0),t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),r({type:"object",properties:N({},(0,A.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:L({},e)},title:c("{{t('Edit')}}")+" - "+c(t.title),properties:K(L({},T().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.error(f("Storage type {{type}} is not registered, please check if related plugin is enabled.",{ns:D,type:e.type}))},[c,a.storageTypes,e]);return l().createElement("div",null,y,l().createElement(o.ActionContext.Provider,{value:{visible:s,setVisible:p}},l().createElement("a",{onClick:b},f("Edit")),l().createElement(o.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function Z(e){var t=q[e];return(null==t?void 0:t.thumbnailRule)?l().createElement("div",null,l().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},o.i18n.t("See more"))):null}var H=function(){var e=(0,o.useCompile)(),t=G((0,o.usePlugin)(tF).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return l().createElement(j.Card,{bordered:!1},l().createElement(o.SchemaComponent,{components:{CreateStorage:$,EditStorage:Y},scope:{useNewId:function(e){return"".concat(e).concat((0,A.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:Z},schema:U}))};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 J(e){return(J=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=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,r,i,l;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=J(t),Q(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ee()?Reflect.construct(t,r||[],J(this).constructor):t.apply(this,r)),"name","attachment"),Q(e,"type","object"),Q(e,"group","media"),Q(e,"title",'{{t("Attachment", { ns: "'.concat(D,'" })}}')),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",(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Q(e,t,n[t])})}return e}({},o.interfacesProperties.defaultProps),l=l={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(D,'" })}}'),"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(D,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(D,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(D,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))}),i)),Q(e,"filterable",{children:[{name:"id",value:"id",title:'{{t("Exists")}}',label:'{{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",value:"filename",title:'{{t("Filename", { ns: "'.concat(D,'" })}}'),label:'{{t("Filename", { ns: "'.concat(D,'" })}}'),operators:o.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(D,'" })}}'),type:"string","x-component":"Input"}}]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&X(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,A.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,A.uid)())),e.otherKey||(e.otherKey="f_".concat((0,A.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.CollectionFieldInterface),en=d(694);function er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var eo=new(function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");er(this,"types",[])}return e=[{key:"add",value:function(e){this.types.unshift(e)}},{key:"getTypeByFile",value:function(e){var t=ei(e);return this.types.find(function(e){return e.match(t)})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}());function ei(e){return e&&"string"==typeof e?{url:e}:e}function el(e){return e?"string"==typeof e?e:e.preview||e.url||"":""}function ea(e){return e?"string"==typeof e?e:e.url||e.preview||"":""}var ec={pdf:"/file-placeholder/pdf-200-200.png",mp4:"/file-placeholder/video-200-200.png",mov:"/file-placeholder/video-200-200.png",avi:"/file-placeholder/video-200-200.png",wmv:"/file-placeholder/video-200-200.png",flv:"/file-placeholder/video-200-200.png",mkv:"/file-placeholder/video-200-200.png",mp3:"/file-placeholder/audio-200-200.png",wav:"/file-placeholder/audio-200-200.png",aac:"/file-placeholder/audio-200-200.png",ogg:"/file-placeholder/audio-200-200.png",doc:"/file-placeholder/docx-200-200.png",docx:"/file-placeholder/docx-200-200.png",odt:"/file-placeholder/docx-200-200.png",xls:"/file-placeholder/xlsx-200-200.png",xlsx:"/file-placeholder/xlsx-200-200.png",csv:"/file-placeholder/xlsx-200-200.png",ppt:"/file-placeholder/pptx-200-200.png",pptx:"/file-placeholder/pptx-200-200.png",jpg:"/file-placeholder/jpeg-200-200.png",jpeg:"/file-placeholder/jpeg-200-200.png",png:"/file-placeholder/png-200-200.png",gif:"/file-placeholder/gif-200-200.png",webp:"/file-placeholder/png-200-200.png",bmp:"/file-placeholder/png-200-200.png",svg:"/file-placeholder/svg-200-200.png",default:"/file-placeholder/unknown-200-200.png"},eu=function(e){return e.split("?")[0].split("#")[0]},es=function(e){if(!e)return"";var t=eu(e),n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},ep=function(e){if(!e)return"";var t=eu(e),n=t.lastIndexOf("/");return -1!==n?t.slice(n+1):t},ef=function(e,t){if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"){if(e.extname)return String(e.extname).replace(/^\./,"").toLowerCase();var n=es(e.name||e.filename||e.title);if(n)return n}return es(t)},ed=function(e,t){var n=ep(t);return e&&"string"!=typeof e&&(e.name||e.filename||e.title)||n},em=function(e,t){return ec[ef(e,t)]||ec.default},ey=function(e){var t,n=ei(e),r=el(n),i=(null!=(t=eo.getTypeByFile(n))?t:{}).getThumbnailURL,l=null==i?void 0:i(n);return l||((0,o.matchMimetype)(n,"image/*")?"":em(n,r))},eb=function(e){var t=e.index,n=e.list,r=e.onSwitchIndex,o=e.onDownload,i=e.file,a="number"==typeof t&&!!r&&t>0,c="number"==typeof t&&!!r&&t<n.length-1;return l().createElement(j.Space,{size:14,style:{fontSize:"20px"}},l().createElement(k.LeftOutlined,{style:{cursor:a?"pointer":"not-allowed"},disabled:!a,onClick:function(){return a&&(null==r?void 0:r(t-1))}}),l().createElement(k.RightOutlined,{style:{cursor:c?"pointer":"not-allowed"},disabled:!c,onClick:function(){return c&&(null==r?void 0:r(t+1))}}),l().createElement(k.DownloadOutlined,{onClick:function(){return o(i)}}))},eg=function(e){return function(t){var n=t.open,r=t.onOpenChange,o=t.onClose,i=t.file;if("boolean"!=typeof n)return l().createElement(e,t);var a=ed(i,ea(i));return l().createElement(j.Modal,{open:n,title:a,onCancel:function(){null==r||r(!1),null==o||o()},footer:eb(t),width:"90vw",centered:!0},l().createElement("div",{style:{maxWidth:"100%",maxHeight:"calc(100vh - 256px)",height:"80vh",width:"100%",background:"white",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",overflowY:"auto"}},l().createElement(e,t)))}};eo.add({match:function(){return!0},Previewer:eg(function(e){(0,R.useTranslation)().t;var t=e.file;return l().createElement(j.Alert,{type:"warning",description:l().createElement(R.Trans,{ns:D},"File type is not supported for previewing, please ",e.onDownload?l().createElement("a",{onClick:function(){var n;return null==(n=e.onDownload)?void 0:n.call(e,t)},style:{textDecoration:"underline",cursor:"pointer"}},"download it to preview"):l().createElement("span",null,"download it to preview")),showIcon:!0})})}),eo.add({match:function(e){return(0,o.matchMimetype)(e,"image/*")},getThumbnailURL:function(e){return el(e)},Previewer:function(e){var t=e.file,n=e.list,r=e.index,o=e.open,i=e.onOpenChange,a=e.onSwitchIndex,c=e.onClose,u=e.onDownload;if("boolean"!=typeof o)return null;var s=ea(t);if(!s)return null;var p="number"==typeof r&&r>0,f="number"==typeof r&&r<n.length-1;return l().createElement(j.Image,{wrapperStyle:{display:"none"},preview:{visible:o,onVisibleChange:function(e){return null==i?void 0:i(e)},afterOpenChange:function(e){e||null==c||c()},toolbarRender:function(e,n){var o=n.transform.scale,i=n.actions,c=i.onFlipY,s=i.onFlipX,d=i.onRotateLeft,m=i.onRotateRight,y=i.onZoomOut,b=i.onZoomIn,g=i.onReset;return l().createElement(j.Space,{size:14,className:"toolbar-wrapper",style:{fontSize:"20px"}},l().createElement(k.LeftOutlined,{style:{cursor:p?"pointer":"not-allowed"},disabled:!p,onClick:function(){return p&&(null==a?void 0:a(r-1))}}),l().createElement(k.RightOutlined,{style:{cursor:f?"pointer":"not-allowed"},disabled:!f,onClick:function(){return f&&(null==a?void 0:a(r+1))}}),u?l().createElement(k.DownloadOutlined,{onClick:function(){return u(t)}}):null,l().createElement(k.SwapOutlined,{rotate:90,onClick:c}),l().createElement(k.SwapOutlined,{onClick:s}),l().createElement(k.RotateLeftOutlined,{onClick:d}),l().createElement(k.RotateRightOutlined,{onClick:m}),l().createElement(k.ZoomOutOutlined,{disabled:1===o,onClick:y}),l().createElement(k.ZoomInOutlined,{disabled:50===o,onClick:b}),l().createElement(k.UndoOutlined,{onClick:g}))}},src:s})}}),eo.add({match:function(e){return["text/plain","application/pdf","application/json"].some(function(t){return(0,o.matchMimetype)(e,t)})},Previewer:eg(function(e){var t=ea(e.file);return t?l().createElement("iframe",{src:t,width:"100%",height:"100%",style:{border:"none"}}):null})}),eo.add({match:function(e){return(0,o.matchMimetype)(e,"audio/*")},Previewer:eg(function(e){var t=e.file,n=(0,R.useTranslation)().t,r=ea(t);return r?l().createElement("audio",{controls:!0},l().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the audio tag.")):null})}),eo.add({match:function(e){return(0,o.matchMimetype)(e,"video/*")},Previewer:eg(function(e){var t=e.file,n=(0,R.useTranslation)().t,r=ea(t);return r?l().createElement("video",{controls:!0,width:"100%",height:"100%"},l().createElement("source",{src:r,type:(null==t?void 0:t.type)||(null==t?void 0:t.mimetype)}),n("Your browser does not support the video tag.")):null})});var eh=function(e){var t,n,r,o=ei(e.file);if(!o)return null;var i=(null!=(r=eo.getTypeByFile(o))?r:{}).Previewer;return i?l().createElement(i,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){er(e,t,n[t])})}return e}({},e),n=n={file:o},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)):null};function ev(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ex(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ew(e){return(ew=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eO(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function eS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ex(e,t,n[t])})}return e}function ej(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eP(e,t){return(eP=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ev(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 ev(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eC=function(){return!!e})()}function eF(){var e,t,n=(e=["\n .ant-image-img {\n border: 1px solid #d9d9d9;\n padding: 2px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return eF=function(){return n},n}var ek=function(e){var t=e.file,n=e.size,r=e.showFileName,i=e.onClick,a=ei(t),c=el(a);if(c){var u=ed(a,c),s=em(a,c),p=ey(a)||s,f=l().createElement("div",{className:(0,o.css)(eF())},l().createElement(j.Image,{src:p,fallback:s,width:n,height:n,preview:!1,style:{borderRadius:4,objectFit:"cover",boxShadow:"0 0 0 2px #fff"}}));return l().createElement("div",{onClick:i,style:{textAlign:"center",width:n,wordBreak:"break-all",cursor:i?"pointer":"default"}},f,r&&l().createElement(j.Tooltip,{title:u},l().createElement("div",{style:{fontSize:12,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},u)))}},eA=function(e){var t=e.value,n=void 0===t?[]:t,r=e.size,o=void 0===r?28:r,i=e.showFileName,a=eE(l().useState(0),2),c=a[0],u=a[1],s=eE(l().useState(!1),2),p=s[0],f=s[1],d=l().useMemo(function(){return(0,I.castArray)(n).filter(Boolean).map(ei).filter(function(e){return el(e)})},[n]);l().useEffect(function(){c>=d.length&&d.length&&u(0)},[c,d.length]),l().useEffect(function(){!d.length&&p&&f(!1)},[d.length,p]);var m=l().useCallback(function(e){var t=e||d[c];if(t){var n=t.url||t.preview;if(n){var r=ed(t,n),o=ef(t,n);r&&o&&!r.toLowerCase().endsWith(".".concat(o))&&(r="".concat(r,".").concat(o));var i="".concat(Date.now(),"_").concat(r||"file");fetch(n).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(new Blob([e])),n=document.createElement("a");n.href=t,n.download=i,document.body.appendChild(n),n.click(),URL.revokeObjectURL(t),n.remove()})}}},[c,d]),y=l().useCallback(function(e){u(e),f(!0)},[]),b=l().useCallback(function(e){e<0||e>=d.length||u(e)},[d.length]);return l().createElement(l().Fragment,null,l().createElement(j.Space,{wrap:!0},d.map(function(e,t){return l().createElement(ek,{file:e,size:o,key:t,showFileName:i,onClick:function(){return y(t)}})})),d[c]?l().createElement(eh,{open:p,file:d[c],index:c,list:d,onOpenChange:f,onClose:function(){return f(!1)},onSwitchIndex:b,onDownload:m}):null)},eI=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=ew(t),ex(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eC()?Reflect.construct(t,r||[],ew(this).constructor):t.apply(this,r)),"disableTitleField",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eP(n,e),t=[{key:"render",value:function(){var e=this,t=this.props,n=t.value,r=t.titleField,o=t.template,i=t.target;return r&&"file"!==o&&"attachments"!==i?(0,I.castArray)(n).flatMap(function(t,n){var o=null==t?void 0:t[r],i=o?l().createElement(eA,ej(eS({key:n},e.props),{value:(0,I.castArray)(o).filter(Boolean)})):l().createElement("span",{key:n},"N/A");return 0===n?[i]:[l().createElement("span",{key:"sep-".concat(n)},", "),i]}):l().createElement(eA,ej(eS({},this.props),{value:(0,I.castArray)(n).filter(Boolean)}))}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.FieldModel);eI.registerFlow({key:"previewReadPrettySetting",sort:500,title:(0,en.tExpr)("Preview Settings"),steps:{size:{title:(0,en.tExpr)("Size"),uiMode:function(e){var t=e.t;return{type:"select",key:"size",props:{options:[{value:300,label:t("Large")},{value:100,label:t("Middle")},{value:28,label:t("Small")}]}}},hideInSettings:function(e){return eO(e.model.parent,o.TableColumnModel)},defaultParams:function(e){return{size:eO(e.model.parent,o.DetailsItemModel)?100:28}},handler:function(e,t){e.model.setProps("size",t.size)}},showFileName:{title:(0,en.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},hideInSettings:function(e){return eO(e.model.parent,o.TableColumnModel)},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}}}}),eI.define({label:(0,en.tExpr)("Preview")}),en.DisplayItemModel.bindModelToInterface("DisplayPreviewFieldModel",["url","attachment","attachmentURL","m2m","m2o","o2o","o2m","oho","obo","mbm"],{isDefault:!0,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}});var eT=d(477),eR=d(418);function eD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var eM=function(e,t){var n,r,o,i,l=null==e?void 0:e.response,a=null!=(n=null==e?void 0:e.id)?n:null==l?void 0:l.id,c=null!=(r=null==e?void 0:e.url)?r:null==l?void 0:l.url,u=null!=(o=null==e?void 0:e.filename)?o:null==l?void 0:l.filename,s=null!=(i=null==e?void 0:e.name)?i:null==l?void 0:l.name;return null!=a?"id:".concat(String(a)):null!=c?"url:".concat(c):null!=u?"filename:".concat(u,":").concat(t):null!=s?"name:".concat(s,":").concat(t):(null==e?void 0:e.uid)?"uid:".concat(e.uid):"index:".concat(t)},eU=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e,t){return[eM(e,t),e.uid]}).filter(function(e){return!!(function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return eD(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return eD(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]}));return e.map(function(e,t){var r,o,i,l=eM(e,t);return r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),o=o={uid:e.uid||n.get(l)||l,thumbUrl:null!=(i=e.thumbUrl)?i:ey(e)},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r})},e_=function(e,t){var n=e.findIndex(function(e){return e.uid===(null==t?void 0:t.uid)});return n>=0?n:0};function eB(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eq(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function ez(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){eq(i,r,o,l,a,"next",e)}function a(e){eq(i,r,o,l,a,"throw",e)}l(void 0)})}}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 eL(e,t,n){return(eL="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=eK(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function eK(e){return(eK=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){eN(e,t,n[t])})}return e}function eG(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function eW(e,t){return(eW=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function e$(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||eZ(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 eY(e){return function(e){if(Array.isArray(e))return eB(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eZ(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 eZ(e,t){if(e){if("string"==typeof e)return eB(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 eB(e,t)}}function eH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eH=function(){return!!e})()}function eQ(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function eJ(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n ","\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return eJ=function(){return n},n}var eX=function(e){var t,n=e.allowSelectExistingRecord,r=e.multiple,o=e.value,a=e.disabled,c=e.onSelectExitRecordClick,u=e.quickUpload,s=e.showFileName,p=e$((0,i.useState)(function(){return eU((0,I.castArray)(o||[]))}),2),f=p[0],d=p[1],m=e$((0,i.useState)(!1),2),b=m[0],g=m[1],h=e$((0,i.useState)(null),2),v=h[0],x=h[1],w=e$((0,i.useState)(0),2),O=w[0],S=w[1],j=(0,R.useTranslation)().t;(0,i.useLayoutEffect)(function(){d(function(e){return eU((0,I.castArray)(o||[]),e)})},[o]);var P=(t=f.length,!!r||0===t);return l().createElement(y.FieldContext.Provider,{value:{value:f}},l().createElement("div",{style:{display:"flex"},className:(0,eT.css)(eJ(),s?"8px 0px":"0px",s?"8px 0px":"0px",r?"":"\n .ant-upload-list-item-container.ant-upload-animate-inline-appear,\n .ant-upload-list-item-container.ant-upload-animate-inline-appear-active,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter,\n .ant-upload-list-item-container.ant-upload-animate-inline-enter-active {\n animation: none !important;\n transition: none !important;\n transform: none !important;\n opacity: 1 !important;\n }\n\n .ant-upload.ant-upload-animate-inline-leave,\n .ant-upload.ant-upload-animate-inline-leave-active {\n animation: none !important;\n transition: none !important;\n }\n ")},l().createElement(eR.Upload,eG(eV({onPreview:function(e){return ez(function(){var t;return eQ(this,function(n){switch(n.label){case 0:var r;if(t=e_(f,e),!(!e.url&&!e.preview))return[3,2];return[4,(r=e.originFileObj,new Promise(function(e,t){var n=new FileReader;n.readAsDataURL(r),n.onload=function(){return e(n.result)},n.onerror=function(e){return t(e)}}))];case 1:e.preview=n.sent(),n.label=2;case 2:return x(e),S(t),g(!0),[2]}})})()}},e),{listType:"picture-card",fileList:f,onChange:function(t){d(function(e){return eU(t,e)});var n=t.filter(function(e){return"done"===e.status||e.id});if(t.every(function(e){return"done"===e.status||e.id}))if(1===e.maxCount){var r=n[0];e.onChange(r?r.response:null)}else e.onChange(n.map(function(e){return e.response||e}).filter(Boolean))},itemRender:function(e,t){return l().createElement(l().Fragment,null,e,s&&l().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:t.filename},t.filename))}}),(void 0===u||u)&&P?l().createElement(k.UploadOutlined,{style:{fontSize:20}}):null),v&&l().createElement(eh,{open:b,file:v,list:f,index:O,onOpenChange:g,onClose:function(){return x(null)},onSwitchIndex:function(e){e<0||e>=f.length||(S(e),x(f[e]))},onDownload:function(e){var t=e||v;if(t){var n=t.url||t.preview;if(n){var r=n.split("?")[0].split("#")[0],o=r?r.substring(r.lastIndexOf("/")+1):n,i=o.slice(o.lastIndexOf(".")),l="".concat(Date.now(),"_").concat(t.filename).concat(i);fetch(n).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(new Blob([e])),n=document.createElement("a");n.href=t,n.download=l,document.body.appendChild(n),n.click(),URL.revokeObjectURL(t),n.remove()})}}}}),n&&P?l().createElement("div",{style:{marginLeft:5}},l().createElement(eR.Upload,{disabled:a,multiple:r,listType:"picture-card",showUploadList:!1},l().createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:function(e){a||(e.stopPropagation(),e.preventDefault(),c())}},l().createElement(k.PlusOutlined,null),j("Select")))):null))},e0=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=eK(t),eN(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eH()?Reflect.construct(t,r||[],eK(this).constructor):t.apply(this,r)),"selectedRows",en.observable.ref([])),eN(e,"_closeView",void 0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eW(n,e),t=[{key:"customRequest",set:function(e){this.setProps({customRequest:e})}},{key:"onInit",value:function(e){var t=this;eL(eK(n.prototype),"onInit",this).call(this,e),this.onSelectExitRecordClick=function(e){t.dispatchEvent("openView",{event:e})}}},{key:"onSelectExitRecordClick",set:function(e){this.setProps({onSelectExitRecordClick:e})}},{key:"change",value:function(){this.props.onChange(this.selectedRows.value)}},{key:"render",value:function(){return l().createElement(eX,this.props)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.FieldModel);(e0=function(e,t,n,r){var o,i=arguments.length,l=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(l=(i<3?o(l):i>3?o(t,n,l):o(t,n))||l);return i>3&&l&&Object.defineProperty(t,n,l),l}([(0,en.largeField)()],e0)).registerFlow({key:"uploadSettings",title:(0,en.tExpr)("Upload file settings"),steps:{quickUpload:{title:(0,en.tExpr)("Quick upload"),uiMode:{type:"switch",key:"quickUpload"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{quickUpload:!0}},handler:function(e,t){e.model.setProps({quickUpload:t.quickUpload})}},allowMultiple:{title:(0,en.tExpr)("Allow multiple"),uiMode:{type:"switch",key:"multiple"},hideInSettings:function(e){return!e.collectionField||!["belongsToMany","hasMany","belongsToArray"].includes(e.collectionField.type)},defaultParams:function(e){return{multiple:e.collectionField&&["belongsToMany","hasMany","belongsToArray"].includes(e.model.context.collectionField.type)}},handler:function(e,t){e.model.setProps({multiple:null==t?void 0:t.multiple,maxCount:(null==t?void 0:t.multiple)?null:1})}},showFileName:{title:(0,en.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}},allowSelectExistingRecord:{title:(0,en.tExpr)("Allow selection of existing file"),uiMode:{type:"switch",key:"allowSelectExistingRecord"},hideInSettings:function(e){return!e.collectionField.isAssociationField()||!e.collectionField.targetCollection},defaultParams:function(e){return{allowSelectExistingRecord:e.collectionField.targetCollection&&e.collectionField.isAssociationField()}},handler:function(e,t){e.model.setProps({allowSelectExistingRecord:t.allowSelectExistingRecord})}}}}),e0.registerFlow({key:"eventSettings",sort:300,steps:{bindEvent:{handler:function(e,t){e.model.customRequest=function(t){e.model.dispatchEvent("customRequest",{apiClient:e.app.apiClient,fileData:t})}}}}}),e0.registerFlow({key:"customRequestSettings",on:"customRequest",steps:{step1:{handler:function(e,t){return ez(function(){var t,n,r,o,i,l,a,c,u,s,p,f,d,m,y,b,g,h,v,x,w,O,S,j,P,E,C,F;return eQ(this,function(k){switch(k.label){case 0:if(n=(t=e.inputArgs.fileData).file,r=t.onSuccess,o=t.onError,i=t.onProgress,l=e.app.pm.get("@nocobase/plugin-file-manager"),a=e.model.props.target,c=e.collectionField,!l)return[2,r(n)];k.label=1;case 1:return k.trys.push([1,6,,7]),[4,e.api.resource("storages").check({fileCollectionName:a,storageName:c.options.storage})];case 2:if(!(null==(v=k.sent().data)||null==(u=v.data)?void 0:u.isSupportToUploadFiles))return w=e.t('The current storage "{{storageName}}" does not support file uploads.',{storageName:null==(x=v.data.storage)?void 0:x.title}).replaceAll(">",">"),null==o||o(Error(w)),[2];if(O=l.getStorageType(null==v||null==(p=v.data)||null==(s=p.storage)?void 0:s.type)||{},S=null==v||null==(f=v.data)?void 0:f.storage,!O.createUploadCustomRequest||"function"!=typeof(j=O.createUploadCustomRequest(eG(eV({},e.model.props),{api:e.api,action:"".concat(a,":create?attachmentField=").concat(c.collectionName,".").concat(c.name),storage:S}))))return[3,4];return[4,j({file:n,onProgress:i,onSuccess:r,onError:o})];case 3:return k.sent(),[2];case 4:return[4,l.uploadFile({file:n,fileCollectionName:a,storageId:null==v||null==(m=v.data)||null==(d=m.storage)?void 0:d.id,storageType:null==v||null==(b=v.data)||null==(y=b.storage)?void 0:y.type,storageRules:null==v||null==(h=v.data)||null==(g=h.storage)?void 0:g.rules,onProgress:function(e){null==i||i({percent:e})},query:{attachmentField:"".concat(c.collectionName,".").concat(c.name)}})];case 5:if(E=(P=k.sent()).data,C=P.errorMessage)return null==o||o(Error(C)),[2];if(!E)return null==o||o(Error("上传成功但响应数据为空")),[2];return r(E),[3,7];case 6:return F=k.sent(),null==o||o(F),[3,7];case 7:return[2]}})})()}}}}),e0.registerFlow({key:"selectExitRecordSettings",title:(0,en.tExpr)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,en.tExpr)("Edit popup"),hideInSettings:function(e){var t,n,r;return!1===(null==(n=(r=e.model).getStepParams)||null==(t=n.call(r,"uploadSettings","allowSelectExistingRecord"))?void 0:t.allowSelectExistingRecord)},uiSchema:function(e){return{mode:{type:"string",title:(0,en.tExpr)("Open mode"),enum:[{label:(0,en.tExpr)("Drawer"),value:"drawer"},{label:(0,en.tExpr)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,en.tExpr)("Popup size"),enum:[{label:(0,en.tExpr)("Small"),value:"small"},{label:(0,en.tExpr)("Medium"),value:"medium"},{label:(0,en.tExpr)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){var n,r,i,a,c,u=["belongsTo","hasOne"].includes(e.collectionField.type),s=e.isMobileLayout?"embed":e.inputArgs.mode||t.mode||"drawer",p=e.inputArgs.size||t.size||"medium",f=(null==(n=e.model.props)?void 0:n.sourceFieldModelUid)||e.model.uid,d=(null==(r=e.model.parent)?void 0:r.use)==="QuickEditFormModel"?null==(i=e.model.parent)?void 0:i.viewContainer:null;null==d||null==(a=d.update)||a.call(d,{preventClose:!0}),e.viewer.open({type:s,width:{drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}}[s][p],inheritContext:!1,target:e.layoutContentElement,onClose:function(){setTimeout(function(){var e;null==d||null==(e=d.update)||e.call(d,{preventClose:!1})},0)},inputArgs:{parentId:f,scene:"select",dataSourceKey:e.collection.dataSourceKey,collectionName:null==(c=e.collectionField)?void 0:c.target,collectionField:e.collectionField,rowSelectionProps:{type:u?"radio":"checkbox",defaultSelectedRows:function(){return e.model.props.value},renderCell:void 0,selectedRowKeys:void 0,onChange:function(t,n){if(u){var r,o;e.model.selectedRows.value=null==n?void 0:n[0],e.model.change(),null==(r=(o=e.model)._closeView)||r.call(o)}else{var i=eY(e.model.props.value||[]).concat(eY(n)).filter(function(t,n,r){return n===r.findIndex(function(n){return n[e.collection.filterTargetKey]===t[e.collection.filterTargetKey]})});e.model.selectedRows.value=i}}}},content:function(){return l().createElement(o.RecordPickerContent,{model:e.model})},styles:{content:eV({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===s?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}})}}}}),e0.define({label:(0,en.tExpr)("File picker")}),en.EditableItemModel.bindModelToInterface("UploadFieldModel",["attachment","m2m","m2o","o2o","o2m","oho","obo","updatedBy","createdBy","mbm"],{isDefault:!0,order:30,when:function(e,t){return!t.targetCollection||"file"===t.targetCollection.template}});let e1="bits",e2="bytes",e4="jedec",e3={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e8={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};var e5=d(484),e6=d.n(e5);function e7(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function e9(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t,n){return(te="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=tt(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function tt(e){return(tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){e9(e,t,n[t])})}return e}function tr(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function to(e,t){return(to=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ti(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return e7(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 e7(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tl=function(){return!!e})()}var ta=function(e){var t,n,r=(0,en.useFlowContext)(),l=(0,i.useMemo)(function(){var t="".concat(e.context.collection.name,":create");if(null==(o=r.view)||null==(n=o.inputArgs)?void 0:n.sourceId){var n,o,i,l=ti(e.context.blockModel.association.resourceName.split("."),2),a=l[0],c=l[1];t="".concat(a,"/").concat(null==(i=r.view)?void 0:i.inputArgs.sourceId,"/").concat(c,":create")}return t},[e.context.collection.name,null==(n=r.view)||null==(t=n.inputArgs)?void 0:t.sourceId]),a={},c=0,u={action:l,onChange:function(t){var n=t.fileList;n.forEach(function(t){if("uploading"!==t.status||a[t.uid]||(c++,a[t.uid]=!0),"uploading"!==t.status&&a[t.uid]&&(delete a[t.uid],0==--c)){var n,r;null==(n=(r=e.context.blockModel.resource).refresh)||n.call(r)}}),n.every(function(e){return"done"===e.status})&&r.view.close()}},s=function(e,t){var n,r,l,a,c,u,s,p,f,d,m,y,b,g,h,v=(l=(r=(0,en.useFlowContext)()).collectionField,a=null==(n=r.collectionField)?void 0:n.targetCollection,c=(0,o.usePlugin)(tF),u=t.context.blockModel.collection,p=null!=(s=(null==l?void 0:l.storage)||u.storage||a.storage)?s:"",f="storages:getBasicInfo/".concat(p),m=(d=(0,o.useRequest)({url:f},{manual:!0,refreshDeps:[p],cacheKey:f})).loading,y=d.data,b=d.run,(0,i.useEffect)(function(){b()},[b]),g=!m&&(null==y?void 0:y.data)||null,h=c.getStorageType(null==g?void 0:g.type),{storage:g,storageType:h}),x=v.storage,w=v.storageType,O=null==w?void 0:w.useUploadProps,S=(null==O?void 0:O(tn({storage:x,rules:x.rules},e)))||{};return tn({rules:null==x?void 0:x.rules},S)}(u,e);return tn({},u,s)},tc={size:function(e,t){var n=null!=t?t:0x1400000;return 0===n||e.size<=n?null:"File size exceeds the limit"},mimetype:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=t.toString().trim();return n&&"*"!==n?n.split(",").filter(Boolean).some(e6()(e.type))?null:"File type is not allowed":null}};function tu(e){var t,n,r,o,a,c,u,s=e.model,p=(0,en.useFlowContext)(),f=ta(s),d=f.rules,m=null!=d?d:{},y=m.size;m.mimetype;var b=(t=null!=y?y:0x1400000,r=(n=(0,R.useTranslation)()).t,o=function(e,{bits:t=!1,pad:n=!1,base:r=-1,round:o=2,locale:i="",localeOptions:l={},separator:a="",spacer:c=" ",symbols:u={},standard:s="",output:p="string",fullform:f=!1,fullforms:d=[],exponent:m=-1,roundingMethod:y="round",precision:b=0}={}){let g=m,h=Number(e),v=[],x=0,w="";"si"===s?(r=10,s=e4):"iec"===s||s===e4?r=2:2===r?s="iec":(r=10,s=e4);let O=10===r?1e3:1024,S=h<0,j=Math[y];if("bigint"!=typeof e&&isNaN(e))throw TypeError("Invalid number");if("function"!=typeof j)throw TypeError("Invalid rounding method");if(S&&(h=-h),(-1===g||isNaN(g))&&(g=Math.floor(Math.log(h)/Math.log(O)))<0&&(g=0),g>8&&(b>0&&(b+=8-g),g=8),"exponent"===p)return g;if(0===h)v[0]=0,w=v[1]=e3[s][t?e1:e2][g];else{x=h/(2===r?Math.pow(2,10*g):Math.pow(1e3,g)),t&&(x*=8)>=O&&g<8&&(x/=O,g++);let e=Math.pow(10,g>0?o:0);v[0]=j(x*e)/e,v[0]===O&&g<8&&-1===m&&(v[0]=1,g++),w=v[1]=10===r&&1===g?t?"kbit":"kB":e3[s][t?e1:e2][g]}if(S&&(v[0]=-v[0]),b>0&&(v[0]=v[0].toPrecision(b)),v[1]=u[v[1]]||v[1],!0===i?v[0]=v[0].toLocaleString():i.length>0?v[0]=v[0].toLocaleString(i,l):a.length>0&&(v[0]=v[0].toString().replace(".",a)),n&&o>0){let e=v[0].toString(),t=a||(e.match(/(\D)/g)||[]).pop()||".",n=e.toString().split(t),r=n[1]||"",i=r.length;v[0]=`${n[0]}${t}${r.padEnd(i+(o-i),"0")}`}return!0===f&&(v[1]=d[g]?d[g]:e8[s][g]+(t?"bit":"byte")+(1===v[0]?"":"s")),"array"===p?v:"object"===p?{value:v[0],symbol:v[1],exponent:g,unit:w}:v.join(c)}(t,{base:2,standard:"jedec",locale:n.i18n.language}),0!==t?r("File size should not exceed {{size}}.",{size:o}):""),g=ti((0,i.useState)(!1),2),h=g[0],v=g[1],x=(0,i.useCallback)(function(e){e.fileList.some(function(e){return"uploading"===e.status})?v(!0):v(!1)},[]),w=p.view.Header,O=(a=(0,R.useTranslation)().t,(0,i.useCallback)(function(e,t){var n=function(e,t){if(!t)return null;var n=Object.keys(t);if(!n.length)return null;var r=!0,o=!1,i=void 0;try{for(var l,a=n[Symbol.iterator]();!(r=(l=a.next()).done);r=!0){var c=l.value,u=tc[c](e,t[c]);if(u)return u}}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return null}(e,d);return n?(e.status="error",e.response=a(n)):"error"===e.status&&(delete e.status,delete e.response),!n&&Promise.resolve(e)},[d]));return l().createElement("div",null,l().createElement(w,{title:p.t("Upload file")}),l().createElement("div",{style:{height:"50vh"},onClick:function(e){return e.stopPropagation()}},l().createElement(j.Upload.Dragger,tn({multiple:!0,listType:"picture"},(c=tr(tn({},f),{handleChange:x,beforeUpload:O}),u=(0,en.useFlowContext)(),tn({customRequest:function(e){var t=e.action,n=e.data,r=e.file,o=e.filename,i=e.headers,l=e.onError,a=e.onProgress,c=e.onSuccess,s=e.withCredentials,p=new FormData;return n&&Object.keys(n).forEach(function(e){p.append(e,n[e])}),p.append(o,r),u.api.axios.post(t,p,{withCredentials:s,headers:i,onUploadProgress:function(e){var t=e.total;a({percent:Math.round(e.loaded/t*100).toFixed(2)},r)}}).then(function(e){c(e.data,r)}).catch(l).finally(function(){}),{abort:function(){console.log("upload progress is aborted.")}}}},c))),l().createElement("p",{className:"ant-upload-drag-icon"},h?l().createElement(k.LoadingOutlined,{style:{fontSize:36},spin:!0}):l().createElement(k.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},p.t("Click or drag file to this area to upload")),l().createElement("ul",{style:{listStyleType:"none"}},l().createElement("li",{className:"ant-upload-hint"},p.t("Support for a single or bulk upload.")),l().createElement("li",{className:"ant-upload-hint"},b)))))}var ts=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=tt(t),e9(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tl()?Reflect.construct(t,r||[],tt(this).constructor):t.apply(this,r)),"defaultProps",{type:"primary",title:(0,en.escapeT)("Upload"),icon:"UploadOutlined"}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&to(n,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"onInit",value:function(e){var t=this;te(tt(n.prototype),"onInit",this).call(this,e),this.onUploadClick=function(e){t.dispatchEvent("openView",{event:e})}}},{key:"onUploadClick",set:function(e){this.setProps({onUploadClick:e})}},{key:"render",value:function(){var e=this.props,t=e.icon?l().createElement(o.Icon,{type:e.icon}):void 0;return l().createElement(j.Button,tr(tn({},e),{onClick:this.props.onUploadClick,icon:t}),e.children||e.title)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.ActionModel);function tp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tf(e){return(tf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function td(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){tp(e,t,n[t])})}return e}function tm(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ty(e,t){return(ty=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tb=function(){return!!e})()}e9(ts,"scene",o.ActionSceneEnum.collection),ts.define({label:(0,en.escapeT)("Upload"),hide:function(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="file"}}),ts.registerFlow({key:"selectExitRecordSettings",title:(0,en.escapeT)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,en.escapeT)("Edit popup"),uiSchema:function(e){return{mode:{type:"string",title:(0,en.escapeT)("Open mode"),enum:[{label:(0,en.escapeT)("Drawer"),value:"drawer"},{label:(0,en.escapeT)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,en.escapeT)("Popup size"),enum:[{label:(0,en.escapeT)("Small"),value:"small"},{label:(0,en.escapeT)("Medium"),value:"medium"},{label:(0,en.escapeT)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(e,t){var n,r=e.inputArgs.mode||t.mode||"drawer",o=e.inputArgs.size||t.size||"medium";e.viewer.open({type:r,width:{drawer:{small:"30%",medium:"50%",large:"70%"},dialog:{small:"40%",medium:"50%",large:"80%"},embed:{}}[r][o],inheritContext:!1,target:e.layoutContentElement,inputArgs:{sourceId:null==(n=e.resource)?void 0:n.getSourceId()},content:function(){return l().createElement(tu,{model:e.model})},styles:{content:tn({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===r?{position:"absolute",top:0,left:0,right:0,bottom:0}:{})}})}}}});var tg=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return n=t,r=arguments,n=tf(n),tp(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tb()?Reflect.construct(n,r||[],tf(this).constructor):n.apply(this,r)),"name","file"),tp(e,"title",'{{t("File collection", { ns: "'.concat(D,'" })}}')),tp(e,"order",3),tp(e,"color","blue"),tp(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(D,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(D,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(D,'" })}}'),"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(D,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(D,'" })}}'),"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(D,'" })}}'),"x-component":"Preview","x-read-pretty":!0}},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:'{{t("Storage", { ns: "'.concat(D,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),tp(e,"presetFieldsDisabled",!0),tp(e,"events",{filterPrimaryKeyCandidate:function(e){return"input"!==e.name},initPrimaryKeyFiledInterface:function(e){e.autoFill&&(e.autoFill["x-disabled"]=!0),e.autoIncrement&&(e.autoIncrement["x-disabled"]=!0)}}),tp(e,"configurableProperties",td(tm(td(tm(td({},(0,o.getConfigurableProperties)("title","name")),{inherits:tm(td({},(0,o.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,o.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(D,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,o.getConfigurableProperties)("presetFields"))),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ty(t,e),t}(o.CollectionTemplate);function th(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function tv(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){th(i,r,o,l,a,"next",e)}function a(e){th(i,r,o,l,a,"throw",e)}l(void 0)})}}function tx(e,t,n){return(tx=tP()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tS(o,n.prototype),o}).apply(null,arguments)}function tw(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tO(e){return(tO=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tS(e,t){return(tS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tj(e){var t="function"==typeof Map?new Map:void 0;return(tj=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 tx(e,arguments,tO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),tS(n,e)})(e)}function tP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tP=function(){return!!e})()}function tE(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var tC=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=tO(t),tw(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tP()?Reflect.construct(t,r||[],tO(this).constructor):t.apply(this,r)),"storageTypes",new Map),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&tS(n,e),t=[{key:"load",value:function(){return tv(function(){var e,t;return tE(this,function(n){return e=this,this.app.dataSourceManager.addFieldInterfaces([et]),this.app.dataSourceManager.addCollectionTemplates([tg]),this.app.use(S),this.app.pluginSettingsManager.add(D,{title:'{{t("File manager", { ns: "'.concat(D,'" })}}'),icon:"FileOutlined",Component:H,aclSnippet:"pm.file-manager.storages"}),Object.values(q).forEach(function(t){e.registerStorageType(t.name,t)}),null==(t=this.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,o.useCollection)().template}}),this.app.addScopes({useAttachmentFieldProps:g,useFileCollectionStorageRules:v,useStorageCfg:c}),this.app.addComponents({FileSizeField:F}),this.flowEngine.registerModels({DisplayPreviewFieldModel:eI,UploadActionModel:ts,UploadFieldModel:e0}),[2]})}).call(this)}},{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){return tv(function(){var t,n,r,o,i,l,a,c,u,s,p,f,d,m;return tE(this,function(y){switch(y.label){case 0:if(!(null==e?void 0:e.file))return[2,{errorMessage:"Missing file"}];if(t=e.file,n=e.storageType,r=e.storageId,o=e.storageRules,l=void 0===(i=e.query)?{}:i,a=(null==e?void 0:e.fileCollectionName)||"attachments",!(null==(c=this.getStorageType(n))?void 0:c.upload))return[3,2];return[4,c.upload({file:t,apiClient:this.app.apiClient,storageType:n,storageId:r,storageRules:o,fileCollectionName:a,query:l})];case 1:return[2,y.sent()];case 2:return y.trys.push([2,4,,5]),(s=new FormData).append("file",t),f=(p=new URLSearchParams(l).toString())?"".concat(a,":create?").concat(p):"".concat(a,":create"),[4,this.app.apiClient.request({url:f,method:"post",data:s})];case 3:return[2,{data:null==(u=y.sent().data)?void 0:u.data}];case 4:return[2,{errorMessage:null!=(m=null==(d=y.sent())?void 0:d.message)?m:"Upload failed"}];case 5:return[2]}})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(tj(o.Plugin));tw(tC,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var tF=tC}(),h}()});
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { FieldModel } from '@nocobase/client';
|
|
11
|
+
export declare const CardUpload: (props: any) => React.JSX.Element;
|
|
12
|
+
export declare class UploadFieldModel extends FieldModel {
|
|
13
|
+
selectedRows: {
|
|
14
|
+
value: any[];
|
|
15
|
+
};
|
|
16
|
+
_closeView: any;
|
|
17
|
+
set customRequest(fn: any);
|
|
18
|
+
onInit(options: any): void;
|
|
19
|
+
set onSelectExitRecordClick(fn: any);
|
|
20
|
+
change(): void;
|
|
21
|
+
render(): React.JSX.Element;
|
|
22
|
+
}
|