← Back
Editing: files-path-legacy.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?e(Object(o),!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),u=new T(n||[]);return a(i,"_invoke",{value:_(t,r,u)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var v="suspendedStart",d="suspendedYield",y="executing",m="completed",g={};function w(){}function b(){}function k(){}var x={};f(x,c,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(G([])));j&&j!==n&&i.call(j,c)&&(x=j);var L=k.prototype=w.prototype=Object.create(x);function P(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(e,r){function n(o,a,u,c){var l=p(e[o],e,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==t(f)&&i.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function _(t,r,n){var o=v;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=S(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=p(t,r,n);if("normal"===l.type){if(o=n.done?m:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function G(r){if(r||""===r){var n=r[c];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(i.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(t(r)+" is not iterable")}return b.prototype=k,a(L,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:b,configurable:!0}),b.displayName=f(k,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,f(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},P(E.prototype),f(E.prototype,l,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new E(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(L),f(L,s,"Generator"),f(L,c,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=G,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(F),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;F(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:G(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},r}function i(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function u(t){i(a,n,o,u,c,"next",t)}function c(t){i(a,n,o,u,c,"throw",t)}u(void 0)}))}}System.register(["./base-lib-legacy.js?v=VERSION_NUMBER","./files-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER"],(function(t,e){"use strict";var n,i,u,c,l,s,f,h,p,v,d,y,m,g,w,b,k,x,O,j,L,P,E,_,S,C,F,T,G;return{setters:[function(t){n=t.c,i=t.r,u=t.k,c=t.w,l=t.p,s=t.a4,f=t.q,h=t.v,p=t.y,v=t.J,d=t.H,y=t.bp,m=t.I,g=t.Q,w=t.O,b=t.F,k=t.a_,x=t.n,O=t.e,j=t.A,L=t.z,P=t.aQ,E=t.av,_=t.bq},function(t){S=t.ag},function(t){C=t.bU,F=t.t,T=t.b,G=t.e}],execute:function(){var e=["id"],N={class:"path-input"},I={class:"fold-dir-list"},U=["onClick"],A=["onClick"],D={class:"path-name"},M=["onClick"],q={class:"fold-dir-list"},R=["onClick"],W=n({__name:"files-path",props:{initialPath:{default:"/www/wwwroot"}},emits:["pathChange","refresh"],setup:function(t,n){var G=n.expose,W=n.emit,B=t,z=W,K=T(),Q=i(C(10,"letter")),Y=i(B.initialPath),H=i(),J=i(!0),V=i([]),$=i(0),X=i(!1),Z=u({showMore:!1,showUl:!1,list:[]}),tt=function(){var t=a(o().mark((function t(e){var r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(J.value=e,!e){t.next=27;break}if(Y.value!==B.initialPath){t.next=4;break}return t.abrupt("return");case 4:if(!((r=Y.value).length>0)||r.includes("/")){t.next=11;break}return K.error("路径输入不符合规则"),Y.value=B.initialPath,t.abrupt("return");case 11:if(0!==r.length){t.next=14;break}return Y.value=B.initialPath,t.abrupt("return");case 14:return t.prev=14,t.next=17,rt(r);case 17:n=t.sent,Y.value=n||r,t.next=25;break;case 21:t.prev=21,t.t0=t.catch(14),Y.value=B.initialPath;case 25:t.next=28;break;case 27:F(H.value);case 28:case"end":return t.stop()}}),t,null,[[14,21]])})));return function(e){return t.apply(this,arguments)}}(),et=function(t,e){var r;""===t&&(Y.value="/"),null===(r=H.value)||void 0===r||r.blur(),e||rt(t)},rt=function(){var t=a(o().mark((function t(e){var r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.replace(/\/+$/,"")||"/",n=nt(r),"/.Recycle_bin"!==e&&"/www/.Recycle_bin"!==e){t.next=5;break}return K.error("此为回收站目录,请在右上角按【回收站】按钮打开"),t.abrupt("return",!1);case 5:return Y.value=n,z("pathChange",n),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),nt=function(t){var e=t;return e=(e=(e=e.replace(/(\\\/|\/\\)/g,"/")).replace(/\\\\+/g,"/")).replace(/\/+/g,"/")},ot=function(t){if(t){var e=t.split("/");"/"!==t?(V.value=e.map((function(t,r){return{name:""===t?"根目录":t,path:""===t?"/":e.slice(0,r+1).join("/"),show:!0,showFold:!1,loading:!1,list:[]}})),ut(),x((function(){Z.list=[],Z.showMore=!1;var t=document.querySelectorAll("#".concat(Q.value," .path-group-item")),e=document.querySelector("#".concat(Q.value," .path-list-group")),r=Array.from(t).reduce((function(t,e){return t+e.clientWidth+4}),0);setTimeout((function(){if(r>((null==e?void 0:e.clientWidth)||400)){for(var n=20,o=t.length-1;o>=0;o--)(n+=t[o].clientWidth)>((null==e?void 0:e.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:[]}]}},it=function(){if(!X.value){if(X.value=!0,"/"===Y.value)return X.value=!1,K.error("当前目录为根目录");var t=Y.value.split("/");t.pop();var e=t.join("/");""===e&&(e="/"),rt(e),setTimeout((function(){X.value=!1}),500)}},at=function(){var t=a(o().mark((function t(e,r){var n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,ut(),V.value[r].showFold=!0,V.value[r].loading=!0,t.next=6,S({path:e,p:1,showRow:2e3});case 6:n=t.sent,i=n.data.dir,V.value[r].loading=!1,V.value[r].list=i.map((function(t){return{name:t.nm,path:"".concat(e,"/").concat(t.nm).replace(/\/+/g,"/")}})),$.value=r,window.addEventListener("click",ut),t.next=18;break;case 14:t.prev=14,t.t0=t.catch(0),V.value[r].loading=!1;case 18:case"end":return t.stop()}}),t,null,[[0,14]])})));return function(e,r){return t.apply(this,arguments)}}(),ut=function(){Z.showUl=!1,V.value[$.value]&&(V.value=V.value.map((function(t){return r(r({},t),{},{showFold:!1})}))),window.removeEventListener("click",ut)},ct=function(){var t=a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!X.value){t.next=2;break}return t.abrupt("return");case 2:X.value=!0;try{z("refresh")}catch(e){K.error("刷新失败")}finally{setTimeout((function(){X.value=!1}),500)}case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return c((function(){return Y.value}),(function(t){ot(t)}),{immediate:!0}),c((function(){return J.value}),(function(){J.value||x((function(){var t;null===(t=H.value)||void 0===t||t.select()}))})),c((function(){return B.initialPath}),(function(t){Y.value=t})),l((function(){ot(Y.value)})),s((function(){ut()})),G({dirPath:Y,refreshList:ct,goBack:it,cutDirPath:et,getPathListGroup:ot}),function(t,r){var n=P,o=E,i=_;return f(),h("div",{class:"nav-path",id:Q.value},[p("div",{class:"back rounded-l-[1rem] relative",onClick:it},[p("i",{class:v(["svgtofont-el-back",{disabledBack:X.value}])},null,2)]),p("div",N,[d(p("input",{"onUpdate:modelValue":r[0]||(r[0]=function(t){return Y.value=t}),ref_key:"pathInputRef",ref:H,type:"text",class:"h-full w-full pl-8px",onBlur:r[1]||(r[1]=function(t){return tt(!0)}),onKeydown:r[2]||(r[2]=g((function(){}),["stop"])),onKeyup:r[3]||(r[3]=w((function(t){return et(Y.value,!0)}),["enter"]))},null,544),[[y,Y.value],[m,!J.value]]),d(p("div",{class:"path-list-group",onClick:r[5]||(r[5]=function(t){return tt(!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:r[4]||(r[4]=g((function(t){return Z.showUl=!0}),["stop"]))},[d(p("ul",I,[(f(!0),h(b,null,k(Z.list,(function(t,e){return f(),h("li",{class:"fold-dir-item",key:e},[O(n,{effect:"dark",content:t.path,placement:"right","show-after":500},{default:j((function(){return[p("div",{class:"w-full flex items-center",onClick:g((function(e){return et(t.path)}),["stop"])},[r[6]||(r[6]=p("span",{class:"dir-icon flex-shrink-0 !h-[1.6rem]"},null,-1)),p("span",null,L(t.name),1)],8,U)]})),_:2},1032,["content"])])})),128))],512),[[m,Z.showUl]])],512),[[m,Z.showMore]]),(f(!0),h(b,null,k(V.value,(function(t,e){return d((f(),h("div",{key:e,class:"path-group-item",onClick:g((function(e){return et(t.path)}),["stop"])},[O(n,{effect:"dark",content:t.name,placement:"bottom","show-after":500},{default:j((function(){return[p("span",D,L(t.name),1)]})),_:2},1032,["content"]),p("div",{class:"svgtofont-el-arrow-right path-name-icon",onClick:g((function(r){return at(t.path,e)}),["stop"])},[d((f(),h("ul",q,[(f(!0),h(b,null,k(t.list,(function(t,e){return f(),h("li",{class:"fold-dir-item",key:e},[O(n,{effect:"dark",content:t.path,placement:"right","show-after":500},{default:j((function(){return[p("div",{class:"w-full flex items-center",onClick:g((function(e){return et(t.path)}),["stop"])},[r[7]||(r[7]=p("span",{class:"dir-icon flex-shrink-0 !h-[1.6rem]"},null,-1)),p("span",null,L(t.name),1)],8,R)]})),_:2},1032,["content"])])})),128)),d(O(o,{"image-size":60,description:"暂无数据"},null,512),[[m,!t.list.length]])])),[[m,t.showFold],[i,t.loading]])],8,M)],8,A)),[[m,t.show]])})),128))],512),[[m,J.value]])]),p("span",{class:"refresh rounded-r-[1rem]",onClick:ct},[p("i",{class:v({"svgtofont-el-refresh-right":!X.value,"svgtofont-el-loading cursor-not-allowed animate-spin":X.value})},null,2)])],8,e)}}});t("F",G(W,[["__scopeId","data-v-088794d2"]]))}}}))}();
Save File
Cancel