vue-devui 1.6.31 → 1.6.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.
@@ -7213,8 +7213,8 @@ function useCodeReview(props, ctx, reviewContentRef, updateLineNumberMap, update
7213
7213
  if (!isInRange || !isClickInner || clickSide === "left" && selectionSide.value === "right" || clickSide === "right" && selectionSide.value === "left" || isLineNumber) {
7214
7214
  setTimeout(() => {
7215
7215
  selectionSide.value = "";
7216
- selection.removeAllRanges();
7217
7216
  });
7217
+ selection.removeRange(selection.getRangeAt(0));
7218
7218
  }
7219
7219
  } else {
7220
7220
  selectionSide.value = "";
@@ -121,4 +121,4 @@ function print() { __p += __j.call(arguments, '') }
121
121
  +++ updated_at Jan 1, 2019, 0:0:0 AM
122
122
  `,P=document.createElement("div");Sr(P,I+T,_.value,S,!0);const N=Array.from(P.querySelectorAll("tr")),H=N.find(on=>{var cn;return(cn=on.children[1])==null?void 0:cn.innerText.trim().match(Te)});if(!H)return;const K=N.filter(on=>on!==H);o(b.dataset,I+T,W),vo(b,K,W),p(b.dataset,W),!Gs(b,H,W)&&(_o(b,H),W==="up"?b.previousElementSibling?We(b,m.value,"middle",!0):We(b,m.value,"top"):b.nextElementSibling?We(b,m.value,"middle",!0):We(b,m.value,"bottom"))},B=()=>{var I;const T=Array.from(s.value.querySelectorAll("tr")),W=T.length;for(const P in T){const N=parseInt(P),H=Array.from(T[N].children),K=H[0],fn=H[1];if(!fn)continue;const on=fn.classList.value,cn=fn.innerText.trim();if(cn.match(Te)&&!co.test(cn)&&on&&on.includes("d2h-info")){const gn=N+1,Z=N-1;if(N===0&&gn in T)Ue(T[N],m.value,"top"),Ke(K,"up");else if(N>0&&N<W-1&&gn in T&&Z in T){const xn=Array.from(T[Z].children),Nn=parseInt(xn[0].children[0].innerText),tn=Array.from(T[gn].children),z=parseInt(tn[0].children[0].innerText);Ue(T[N],m.value,"middle");const J=z-Nn<=m.value;Ke(K,J?"all":"updown")}}}const b=T[0].cloneNode(!0);if(b.children[0].children[0]&&b.children[0].removeChild(b.children[0].children[0]),b.children[1].innerText="",(I=T[0].parentElement)==null||I.appendChild(b),!Ue(b,m.value,"bottom")){b.remove();return}Ke(b.children[0],"down")},R=(T,W,b,S)=>{if(!b)return;if(!T)return b==null?void 0:b.remove();const I=`--- updated_at Jan 1, 2019, 0:0:0 AM
123
123
  +++ updated_at Jan 1, 2019, 0:0:0 AM
124
- `,P=document.createElement("div");Sr(P,I+T,_.value,S,!0);const N=Array.from(P.querySelectorAll("tr")),H=N.find(on=>{var cn;return(cn=on.children[1])==null?void 0:cn.innerText.trim().match(Te)});if(!H)return;const K=N.filter(on=>on.children[0].children.length===2);vo(b,K,W),p(b.dataset,W),!Zs(b,H,W)&&(_o(b,H),W==="up"?b.previousElementSibling?Ue(b,m.value,"middle",!0):Ue(b,m.value,"top"):b.nextElementSibling?Ue(b,m.value,"middle",!0):Ue(b,m.value,"bottom"))};return{insertExpandButton:()=>{_.value==="side-by-side"?C():B()},onExpandButtonClick:(T,W)=>{var I,P;const S=T.composedPath().find(N=>{var H;return(H=N.classList)==null?void 0:H.contains("expand-icon")});if(S){const N=(I=Array.from(S.classList).find(gn=>gn.endsWith("expand")))==null?void 0:I.split("-")[0],H=N==="up"||N==="all"?"up":"down",[K,fn,on,cn]=zs(S,m.value);(P=x==null?void 0:x.value)==null||P.call(x,[K,fn,on,cn],gn=>{var Z,xn;_.value==="line-by-line"?R(gn,H,(Z=S.parentElement)==null?void 0:Z.parentElement,W):A(gn,H,(xn=S.parentElement)==null?void 0:xn.parentElement,W)})}}}}function ef(s,c,o,p,_){const{diff:m,outputFormat:x,allowExpand:C,showBlob:A}=g.toRefs(s),B=g.ref(""),R=g.ref([]),M=ie("code-review"),U=g.ref(""),{insertExpandButton:T,onExpandButtonClick:W}=nf(o,s,p,_),b=()=>{R.value=ds.parse(m.value),g.nextTick(()=>{xs&&!A.value&&(Sr(o.value,m.value,x.value,s.options),C.value&&T(),c.emit("contentRefresh",JSON.parse(JSON.stringify(R.value))))})},S=N=>{W(N,s.options)};function I(){if(U.value||typeof window=="undefined")return;const N=window.getSelection();if((N==null?void 0:N.toString())&&(N==null?void 0:N.anchorNode)){const H=Mr(N.anchorNode);H&&(U.value=H)}}function P(N){if(typeof window=="undefined")return;const H=window.getSelection(),K=N.composedPath(),fn=K.some(gn=>{var Z;return(Z=gn.classList)==null?void 0:Z.contains("d2h-code-side-linenumber")}),on=K.some(gn=>{var Z;return(Z=gn.classList)==null?void 0:Z.contains(M.e("content"))}),cn=Mr(N.target);H&&H.toString()?(!(H==null?void 0:H.getRangeAt(0).intersectsNode(N.target))||!on||cn==="left"&&U.value==="right"||cn==="right"&&U.value==="left"||fn)&&setTimeout(()=>{U.value="",H.removeAllRanges()}):U.value=""}return g.watch(A,b),g.watch(x,b),g.watch(m,b,{immediate:!0}),g.watch(()=>s.outputFormat,N=>{N==="side-by-side"?(document.addEventListener("selectionchange",I),document.addEventListener("mousedown",P,!0)):(document.removeEventListener("selectionchange",I),document.removeEventListener("mousedown",P,!0))},{immediate:!0}),g.onUnmounted(()=>{document.removeEventListener("selectionchange",I),document.removeEventListener("mousedown",P,!0)}),{renderHtml:B,diffFile:R,selectionSide:U,onContentClick:S}}function tf(s,c){const{fold:o}=g.toRefs(s),p=g.ref(o.value),_=m=>{m!==void 0?p.value=m:p.value=!p.value};return g.watch(o,m=>{p.value=m}),g.watch(p,()=>{c.emit("foldChange",p.value)}),{isFold:p,toggleFold:_}}function rf(s,c,o){const p=ie("code-review");let _=!1,m,x,C=[],A,B,R=[],M={},U={},T=[],W,b,S,I,P;const N=Z=>{var xn;if(Z.button===0){const Nn=Z.composedPath(),tn=Nn.find(J=>{var G,nn;return((G=J.classList)==null?void 0:G.contains("comment-icon-hover"))||((nn=J.classList)==null?void 0:nn.contains("comment-icon"))});if(x=Array.from(s.value.querySelectorAll("tr")).filter(J=>{var G;return!((G=J.classList)!=null&&G.contains("expand-line"))}),!tn)return;const z=Br(Z.target);if(z&&((xn=z==null?void 0:z.classList)==null?void 0:xn.contains("expand-line")))return;m=z,C=[];for(let J=0;J<x.length;J++)C.push(...x[J].children);if(c.outputFormat==="side-by-side"){const{left:J,right:G}=Xs(x);M=J,U=G,W=Nn.some(nn=>{var V;return(V=nn.classList)==null?void 0:V.contains("d-code-left")})?"left":"right"}_=!0,A=!0,B=!1,Z.preventDefault(),Z.stopPropagation(),document.addEventListener("mousemove",H),document.addEventListener("mouseup",K)}};function H(Z){var G,nn;if(!_)return;A&&(bo(T),A=!1);const xn=Z.composedPath();if(!xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains(p.e("content"))}))return;const tn=Br(Z.target);let z;if(c.outputFormat==="side-by-side"&&(xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains("d-code-left")})&&(z="left"),xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains("d-code-right")})&&(z="right")),!tn)return;B=!0;const J=tn.children;if(!(z==="left"&&isNaN(parseInt((G=J[0])==null?void 0:G.innerText))||z==="right"&&isNaN(parseInt((nn=J[2])==null?void 0:nn.innerText)))){if(T=[],c.outputFormat==="line-by-line"){let V=x.indexOf(m),dn=x.indexOf(tn);if(dn===-1)return;V>dn&&([V,dn]=[dn,V]);for(let Cn=0;Cn<x.length;Cn++){const hn=Array.from(x[Cn].children);Cn>=V&&Cn<=dn&&T.push(...hn)}}if(c.outputFormat==="side-by-side"){const V=parseInt(m.children[W==="left"?0:2].innerText);let dn=R.findIndex(Sn=>Sn[W]===V);const Cn=parseInt(tn.children[z==="left"?0:2].innerText);let hn=R.findIndex(Sn=>Sn[z]===Cn);dn>hn&&([dn,hn]=[hn,dn]);const Tn=R.slice(dn,hn+1);for(let Sn=0;Sn<Tn.length;Sn++){const{left:Ae,right:pe}=Tn[Sn];Ae!==-1&&T.push(...M[Ae]),pe!==-1&&T.push(...U[pe])}}for(let V=0;V<C.length;V++)T.includes(C[V])?C[V].classList.add("comment-checked"):C[V].classList.remove("comment-checked")}}function K(){if(_=!1,B){let Z;c.outputFormat==="side-by-side"?Z=Io(T):Z=No(T),b=Z.lefts[0],S=Z.lefts[Z.lefts.length-1],I=Z.rights[0],P=Z.rights[Z.rights.length-1],o(Z)}document.removeEventListener("mouseup",K),document.removeEventListener("mousemove",H)}const fn=()=>{if(T.length)return c.outputFormat==="side-by-side"?Io(T):No(T)},on=()=>{bo(T),T=[]},cn=(Z,xn,Nn)=>{const tn=document.createElement("div");Eo(tn,xn,c.options);const{prevL:z,prevR:J,nextL:G,nextR:nn}=Z,V=Ao(Array.from(tn.querySelectorAll("tr")));if(Nn==="down"){const dn=Number(z)-1,Cn=Number(J)-1,hn=R.findIndex(Tn=>Tn.left===dn&&Tn.right===Cn);R.splice(hn+1,0,...V)}else{const dn=Number(G)+1,Cn=Number(nn)+1,hn=R.findIndex(Tn=>Tn.left===dn&&Tn.right===Cn);R.splice(hn,0,...V)}},gn=(Z,xn)=>{const Nn=Array.from(s.value.querySelectorAll("tr")).filter(G=>{var nn;return!((nn=G.classList)!=null&&nn.contains("expand-line"))}),{prevL:tn,nextL:z}=Z,J=Number(xn==="down"?tn:z);if(!(!T.length||J<b||J>S)){T=[];for(let G=0;G<Nn.length;G++){const nn=Nn[G];c.outputFormat==="side-by-side"?T.push(...Qs(nn,b,S,I,P)):T.push(...js(nn,b,S,I,P))}}};return g.watch([()=>c.outputFormat,()=>c.allowChecked],()=>{if(c.allowChecked&&c.outputFormat==="side-by-side"){const Z=document.createElement("div");Eo(Z,c.diff,c.options),R=Ao(Array.from(Z.querySelectorAll("tr")))}},{immediate:!0}),{onMousedown:N,updateLineNumberMap:cn,getCheckedLineDetails:fn,clearCommentClass:on,updateCheckedLine:gn}}function of(s,c,o){const{outputFormat:p,allowComment:_,allowChecked:m}=g.toRefs(c),x=ie("code-review"),{onMousedown:C,updateLineNumberMap:A,getCheckedLineDetails:B,clearCommentClass:R,updateCheckedLine:M}=rf(s,c,on),U=g.ref(-100),T=g.ref(-100);let W=-1,b=-1,S,I;const P=()=>{U.value=-100,T.value=-100,W=-1,b=-1,I==null||I.classList.remove("comment-icon-hover"),I=null},N=tn=>{var G,nn;const z=tn.composedPath(),J=z.find(V=>V.tagName==="TR");if(J)if(p.value==="line-by-line"){const V=Array.from(J.children)[0];if(I!==V&&(I==null||I.classList.remove("comment-icon-hover")),dt(V)){I=V,V.classList.add("comment-icon-hover");const{top:dn,left:Cn}=V.getBoundingClientRect();U.value=Cn,T.value=dn,W=parseInt((G=V.children[0])==null?void 0:G.innerText)||-1,b=parseInt((nn=V.children[1])==null?void 0:nn.innerText)||-1}else P()}else{if(J.classList.contains("comment-block"))return P();const V=z.find(Sn=>Sn.tagName==="TD"),dn=Array.from(J.children).findIndex(Sn=>Sn===V),Cn=Array.from(J.children),hn=Cn[0],Tn=Cn[2];if(dn<2)if(I!==hn&&(I==null||I.classList.remove("comment-icon-hover")),dt(hn)){I=hn,hn.classList.add("comment-icon-hover");const{top:Sn,left:Ae}=hn.getBoundingClientRect();U.value=Ae,T.value=Sn,W=parseInt(hn.innerText),b=parseInt(Tn.innerText||"-1"),S="left"}else P();else if(I!==Tn&&(I==null||I.classList.remove("comment-icon-hover")),Tn&&dt(Tn)){I=Tn,Tn.classList.add("comment-icon-hover");const{top:Sn,left:Ae}=Tn.getBoundingClientRect();U.value=Ae,T.value=Sn,W=parseInt(hn.innerText||"-1"),b=parseInt(Tn.innerText),S="right"}else P()}},H=tn=>{var z;(z=tn.relatedTarget)!=null&&z.classList.contains("comment-icon")||P()},K=tn=>{var z;(z=tn.relatedTarget)!=null&&z.classList.contains(x.e("content"))||P()},fn=()=>{let tn={left:W,right:b,position:S};const z=B();if(z&&m.value){const{lefts:J,rights:G}=z,nn=J[J.length-1],V=G[G.length-1];nn===W||V===b?tn.details=z:R()}o.emit("addComment",tn)};function on(tn){o.emit("afterCheckLines",{left:W,right:b,position:S,details:tn})}const cn=tn=>{tn&&!tn.composedPath().find(G=>{var nn,V;return((nn=G.classList)==null?void 0:nn.contains("comment-icon-hover"))||((V=G.classList)==null?void 0:V.contains("comment-icon"))})||fn()},gn=(tn,z,J)=>{if(p.value==="line-by-line"){const G=yo(s.value,tn,z);G&&Ys(G,J,z)}else{const G=Co(s.value,tn,z);G&&Js(G,J,z)}},Z=(tn,z)=>{if(p.value==="line-by-line"){const J=yo(s.value,tn,z);let G=J==null?void 0:J.nextElementSibling;for(;G;){const nn=G==null?void 0:G.classList;if((nn==null?void 0:nn.contains("comment-block"))&&nn.contains(z)){G.remove();return}G=G.nextElementSibling}}else{const J=Co(s.value,tn,z),G=J==null?void 0:J.nextElementSibling;if(G&&G.classList.contains("comment-block")){const nn=G.children[0],V=G.children[1];z==="left"?nn.children[0].remove():V.children[0].remove(),!nn.children.length&&!V.children.length&&G.remove()}}},xn=()=>{R()},Nn={};return _.value&&(Nn.onMousemove=N,Nn.onMouseleave=H),c.allowChecked&&(Nn.onMousedown=C),window.addEventListener("scroll",P),g.onUnmounted(()=>{window.removeEventListener("scroll",P)}),{commentLeft:U,commentTop:T,mouseEvent:Nn,clearCheckedLines:xn,onCommentMouseLeave:K,onCommentIconClick:cn,insertComment:gn,removeComment:Z,updateLineNumberMap:A,updateCheckedLine:M}}var Jp="",Pr=g.defineComponent({name:"DCodeReview",props:ao,emits:["foldChange","addComment","afterViewInit","contentRefresh","afterCheckLines"],setup(s,c){const o=ie("code-review"),{diffType:p}=g.toRefs(s),_=g.ref(),{commentLeft:m,commentTop:x,mouseEvent:C,onCommentMouseLeave:A,onCommentIconClick:B,insertComment:R,removeComment:M,clearCheckedLines:U,updateLineNumberMap:T,updateCheckedLine:W}=of(_,s,c),{renderHtml:b,diffFile:S,selectionSide:I,onContentClick:P}=ef(s,c,_,T,W),{isFold:N,toggleFold:H}=tf(s,c);return g.onMounted(()=>{c.emit("afterViewInit",{toggleFold:H,insertComment:R,removeComment:M,clearCheckedLines:U})}),g.provide(Rr,{diffType:p,reviewContentRef:_,diffInfo:S.value[0],isFold:N,rootCtx:c}),()=>{var K,fn;return g.createVNode("div",{class:[o.b(),{[o.m(`${I.value}-selected`)]:Boolean(I.value)}]},[g.createVNode(Ds,{onClick:()=>N.value=!N.value},null),g.withDirectives(g.createVNode("div",null,[s.showBlob?(fn=(K=c.slots).blob)==null?void 0:fn.call(K):g.createVNode("div",g.mergeProps({class:[o.e("content"),s.outputFormat],innerHTML:b.value,ref:_,onClick:on=>{P(on),B(on)}},C),null)]),[[g.vShow,!N.value]]),s.allowComment&&g.createVNode("div",{class:"comment-icon",style:{left:m.value+"px",top:x.value+"px"},onClick:B,onMouseleave:A},[g.createVNode(Fs,null,null)])])}}}),uf={title:"CodeReview \u4EE3\u7801\u68C0\u89C6",category:"\u6F14\u8FDB\u4E2D",status:"100%",install(s){s.component(Pr.name,Pr)}};Dn.CodeReview=Pr,Dn.CodeReviewInjectionKey=Rr,Dn.codeReviewProps=ao,Dn.default=uf,Object.defineProperties(Dn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
124
+ `,P=document.createElement("div");Sr(P,I+T,_.value,S,!0);const N=Array.from(P.querySelectorAll("tr")),H=N.find(on=>{var cn;return(cn=on.children[1])==null?void 0:cn.innerText.trim().match(Te)});if(!H)return;const K=N.filter(on=>on.children[0].children.length===2);vo(b,K,W),p(b.dataset,W),!Zs(b,H,W)&&(_o(b,H),W==="up"?b.previousElementSibling?Ue(b,m.value,"middle",!0):Ue(b,m.value,"top"):b.nextElementSibling?Ue(b,m.value,"middle",!0):Ue(b,m.value,"bottom"))};return{insertExpandButton:()=>{_.value==="side-by-side"?C():B()},onExpandButtonClick:(T,W)=>{var I,P;const S=T.composedPath().find(N=>{var H;return(H=N.classList)==null?void 0:H.contains("expand-icon")});if(S){const N=(I=Array.from(S.classList).find(gn=>gn.endsWith("expand")))==null?void 0:I.split("-")[0],H=N==="up"||N==="all"?"up":"down",[K,fn,on,cn]=zs(S,m.value);(P=x==null?void 0:x.value)==null||P.call(x,[K,fn,on,cn],gn=>{var Z,xn;_.value==="line-by-line"?R(gn,H,(Z=S.parentElement)==null?void 0:Z.parentElement,W):A(gn,H,(xn=S.parentElement)==null?void 0:xn.parentElement,W)})}}}}function ef(s,c,o,p,_){const{diff:m,outputFormat:x,allowExpand:C,showBlob:A}=g.toRefs(s),B=g.ref(""),R=g.ref([]),M=ie("code-review"),U=g.ref(""),{insertExpandButton:T,onExpandButtonClick:W}=nf(o,s,p,_),b=()=>{R.value=ds.parse(m.value),g.nextTick(()=>{xs&&!A.value&&(Sr(o.value,m.value,x.value,s.options),C.value&&T(),c.emit("contentRefresh",JSON.parse(JSON.stringify(R.value))))})},S=N=>{W(N,s.options)};function I(){if(U.value||typeof window=="undefined")return;const N=window.getSelection();if((N==null?void 0:N.toString())&&(N==null?void 0:N.anchorNode)){const H=Mr(N.anchorNode);H&&(U.value=H)}}function P(N){if(typeof window=="undefined")return;const H=window.getSelection(),K=N.composedPath(),fn=K.some(gn=>{var Z;return(Z=gn.classList)==null?void 0:Z.contains("d2h-code-side-linenumber")}),on=K.some(gn=>{var Z;return(Z=gn.classList)==null?void 0:Z.contains(M.e("content"))}),cn=Mr(N.target);H&&H.toString()?(!(H==null?void 0:H.getRangeAt(0).intersectsNode(N.target))||!on||cn==="left"&&U.value==="right"||cn==="right"&&U.value==="left"||fn)&&(setTimeout(()=>{U.value=""}),H.removeRange(H.getRangeAt(0))):U.value=""}return g.watch(A,b),g.watch(x,b),g.watch(m,b,{immediate:!0}),g.watch(()=>s.outputFormat,N=>{N==="side-by-side"?(document.addEventListener("selectionchange",I),document.addEventListener("mousedown",P,!0)):(document.removeEventListener("selectionchange",I),document.removeEventListener("mousedown",P,!0))},{immediate:!0}),g.onUnmounted(()=>{document.removeEventListener("selectionchange",I),document.removeEventListener("mousedown",P,!0)}),{renderHtml:B,diffFile:R,selectionSide:U,onContentClick:S}}function tf(s,c){const{fold:o}=g.toRefs(s),p=g.ref(o.value),_=m=>{m!==void 0?p.value=m:p.value=!p.value};return g.watch(o,m=>{p.value=m}),g.watch(p,()=>{c.emit("foldChange",p.value)}),{isFold:p,toggleFold:_}}function rf(s,c,o){const p=ie("code-review");let _=!1,m,x,C=[],A,B,R=[],M={},U={},T=[],W,b,S,I,P;const N=Z=>{var xn;if(Z.button===0){const Nn=Z.composedPath(),tn=Nn.find(J=>{var G,nn;return((G=J.classList)==null?void 0:G.contains("comment-icon-hover"))||((nn=J.classList)==null?void 0:nn.contains("comment-icon"))});if(x=Array.from(s.value.querySelectorAll("tr")).filter(J=>{var G;return!((G=J.classList)!=null&&G.contains("expand-line"))}),!tn)return;const z=Br(Z.target);if(z&&((xn=z==null?void 0:z.classList)==null?void 0:xn.contains("expand-line")))return;m=z,C=[];for(let J=0;J<x.length;J++)C.push(...x[J].children);if(c.outputFormat==="side-by-side"){const{left:J,right:G}=Xs(x);M=J,U=G,W=Nn.some(nn=>{var V;return(V=nn.classList)==null?void 0:V.contains("d-code-left")})?"left":"right"}_=!0,A=!0,B=!1,Z.preventDefault(),Z.stopPropagation(),document.addEventListener("mousemove",H),document.addEventListener("mouseup",K)}};function H(Z){var G,nn;if(!_)return;A&&(bo(T),A=!1);const xn=Z.composedPath();if(!xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains(p.e("content"))}))return;const tn=Br(Z.target);let z;if(c.outputFormat==="side-by-side"&&(xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains("d-code-left")})&&(z="left"),xn.some(V=>{var dn;return(dn=V.classList)==null?void 0:dn.contains("d-code-right")})&&(z="right")),!tn)return;B=!0;const J=tn.children;if(!(z==="left"&&isNaN(parseInt((G=J[0])==null?void 0:G.innerText))||z==="right"&&isNaN(parseInt((nn=J[2])==null?void 0:nn.innerText)))){if(T=[],c.outputFormat==="line-by-line"){let V=x.indexOf(m),dn=x.indexOf(tn);if(dn===-1)return;V>dn&&([V,dn]=[dn,V]);for(let Cn=0;Cn<x.length;Cn++){const hn=Array.from(x[Cn].children);Cn>=V&&Cn<=dn&&T.push(...hn)}}if(c.outputFormat==="side-by-side"){const V=parseInt(m.children[W==="left"?0:2].innerText);let dn=R.findIndex(Sn=>Sn[W]===V);const Cn=parseInt(tn.children[z==="left"?0:2].innerText);let hn=R.findIndex(Sn=>Sn[z]===Cn);dn>hn&&([dn,hn]=[hn,dn]);const Tn=R.slice(dn,hn+1);for(let Sn=0;Sn<Tn.length;Sn++){const{left:Ae,right:pe}=Tn[Sn];Ae!==-1&&T.push(...M[Ae]),pe!==-1&&T.push(...U[pe])}}for(let V=0;V<C.length;V++)T.includes(C[V])?C[V].classList.add("comment-checked"):C[V].classList.remove("comment-checked")}}function K(){if(_=!1,B){let Z;c.outputFormat==="side-by-side"?Z=Io(T):Z=No(T),b=Z.lefts[0],S=Z.lefts[Z.lefts.length-1],I=Z.rights[0],P=Z.rights[Z.rights.length-1],o(Z)}document.removeEventListener("mouseup",K),document.removeEventListener("mousemove",H)}const fn=()=>{if(T.length)return c.outputFormat==="side-by-side"?Io(T):No(T)},on=()=>{bo(T),T=[]},cn=(Z,xn,Nn)=>{const tn=document.createElement("div");Eo(tn,xn,c.options);const{prevL:z,prevR:J,nextL:G,nextR:nn}=Z,V=Ao(Array.from(tn.querySelectorAll("tr")));if(Nn==="down"){const dn=Number(z)-1,Cn=Number(J)-1,hn=R.findIndex(Tn=>Tn.left===dn&&Tn.right===Cn);R.splice(hn+1,0,...V)}else{const dn=Number(G)+1,Cn=Number(nn)+1,hn=R.findIndex(Tn=>Tn.left===dn&&Tn.right===Cn);R.splice(hn,0,...V)}},gn=(Z,xn)=>{const Nn=Array.from(s.value.querySelectorAll("tr")).filter(G=>{var nn;return!((nn=G.classList)!=null&&nn.contains("expand-line"))}),{prevL:tn,nextL:z}=Z,J=Number(xn==="down"?tn:z);if(!(!T.length||J<b||J>S)){T=[];for(let G=0;G<Nn.length;G++){const nn=Nn[G];c.outputFormat==="side-by-side"?T.push(...Qs(nn,b,S,I,P)):T.push(...js(nn,b,S,I,P))}}};return g.watch([()=>c.outputFormat,()=>c.allowChecked],()=>{if(c.allowChecked&&c.outputFormat==="side-by-side"){const Z=document.createElement("div");Eo(Z,c.diff,c.options),R=Ao(Array.from(Z.querySelectorAll("tr")))}},{immediate:!0}),{onMousedown:N,updateLineNumberMap:cn,getCheckedLineDetails:fn,clearCommentClass:on,updateCheckedLine:gn}}function of(s,c,o){const{outputFormat:p,allowComment:_,allowChecked:m}=g.toRefs(c),x=ie("code-review"),{onMousedown:C,updateLineNumberMap:A,getCheckedLineDetails:B,clearCommentClass:R,updateCheckedLine:M}=rf(s,c,on),U=g.ref(-100),T=g.ref(-100);let W=-1,b=-1,S,I;const P=()=>{U.value=-100,T.value=-100,W=-1,b=-1,I==null||I.classList.remove("comment-icon-hover"),I=null},N=tn=>{var G,nn;const z=tn.composedPath(),J=z.find(V=>V.tagName==="TR");if(J)if(p.value==="line-by-line"){const V=Array.from(J.children)[0];if(I!==V&&(I==null||I.classList.remove("comment-icon-hover")),dt(V)){I=V,V.classList.add("comment-icon-hover");const{top:dn,left:Cn}=V.getBoundingClientRect();U.value=Cn,T.value=dn,W=parseInt((G=V.children[0])==null?void 0:G.innerText)||-1,b=parseInt((nn=V.children[1])==null?void 0:nn.innerText)||-1}else P()}else{if(J.classList.contains("comment-block"))return P();const V=z.find(Sn=>Sn.tagName==="TD"),dn=Array.from(J.children).findIndex(Sn=>Sn===V),Cn=Array.from(J.children),hn=Cn[0],Tn=Cn[2];if(dn<2)if(I!==hn&&(I==null||I.classList.remove("comment-icon-hover")),dt(hn)){I=hn,hn.classList.add("comment-icon-hover");const{top:Sn,left:Ae}=hn.getBoundingClientRect();U.value=Ae,T.value=Sn,W=parseInt(hn.innerText),b=parseInt(Tn.innerText||"-1"),S="left"}else P();else if(I!==Tn&&(I==null||I.classList.remove("comment-icon-hover")),Tn&&dt(Tn)){I=Tn,Tn.classList.add("comment-icon-hover");const{top:Sn,left:Ae}=Tn.getBoundingClientRect();U.value=Ae,T.value=Sn,W=parseInt(hn.innerText||"-1"),b=parseInt(Tn.innerText),S="right"}else P()}},H=tn=>{var z;(z=tn.relatedTarget)!=null&&z.classList.contains("comment-icon")||P()},K=tn=>{var z;(z=tn.relatedTarget)!=null&&z.classList.contains(x.e("content"))||P()},fn=()=>{let tn={left:W,right:b,position:S};const z=B();if(z&&m.value){const{lefts:J,rights:G}=z,nn=J[J.length-1],V=G[G.length-1];nn===W||V===b?tn.details=z:R()}o.emit("addComment",tn)};function on(tn){o.emit("afterCheckLines",{left:W,right:b,position:S,details:tn})}const cn=tn=>{tn&&!tn.composedPath().find(G=>{var nn,V;return((nn=G.classList)==null?void 0:nn.contains("comment-icon-hover"))||((V=G.classList)==null?void 0:V.contains("comment-icon"))})||fn()},gn=(tn,z,J)=>{if(p.value==="line-by-line"){const G=yo(s.value,tn,z);G&&Ys(G,J,z)}else{const G=Co(s.value,tn,z);G&&Js(G,J,z)}},Z=(tn,z)=>{if(p.value==="line-by-line"){const J=yo(s.value,tn,z);let G=J==null?void 0:J.nextElementSibling;for(;G;){const nn=G==null?void 0:G.classList;if((nn==null?void 0:nn.contains("comment-block"))&&nn.contains(z)){G.remove();return}G=G.nextElementSibling}}else{const J=Co(s.value,tn,z),G=J==null?void 0:J.nextElementSibling;if(G&&G.classList.contains("comment-block")){const nn=G.children[0],V=G.children[1];z==="left"?nn.children[0].remove():V.children[0].remove(),!nn.children.length&&!V.children.length&&G.remove()}}},xn=()=>{R()},Nn={};return _.value&&(Nn.onMousemove=N,Nn.onMouseleave=H),c.allowChecked&&(Nn.onMousedown=C),window.addEventListener("scroll",P),g.onUnmounted(()=>{window.removeEventListener("scroll",P)}),{commentLeft:U,commentTop:T,mouseEvent:Nn,clearCheckedLines:xn,onCommentMouseLeave:K,onCommentIconClick:cn,insertComment:gn,removeComment:Z,updateLineNumberMap:A,updateCheckedLine:M}}var Jp="",Pr=g.defineComponent({name:"DCodeReview",props:ao,emits:["foldChange","addComment","afterViewInit","contentRefresh","afterCheckLines"],setup(s,c){const o=ie("code-review"),{diffType:p}=g.toRefs(s),_=g.ref(),{commentLeft:m,commentTop:x,mouseEvent:C,onCommentMouseLeave:A,onCommentIconClick:B,insertComment:R,removeComment:M,clearCheckedLines:U,updateLineNumberMap:T,updateCheckedLine:W}=of(_,s,c),{renderHtml:b,diffFile:S,selectionSide:I,onContentClick:P}=ef(s,c,_,T,W),{isFold:N,toggleFold:H}=tf(s,c);return g.onMounted(()=>{c.emit("afterViewInit",{toggleFold:H,insertComment:R,removeComment:M,clearCheckedLines:U})}),g.provide(Rr,{diffType:p,reviewContentRef:_,diffInfo:S.value[0],isFold:N,rootCtx:c}),()=>{var K,fn;return g.createVNode("div",{class:[o.b(),{[o.m(`${I.value}-selected`)]:Boolean(I.value)}]},[g.createVNode(Ds,{onClick:()=>N.value=!N.value},null),g.withDirectives(g.createVNode("div",null,[s.showBlob?(fn=(K=c.slots).blob)==null?void 0:fn.call(K):g.createVNode("div",g.mergeProps({class:[o.e("content"),s.outputFormat],innerHTML:b.value,ref:_,onClick:on=>{P(on),B(on)}},C),null)]),[[g.vShow,!N.value]]),s.allowComment&&g.createVNode("div",{class:"comment-icon",style:{left:m.value+"px",top:x.value+"px"},onClick:B,onMouseleave:A},[g.createVNode(Fs,null,null)])])}}}),uf={title:"CodeReview \u4EE3\u7801\u68C0\u89C6",category:"\u6F14\u8FDB\u4E2D",status:"100%",install(s){s.component(Pr.name,Pr)}};Dn.CodeReview=Pr,Dn.CodeReviewInjectionKey=Rr,Dn.codeReviewProps=ao,Dn.default=uf,Object.defineProperties(Dn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-devui",
3
- "version": "1.6.31",
3
+ "version": "1.6.32",
4
4
  "license": "MIT",
5
5
  "description": "DevUI components based on Vite and Vue3",
6
6
  "keywords": [
package/vue-devui.es.js CHANGED
@@ -17923,8 +17923,8 @@ function useCodeReview(props, ctx2, reviewContentRef, updateLineNumberMap, updat
17923
17923
  if (!isInRange || !isClickInner || clickSide === "left" && selectionSide.value === "right" || clickSide === "right" && selectionSide.value === "left" || isLineNumber) {
17924
17924
  setTimeout(() => {
17925
17925
  selectionSide.value = "";
17926
- selection.removeAllRanges();
17927
17926
  });
17927
+ selection.removeRange(selection.getRangeAt(0));
17928
17928
  }
17929
17929
  } else {
17930
17930
  selectionSide.value = "";
@@ -54534,7 +54534,7 @@ const installs = [
54534
54534
  VirtualListInstall
54535
54535
  ];
54536
54536
  var vueDevui = {
54537
- version: "1.6.31",
54537
+ version: "1.6.32",
54538
54538
  install(app) {
54539
54539
  installs.forEach((p) => app.use(p));
54540
54540
  }