@cubone/react-file-manager 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4520,7 +4520,7 @@ if (process.env.NODE_ENV !== "production") {
4520
4520
  Nt.exports = kr()();
4521
4521
  var Nr = Nt.exports;
4522
4522
  const on = /* @__PURE__ */ At(Nr), Ar = ({
4523
- files: e = [],
4523
+ files: e,
4524
4524
  fileUploadConfig: y,
4525
4525
  isLoading: r,
4526
4526
  onCreateFolder: i,
@@ -4638,7 +4638,7 @@ const on = /* @__PURE__ */ At(Nr), Ar = ({
4638
4638
  ] });
4639
4639
  };
4640
4640
  Ar.propTypes = {
4641
- files: on.arrayOf(on.object)
4641
+ files: on.arrayOf(on.object).isRequired
4642
4642
  };
4643
4643
  export {
4644
4644
  Ar as FileManager
@@ -204,4 +204,4 @@ object-assign
204
204
  (c) Sindre Sorhus
205
205
  @license MIT
206
206
  */var yt,hn;function Or(){if(hn)return yt;hn=1;var e=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function i(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function d(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var u={},p=0;p<10;p++)u["_"+String.fromCharCode(p)]=p;var h=Object.getOwnPropertyNames(u).map(function(m){return u[m]});if(h.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(m){c[m]=m}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return yt=d()?Object.assign:function(s,u){for(var p,h=i(s),c,m=1;m<arguments.length;m++){p=Object(arguments[m]);for(var O in p)y.call(p,O)&&(h[O]=p[O]);if(e){c=e(p);for(var x=0;x<c.length;x++)r.call(p,c[x])&&(h[c[x]]=p[c[x]])}}return h},yt}var gt,vn;function bt(){if(vn)return gt;vn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return gt=e,gt}var xt,mn;function yn(){return mn||(mn=1,xt=Function.call.bind(Object.prototype.hasOwnProperty)),xt}var Ct,gn;function Tr(){if(gn)return Ct;gn=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var y=bt(),r={},i=yn();e=function(s){var u="Warning: "+s;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function d(s,u,p,h,c){if(process.env.NODE_ENV!=="production"){for(var m in s)if(i(s,m)){var O;try{if(typeof s[m]!="function"){var x=Error((h||"React class")+": "+p+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw x.name="Invariant Violation",x}O=s[m](u,m,h,p,null,y)}catch(H){O=H}if(O&&!(O instanceof Error)&&e((h||"React class")+": type specification of "+p+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof O+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),O instanceof Error&&!(O.message in r)){r[O.message]=!0;var V=c?c():"";e("Failed "+p+" type: "+O.message+(V??""))}}}}return d.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},Ct=d,Ct}var jt,bn;function Sr(){if(bn)return jt;bn=1;var e=pn(),y=Or(),r=bt(),i=yn(),d=Tr(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(p){var h="Warning: "+p;typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}});function u(){return null}return jt=function(p,h){var c=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function O(k){var B=k&&(c&&k[c]||k[m]);if(typeof B=="function")return B}var x="<<anonymous>>",V={array:z("array"),bigint:z("bigint"),bool:z("boolean"),func:z("function"),number:z("number"),object:z("object"),string:z("string"),symbol:z("symbol"),any:q(),arrayOf:X,element:E(),elementType:f(),instanceOf:C,node:U(),objectOf:M,oneOf:j,oneOfType:G,shape:J,exact:Q};function H(k,B){return k===B?k!==0||1/k===1/B:k!==k&&B!==B}function T(k,B){this.message=k,this.data=B&&typeof B=="object"?B:{},this.stack=""}T.prototype=Error.prototype;function F(k){if(process.env.NODE_ENV!=="production")var B={},g=0;function _(Y,D,a,v,S,w,L){if(v=v||x,w=w||a,L!==r){if(h){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ae=v+":"+a;!B[ae]&&g<3&&(s("You are manually calling a React.PropTypes validation function for the `"+w+"` prop on `"+v+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),B[ae]=!0,g++)}}return D[a]==null?Y?D[a]===null?new T("The "+S+" `"+w+"` is marked as required "+("in `"+v+"`, but its value is `null`.")):new T("The "+S+" `"+w+"` is marked as required in "+("`"+v+"`, but its value is `undefined`.")):null:k(D,a,v,S,w)}var I=_.bind(null,!1);return I.isRequired=_.bind(null,!0),I}function z(k){function B(g,_,I,Y,D,a){var v=g[_],S=re(v);if(S!==k){var w=me(v);return new T("Invalid "+Y+" `"+D+"` of type "+("`"+w+"` supplied to `"+I+"`, expected ")+("`"+k+"`."),{expectedType:k})}return null}return F(B)}function q(){return F(u)}function X(k){function B(g,_,I,Y,D){if(typeof k!="function")return new T("Property `"+D+"` of component `"+I+"` has invalid PropType notation inside arrayOf.");var a=g[_];if(!Array.isArray(a)){var v=re(a);return new T("Invalid "+Y+" `"+D+"` of type "+("`"+v+"` supplied to `"+I+"`, expected an array."))}for(var S=0;S<a.length;S++){var w=k(a,S,I,Y,D+"["+S+"]",r);if(w instanceof Error)return w}return null}return F(B)}function E(){function k(B,g,_,I,Y){var D=B[g];if(!p(D)){var a=re(D);return new T("Invalid "+I+" `"+Y+"` of type "+("`"+a+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return F(k)}function f(){function k(B,g,_,I,Y){var D=B[g];if(!e.isValidElementType(D)){var a=re(D);return new T("Invalid "+I+" `"+Y+"` of type "+("`"+a+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return F(k)}function C(k){function B(g,_,I,Y,D){if(!(g[_]instanceof k)){var a=k.name||x,v=ce(g[_]);return new T("Invalid "+Y+" `"+D+"` of type "+("`"+v+"` supplied to `"+I+"`, expected ")+("instance of `"+a+"`."))}return null}return F(B)}function j(k){if(!Array.isArray(k))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),u;function B(g,_,I,Y,D){for(var a=g[_],v=0;v<k.length;v++)if(H(a,k[v]))return null;var S=JSON.stringify(k,function(L,b){var ae=me(b);return ae==="symbol"?String(b):b});return new T("Invalid "+Y+" `"+D+"` of value `"+String(a)+"` "+("supplied to `"+I+"`, expected one of "+S+"."))}return F(B)}function M(k){function B(g,_,I,Y,D){if(typeof k!="function")return new T("Property `"+D+"` of component `"+I+"` has invalid PropType notation inside objectOf.");var a=g[_],v=re(a);if(v!=="object")return new T("Invalid "+Y+" `"+D+"` of type "+("`"+v+"` supplied to `"+I+"`, expected an object."));for(var S in a)if(i(a,S)){var w=k(a,S,I,Y,D+"."+S,r);if(w instanceof Error)return w}return null}return F(B)}function G(k){if(!Array.isArray(k))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var B=0;B<k.length;B++){var g=k[B];if(typeof g!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+he(g)+" at index "+B+"."),u}function _(I,Y,D,a,v){for(var S=[],w=0;w<k.length;w++){var L=k[w],b=L(I,Y,D,a,v,r);if(b==null)return null;b.data&&i(b.data,"expectedType")&&S.push(b.data.expectedType)}var ae=S.length>0?", expected one of type ["+S.join(", ")+"]":"";return new T("Invalid "+a+" `"+v+"` supplied to "+("`"+D+"`"+ae+"."))}return F(_)}function U(){function k(B,g,_,I,Y){return te(B[g])?null:new T("Invalid "+I+" `"+Y+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return F(k)}function P(k,B,g,_,I){return new T((k||"React class")+": "+B+" type `"+g+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+I+"`.")}function J(k){function B(g,_,I,Y,D){var a=g[_],v=re(a);if(v!=="object")return new T("Invalid "+Y+" `"+D+"` of type `"+v+"` "+("supplied to `"+I+"`, expected `object`."));for(var S in k){var w=k[S];if(typeof w!="function")return P(I,Y,D,S,me(w));var L=w(a,S,I,Y,D+"."+S,r);if(L)return L}return null}return F(B)}function Q(k){function B(g,_,I,Y,D){var a=g[_],v=re(a);if(v!=="object")return new T("Invalid "+Y+" `"+D+"` of type `"+v+"` "+("supplied to `"+I+"`, expected `object`."));var S=y({},g[_],k);for(var w in S){var L=k[w];if(i(k,w)&&typeof L!="function")return P(I,Y,D,w,me(L));if(!L)return new T("Invalid "+Y+" `"+D+"` key `"+w+"` supplied to `"+I+"`.\nBad object: "+JSON.stringify(g[_],null," ")+`
207
- Valid keys: `+JSON.stringify(Object.keys(k),null," "));var b=L(a,w,I,Y,D+"."+w,r);if(b)return b}return null}return F(B)}function te(k){switch(typeof k){case"number":case"string":case"undefined":return!0;case"boolean":return!k;case"object":if(Array.isArray(k))return k.every(te);if(k===null||p(k))return!0;var B=O(k);if(B){var g=B.call(k),_;if(B!==k.entries){for(;!(_=g.next()).done;)if(!te(_.value))return!1}else for(;!(_=g.next()).done;){var I=_.value;if(I&&!te(I[1]))return!1}}else return!1;return!0;default:return!1}}function ue(k,B){return k==="symbol"?!0:B?B["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&B instanceof Symbol:!1}function re(k){var B=typeof k;return Array.isArray(k)?"array":k instanceof RegExp?"object":ue(B,k)?"symbol":B}function me(k){if(typeof k>"u"||k===null)return""+k;var B=re(k);if(B==="object"){if(k instanceof Date)return"date";if(k instanceof RegExp)return"regexp"}return B}function he(k){var B=me(k);switch(B){case"array":case"object":return"an "+B;case"boolean":case"date":case"regexp":return"a "+B;default:return B}}function ce(k){return!k.constructor||!k.constructor.name?x:k.constructor.name}return V.checkPropTypes=d,V.resetWarningCache=d.resetWarningCache,V.PropTypes=V,V},jt}var wt,xn;function Pr(){if(xn)return wt;xn=1;var e=bt();function y(){}function r(){}return r.resetWarningCache=y,wt=function(){function i(u,p,h,c,m,O){if(O!==e){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}i.isRequired=i;function d(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:d,element:i,elementType:i,instanceOf:d,node:i,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:r,resetWarningCache:y};return s.PropTypes=s,s},wt}if(process.env.NODE_ENV!=="production"){var Rr=pn(),Mr=!0;mt.exports=Sr()(Rr.isElement,Mr)}else mt.exports=Pr()();var kr=mt.exports;const Cn=ut(kr),jn=({files:e=[],fileUploadConfig:y,isLoading:r,onCreateFolder:i,onFileUploading:d,onFileUploaded:s,onRename:u,onDelete:p,onPaste:h,onLayoutChange:c,onRefresh:m,allowedFileExtensions:O})=>{const x=dr(),[V,H]=$.useState(!1),[T,F]=$.useState(null),[z,q]=$.useState(""),[X,E]=$.useState(null),[f,C]=$.useState([]),[j,M]=$.useState(null),[G,U]=$.useState("grid");$.useEffect(()=>{Array.isArray(e)&&(C(()=>e.filter(ce=>ce.path===`${z}/${ce.name}`)),E(()=>e==null?void 0:e.find(ce=>ce.path===z)))},[e,z]);const[P,J]=$.useState({col1:"20",col2:"80"}),[Q,te]=$.useState(!1),ue=$.useRef(null),re=()=>{te(!0)},me=()=>{te(!1)},he=ce=>{if(!Q)return;ce.preventDefault();const B=ue.current.getBoundingClientRect(),g=(ce.clientX-B.left)/B.width*100;g>=15&&g<=60&&J({col1:g,col2:100-g})};return n.jsxs("main",{className:"file-explorer",onContextMenu:ce=>ce.preventDefault(),children:[n.jsx(jr,{isLoading:r}),n.jsx(Kn,{allowCreateFolder:!0,allowUploadFile:!0,handleRefresh:m,isItemSelection:V,setIsItemSelection:H,currentPath:z,selectedFile:T,setSelectedFile:F,files:e,clipBoard:j,setClipBoard:M,handlePaste:h,triggerAction:x,activeLayout:G,setActiveLayout:U,onLayoutChange:c}),n.jsxs("section",{ref:ue,onMouseMove:he,onMouseUp:me,className:"files-container",children:[n.jsxs("div",{className:"navigation-pane",style:{width:P.col1+"%"},children:[n.jsx(er,{files:e,currentPath:z,setCurrentPath:q}),n.jsx("div",{className:`sidebar-resize ${Q?"sidebar-dragging":""}`,onMouseDown:re})]}),n.jsxs("div",{className:"folders-preview",style:{width:P.col2+"%"},children:[n.jsx(tr,{currentPath:z,setCurrentPath:q}),n.jsx(fr,{currentPathFiles:f,setCurrentPathFiles:C,setCurrentPath:q,isItemSelection:V,setIsItemSelection:H,setSelectedFile:F,currentPath:z,clipBoard:j,setClipBoard:M,handlePaste:h,files:e,triggerAction:x,currentFolder:X,handleCreateFolder:i,handleRename:u,activeLayout:G})]})]}),n.jsx(Cr,{files:e,fileUploadConfig:y,currentPath:z,currentPathFiles:f,selectedFile:T,triggerAction:x,handleCreateFolder:i,handleFileUploading:d,handleFileUploaded:s,currentFolder:X,handleRename:u,handleDelete:p,setIsItemSelection:H,setSelectedFile:F,allowedFileExtensions:O})]})};jn.propTypes={files:Cn.arrayOf(Cn.object)},Me.FileManager=jn,Object.defineProperty(Me,Symbol.toStringTag,{value:"Module"})});
207
+ Valid keys: `+JSON.stringify(Object.keys(k),null," "));var b=L(a,w,I,Y,D+"."+w,r);if(b)return b}return null}return F(B)}function te(k){switch(typeof k){case"number":case"string":case"undefined":return!0;case"boolean":return!k;case"object":if(Array.isArray(k))return k.every(te);if(k===null||p(k))return!0;var B=O(k);if(B){var g=B.call(k),_;if(B!==k.entries){for(;!(_=g.next()).done;)if(!te(_.value))return!1}else for(;!(_=g.next()).done;){var I=_.value;if(I&&!te(I[1]))return!1}}else return!1;return!0;default:return!1}}function ue(k,B){return k==="symbol"?!0:B?B["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&B instanceof Symbol:!1}function re(k){var B=typeof k;return Array.isArray(k)?"array":k instanceof RegExp?"object":ue(B,k)?"symbol":B}function me(k){if(typeof k>"u"||k===null)return""+k;var B=re(k);if(B==="object"){if(k instanceof Date)return"date";if(k instanceof RegExp)return"regexp"}return B}function he(k){var B=me(k);switch(B){case"array":case"object":return"an "+B;case"boolean":case"date":case"regexp":return"a "+B;default:return B}}function ce(k){return!k.constructor||!k.constructor.name?x:k.constructor.name}return V.checkPropTypes=d,V.resetWarningCache=d.resetWarningCache,V.PropTypes=V,V},jt}var wt,xn;function Pr(){if(xn)return wt;xn=1;var e=bt();function y(){}function r(){}return r.resetWarningCache=y,wt=function(){function i(u,p,h,c,m,O){if(O!==e){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}i.isRequired=i;function d(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:d,element:i,elementType:i,instanceOf:d,node:i,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:r,resetWarningCache:y};return s.PropTypes=s,s},wt}if(process.env.NODE_ENV!=="production"){var Rr=pn(),Mr=!0;mt.exports=Sr()(Rr.isElement,Mr)}else mt.exports=Pr()();var kr=mt.exports;const Cn=ut(kr),jn=({files:e,fileUploadConfig:y,isLoading:r,onCreateFolder:i,onFileUploading:d,onFileUploaded:s,onRename:u,onDelete:p,onPaste:h,onLayoutChange:c,onRefresh:m,allowedFileExtensions:O})=>{const x=dr(),[V,H]=$.useState(!1),[T,F]=$.useState(null),[z,q]=$.useState(""),[X,E]=$.useState(null),[f,C]=$.useState([]),[j,M]=$.useState(null),[G,U]=$.useState("grid");$.useEffect(()=>{Array.isArray(e)&&(C(()=>e.filter(ce=>ce.path===`${z}/${ce.name}`)),E(()=>e==null?void 0:e.find(ce=>ce.path===z)))},[e,z]);const[P,J]=$.useState({col1:"20",col2:"80"}),[Q,te]=$.useState(!1),ue=$.useRef(null),re=()=>{te(!0)},me=()=>{te(!1)},he=ce=>{if(!Q)return;ce.preventDefault();const B=ue.current.getBoundingClientRect(),g=(ce.clientX-B.left)/B.width*100;g>=15&&g<=60&&J({col1:g,col2:100-g})};return n.jsxs("main",{className:"file-explorer",onContextMenu:ce=>ce.preventDefault(),children:[n.jsx(jr,{isLoading:r}),n.jsx(Kn,{allowCreateFolder:!0,allowUploadFile:!0,handleRefresh:m,isItemSelection:V,setIsItemSelection:H,currentPath:z,selectedFile:T,setSelectedFile:F,files:e,clipBoard:j,setClipBoard:M,handlePaste:h,triggerAction:x,activeLayout:G,setActiveLayout:U,onLayoutChange:c}),n.jsxs("section",{ref:ue,onMouseMove:he,onMouseUp:me,className:"files-container",children:[n.jsxs("div",{className:"navigation-pane",style:{width:P.col1+"%"},children:[n.jsx(er,{files:e,currentPath:z,setCurrentPath:q}),n.jsx("div",{className:`sidebar-resize ${Q?"sidebar-dragging":""}`,onMouseDown:re})]}),n.jsxs("div",{className:"folders-preview",style:{width:P.col2+"%"},children:[n.jsx(tr,{currentPath:z,setCurrentPath:q}),n.jsx(fr,{currentPathFiles:f,setCurrentPathFiles:C,setCurrentPath:q,isItemSelection:V,setIsItemSelection:H,setSelectedFile:F,currentPath:z,clipBoard:j,setClipBoard:M,handlePaste:h,files:e,triggerAction:x,currentFolder:X,handleCreateFolder:i,handleRename:u,activeLayout:G})]})]}),n.jsx(Cr,{files:e,fileUploadConfig:y,currentPath:z,currentPathFiles:f,selectedFile:T,triggerAction:x,handleCreateFolder:i,handleFileUploading:d,handleFileUploaded:s,currentFolder:X,handleRename:u,handleDelete:p,setIsItemSelection:H,setSelectedFile:F,allowedFileExtensions:O})]})};jn.propTypes={files:Cn.arrayOf(Cn.object).isRequired},Me.FileManager=jn,Object.defineProperty(Me,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cubone/react-file-manager",
3
3
  "private": false,
4
- "version": "1.3.0",
4
+ "version": "1.3.1",
5
5
  "type": "module",
6
6
  "module": "dist/react-file-manager.es.js",
7
7
  "files": [