@nocobase/plugin-file-manager 2.1.0-beta.29 → 2.1.0-beta.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/client-v2/125.01d5562df948d974.js +10 -0
- package/dist/client-v2/229.bd72c2d7aa088310.js +10 -0
- package/dist/client-v2/336.1dd1b32466d0c778.js +10 -0
- package/dist/client-v2/43.eb45d53ba3e9828b.js +10 -0
- package/dist/client-v2/450.24143827c94b9dca.js +10 -0
- package/dist/client-v2/501.37bff0473d880acd.js +10 -0
- package/dist/client-v2/885.b832814bff4497c8.js +10 -0
- package/dist/client-v2/929.d7e783304cc1f236.js +10 -0
- package/dist/client-v2/942.c10c97317af6dd02.js +10 -0
- package/dist/client-v2/{storageTypes/index.d.ts → components/BaseUrlField.d.ts} +2 -2
- package/dist/client-v2/components/DefaultField.d.ts +18 -0
- package/dist/client-v2/components/FileSizeField.d.ts +10 -0
- package/dist/client-v2/components/MimetypeField.d.ts +10 -0
- package/dist/client-v2/components/NameField.d.ts +10 -0
- package/dist/client-v2/components/ParanoidField.d.ts +10 -0
- package/dist/client-v2/components/PathField.d.ts +18 -0
- package/dist/client-v2/components/RenameModeField.d.ts +10 -0
- package/dist/client-v2/components/TitleField.d.ts +10 -0
- package/dist/client-v2/components/index.d.ts +17 -0
- package/dist/client-v2/index.d.ts +4 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/plugin.d.ts +47 -6
- package/dist/client-v2/storage-forms/AliOssStorageForm.d.ts +10 -0
- package/dist/client-v2/storage-forms/LocalStorageForm.d.ts +10 -0
- package/dist/client-v2/storage-forms/S3StorageForm.d.ts +10 -0
- package/dist/client-v2/storage-forms/TxCosStorageForm.d.ts +10 -0
- package/dist/externalVersion.js +9 -10
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -1
- 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/shared/previewer/filePreviewTypes.d.ts +1 -0
- package/dist/shared/previewer/filePreviewTypes.js +21 -0
- package/package.json +2 -2
- package/dist/client-v2/855.e7d2e24a0b457a89.js +0 -10
- package/dist/client-v2/storageTypes/types.d.ts +0 -26
package/dist/client-v2/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("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@nocobase/plugin-environment-variables/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["ahooks","react-i18next","@emotion/css","@nocobase/client-v2","@nocobase/plugin-environment-variables/client-v2","react","antd","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("@nocobase/plugin-environment-variables/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-file-manager"]=t(e.ahooks,e["react-i18next"],e["@emotion/css"],e["@nocobase/client-v2"],e["@nocobase/plugin-environment-variables/client-v2"],e.react,e.antd,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,l,a,u,c,s){return function(){var p,f,d,m={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}},907:function(e,t,n){"use strict";n.d(t,{N:function(){return c}});var r,o=n(624);function i(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){i(e,t,n[t])})}return e}function a(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}var u={title:{name:"title",label:"Title",component:"input",required:!0},name:{name:"name",label:"Storage name",component:"input",required:!0,description:"Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter."},baseUrl:{name:"baseUrl",label:"Base URL",component:"variableInput",required:!0,description:'Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".'},path:{name:"path",label:"Path",component:"variableInput",description:'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".'},renameMode:{name:"renameMode",label:"Renaming",component:"radio",defaultValue:"appendRandomID",description:"Renaming strategy to avoid filename conflicts when uploading files."},rulesSize:{name:["rules","size"],label:"File size limit",component:"number",required:!0,defaultValue:o.ZH,description:"Minimum from 1 byte."},rulesMimetype:{name:["rules","mimetype"],label:"File type allowed (in MIME type format)",component:"input",placeholder:"*",description:'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.'},default:{name:"default",label:"Default storage",component:"checkbox"},paranoid:{name:"paranoid",label:"Keep file in storage when destroy the file record",component:"checkbox",description:"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."}},c=(i(r={},o.ZF,{name:o.ZF,title:"Local storage",fields:[u.title,u.name,a(l({},u.baseUrl),{hidden:!0,defaultValue:"/storage/uploads"}),{name:["options","documentRoot"],label:"Destination",component:"input",hidden:!0,defaultValue:"storage/uploads"},a(l({},u.path),{addonBefore:"storage/uploads/"}),u.renameMode,u.rulesSize,u.rulesMimetype,u.default,u.paranoid]}),i(r,o.y2,{name:o.y2,title:"Aliyun OSS",thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",fields:[u.title,u.name,u.baseUrl,{name:["options","region"],label:"Region",component:"variableInput",required:!0,description:'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".'},{name:["options","accessKeyId"],label:"AccessKey ID",component:"variableInput",required:!0},{name:["options","accessKeySecret"],label:"AccessKey Secret",component:"passwordVariableInput",required:!0},{name:["options","bucket"],label:"Bucket",component:"variableInput",required:!0},{name:["options","timeout"],label:"Timeout",component:"number",defaultValue:6e5,description:"Upload timeout for a single file in milliseconds. Default is 600000."},{name:["options","thumbnailRule"],label:"File pre-process parameters",component:"variableInput",placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},u.path,u.renameMode,u.rulesSize,u.rulesMimetype,u.default,u.paranoid,{name:["settings","requestOptions"],label:"Request options",component:"json",defaultValue:{},description:"Additional options for HTTP requests when fetching files from remote storage on server side, such as headers."}]}),i(r,o.e7,{name:o.e7,title:"Amazon S3",fields:[u.title,u.name,u.baseUrl,{name:["options","region"],label:"Region",component:"variableInput",required:!0},{name:["options","accessKeyId"],label:"AccessKey ID",component:"variableInput",required:!0},{name:["options","secretAccessKey"],label:"AccessKey Secret",component:"passwordVariableInput",required:!0},{name:["options","bucket"],label:"Bucket",component:"variableInput",required:!0},{name:["options","endpoint"],label:"Endpoint",component:"variableInput"},u.path,u.renameMode,u.rulesSize,u.rulesMimetype,u.default,u.paranoid]}),i(r,o.a_,{name:o.a_,title:"Tencent COS",thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214",fields:[u.title,u.name,u.baseUrl,{name:["options","Region"],label:"Region",component:"variableInput",required:!0},{name:["options","SecretId"],label:"SecretId",component:"variableInput",required:!0},{name:["options","SecretKey"],label:"SecretKey",component:"passwordVariableInput",required:!0},{name:["options","Bucket"],label:"Bucket",component:"variableInput",required:!0},{name:["options","thumbnailRule"],label:"Thumbnail rule",component:"variableInput",placeholder:"?imageMogr2/thumbnail/!50p"},u.path,u.renameMode,u.rulesSize,u.rulesMimetype,u.default,u.paranoid]}),r)},624:function(e,t,n){"use strict";n.d(t,{Qj:function(){return o},UW:function(){return r},ZF:function(){return l},ZH:function(){return i},a_:function(){return c},e7:function(){return u},y2:function(){return a}});var r=1,o=1/0,i=0x1400000,l="local",a="ali-oss",u="s3",c="tx-cos"},301:function(e,t,n){"use strict";n.d(t,{C:function(){return r}});var r="file-manager"},375:function(e){"use strict";e.exports=u},477:function(e){"use strict";e.exports=n},230:function(e){"use strict";e.exports=a},485:function(e){"use strict";e.exports=r},694:function(e){"use strict";e.exports=c},191:function(e){"use strict";e.exports=o},625:function(t){"use strict";t.exports=e},59:function(e){"use strict";e.exports=l},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=i},953:function(e){"use strict";e.exports=t}},b={};function y(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.m=m,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+".e7d2e24a0b457a89.js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},y.l=function(e,t,n,r){if(g[e])return void g[e].push(t);if(void 0!==n)for(var o,i,l=document.getElementsByTagName("script"),a=0;a<l.length;a++){var u=l[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-file-manager:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-file-manager:"+n),o.src=e),g[e]=[t];var c=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(v=y.g.location+"");var g,v,h=y.g.document;if(!v&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(v=h.currentScript.src),!v)){var w=h.getElementsByTagName("script");if(w.length)for(var O=w.length-1;O>-1&&(!v||!/^http(s?):/.test(v));)v=w[O--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");y.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),p={889:0},y.f.j=function(e,t){var n=y.o(p,e)?p[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=p[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(p,e)&&(0!==(n=p[e])&&(p[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},f=function(e,t){var n,r,o=t[0],i=t[1],l=t[2],a=0;if(o.some(function(e){return 0!==p[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);l&&l(y)}for(e&&e(t);a<o.length;a++)r=o[a],y.o(p,r)&&p[r]&&p[r][0](),p[r]=0},(d=self.webpackChunk_nocobase_plugin_file_manager=self.webpackChunk_nocobase_plugin_file_manager||[]).forEach(f.bind(null,0)),d.push=f.bind(null,d.push.bind(d));var x={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-manager/dist/client-v2/"}y.p=e}(),!function(){"use strict";y.r(x),y.d(x,{PluginFileManagerClientV2:function(){return eH},default:function(){return eH}});var e=y(485),t=y(624),n="file-manager",r=y(477),o=y(694),i=y(59),l=y(773),a=y(155),u=y.n(a),c=y(953),s=y(375),p=y(484),f=y.n(p),d=y(301);function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=new(function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");m(this,"types",[])}return e=[{key:"add",value:function(e){this.types.unshift(e)}},{key:"getTypeByFile",value:function(e){var t=g(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 g(e){return e&&"string"==typeof e?{url:e}:e}function v(e){return e?"string"==typeof e?e:e.preview||e.url||"":""}function h(e){return e?"string"==typeof e?e:e.url||e.preview||"":""}var w={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"},O=function(e){return e.split("?")[0].split("#")[0]},S=function(e){if(!e)return"";var t=O(e),n=t.lastIndexOf(".");return -1!==n?t.slice(n+1).toLowerCase():""},j={aac:"audio/aac",avi:"video/x-msvideo",bmp:"image/bmp",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",flv:"video/x-flv",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",odt:"application/vnd.oasis.opendocument.text",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",txt:"text/plain",wav:"audio/wav",webp:"image/webp",wmv:"video/x-ms-wmv",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};function E(e,t){return!!e&&(e.originFileObj?f()(e.type,t):e.mimetype?f()(e.mimetype,t):!!e.url&&f()(j[S(e.url)]||"",t))}var P=function(e){if(!e)return"";var t=O(e),n=t.lastIndexOf("/");return -1!==n?t.slice(n+1):t},k=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=S(e.name||e.filename||e.title);if(n)return n}return S(t)},C=function(e,t){var n=P(t);return e&&"string"!=typeof e&&(e.name||e.filename||e.title)||n},I=function(e,t){var n=t||h(e),r=C(e,n),o=k(e,n);return r&&o&&!r.toLowerCase().endsWith(".".concat(o))&&(r="".concat(r,".").concat(o)),"".concat(Date.now(),"_").concat(r||"file")},R=function(e,t){return w[k(e,t)]||w.default},T=function(e){var t,n=g(e),r=v(n),o=(null!=(t=b.getTypeByFile(n))?t:{}).getThumbnailURL,i=null==o?void 0:o(n);return i||(E(n,"image/*")?"":R(n,r))},F=function(e){var t=e.index,n=e.list,r=e.onSwitchIndex,o=e.onDownload,l=e.file,a="number"==typeof t&&!!r&&t>0,c="number"==typeof t&&!!r&&t<n.length-1;return u().createElement(i.Space,{size:14,style:{fontSize:"20px"}},u().createElement(s.LeftOutlined,{style:{cursor:a?"pointer":"not-allowed"},disabled:!a,onClick:function(){return a&&(null==r?void 0:r(t-1))}}),u().createElement(s.RightOutlined,{style:{cursor:c?"pointer":"not-allowed"},disabled:!c,onClick:function(){return c&&(null==r?void 0:r(t+1))}}),u().createElement(s.DownloadOutlined,{onClick:function(){return o(l)}}))},M=function(e){return function(t){var n=t.open,r=t.onOpenChange,o=t.onClose,l=t.file;if("boolean"!=typeof n)return u().createElement(e,t);var a=C(l,h(l));return u().createElement(i.Modal,{open:n,title:a,onCancel:function(){null==r||r(!1),null==o||o()},footer:F(t),width:"90vw",centered:!0},u().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"}},u().createElement(e,t)))}};b.add({match:function(){return!0},Previewer:M(function(e){(0,c.useTranslation)().t;var t=e.file;return u().createElement(i.Alert,{type:"warning",description:u().createElement(c.Trans,{ns:d.C},"File type is not supported for previewing, please ",e.onDownload?u().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"):u().createElement("span",null,"download it to preview")),showIcon:!0})})}),b.add({match:function(e){return E(e,"image/*")},getThumbnailURL:function(e){return v(e)},Previewer:function(e){var t=e.file,n=e.list,r=e.index,o=e.open,l=e.onOpenChange,a=e.onSwitchIndex,c=e.onClose,p=e.onDownload;if("boolean"!=typeof o)return null;var f=h(t);if(!f)return null;var d="number"==typeof r&&r>0,m="number"==typeof r&&r<n.length-1;return u().createElement(i.Image,{wrapperStyle:{display:"none"},preview:{visible:o,onVisibleChange:function(e){return null==l?void 0:l(e)},afterOpenChange:function(e){e||null==c||c()},toolbarRender:function(e,n){var o=n.transform.scale,l=n.actions,c=l.onFlipY,f=l.onFlipX,b=l.onRotateLeft,y=l.onRotateRight,g=l.onZoomOut,v=l.onZoomIn,h=l.onReset;return u().createElement(i.Space,{size:14,className:"toolbar-wrapper",style:{fontSize:"20px"}},u().createElement(s.LeftOutlined,{style:{cursor:d?"pointer":"not-allowed"},disabled:!d,onClick:function(){return d&&(null==a?void 0:a(r-1))}}),u().createElement(s.RightOutlined,{style:{cursor:m?"pointer":"not-allowed"},disabled:!m,onClick:function(){return m&&(null==a?void 0:a(r+1))}}),p?u().createElement(s.DownloadOutlined,{onClick:function(){return p(t)}}):null,u().createElement(s.SwapOutlined,{rotate:90,onClick:c}),u().createElement(s.SwapOutlined,{onClick:f}),u().createElement(s.RotateLeftOutlined,{onClick:b}),u().createElement(s.RotateRightOutlined,{onClick:y}),u().createElement(s.ZoomOutOutlined,{disabled:1===o,onClick:g}),u().createElement(s.ZoomInOutlined,{disabled:50===o,onClick:v}),u().createElement(s.UndoOutlined,{onClick:h}))}},src:f})}}),b.add({match:function(e){return["text/plain","application/pdf","application/json"].some(function(t){return E(e,t)})},Previewer:M(function(e){var t=h(e.file);return t?u().createElement("iframe",{src:t,width:"100%",height:"100%",style:{border:"none"}}):null})}),b.add({match:function(e){return E(e,"audio/*")},Previewer:M(function(e){var t=e.file,n=(0,c.useTranslation)().t,r=h(t);return r?u().createElement("audio",{controls:!0},u().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})}),b.add({match:function(e){return E(e,"video/*")},Previewer:M(function(e){var t=e.file,n=(0,c.useTranslation)().t,r=h(t);return r?u().createElement("video",{controls:!0,width:"100%",height:"100%"},u().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 A=function(e){var t,n,r,o=g(e.file);if(!o)return null;var i=(null!=(r=b.getTypeByFile(o))?r:{}).Previewer;return i?u().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){m(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 _(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 q(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function z(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){D(e,t,n[t])})}return e}function N(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 L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(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 _(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 _(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 V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(V=function(){return!!e})()}function $(){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 $=function(){return n},n}var Z=function(e){var t=e.file,n=e.size,o=e.showFileName,l=e.onClick,a=g(t),c=v(a);if(!c)return null;var s=C(a,c),p=R(a,c),f=T(a)||p,d=u().createElement("div",{className:(0,r.css)($())},u().createElement(i.Image,{src:f,fallback:p,width:n,height:n,preview:!1,style:{borderRadius:4,objectFit:"cover",boxShadow:"0 0 0 2px #fff"}}));return u().createElement("div",{onClick:l,style:{textAlign:"center",width:n,wordBreak:"break-all",cursor:l?"pointer":"default"}},d,o&&u().createElement(i.Tooltip,{title:s},u().createElement("div",{style:{fontSize:12,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},s)))},G=function(e){var t=e.value,n=void 0===t?[]:t,r=e.size,o=void 0===r?28:r,a=e.showFileName,s=(0,c.useTranslation)().t,p=K(u().useState(0),2),f=p[0],d=p[1],m=K(u().useState(!1),2),b=m[0],y=m[1],h=u().useMemo(function(){return(0,l.castArray)(n).filter(Boolean).map(g).filter(function(e){return v(e)})},[n]);u().useEffect(function(){f>=h.length&&h.length&&d(0)},[f,h.length]),u().useEffect(function(){!h.length&&b&&y(!1)},[h.length,b]);var w=u().useCallback(function(e){var t;return(t=function(){var t,n,r,o,l,a,u;return function(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:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}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}}}}(this,function(c){switch(c.label){case 0:if(!(t=e||h[f])||!(n=t.url||t.preview))return[2];r=I(t,n),c.label=1;case 1:return c.trys.push([1,4,5,6]),[4,fetch(n)];case 2:if(!(a=c.sent()).ok)throw Error("Download failed with status ".concat(a.status));return[4,a.blob()];case 3:return u=c.sent(),o=URL.createObjectURL(u),(l=document.createElement("a")).href=o,l.download=r,document.body.appendChild(l),l.click(),[3,6];case 4:return console.error("File download failed:",c.sent()),i.message.error(s("file-manager:File download failed")),[3,6];case 5:return l&&l.remove(),o&&setTimeout(function(){URL.revokeObjectURL(o)},1e3),[7];case 6:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function l(e){q(i,r,o,l,a,"next",e)}function a(e){q(i,r,o,l,a,"throw",e)}l(void 0)})})()},[f,h,s]),O=u().useCallback(function(e){d(e),y(!0)},[]),x=u().useCallback(function(e){e<0||e>=h.length||d(e)},[h.length]);return u().createElement(u().Fragment,null,u().createElement(i.Space,{wrap:!0},h.map(function(e,t){return u().createElement(Z,{file:e,size:o,key:t,showFileName:a,onClick:function(){return O(t)}})})),h[f]?u().createElement(A,{open:b,file:h[f],index:f,list:h,onOpenChange:y,onClose:function(){return y(!1)},onSwitchIndex:x,onDownload:w}):null)},Y=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=U(t),D(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,V()?Reflect.construct(t,r||[],U(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&&L(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,l.castArray)(n).flatMap(function(t,n){var o=null==t?void 0:t[r],i=o?u().createElement(G,N(z({key:n},e.props),{value:(0,l.castArray)(o).filter(Boolean)})):u().createElement("span",{key:n},"N/A");return 0===n?[i]:[u().createElement("span",{key:"sep-".concat(n)},", "),i]}):u().createElement(G,N(z({},this.props),{value:(0,l.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}(e.FieldModel);Y.registerFlow({key:"previewReadPrettySetting",sort:500,title:(0,o.tExpr)("Preview Settings"),steps:{size:{title:(0,o.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(t){return B(t.model.parent,e.TableColumnModel)},defaultParams:function(t){return{size:B(t.model.parent,e.DetailsItemModel)?100:28}},handler:function(e,t){e.model.setProps("size",t.size)}},showFileName:{title:(0,o.tExpr)("Show file name"),uiMode:{type:"switch",key:"showFileName"},hideInSettings:function(t){return B(t.model.parent,e.TableColumnModel)},defaultParams:{showFileName:!1},handler:function(e,t){e.model.setProps("showFileName",t.showFileName)}}}}),Y.define({label:(0,o.tExpr)("Preview")}),o.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 H=y(625);let W="bits",Q="bytes",X="jedec",J={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"]}},ee={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function et(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 en(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}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}function eo(e,t,n){return(eo="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=ei(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 ei(e){return(ei=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function el(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}function ea(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 eu(e,t){return(eu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(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 et(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 et(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 es(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(es=function(){return!!e})()}var ep=function(e){var t,n,r=(0,o.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,l=ec(e.context.blockModel.association.resourceName.split("."),2),a=l[0],u=l[1];t="".concat(a,"/").concat(null==(i=r.view)?void 0:i.inputArgs.sourceId,"/").concat(u,":create")}return t},[e.context.collection.name,null==(n=r.view)||null==(t=n.inputArgs)?void 0:t.sourceId]),l={},u=0,c={action:i,onChange:function(t){var n=t.fileList;n.forEach(function(t){if("uploading"!==t.status||l[t.uid]||(u++,l[t.uid]=!0),"uploading"!==t.status&&l[t.uid]&&(delete l[t.uid],0==--u)){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,u,c,s,p,f,d,m,b,y,g,v,h,w=(i=(r=(0,o.useFlowContext)()).collectionField,l=null==(n=r.collectionField)?void 0:n.targetCollection,u=r.app.pm.get("@nocobase/plugin-file-manager"),c=t.context.blockModel.collection,p=null!=(s=(null==i?void 0:i.storage)||c.storage||l.storage)?s:"",f="storages:getBasicInfo/".concat(p),d=(0,o.useFlowContext)(),b=(m=(0,H.useRequest)(function(){var e;return(e=function(){var e;return function(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:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}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}}}}(this,function(t){switch(t.label){case 0:return[4,d.api.request({url:f,skipNotify:!0})];case 1:return[2,null==(e=t.sent())?void 0:e.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){en(i,r,o,l,a,"next",e)}function a(e){en(i,r,o,l,a,"throw",e)}l(void 0)})})()},{manual:!0,refreshDeps:[p],cacheKey:f})).loading,y=m.data,g=m.run,(0,a.useEffect)(function(){g()},[g]),v=!b&&(null==y?void 0:y.data)||null,h=u.getStorageType(null==v?void 0:v.type),{storage:v,storageType:h}),O=w.storage,x=w.storageType,S=null==x?void 0:x.useUploadProps,j=(null==S?void 0:S(el({storage:O,rules:O.rules},e)))||{};return el({rules:null==O?void 0:O.rules},j)}(c,e);return el({},c,s)},ef={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(f()(e.type))?null:"File type is not allowed":null}};function ed(e){var t,n,r,l,p,f,d,m=e.model,b=(0,o.useFlowContext)(),y=ep(m),g=y.rules,v=null!=g?g:{},h=v.size;v.mimetype;var w=(t=null!=h?h:0x1400000,r=(n=(0,c.useTranslation)()).t,l=function(e,{bits:t=!1,pad:n=!1,base:r=-1,round:o=2,locale:i="",localeOptions:l={},separator:a="",spacer:u=" ",symbols:c={},standard:s="",output:p="string",fullform:f=!1,fullforms:d=[],exponent:m=-1,roundingMethod:b="round",precision:y=0}={}){let g=m,v=Number(e),h=[],w=0,O="";"si"===s?(r=10,s=X):"iec"===s||s===X?r=2:2===r?s="iec":(r=10,s=X);let x=10===r?1e3:1024,S=v<0,j=Math[b];if("bigint"!=typeof e&&isNaN(e))throw TypeError("Invalid number");if("function"!=typeof j)throw TypeError("Invalid rounding method");if(S&&(v=-v),(-1===g||isNaN(g))&&(g=Math.floor(Math.log(v)/Math.log(x)))<0&&(g=0),g>8&&(y>0&&(y+=8-g),g=8),"exponent"===p)return g;if(0===v)h[0]=0,O=h[1]=J[s][t?W:Q][g];else{w=v/(2===r?Math.pow(2,10*g):Math.pow(1e3,g)),t&&(w*=8)>=x&&g<8&&(w/=x,g++);let e=Math.pow(10,g>0?o:0);h[0]=j(w*e)/e,h[0]===x&&g<8&&-1===m&&(h[0]=1,g++),O=h[1]=10===r&&1===g?t?"kbit":"kB":J[s][t?W:Q][g]}if(S&&(h[0]=-h[0]),y>0&&(h[0]=h[0].toPrecision(y)),h[1]=c[h[1]]||h[1],!0===i?h[0]=h[0].toLocaleString():i.length>0?h[0]=h[0].toLocaleString(i,l):a.length>0&&(h[0]=h[0].toString().replace(".",a)),n&&o>0){let e=h[0].toString(),t=a||(e.match(/(\D)/g)||[]).pop()||".",n=e.toString().split(t),r=n[1]||"",i=r.length;h[0]=`${n[0]}${t}${r.padEnd(i+(o-i),"0")}`}return!0===f&&(h[1]=d[g]?d[g]:ee[s][g]+(t?"bit":"byte")+(1===h[0]?"":"s")),"array"===p?h:"object"===p?{value:h[0],symbol:h[1],exponent:g,unit:O}:h.join(u)}(t,{base:2,standard:"jedec",locale:n.i18n.language}),0!==t?r("File size should not exceed {{size}}.",{size:l}):""),O=ec((0,a.useState)(!1),2),x=O[0],S=O[1],j=(0,a.useCallback)(function(e){e.fileList.some(function(e){return"uploading"===e.status})?S(!0):S(!1)},[]),E=b.view.Header,P=(p=(0,c.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 l,a=n[Symbol.iterator]();!(r=(l=a.next()).done);r=!0){var u=l.value,c=ef[u](e,t[u]);if(c)return c}}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return null}(e,g);return n?(e.status="error",e.response=p(n)):"error"===e.status&&(delete e.status,delete e.response),!n&&Promise.resolve(e)},[g]));return u().createElement("div",null,u().createElement(E,{title:b.t("Upload file")}),u().createElement("div",{style:{height:"50vh"},onClick:function(e){return e.stopPropagation()}},u().createElement(i.Upload.Dragger,el({multiple:!0,listType:"picture"},(f=ea(el({},y),{handleChange:j,beforeUpload:P}),d=(0,o.useFlowContext)(),el({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,u=e.onSuccess,c=e.withCredentials,s=new FormData;return n&&Object.keys(n).forEach(function(e){s.append(e,n[e])}),s.append(o,r),d.api.axios.post(t,s,{withCredentials:c,headers:i,onUploadProgress:function(e){var t=e.total;a({percent:Math.round(e.loaded/t*100).toFixed(2)},r)}}).then(function(e){u(e.data,r)}).catch(l).finally(function(){}),{abort:function(){console.log("upload progress is aborted.")}}}},f))),u().createElement("p",{className:"ant-upload-drag-icon"},x?u().createElement(s.LoadingOutlined,{style:{fontSize:36},spin:!0}):u().createElement(s.InboxOutlined,null)),u().createElement("p",{className:"ant-upload-text"},b.t("Click or drag file to this area to upload")),u().createElement("ul",{style:{listStyleType:"none"}},u().createElement("li",{className:"ant-upload-hint"},b.t("Support for a single or bulk upload.")),u().createElement("li",{className:"ant-upload-hint"},w)))))}var em=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=ei(t),er(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,es()?Reflect.construct(t,n||[],ei(this).constructor):t.apply(this,n)),"defaultProps",{type:"primary",title:(0,o.escapeT)("Upload"),icon:"UploadOutlined"}),e}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&eu(r,t),n=[{key:"getAclActionName",value:function(){return"create"}},{key:"onInit",value:function(e){var t=this;eo(ei(r.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 t=this.props,n=t.icon?u().createElement(e.Icon,{type:t.icon}):void 0;return u().createElement(i.Button,ea(el({},t),{onClick:this.props.onUploadClick,icon:n}),t.children||t.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)}}(r.prototype,n),r}(e.ActionModel);er(em,"scene",e.ActionSceneEnum.collection),em.define({label:(0,o.escapeT)("Upload"),hide:function(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="file"}}),em.registerFlow({key:"selectExitRecordSettings",title:(0,o.escapeT)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,o.escapeT)("Edit popup"),uiSchema:function(e){return{mode:{type:"string",title:(0,o.escapeT)("Open mode"),enum:[{label:(0,o.escapeT)("Drawer"),value:"drawer"},{label:(0,o.escapeT)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,o.escapeT)("Popup size"),enum:[{label:(0,o.escapeT)("Small"),value:"small"},{label:(0,o.escapeT)("Medium"),value:"medium"},{label:(0,o.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 u().createElement(ed,{model:e.model})},styles:{content:el({padding:0,backgroundColor:e.model.flowEngine.context.themeToken.colorBgLayout},"embed"===r?{position:"absolute",top:0,left:0,right:0,bottom:0}:{})}})}}}});var eb=y(230);function ey(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 eg=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,u=null!=(r=null==e?void 0:e.url)?r:null==l?void 0:l.url,c=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!=u?"url:".concat(u):null!=c?"filename:".concat(c,":").concat(t):null!=s?"name:".concat(s,":").concat(t):(null==e?void 0:e.uid)?"uid:".concat(e.uid):"index:".concat(t)},ev=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Map(t.map(function(e,t){return[eg(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 ey(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 ey(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=eg(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:T(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})},eh=function(e,t){var n=e.findIndex(function(e){return e.uid===(null==t?void 0:t.uid)});return n>=0?n:0};function ew(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 eO(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function ex(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){eO(i,r,o,l,a,"next",e)}function a(e){eO(i,r,o,l,a,"throw",e)}l(void 0)})}}function eS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ej(e,t,n){return(ej="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=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 eP(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){eS(e,t,n[t])})}return e}function ek(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 eC(e,t){return(eC=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eI(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)||eT(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eR(e){return function(e){if(Array.isArray(e))return ew(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eT(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eT(e,t){if(e){if("string"==typeof e)return ew(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 ew(e,t)}}function eF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eF=function(){return!!e})()}function eM(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:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}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}}}}function eA(){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 eA=function(){return n},n}var e_=function(e){var t,n=e.allowSelectExistingRecord,o=e.multiple,p=e.value,f=e.disabled,d=e.onSelectExitRecordClick,m=e.quickUpload,b=e.showFileName,y=eI((0,a.useState)(function(){return ev((0,l.castArray)(p||[]))}),2),g=y[0],v=y[1],h=eI((0,a.useState)(!1),2),w=h[0],O=h[1],x=eI((0,a.useState)(null),2),S=x[0],j=x[1],E=eI((0,a.useState)(0),2),P=E[0],k=E[1],C=(0,c.useTranslation)().t;(0,a.useLayoutEffect)(function(){v(function(e){return ev((0,l.castArray)(p||[]),e)})},[p]);var R=(t=g.length,!!o||0===t);return u().createElement(eb.FieldContext.Provider,{value:{value:g}},u().createElement("div",{style:{display:"flex"},className:(0,r.css)(eA(),b?"8px 0px":"0px",b?"8px 0px":"0px",o?"":"\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 ")},u().createElement(i.Upload,ek(eP({onPreview:function(e){return ex(function(){var t;return eM(this,function(n){switch(n.label){case 0:var r;if(t=eh(g,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 j(e),k(t),O(!0),[2]}})})()}},e),{listType:"picture-card",fileList:g,onChange:function(t){var n=t.fileList;v(function(e){return ev(n,e)});var r=n.filter(function(e){return"done"===e.status||e.id});if(n.every(function(e){return"done"===e.status||e.id}))if(1===e.maxCount){var o=r[0];e.onChange(o?o.response:null)}else e.onChange(r.map(function(e){return e.response||e}).filter(Boolean))},itemRender:function(e,t){return u().createElement(u().Fragment,null,e,b&&u().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:t.filename},t.filename))}}),(void 0===m||m)&&R?u().createElement(s.UploadOutlined,{style:{fontSize:20}}):null),S&&u().createElement(A,{open:w,file:S,list:g,index:P,onOpenChange:O,onClose:function(){return j(null)},onSwitchIndex:function(e){e<0||e>=g.length||(k(e),j(g[e]))},onDownload:function(e){var t=e||S;if(t){var n=t.url||t.preview;if(n){var r=I(t,n);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=r,document.body.appendChild(n),n.click(),URL.revokeObjectURL(t),n.remove()})}}}}),n&&R?u().createElement("div",{style:{marginLeft:5}},u().createElement(i.Upload,{disabled:f,multiple:o,listType:"picture-card",showUploadList:!1},u().createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},onClick:function(e){f||(e.stopPropagation(),e.preventDefault(),d())}},u().createElement(s.PlusOutlined,null),C("Select")))):null))},eq=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),eS(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,eF()?Reflect.construct(t,r||[],eE(this).constructor):t.apply(this,r)),"selectedRows",o.observable.ref([])),eS(e,"_closeView",void 0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&eC(n,e),t=[{key:"customRequest",set:function(e){this.setProps({customRequest:e})}},{key:"onInit",value:function(e){var t=this;ej(eE(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 u().createElement(e_,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}(e.FieldModel);(eq=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,o.largeField)()],eq)).registerFlow({key:"uploadSettings",title:(0,o.tExpr)("Upload file settings"),steps:{quickUpload:{title:(0,o.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,o.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,o.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,o.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})}}}}),eq.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})}}}}}),eq.registerFlow({key:"customRequestSettings",on:"customRequest",steps:{step1:{handler:function(e,t){return ex(function(){var t,n,r,o,i,l,a,u,c,s,p,f,d,m,b,y,g,v,h,w,O,x,S,j,E,P,k,C;return eM(this,function(I){switch(I.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,u=e.collectionField,!l)return[2,r(n)];I.label=1;case 1:return I.trys.push([1,6,,7]),[4,e.api.resource("storages").check({fileCollectionName:a,storageName:u.options.storage})];case 2:if(!(null==(h=I.sent().data)||null==(c=h.data)?void 0:c.isSupportToUploadFiles))return O=e.t('The current storage "{{storageName}}" does not support file uploads.',{storageName:null==(w=h.data.storage)?void 0:w.title}).replaceAll(">",">"),null==o||o(Error(O)),[2];if(x=l.getStorageType(null==h||null==(p=h.data)||null==(s=p.storage)?void 0:s.type)||{},S=null==h||null==(f=h.data)?void 0:f.storage,!x.createUploadCustomRequest||"function"!=typeof(j=x.createUploadCustomRequest(ek(eP({},e.model.props),{api:e.api,action:"".concat(a,":create?attachmentField=").concat(u.collectionName,".").concat(u.name),storage:S}))))return[3,4];return[4,j({file:n,onProgress:i,onSuccess:r,onError:o})];case 3:return I.sent(),[2];case 4:return[4,l.uploadFile({file:n,fileCollectionName:a,storageId:null==h||null==(m=h.data)||null==(d=m.storage)?void 0:d.id,storageType:null==h||null==(y=h.data)||null==(b=y.storage)?void 0:b.type,storageRules:null==h||null==(v=h.data)||null==(g=v.storage)?void 0:g.rules,onProgress:function(e){null==i||i({percent:e})},query:{attachmentField:"".concat(u.collectionName,".").concat(u.name)}})];case 5:if(P=(E=I.sent()).data,k=E.errorMessage)return null==o||o(Error(k)),[2];if(!P)return null==o||o(Error("上传成功但响应数据为空")),[2];return r(P),[3,7];case 6:return C=I.sent(),null==o||o(C),[3,7];case 7:return[2]}})})()}}}}),eq.registerFlow({key:"selectExitRecordSettings",title:(0,o.tExpr)("Selector setting"),on:{eventName:"openView"},steps:{openView:{title:(0,o.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,o.tExpr)("Open mode"),enum:[{label:(0,o.tExpr)("Drawer"),value:"drawer"},{label:(0,o.tExpr)("Dialog"),value:"dialog"}],"x-decorator":"FormItem","x-component":"Radio.Group"},size:{type:"string",title:(0,o.tExpr)("Popup size"),enum:[{label:(0,o.tExpr)("Small"),value:"small"},{label:(0,o.tExpr)("Medium"),value:"medium"},{label:(0,o.tExpr)("Large"),value:"large"}],"x-decorator":"FormItem","x-component":"Radio.Group"}}},defaultParams:{mode:"drawer",size:"medium"},handler:function(t,n){var r,o,i,l,a,c=["belongsTo","hasOne"].includes(t.collectionField.type),s=t.isMobileLayout?"embed":t.inputArgs.mode||n.mode||"drawer",p=t.inputArgs.size||n.size||"medium",f=(null==(r=t.model.props)?void 0:r.sourceFieldModelUid)||t.model.uid,d=(null==(o=t.model.parent)?void 0:o.use)==="QuickEditFormModel"?null==(i=t.model.parent)?void 0:i.viewContainer:null;null==d||null==(l=d.update)||l.call(d,{preventClose:!0}),t.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:t.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:t.collection.dataSourceKey,collectionName:null==(a=t.collectionField)?void 0:a.target,collectionField:t.collectionField,rowSelectionProps:{type:c?"radio":"checkbox",defaultSelectedRows:function(){return t.model.props.value},renderCell:void 0,selectedRowKeys:void 0,onChange:function(e,n){if(c){var r,o;t.model.selectedRows.value=null==n?void 0:n[0],t.model.change(),null==(r=(o=t.model)._closeView)||r.call(o)}else{var i=eR(t.model.props.value||[]).concat(eR(n)).filter(function(e,n,r){return n===r.findIndex(function(n){return n[t.collection.filterTargetKey]===e[t.collection.filterTargetKey]})});t.model.selectedRows.value=i}}}},content:function(){return u().createElement(e.RecordPickerContent,{model:t.model})},styles:{content:eP({padding:0,backgroundColor:t.model.flowEngine.context.themeToken.colorBgLayout},"embed"===s?{position:"absolute",top:0,left:0,right:0,bottom:0}:{}),body:{padding:0}}})}}}}),eq.define({label:(0,o.tExpr)("File picker")}),o.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}});var eD=y(907);function eU(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 eB(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).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){eB(i,r,o,l,a,"next",e)}function a(e){eB(i,r,o,l,a,"throw",e)}l(void 0)})}}function eN(e,t,n){return(eN=eZ()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&eV(o,n.prototype),o}).apply(null,arguments)}function eL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):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,t){return(eV=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function e$(e){var t="function"==typeof Map?new Map:void 0;return(e$=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 eN(e,arguments,eK(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),eV(n,e)})(e)}function eZ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eZ=function(){return!!e})()}function eG(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:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}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 eY=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=eK(t),eL(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,eZ()?Reflect.construct(t,n||[],eK(this).constructor):t.apply(this,n)),"storageTypes",new Map),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eV(r,e),t=[{key:"load",value:function(){return ez(function(){var e,t;return eG(this,function(r){return e=this,t=this.app.i18n.t("File manager",{ns:n}),this.pluginSettingsManager.addMenuItem({key:n,title:t,icon:"FileOutlined",aclSnippet:"pm.file-manager.storages"}),this.pluginSettingsManager.addPageTabItem({menuKey:n,key:"index",title:t,componentLoader:function(){return y.e("855").then(y.bind(y,138))}}),Object.values(eD.N).forEach(function(t){e.registerStorageType(t.name,t)}),this.flowEngine.registerModels({DisplayPreviewFieldModel:Y,UploadActionModel:em,UploadFieldModel:eq}),[2]})}).call(this)}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,t)}},{key:"getStorageType",value:function(e){return e?this.storageTypes.get(e):void 0}},{key:"uploadFile",value:function(e){return ez(function(){var t,n,r,o,i,l,a,u,c,s,p,f,d;return eG(this,function(m){switch(m.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=e.fileCollectionName||"attachments",!(null==(u=this.getStorageType(n))?void 0:u.upload))return[3,2];return[4,u.upload({file:t,apiClient:this.app.apiClient,storageType:n,storageId:r,storageRules:o,fileCollectionName:a,query:l})];case 1:return[2,m.sent()];case 2:return m.trys.push([2,4,,5]),(s=new FormData).append("file",t),f=(p=new URLSearchParams(Object.entries(l).map(function(e){var t=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 eU(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 eU(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.")}();return[t[0],String(t[1])]})).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==(c=m.sent().data)?void 0:c.data}];case 4:var b,y;return[2,{errorMessage:(b=d=m.sent(),null!=(y=Error)&&"u">typeof Symbol&&y[Symbol.hasInstance]?!!y[Symbol.hasInstance](b):b instanceof y)?d.message:"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)}}(r.prototype,t),r}(e$(e.Plugin));eL(eY,"buildInStorage",[t.ZF,t.y2,t.e7,t.a_]);var eH=eY}(),x}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("react-i18next"),require("@ant-design/icons"),require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager/client-v2",["lodash","react-i18next","@ant-design/icons","@emotion/css","ahooks","@nocobase/client-v2","react","antd","@formily/react","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager/client-v2"]=t(require("lodash"),require("react-i18next"),require("@ant-design/icons"),require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine")):e["@nocobase/plugin-file-manager/client-v2"]=t(e.lodash,e["react-i18next"],e["@ant-design/icons"],e["@emotion/css"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e["@formily/react"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,a,u,l,c){return function(){"use strict";var s,f,p,d,b,m={124:function(e,t,n){n.d(t,{A:function(){return v},S:function(){return h}});var r=n(485),o=n(624),i="file-manager";function a(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 u(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){n(e);return}u.done?t(l):Promise.resolve(l).then(r,o)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,l,"next",e)}function l(e){u(i,r,o,a,l,"throw",e)}a(void 0)})}}function c(e,t,n){return(c=g()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&b(o,n.prototype),o}).apply(null,arguments)}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(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){s(e,t,n[t])})}return e}function d(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 b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){var t="function"==typeof Map?new Map:void 0;return(m=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 c(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function y(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){var c=[u,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}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 h=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=f(t),s(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,g()?Reflect.construct(t,n||[],f(this).constructor):t.apply(this,n)),"storageTypes",new Map),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&b(r,e),t=[{key:"load",value:function(){return l(function(){var e;return y(this,function(t){return e=this.app.i18n.t("File manager",{ns:i}),this.pluginSettingsManager.addMenuItem({key:i,title:e,icon:"FileOutlined",aclSnippet:"pm.file-manager.storages"}),this.pluginSettingsManager.addPageTabItem({menuKey:i,key:"index",title:e,componentLoader:function(){return n.e("942").then(n.bind(n,837))}}),this.registerBuiltInStorageTypes(),this.flowEngine.registerModelLoaders({DisplayPreviewFieldModel:{loader:function(){return Promise.all([n.e("885"),n.e("125")]).then(n.bind(n,212))}},UploadActionModel:{loader:function(){return n.e("450").then(n.bind(n,177))}},UploadFieldModel:{loader:function(){return Promise.all([n.e("885"),n.e("501")]).then(n.bind(n,76))}}}),[2]})}).call(this)}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,d(p({},t),{name:e}))}},{key:"getStorageType",value:function(e){return e?this.storageTypes.get(e):void 0}},{key:"registerBuiltInStorageTypes",value:function(){var e={renameMode:"appendRandomID",rules:{size:o.ZH}};this.registerStorageType(o.ZF,{title:"Local storage",formLoader:function(){return n.e("929").then(n.bind(n,864))},defaultValues:d(p({},e),{baseUrl:"/storage/uploads",options:{documentRoot:"storage/uploads"}})}),this.registerStorageType(o.y2,{title:"Aliyun OSS",formLoader:function(){return n.e("43").then(n.bind(n,574))},defaultValues:d(p({},e),{options:{timeout:6e5},settings:{requestOptions:{}}})}),this.registerStorageType(o.e7,{title:"Amazon S3",formLoader:function(){return n.e("336").then(n.bind(n,595))},defaultValues:e}),this.registerStorageType(o.a_,{title:"Tencent COS",formLoader:function(){return n.e("229").then(n.bind(n,316))},defaultValues:e})}},{key:"uploadFile",value:function(e){return l(function(){var t,n,r,o,i,u,l,c,s,f,p,d,b;return y(this,function(m){switch(m.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,u=void 0===(i=e.query)?{}:i,l=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:l,query:u})];case 1:return[2,m.sent()];case 2:return m.trys.push([2,4,,5]),(f=new FormData).append("file",t),d=(p=new URLSearchParams(Object.entries(u).map(function(e){var t=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,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return a(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 a(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.")}();return[t[0],String(t[1])]})).toString())?"".concat(l,":create?").concat(p):"".concat(l,":create"),[4,this.app.apiClient.request({url:d,method:"post",data:f})];case 3:return[2,{data:null==(s=m.sent().data)?void 0:s.data}];case 4:var g,y;return[2,{errorMessage:(g=b=m.sent(),null!=(y=Error)&&"u">typeof Symbol&&y[Symbol.hasInstance]?!!y[Symbol.hasInstance](g):g instanceof y)?b.message:"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)}}(r.prototype,t),r}(m(r.Plugin));s(h,"buildInStorage",[o.ZF,o.y2,o.e7,o.a_]);var v=h},564:function(e,t,n){n.d(t,{KT:function(){return f},tp:function(){return b},OC:function(){return y},BL:function(){return l},om:function(){return d},mt:function(){return c},Sx:function(){return m},Lq:function(){return p},Lg:function(){return h}});var r=n(485),o=n(59),i=n(155),a=n.n(i),u=n(488);function l(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:"baseUrl",label:"".concat(e("Base URL")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e('Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".')},a().createElement(r.EnvVariableInput,null))}function c(e){var t=(0,u.k)();return a().createElement(o.Form.Item,{name:"default",valuePropName:"checked"},a().createElement(o.Checkbox,{disabled:e.disabled},t("Default storage")))}var s=n(624);function f(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:["rules","size"],label:"".concat(e("File size limit")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Minimum from 1 byte.")},a().createElement(r.FileSizeInput,{min:s.UW,max:s.Qj,defaultValue:s.ZH}))}function p(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:["rules","mimetype"],label:"".concat(e("File type allowed (in MIME type format)")," :"),extra:e('Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.')},a().createElement(o.Input,{placeholder:"*"}))}function d(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:"name",label:"".concat(e("Storage name")," :"),rules:[{required:!0,message:e("The field value is required")}],extra:e("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")},a().createElement(o.Input,null))}function b(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:"paranoid",valuePropName:"checked",extra:e("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.")},a().createElement(o.Checkbox,null,e("Keep file in storage when destroy the file record")))}function m(e){var t=(0,u.k)();return a().createElement(o.Form.Item,{name:"path",label:"".concat(t("Path")," :"),extra: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".')},a().createElement(r.EnvVariableInput,{addonBefore:e.addonBefore}))}var g=[{label:"Append random ID",value:"appendRandomID"},{label:"Random string",value:"random"},{label:"Keep original filename (will be overwrite if filename is existed)",value:"none"}];function y(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:"renameMode",label:"".concat(e("Renaming")," :"),extra:e("Renaming strategy to avoid filename conflicts when uploading files.")},a().createElement(o.Radio.Group,{options:g.map(function(t){var n,r;return n=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}({},t),r=r={label:e(t.label)},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n})}))}function h(){var e=(0,u.k)();return a().createElement(o.Form.Item,{name:"title",label:"".concat(e("Title")," :"),rules:[{required:!0,message:e("The field value is required")}]},a().createElement(o.Input,null))}},488:function(e,t,n){n.d(t,{k:function(){return i}});var r=n(694),o=n(301);function i(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(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}({ns:[o.C,"client"]},n))}}},624:function(e,t,n){n.d(t,{Qj:function(){return o},UW:function(){return r},ZF:function(){return a},ZH:function(){return i},a_:function(){return c},e7:function(){return l},y2:function(){return u}});var r=1,o=1/0,i=0x1400000,a="local",u="ali-oss",l="s3",c="tx-cos"},301:function(e,t,n){n.d(t,{C:function(){return r}});var r="file-manager"},375:function(e){e.exports=n},477:function(e){e.exports=r},230:function(e){e.exports=l},485:function(e){e.exports=i},694:function(e){e.exports=c},625:function(e){e.exports=o},59:function(e){e.exports=u},773:function(t){t.exports=e},155:function(e){e.exports=a},953:function(e){e.exports=t}},g={};function y(e){var t=g[e];if(void 0!==t)return t.exports;var n=g[e]={exports:{}};return m[e](n,n.exports,y),n.exports}y.m=m,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+"."+({125:"01d5562df948d974",229:"bd72c2d7aa088310",336:"1dd1b32466d0c778",43:"eb45d53ba3e9828b",450:"24143827c94b9dca",501:"37bff0473d880acd",885:"b832814bff4497c8",929:"d7e783304cc1f236",942:"c10c97317af6dd02"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},y.l=function(e,t,n,r){if(h[e])return void h[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var l=a[u];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-file-manager/client-v2:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-file-manager/client-v2:"+n),o.src=e),h[e]=[t];var c=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(v=y.g.location+"");var h,v,w=y.g.document;if(!v&&w&&(w.currentScript&&"SCRIPT"===w.currentScript.tagName.toUpperCase()&&(v=w.currentScript.src),!v)){var O=w.getElementsByTagName("script");if(O.length)for(var S=O.length-1;S>-1&&(!v||!/^http(s?):/.test(v));)v=O[S--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");y.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},y.f.j=function(e,t){var n=y.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},f=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(y)}for(e&&e(t);u<o.length;u++)r=o[u],y.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(p=self.webpackChunk_nocobase_plugin_file_manager_client_v2=self.webpackChunk_nocobase_plugin_file_manager_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var j={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-file-manager/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-file-manager/dist/client-v2/"}y.p=e}(),y.r(j),y.d(j,{BaseUrlField:function(){return b.BL},DefaultField:function(){return b.mt},FileSizeField:function(){return b.KT},MimetypeField:function(){return b.Lq},NameField:function(){return b.om},ParanoidField:function(){return b.tp},PathField:function(){return b.Sx},PluginFileManagerClientV2:function(){return d.A},RenameModeField:function(){return b.OC},TitleField:function(){return b.Lg},default:function(){return d.A}}),d=y(124),b=y(564),j}()});
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Application } from '@nocobase/client-v2';
|
|
10
10
|
import { Plugin } from '@nocobase/client-v2';
|
|
11
|
-
import type
|
|
11
|
+
import type React from 'react';
|
|
12
12
|
type UploadFileResult = {
|
|
13
13
|
errorMessage?: string;
|
|
14
14
|
data?: unknown;
|
|
@@ -25,15 +25,56 @@ type StorageUploadOptions = {
|
|
|
25
25
|
fileCollectionName: string;
|
|
26
26
|
query?: Record<string, string | number | boolean>;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Unified storage type definition. A single entry describes both the
|
|
30
|
+
* settings-page form (UI: `title` + `formLoader` + `defaultValues`) and the
|
|
31
|
+
* optional runtime upload override (`upload` / `createUploadCustomRequest`).
|
|
32
|
+
*
|
|
33
|
+
* Built-in storages register the UI fields only and fall back to the default
|
|
34
|
+
* `apiClient.request` multipart upload. Commercial / third-party storage
|
|
35
|
+
* plugins (e.g. S3 Pro) layer a presigned-PUT pipeline on top by populating
|
|
36
|
+
* the optional runtime fields.
|
|
37
|
+
*/
|
|
38
|
+
export interface StorageType {
|
|
39
|
+
/** Server-side storage type identifier — must match the persisted `storages.type` value. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Display title shown in the "Add new" dropdown and drawer header. Wrapped with `t(...)` at render time. */
|
|
42
|
+
title: string;
|
|
43
|
+
/**
|
|
44
|
+
* Async loader for the form body — the list of `<Form.Item>` fields inside
|
|
45
|
+
* the storage drawer. The loaded module's default export is used, matching
|
|
46
|
+
* the convention of `componentLoader` and `registerModelLoaders` elsewhere
|
|
47
|
+
* in the codebase.
|
|
48
|
+
*/
|
|
49
|
+
formLoader: () => Promise<{
|
|
50
|
+
default: React.ComponentType;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Optional per-storage initial values merged on top of the page-level
|
|
54
|
+
* defaults (`type` + generated `name`) when creating a new record.
|
|
55
|
+
*/
|
|
56
|
+
defaultValues?: Record<string, any>;
|
|
57
|
+
/**
|
|
58
|
+
* Optional override of the `PluginFileManagerClientV2.uploadFile` pipeline,
|
|
59
|
+
* used when editors (Markdown, Vditor, etc.) paste / drop files outside of
|
|
60
|
+
* an attachment field. When absent, uploads go through the default
|
|
61
|
+
* multipart `apiClient.request` path.
|
|
62
|
+
*/
|
|
29
63
|
upload?: (options: StorageUploadOptions) => Promise<UploadFileResult>;
|
|
30
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Optional `customRequest` factory consumed by `UploadFieldModel` for the
|
|
66
|
+
* inline attachment Upload component. When absent, `UploadFieldModel` falls
|
|
67
|
+
* back to `uploadFile`.
|
|
68
|
+
*/
|
|
69
|
+
createUploadCustomRequest?: (options: any) => (option: any) => void;
|
|
70
|
+
}
|
|
31
71
|
export declare class PluginFileManagerClientV2 extends Plugin<Record<string, never>, Application> {
|
|
32
72
|
static buildInStorage: string[];
|
|
33
|
-
storageTypes: Map<string,
|
|
73
|
+
storageTypes: Map<string, StorageType>;
|
|
34
74
|
load(): Promise<void>;
|
|
35
|
-
registerStorageType(name: string,
|
|
36
|
-
getStorageType(name?: string):
|
|
75
|
+
registerStorageType(name: string, storageType: Omit<StorageType, 'name'>): void;
|
|
76
|
+
getStorageType(name?: string): StorageType;
|
|
77
|
+
private registerBuiltInStorageTypes;
|
|
37
78
|
uploadFile(options?: {
|
|
38
79
|
file: File;
|
|
39
80
|
fileCollectionName?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export default function AliOssStorageForm(): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export default function LocalStorageForm(): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export default function S3StorageForm(): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export default function TxCosStorageForm(): React.JSX.Element;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.32",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
@@ -18,18 +18,17 @@ module.exports = {
|
|
|
18
18
|
"@formily/antd-v5": "1.2.3",
|
|
19
19
|
"@formily/core": "2.3.7",
|
|
20
20
|
"@formily/react": "2.3.7",
|
|
21
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
22
|
-
"@nocobase/client-v2": "2.1.0-beta.
|
|
21
|
+
"@nocobase/flow-engine": "2.1.0-beta.32",
|
|
22
|
+
"@nocobase/client-v2": "2.1.0-beta.32",
|
|
23
23
|
"multer": "1.4.5-lts.2",
|
|
24
|
-
"@nocobase/database": "2.1.0-beta.
|
|
25
|
-
"@nocobase/server": "2.1.0-beta.
|
|
26
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
27
|
-
"@nocobase/test": "2.1.0-beta.
|
|
24
|
+
"@nocobase/database": "2.1.0-beta.32",
|
|
25
|
+
"@nocobase/server": "2.1.0-beta.32",
|
|
26
|
+
"@nocobase/utils": "2.1.0-beta.32",
|
|
27
|
+
"@nocobase/test": "2.1.0-beta.32",
|
|
28
28
|
"@emotion/css": "11.13.0",
|
|
29
29
|
"ahooks": "3.7.8",
|
|
30
|
-
"@nocobase/
|
|
31
|
-
"@nocobase/actions": "2.1.0-beta.29",
|
|
30
|
+
"@nocobase/actions": "2.1.0-beta.32",
|
|
32
31
|
"sequelize": "6.35.2",
|
|
33
|
-
"@nocobase/plugin-data-source-main": "2.1.0-beta.
|
|
32
|
+
"@nocobase/plugin-data-source-main": "2.1.0-beta.32",
|
|
34
33
|
"axios": "1.7.7"
|
|
35
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2026-05-13T05:25:15.413Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"@aws-sdk/lib-storage","version":"3.750.0","description":"Storage higher order operation","main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline lib-storage","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","test":"yarn g:vitest run","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts --mode development","test:watch":"yarn g:vitest watch","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts"},"engines":{"node":">=18.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/abort-controller":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/smithy-client":"^4.1.5","buffer":"5.6.0","events":"3.3.0","stream-browserify":"3.0.0","tslib":"^2.6.2"},"peerDependencies":{"@aws-sdk/client-s3":"^3.750.0"},"devDependencies":{"@aws-sdk/client-s3":"3.750.0","@smithy/types":"^4.1.0","@tsconfig/recommended":"1.0.1","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2","web-streams-polyfill":"3.2.1"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser","fs":false,"stream":"stream-browserify"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"files":["dist-*/**"],"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/lib/lib-storage","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"lib/lib-storage"},"_lastModified":"2026-05-13T05:25:16.639Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"ali-oss","version":"6.20.0","description":"aliyun oss(object storage service) node client","main":"./lib/client.js","files":["lib","shims","dist"],"browser":{"./lib/client.js":"./dist/aliyun-oss-sdk.js","mime":"mime/lite","urllib":"./shims/xhr.js","utility":"./shims/utility.js","crypto":"./shims/crypto/crypto.js","debug":"./shims/debug","fs":false,"child_process":false,"is-type-of":"./shims/is-type-of.js"},"scripts":{"build-change-log":"standard-version","test":"npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js","test-cov":"npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js","jshint":"jshint .","build-test":"MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js","browser-test":"npm run build-test && karma start","build-dist":"npm run tsc && node browser-build.js > dist/aliyun-oss-sdk.js && MINIFY=1 node browser-build.js > dist/aliyun-oss-sdk.min.js","publish-to-npm":"node publish-npm-check.js && npm publish","publish-to-cdn":"node publish.js","snyk-protect":"snyk-protect","lint-staged":"lint-staged","detect-secrets":"node task/detect-secrets","tsc":"npm run tsc:clean && npm run tsc:build","tsc:build":"tsc -b tsconfig.json tsconfig-cjs.json","tsc:watch":"tsc -b tsconfig.json tsconfig-cjs.json --watch","tsc:clean":"tsc -b tsconfig.json tsconfig-cjs.json --clean ","prepare":"husky install"},"git-pre-hooks":{"pre-release":"npm run build-dist","post-release":["npm run publish-to-npm","npm run publish-to-cdn"]},"homepage":"https://github.com/ali-sdk/ali-oss","bugs":{"url":"https://github.com/ali-sdk/ali-oss/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"repository":{"type":"git","url":"https://github.com/ali-sdk/ali-oss.git"},"keywords":["oss","client","file","aliyun"],"author":"dead_horse","license":"MIT","engines":{"node":">=8"},"devDependencies":{"@babel/core":"^7.11.6","@babel/plugin-transform-regenerator":"^7.10.4","@babel/plugin-transform-runtime":"^7.11.5","@babel/preset-env":"^7.11.5","@babel/runtime":"^7.11.2","@commitlint/cli":"^17.6.7","@commitlint/config-conventional":"^16.2.4","@octokit/core":"^5.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@snyk/protect":"^1.1196.0","@types/node":"^14.0.12","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","aliasify":"^2.0.0","axios":"0.27.2","babelify":"^10.0.0","beautify-benchmark":"^0.2.4","benchmark":"^2.1.1","bluebird":"^3.1.5","browserify":"^17.0.0","core-js":"^3.6.5","crypto-js":"^3.1.9-1","dotenv":"^8.2.0","eslint":"^8.44.0","eslint-config-airbnb":"^19.0.4","eslint-config-ali":"^13.0.0","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.21.1","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-prettier":"^4.2.1","filereader":"^0.10.3","form-data":"^4.0.0","git-pre-hooks":"^1.2.0","husky":"^7.0.4","immediate":"^3.3.0","karma":"^6.3.4","karma-browserify":"^8.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.0.1","karma-ie-launcher":"^1.0.0","karma-mocha":"^2.0.1","karma-safari-launcher":"^1.0.0","lint-staged":"^12.4.1","mm":"^2.0.0","mocha":"^9.1.2","nyc":"^15.1.0","prettier":"^3.0.0","promise-polyfill":"^6.0.2","puppeteer":"19.0.0","semantic-release":"^21.1.1","should":"^11.0.0","sinon":"^15.2.0","standard-version":"^9.3.1","stream-equal":"^1.1.0","timemachine":"^0.3.0","typescript":"^3.9.5","uglify-js":"^3.14.2","watchify":"^4.0.0"},"dependencies":{"address":"^1.2.2","agentkeepalive":"^3.4.1","bowser":"^1.6.0","copy-to":"^2.0.1","dateformat":"^2.0.0","debug":"^4.3.4","destroy":"^1.0.4","end-or-error":"^1.0.1","get-ready":"^1.0.0","humanize-ms":"^1.2.0","is-type-of":"^1.4.0","js-base64":"^2.5.2","jstoxml":"^2.0.0","lodash":"^4.17.21","merge-descriptors":"^1.0.1","mime":"^2.4.5","platform":"^1.3.1","pump":"^3.0.0","qs":"^6.4.0","sdk-base":"^2.0.1","stream-http":"2.8.2","stream-wormhole":"^1.0.4","urllib":"2.41.0","utility":"^1.18.0","xml2js":"^0.6.2"},"snyk":true,"lint-staged":{"**/!(dist)/*":["npm run detect-secrets --"],"**/*.{js,ts}":["eslint --cache --fix --ext .js,.ts","prettier --write","git add"]},"_lastModified":"2026-05-13T05:25:14.044Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2026-05-13T05:25:09.230Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2026-05-13T05:25:09.525Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-05-
|
|
1
|
+
{"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2026-05-13T05:25:14.145Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2026-05-
|
|
1
|
+
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2026-05-13T05:25:20.347Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2026-05-13T05:25:09.325Z"}
|
|
@@ -33,6 +33,7 @@ export declare function getPreviewFileUrl(file: any): any;
|
|
|
33
33
|
export declare function getFileUrl(file: any): any;
|
|
34
34
|
export declare function matchMimetype(file: any, type: string): any;
|
|
35
35
|
export declare const getFileExt: (file: any, url?: string) => string;
|
|
36
|
+
export declare const isActiveContentFile: (file: any, url?: string) => boolean;
|
|
36
37
|
export declare const getFileName: (file: any, url?: string) => any;
|
|
37
38
|
export declare const getDownloadFileName: (file: any, url?: string) => string;
|
|
38
39
|
export declare const getFallbackIcon: (file: any, url?: string) => string;
|
|
@@ -46,6 +46,7 @@ __export(filePreviewTypes_exports, {
|
|
|
46
46
|
getFileUrl: () => getFileUrl,
|
|
47
47
|
getPreviewFileUrl: () => getPreviewFileUrl,
|
|
48
48
|
getPreviewThumbnailUrl: () => getPreviewThumbnailUrl,
|
|
49
|
+
isActiveContentFile: () => isActiveContentFile,
|
|
49
50
|
matchMimetype: () => matchMimetype,
|
|
50
51
|
normalizePreviewFile: () => normalizePreviewFile,
|
|
51
52
|
wrapWithModalPreviewer: () => wrapWithModalPreviewer
|
|
@@ -124,6 +125,8 @@ const FALLBACK_ICON_MAP = {
|
|
|
124
125
|
svg: "/file-placeholder/svg-200-200.png",
|
|
125
126
|
default: "/file-placeholder/unknown-200-200.png"
|
|
126
127
|
};
|
|
128
|
+
const ACTIVE_CONTENT_MIMETYPES = /* @__PURE__ */ new Set(["application/xhtml+xml", "image/svg+xml", "text/html"]);
|
|
129
|
+
const ACTIVE_CONTENT_EXTENSIONS = /* @__PURE__ */ new Set(["htm", "html", "svg", "svgz", "xhtml"]);
|
|
127
130
|
const stripQueryAndHash = (url) => url.split("?")[0].split("#")[0];
|
|
128
131
|
const getExtFromName = (value) => {
|
|
129
132
|
if (!value) {
|
|
@@ -198,6 +201,14 @@ const getFileExt = (file, url) => {
|
|
|
198
201
|
}
|
|
199
202
|
return getExtFromName(url);
|
|
200
203
|
};
|
|
204
|
+
const isActiveContentFile = (file, url) => {
|
|
205
|
+
const mimetype = (file == null ? void 0 : file.mimetype) || (file == null ? void 0 : file.type);
|
|
206
|
+
if (typeof mimetype === "string" && ACTIVE_CONTENT_MIMETYPES.has(mimetype.toLowerCase())) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
const ext = getFileExt(file, url);
|
|
210
|
+
return ACTIVE_CONTENT_EXTENSIONS.has(ext);
|
|
211
|
+
};
|
|
201
212
|
const getFileName = (file, url) => {
|
|
202
213
|
const nameFromUrl = getNameFromUrl(url);
|
|
203
214
|
if (!file || typeof file === "string") {
|
|
@@ -221,6 +232,9 @@ const getFallbackIcon = (file, url) => {
|
|
|
221
232
|
const getPreviewThumbnailUrl = (file) => {
|
|
222
233
|
const previewFile = normalizePreviewFile(file);
|
|
223
234
|
const src = getPreviewFileUrl(previewFile);
|
|
235
|
+
if (isActiveContentFile(previewFile, src)) {
|
|
236
|
+
return getFallbackIcon(previewFile, src);
|
|
237
|
+
}
|
|
224
238
|
const { getThumbnailURL } = filePreviewTypes.getTypeByFile(previewFile) ?? {};
|
|
225
239
|
const thumbnail = getThumbnailURL == null ? void 0 : getThumbnailURL(previewFile);
|
|
226
240
|
if (thumbnail) {
|
|
@@ -409,6 +423,12 @@ filePreviewTypes.add({
|
|
|
409
423
|
},
|
|
410
424
|
Previewer: wrapWithModalPreviewer(VideoPreviewer)
|
|
411
425
|
});
|
|
426
|
+
filePreviewTypes.add({
|
|
427
|
+
match(file) {
|
|
428
|
+
return isActiveContentFile(file, getFileUrl(file));
|
|
429
|
+
},
|
|
430
|
+
Previewer: wrapWithModalPreviewer(UnsupportedPreviewer)
|
|
431
|
+
});
|
|
412
432
|
const FilePreviewRenderer = (props) => {
|
|
413
433
|
const normalized = normalizePreviewFile(props.file);
|
|
414
434
|
if (!normalized) {
|
|
@@ -432,6 +452,7 @@ const FilePreviewRenderer = (props) => {
|
|
|
432
452
|
getFileUrl,
|
|
433
453
|
getPreviewFileUrl,
|
|
434
454
|
getPreviewThumbnailUrl,
|
|
455
|
+
isActiveContentFile,
|
|
435
456
|
matchMimetype,
|
|
436
457
|
normalizePreviewFile,
|
|
437
458
|
wrapWithModalPreviewer
|