← Back
Editing: files-path-legacy.js
!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,n,r){return(n=function(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}(n))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,o,a){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return i(s,"_invoke",function(n,r,o){var i,a,u,c=0,s=o||[],f=!1,v={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,a=0,u=e,v.n=n,l}};function p(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<s.length;t++){var o,i=s[t],p=v.p,h=i[2];n>3?(o=h===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(a=0,v.v=r,v.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,v.n=h,a=0))}if(o||n>1)return l;throw f=!0,r}return function(o,s,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&p(s,h),a=s,u=h;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(v.n=-1),p(a,u)):v.n=u:v.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=v.n<0)?u:n.call(r,v))!==l)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,a),!0),s}var l={};function c(){}function s(){}function f(){}t=Object.getPrototypeOf;var v=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),p=f.prototype=c.prototype=Object.create(v);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return s.prototype=f,i(p,"constructor",f),i(f,"constructor",s),s.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,r,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){a(i,r,o,u,l,"next",e)}function l(e){a(i,r,o,u,l,"throw",e)}u(void 0)})}}System.register(["./base-lib-legacy.js?v=1765440387","./files-legacy.js?v=1765440387","./utils-lib-legacy.js?v=1765440387"],function(e,t){"use strict";var r,i,a,l,c,s,f,v,p,h,d,m,b,y,w,g,k,O,j,P,S,_,C,x,T,F,E,G,q;return{setters:[function(e){r=e.c,i=e.r,a=e.k,l=e.w,c=e.p,s=e.a5,f=e.q,v=e.v,p=e.y,h=e.J,d=e.H,m=e.bq,b=e.I,y=e.Q,w=e.O,g=e.F,k=e.a$,O=e.n,j=e.e,P=e.A,S=e.z,_=e.aR,C=e.aw,x=e.br},function(e){T=e.ag},function(e){F=e.bT,E=e.q,G=e.b,q=e.e}],execute:function(){var t=["id"],D={class:"path-input"},M={class:"fold-dir-list"},R=["onClick"],U=["onClick"],L={class:"path-name"},W=["onClick"],A={class:"fold-dir-list"},B=["onClick"],I=r({__name:"files-path",props:{initialPath:{default:"/www/wwwroot"}},emits:["pathChange","refresh"],setup:function(e,r){var q=r.expose,I=r.emit,z=e,K=I,N=G(),$=i(F(10,"letter")),H=i(z.initialPath),J=i(),Q=i(!0),V=i([]),X=i(0),Y=i(!1),Z=a({showMore:!1,showUl:!1,list:[]}),ee=function(){var e=u(o().m(function e(t){var n,r;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(Q.value=t,!t){e.n=7;break}if(H.value!==z.initialPath){e.n=1;break}return e.a(2);case 1:if(!((n=H.value).length>0)||n.includes("/")){e.n=2;break}return N.error("路径输入不符合规则"),H.value=z.initialPath,e.a(2);case 2:if(0!==n.length){e.n=3;break}return H.value=z.initialPath,e.a(2);case 3:return e.p=3,e.n=4,ne(n);case 4:r=e.v,H.value=r||n,e.n=6;break;case 5:e.p=5,e.v,H.value=z.initialPath;case 6:e.n=8;break;case 7:E(J.value);case 8:return e.a(2)}},e,null,[[3,5]])}));return function(t){return e.apply(this,arguments)}}(),te=function(e,t){var n;""===e&&(H.value="/"),null===(n=J.value)||void 0===n||n.blur(),t||ne(e)},ne=function(){var e=u(o().m(function e(t){var n,r;return o().w(function(e){for(;;)switch(e.n){case 0:if(n=t.replace(/\/+$/,"")||"/",r=re(n),"/.Recycle_bin"!==t&&"/www/.Recycle_bin"!==t){e.n=1;break}return N.error("此为回收站目录,请在右上角按【回收站】按钮打开"),e.a(2,!1);case 1:return H.value=r,K("pathChange",r),e.a(2,r)}},e)}));return function(t){return e.apply(this,arguments)}}(),re=function(e){var t=e;return t=(t=(t=t.replace(/(\\\/|\/\\)/g,"/")).replace(/\\\\+/g,"/")).replace(/\/+/g,"/")},oe=function(e){if(e){var t=e.split("/");"/"!==e?(V.value=t.map(function(e,n){return{name:""===e?"根目录":e,path:""===e?"/":t.slice(0,n+1).join("/"),show:!0,showFold:!1,loading:!1,list:[]}}),ue(),O(function(){Z.list=[],Z.showMore=!1;var e=document.querySelectorAll("#".concat($.value," .path-group-item")),t=document.querySelector("#".concat($.value," .path-list-group")),n=Array.from(e).reduce(function(e,t){return e+t.clientWidth+4},0);setTimeout(function(){if(n>((null==t?void 0:t.clientWidth)||400)){for(var r=20,o=e.length-1;o>=0;o--)(r+=e[o].clientWidth)>((null==t?void 0:t.clientWidth)||0)&&(V.value[o].show=!1,Z.showMore=!0,Z.list=V.value.slice(o+1));Z.showMore&&(V.value[0].show=!1,Z.list=V.value.slice(1))}},100)})):V.value=[{name:"根目录",path:"/",show:!0,list:[]}]}},ie=function(){if(!Y.value){if(Y.value=!0,"/"===H.value)return Y.value=!1,N.error("当前目录为根目录");var e=H.value.split("/");e.pop();var t=e.join("/");""===t&&(t="/"),ne(t),setTimeout(function(){Y.value=!1},500)}},ae=function(){var e=u(o().m(function e(t,n){var r,i;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,ue(),V.value[n].showFold=!0,V.value[n].loading=!0,e.n=1,T({path:t,p:1,showRow:2e3});case 1:r=e.v,i=r.data.dir,V.value[n].loading=!1,V.value[n].list=i.map(function(e){return{name:e.nm,path:"".concat(t,"/").concat(e.nm).replace(/\/+/g,"/")}}),X.value=n,window.addEventListener("click",ue),e.n=3;break;case 2:e.p=2,e.v,V.value[n].loading=!1;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n){return e.apply(this,arguments)}}(),ue=function(){Z.showUl=!1,V.value[X.value]&&(V.value=V.value.map(function(e){return n(n({},e),{},{showFold:!1})})),window.removeEventListener("click",ue)},le=function(){var e=u(o().m(function e(){return o().w(function(e){for(;;)switch(e.n){case 0:if(!Y.value){e.n=1;break}return e.a(2);case 1:Y.value=!0;try{K("refresh")}catch(t){N.error("刷新失败")}finally{setTimeout(function(){Y.value=!1},500)}case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return l(function(){return H.value},function(e){oe(e)},{immediate:!0}),l(function(){return Q.value},function(){Q.value||O(function(){var e;null===(e=J.value)||void 0===e||e.select()})}),l(function(){return z.initialPath},function(e){H.value=e}),c(function(){oe(H.value)}),s(function(){ue()}),q({dirPath:H,refreshList:le,goBack:ie,cutDirPath:te,getPathListGroup:oe}),function(e,n){var r=_,o=C,i=x;return f(),v("div",{class:"nav-path",id:$.value},[p("div",{class:"back rounded-l-[1rem] relative",onClick:ie},[p("i",{class:h(["svgtofont-el-back",{disabledBack:Y.value}])},null,2)]),p("div",D,[d(p("input",{"onUpdate:modelValue":n[0]||(n[0]=function(e){return H.value=e}),ref_key:"pathInputRef",ref:J,type:"text",class:"h-full w-full pl-8px",onBlur:n[1]||(n[1]=function(e){return ee(!0)}),onKeydown:n[2]||(n[2]=y(function(){},["stop"])),onKeyup:n[3]||(n[3]=w(function(e){return te(H.value,!0)},["enter"]))},null,544),[[m,H.value],[b,!Q.value]]),d(p("div",{class:"path-list-group",onClick:n[5]||(n[5]=function(e){return ee(!1)})},[d(p("div",{class:"svgtofont-el-arrow-left font-bold px-[.2rem] h-full leading-[2.9rem] cursor-pointer border-l border-r border-white relative hover:border-#e1e1e1 hover:bg-[#f5f7fa]",onClick:n[4]||(n[4]=y(function(e){return Z.showUl=!0},["stop"]))},[d(p("ul",M,[(f(!0),v(g,null,k(Z.list,function(e,t){return f(),v("li",{class:"fold-dir-item",key:t},[j(r,{effect:"dark",content:e.path,placement:"right","show-after":500},{default:P(function(){return[p("div",{class:"w-full flex items-center",onClick:y(function(t){return te(e.path)},["stop"])},[n[6]||(n[6]=p("span",{class:"dir-icon flex-shrink-0 !h-[1.6rem]"},null,-1)),p("span",null,S(e.name),1)],8,R)]}),_:2},1032,["content"])])}),128))],512),[[b,Z.showUl]])],512),[[b,Z.showMore]]),(f(!0),v(g,null,k(V.value,function(e,t){return d((f(),v("div",{key:t,class:"path-group-item",onClick:y(function(t){return te(e.path)},["stop"])},[j(r,{effect:"dark",content:e.name,placement:"bottom","show-after":500},{default:P(function(){return[p("span",L,S(e.name),1)]}),_:2},1032,["content"]),p("div",{class:"svgtofont-el-arrow-right path-name-icon",onClick:y(function(n){return ae(e.path,t)},["stop"])},[d((f(),v("ul",A,[(f(!0),v(g,null,k(e.list,function(e,t){return f(),v("li",{class:"fold-dir-item",key:t},[j(r,{effect:"dark",content:e.path,placement:"right","show-after":500},{default:P(function(){return[p("div",{class:"w-full flex items-center",onClick:y(function(t){return te(e.path)},["stop"])},[n[7]||(n[7]=p("span",{class:"dir-icon flex-shrink-0 !h-[1.6rem]"},null,-1)),p("span",null,S(e.name),1)],8,B)]}),_:2},1032,["content"])])}),128)),d(j(o,{"image-size":60,description:"暂无数据"},null,512),[[b,!e.list.length]])])),[[b,e.showFold],[i,e.loading]])],8,W)],8,U)),[[b,e.show]])}),128))],512),[[b,Q.value]])]),p("span",{class:"refresh rounded-r-[1rem]",onClick:le},[p("i",{class:h({"svgtofont-el-refresh-right":!Y.value,"svgtofont-el-loading cursor-not-allowed animate-spin":Y.value})},null,2)])],8,t)}}});e("F",q(I,[["__scopeId","data-v-088794d2"]]))}}})}();
Save File
Cancel