video-split-screen 1.0.15 → 1.0.17
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/index.js +1 -1
- package/dist/index.mjs +191 -222
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4}},I={};function G(i){if(I[i])return I[i];const o={1:[{col:1,colSpan:1,row:1,rowSpan:1}],2:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1}],3:[{col:1,colSpan:1,row:1,rowSpan:2,isMain:!0},{col:2,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],4:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],6:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1}],7:[{col:1,colSpan:2,row:1,rowSpan:2},{col:3,colSpan:2,row:1,rowSpan:2},{col:1,colSpan:2,row:3,rowSpan:2},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],8:[{col:1,colSpan:3,row:1,rowSpan:3,isMain:!0},{col:4,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],9:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1}],10:[{col:1,colSpan:5,row:1,rowSpan:3,isMain:!0},{col:6,colSpan:1,row:1,rowSpan:1},{col:6,colSpan:1,row:2,rowSpan:1},{col:6,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1},{col:5,colSpan:1,row:4,rowSpan:1},{col:6,colSpan:1,row:4,rowSpan:1}],13:[{col:1,colSpan:2,row:1,rowSpan:2,isMain:!0},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],16:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}]}[i]||[];return o.length>0&&(I[i]=o),o}function M(){return Object.keys(y)}const K={class:"layout-icon"},Z={key:0,viewBox:"0 0 48 48",fill:"none"},ee={key:1,viewBox:"0 0 48 48",fill:"none"},te={key:2,viewBox:"0 0 48 48",fill:"none"},oe={key:3,viewBox:"0 0 48 48",fill:"none"},re={key:4,viewBox:"0 0 48 48",fill:"none"},ae={key:5,viewBox:"0 0 48 48",fill:"none"},le={key:6,viewBox:"0 0 48 48",fill:"none"},ne={key:7,viewBox:"0 0 48 48",fill:"none"},ce={key:8,viewBox:"0 0 54 48",fill:"none"},ie={key:9,viewBox:"0 0 48 48",fill:"none"},de={key:10,viewBox:"0 0 48 48",fill:"none"},se=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(i){return(v,o)=>(e.openBlock(),e.createElementBlock("div",K,[i.type==="1"?(e.openBlock(),e.createElementBlock("svg",Z,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):i.type==="2"?(e.openBlock(),e.createElementBlock("svg",ee,[...o[1]||(o[1]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="3"?(e.openBlock(),e.createElementBlock("svg",te,[...o[2]||(o[2]=[e.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="4"?(e.openBlock(),e.createElementBlock("svg",oe,[...o[3]||(o[3]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="6"?(e.openBlock(),e.createElementBlock("svg",re,[...o[4]||(o[4]=[e.createStaticVNode('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',6)])])):i.type==="7"?(e.openBlock(),e.createElementBlock("svg",ae,[...o[5]||(o[5]=[e.createStaticVNode('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',7)])])):i.type==="8"?(e.openBlock(),e.createElementBlock("svg",le,[...o[6]||(o[6]=[e.createStaticVNode('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',8)])])):i.type==="9"?(e.openBlock(),e.createElementBlock("svg",ne,[...o[7]||(o[7]=[e.createStaticVNode('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',9)])])):i.type==="10"?(e.openBlock(),e.createElementBlock("svg",ce,[...o[8]||(o[8]=[e.createStaticVNode('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',10)])])):i.type==="13"?(e.openBlock(),e.createElementBlock("svg",ie,[...o[9]||(o[9]=[e.createStaticVNode('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',13)])])):i.type==="16"?(e.openBlock(),e.createElementBlock("svg",de,[...o[10]||(o[10]=[e.createStaticVNode('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',16)])])):e.createCommentVNode("",!0)]))}}),O=(i,v)=>{const o=i.__vccOpts||i;for(const[g,w]of v)o[g]=w;return o},$=O(se,[["__scopeId","data-v-31e0404d"]]),he={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},we={class:"layout-buttons"},ue=["onClick","title","aria-label","aria-pressed"],pe={class:"layout-label"},ve={class:"video-grid-container",role:"region","aria-label":"视频网格"},ye=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ke={class:"video-placeholder"},ge={class:"placeholder-number"},Se=.5,me="grabbing",fe="0.8",Ce=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(i,{emit:v}){const o=i,g=v,w=e.ref(o.layout);e.watch(()=>o.layout,t=>{w.value=t});const P=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:M()),p=e.shallowRef([]);function E(t){const r=Array.isArray(t)?t:o.videos||[],l=V.value,a={};p.value.forEach((s,h)=>{s&&s.id!==void 0&&(a[s.id]=s.__labelNumber??h+1)});const c=Array.from({length:l}).map((s,h)=>{const n=r[h];if(n){const k=a[n.id]??n.__labelNumber??h+1;return{...n,__labelNumber:k}}});p.value=c}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}E(t)},{flush:"post"});let A=!1;e.watch(p,t=>{!A&&Array.isArray(t)&&g("videosChange",t)});const _=e.computed(()=>{const t=y[w.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${w.value}, fallback to '4'`),y[4])}),S=e.computed(()=>G(w.value)),V=e.computed(()=>{var t;return((t=_.value)==null?void 0:t.count)||4}),x=e.computed(()=>p.value.slice(0,V.value).map(t=>t).filter(Boolean));E(o.videos),e.watch(V,()=>{E(o.videos)});const T=e.computed(()=>{const t=S.value.map((r,l)=>({p:r,idx:l}));return t.sort((r,l)=>r.p.row===l.p.row?(r.p.col||0)-(l.p.col||0):(r.p.row||0)-(l.p.row||0)),t.map(r=>r.idx)}),u=e.ref(-1),m=e.ref(-1),b=e.shallowRef(null),d=e.shallowRef(null);let f=null,C=null;const z=e.computed(()=>{const t=_.value;return{display:"grid",gridTemplateColumns:(t==null?void 0:t.colTemplate)||`repeat(${(t==null?void 0:t.cols)||2}, 1fr)`,gridTemplateRows:(t==null?void 0:t.rowTemplate)||`repeat(${(t==null?void 0:t.rows)||2}, 1fr)`,gap:"4px",width:o.width||"100%",height:o.height||"100%"}}),F=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function Y(t){const r=t,l=T.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[l]!==void 0)return String(o.placeholders[l]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function H(t){const r=S.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function U(t){const r=S.value[t];return(r==null?void 0:r.isMain)||!1}function j(t){w.value=t,g("layoutChange",w.value)}function B(){if(b.value&&document.body.contains(b.value)){try{document.body.removeChild(b.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}b.value=null}if(d.value&&document.body.contains(d.value)){try{document.body.removeChild(d.value)}catch{}d.value=null}f&&(document.removeEventListener("mousemove",f),f=null),C&&(document.removeEventListener("drag",C),C=null)}function q(t,r){if(r<0||r>=p.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(u.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(B(),t.dataTransfer){t.dataTransfer.effectAllowed="move";const n=new Image;n.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t.dataTransfer.setDragImage(n,0,0)}const c=a.cloneNode(!0);c.querySelectorAll(".progress-bar, .play-button").forEach(n=>n.remove()),c.querySelectorAll('[style*="transition"], [style*="animation"], .video-icon').forEach(n=>{try{n.style.transition="none",n.style.animation="none"}catch{}}),c.style.position="fixed",c.style.margin="0",c.style.pointerEvents="none",c.style.opacity=fe,c.style.zIndex="9999",document.body.appendChild(c),d.value=c;try{const n=a.getBoundingClientRect();c.style.width=`${n.width}px`,c.style.height=`${n.height}px`}catch{}f=n=>{if(!d.value)return;const k=d.value.offsetWidth||0,L=d.value.offsetHeight||0,N=Math.max(0,n.clientX-k/2),D=Math.max(0,n.clientY-L/2);d.value.style.left=`${N}px`,d.value.style.top=`${D}px`},document.addEventListener("mousemove",f),C=n=>{if(!d.value)return;const k=d.value.offsetWidth||0,L=d.value.offsetHeight||0,N=Math.max(0,(n.clientX||0)-k/2),D=Math.max(0,(n.clientY||0)-L/2);d.value.style.left=`${N}px`,d.value.style.top=`${D}px`},document.addEventListener("drag",C),a.style.opacity=String(Se),a.style.cursor=me,a.style.borderColor="#ff6b6b"}catch(c){console.error("[VideoGridLayout] Drag start error:",c),B()}}function W(t,r){t.preventDefault(),t.stopPropagation();const l=u.value;if(l===-1||l===r){u.value=-1;return}if(r<0||r>=S.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),u.value=-1;return}try{const a=t.currentTarget;a&&(a.style.backgroundColor="rgba(66, 184, 131, 0.3)",a.style.borderColor="#42b883",setTimeout(()=>{a.style.backgroundColor="",a.style.borderColor=""},200));const c=[...p.value],s=c[l],h=c[r];c[l]=h,c[r]=s,A=!0,p.value=c,setTimeout(()=>{A=!1,g("videosChange",p.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{u.value=-1}}function X(t,r){t.preventDefault(),u.value!==-1&&u.value!==r&&(m.value=r)}function Q(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||m.value===r&&(m.value=-1)}function J(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move",l.style.borderColor=""),B(),u.value=-1,m.value=-1}return e.onBeforeUnmount(()=>{B()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(F.value)},[i.showToolbar?(e.openBlock(),e.createElementBlock("div",he,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,l=>{var a,c,s;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:w.value===l}]),onClick:h=>j(l),title:((a=e.unref(y)[l])==null?void 0:a.label)||"","aria-label":`切换到${((c=e.unref(y)[l])==null?void 0:c.label)||""}布局`,"aria-pressed":w.value===l,type:"button"},[e.createVNode($,{type:l},null,8,["type"]),e.createElementVNode("span",pe,e.toDisplayString(((s=e.unref(y)[l])==null?void 0:s.label)||""),1)],10,ue)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",ve,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(z.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(l,a)=>{var c,s,h;return e.openBlock(),e.createElementBlock("div",{key:((c=x.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":U(a),dragging:u.value===a,"drag-over":m.value===a&&u.value!==a}]),style:e.normalizeStyle(H(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((s=x.value[a])==null?void 0:s.title)||((h=x.value[a])==null?void 0:h.id)||""}`,role:"article",tabindex:"0",onDragstart:n=>q(n,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:n=>X(n,a),onDragleave:n=>Q(n,a),onDrop:n=>W(n,a),onDragend:J},[e.renderSlot(t.$slots,"video",{video:x.value[a],index:a},()=>[e.createElementVNode("div",ke,[e.createElementVNode("div",ge,e.toDisplayString(Y(T.value.indexOf(a))),1)])],!0)],46,ye)}),128))],4)])],4))}}),R=O(Ce,[["__scopeId","data-v-f0958f8e"]]),xe={VideoGridLayout:R,VideoLayoutIcon:$},be={install(i){Object.entries(xe).forEach(([v,o])=>{i.component(v,o)})}};exports.LAYOUT_CONFIGS=y;exports.VideoGridLayout=R;exports.VideoLayoutIcon=$;exports.default=be;exports.getAllLayoutTypes=M;exports.getLayoutPositions=G;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4}},B={};function L(n){if(B[n])return B[n];const o={1:[{col:1,colSpan:1,row:1,rowSpan:1}],2:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1}],3:[{col:1,colSpan:1,row:1,rowSpan:2,isMain:!0},{col:2,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],4:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],6:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1}],7:[{col:1,colSpan:2,row:1,rowSpan:2},{col:3,colSpan:2,row:1,rowSpan:2},{col:1,colSpan:2,row:3,rowSpan:2},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],8:[{col:1,colSpan:3,row:1,rowSpan:3,isMain:!0},{col:4,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],9:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1}],10:[{col:1,colSpan:5,row:1,rowSpan:3,isMain:!0},{col:6,colSpan:1,row:1,rowSpan:1},{col:6,colSpan:1,row:2,rowSpan:1},{col:6,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1},{col:5,colSpan:1,row:4,rowSpan:1},{col:6,colSpan:1,row:4,rowSpan:1}],13:[{col:1,colSpan:2,row:1,rowSpan:2,isMain:!0},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],16:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}]}[n]||[];return o.length>0&&(B[n]=o),o}function D(){return Object.keys(k)}const H={class:"layout-icon"},W={key:0,viewBox:"0 0 48 48",fill:"none"},q={key:1,viewBox:"0 0 48 48",fill:"none"},J={key:2,viewBox:"0 0 48 48",fill:"none"},K={key:3,viewBox:"0 0 48 48",fill:"none"},Q={key:4,viewBox:"0 0 48 48",fill:"none"},X={key:5,viewBox:"0 0 48 48",fill:"none"},Z={key:6,viewBox:"0 0 48 48",fill:"none"},ee={key:7,viewBox:"0 0 48 48",fill:"none"},te={key:8,viewBox:"0 0 54 48",fill:"none"},oe={key:9,viewBox:"0 0 48 48",fill:"none"},re={key:10,viewBox:"0 0 48 48",fill:"none"},ae=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(n){return(p,o)=>(e.openBlock(),e.createElementBlock("div",H,[n.type==="1"?(e.openBlock(),e.createElementBlock("svg",W,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):n.type==="2"?(e.openBlock(),e.createElementBlock("svg",q,[...o[1]||(o[1]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="3"?(e.openBlock(),e.createElementBlock("svg",J,[...o[2]||(o[2]=[e.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="4"?(e.openBlock(),e.createElementBlock("svg",K,[...o[3]||(o[3]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="6"?(e.openBlock(),e.createElementBlock("svg",Q,[...o[4]||(o[4]=[e.createStaticVNode('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',6)])])):n.type==="7"?(e.openBlock(),e.createElementBlock("svg",X,[...o[5]||(o[5]=[e.createStaticVNode('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',7)])])):n.type==="8"?(e.openBlock(),e.createElementBlock("svg",Z,[...o[6]||(o[6]=[e.createStaticVNode('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',8)])])):n.type==="9"?(e.openBlock(),e.createElementBlock("svg",ee,[...o[7]||(o[7]=[e.createStaticVNode('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',9)])])):n.type==="10"?(e.openBlock(),e.createElementBlock("svg",te,[...o[8]||(o[8]=[e.createStaticVNode('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',10)])])):n.type==="13"?(e.openBlock(),e.createElementBlock("svg",oe,[...o[9]||(o[9]=[e.createStaticVNode('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',13)])])):n.type==="16"?(e.openBlock(),e.createElementBlock("svg",re,[...o[10]||(o[10]=[e.createStaticVNode('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',16)])])):e.createCommentVNode("",!0)]))}}),_=(n,p)=>{const o=n.__vccOpts||n;for(const[v,s]of p)o[v]=s;return o},E=_(ae,[["__scopeId","data-v-31e0404d"]]),le={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ce={class:"layout-buttons"},ne=["onClick","title","aria-label","aria-pressed"],ie={class:"layout-label"},de={class:"video-grid-container",role:"region","aria-label":"视频网格"},se=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],he={class:"video-placeholder"},we={class:"placeholder-number"},ue=.5,pe="grabbing",ke="0.8",ve=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(n,{emit:p}){const o=n,v=p,s=e.ref(o.layout);e.watch(()=>o.layout,t=>{s.value=t});const $=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:D()),u=e.shallowRef([]);function f(t){const r=Array.isArray(t)?t:o.videos||[],l=b.value,a={};u.value.forEach((i,w)=>{i&&i.id!==void 0&&(a[i.id]=i.__labelNumber??w+1)});const c=Array.from({length:l}).map((i,w)=>{const d=r[w];if(d){const j=a[d.id]??d.__labelNumber??w+1;return{...d,__labelNumber:j}}});u.value=c}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}f(t)},{flush:"post"});let x=!1;e.watch(u,t=>{!x&&Array.isArray(t)&&v("videosChange",t)});const V=e.computed(()=>{const t=k[s.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${s.value}, fallback to '4'`),k[4])}),y=e.computed(()=>L(s.value)),b=e.computed(()=>{var t;return((t=V.value)==null?void 0:t.count)||4}),C=e.computed(()=>u.value.slice(0,b.value).map(t=>t).filter(Boolean));f(o.videos),e.watch(b,()=>{f(o.videos)});const N=e.computed(()=>{const t=y.value.map((r,l)=>({p:r,idx:l}));return t.sort((r,l)=>r.p.row===l.p.row?(r.p.col||0)-(l.p.col||0):(r.p.row||0)-(l.p.row||0)),t.map(r=>r.idx)}),h=e.ref(-1),S=e.ref(-1),g=e.shallowRef(null),A=e.computed(()=>{const t=V.value;return{display:"grid",gridTemplateColumns:(t==null?void 0:t.colTemplate)||`repeat(${(t==null?void 0:t.cols)||2}, 1fr)`,gridTemplateRows:(t==null?void 0:t.rowTemplate)||`repeat(${(t==null?void 0:t.rows)||2}, 1fr)`,gap:"4px",width:o.width||"100%",height:o.height||"100%"}}),T=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function G(t){const r=t,l=N.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[l]!==void 0)return String(o.placeholders[l]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function O(t){const r=y.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function M(t){const r=y.value[t];return(r==null?void 0:r.isMain)||!1}function R(t){s.value=t,v("layoutChange",s.value)}function m(){if(g.value&&document.body.contains(g.value)){try{document.body.removeChild(g.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}g.value=null}}function P(t,r){if(r<0||r>=u.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(h.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{m();const c=a.cloneNode(!0);c.style.width=`${a.offsetWidth}px`,c.style.height=`${a.offsetHeight}px`,c.style.opacity=ke,c.style.position="absolute",c.style.top="-9999px",c.style.pointerEvents="none",document.body.appendChild(c),g.value=c,t.dataTransfer.setDragImage(c,a.offsetWidth/2,a.offsetHeight/2),setTimeout(()=>{m()},100),a.style.opacity=String(ue),a.style.cursor=pe}catch(c){console.error("[VideoGridLayout] Drag start error:",c),m()}}function F(t,r){t.preventDefault(),t.stopPropagation();const l=h.value;if(l===-1||l===r){h.value=-1;return}if(r<0||r>=y.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),h.value=-1;return}try{const a=t.currentTarget;a&&(a.style.backgroundColor="rgba(66, 184, 131, 0.3)",a.style.borderColor="#42b883",setTimeout(()=>{a.style.backgroundColor="",a.style.borderColor=""},200));const c=[...u.value],i=c[l],w=c[r];c[l]=w,c[r]=i,x=!0,u.value=c,setTimeout(()=>{x=!1,v("videosChange",u.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{h.value=-1}}function z(t,r){t.preventDefault(),h.value!==-1&&h.value!==r&&(S.value=r)}function U(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||S.value===r&&(S.value=-1)}function Y(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),m(),h.value=-1,S.value=-1}return e.onBeforeUnmount(()=>{m()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(T.value)},[n.showToolbar?(e.openBlock(),e.createElementBlock("div",le,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,l=>{var a,c,i;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:s.value===l}]),onClick:w=>R(l),title:((a=e.unref(k)[l])==null?void 0:a.label)||"","aria-label":`切换到${((c=e.unref(k)[l])==null?void 0:c.label)||""}布局`,"aria-pressed":s.value===l,type:"button"},[e.createVNode(E,{type:l},null,8,["type"]),e.createElementVNode("span",ie,e.toDisplayString(((i=e.unref(k)[l])==null?void 0:i.label)||""),1)],10,ne)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(A.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(l,a)=>{var c,i,w;return e.openBlock(),e.createElementBlock("div",{key:((c=C.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":M(a),dragging:h.value===a,"drag-over":S.value===a&&h.value!==a}]),style:e.normalizeStyle(O(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((i=C.value[a])==null?void 0:i.title)||((w=C.value[a])==null?void 0:w.id)||""}`,role:"article",tabindex:"0",onDragstart:d=>P(d,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:d=>z(d,a),onDragleave:d=>U(d,a),onDrop:d=>F(d,a),onDragend:Y},[e.renderSlot(t.$slots,"video",{video:C.value[a],index:a},()=>[e.createElementVNode("div",he,[e.createElementVNode("div",we,e.toDisplayString(G(N.value.indexOf(a))),1)])],!0)],46,se)}),128))],4)])],4))}}),I=_(ve,[["__scopeId","data-v-1b7d75db"]]),ye={VideoGridLayout:I,VideoLayoutIcon:E},Se={install(n){Object.entries(ye).forEach(([p,o])=>{n.component(p,o)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=I;exports.VideoLayoutIcon=E;exports.default=Se;exports.getAllLayoutTypes=D;exports.getLayoutPositions=L;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as F, createElementBlock as c, openBlock as i, createCommentVNode as U, createElementVNode as d, createStaticVNode as g, ref as A, watch as L, computed as y, shallowRef as E, onBeforeUnmount as at, normalizeStyle as B, Fragment as N, renderList as M, unref as V, normalizeClass as R, createVNode as lt, toDisplayString as P, withModifiers as nt, renderSlot as ct } from "vue";
|
|
2
|
+
const S = {
|
|
3
3
|
1: {
|
|
4
4
|
type: "1",
|
|
5
5
|
label: "1分屏",
|
|
@@ -77,11 +77,11 @@ const C = {
|
|
|
77
77
|
cols: 4,
|
|
78
78
|
rows: 4
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
function
|
|
82
|
-
if (
|
|
83
|
-
return
|
|
84
|
-
const
|
|
80
|
+
}, T = {};
|
|
81
|
+
function it(n) {
|
|
82
|
+
if (T[n])
|
|
83
|
+
return T[n];
|
|
84
|
+
const o = {
|
|
85
85
|
1: [
|
|
86
86
|
{ col: 1, colSpan: 1, row: 1, rowSpan: 1 }
|
|
87
87
|
],
|
|
@@ -183,64 +183,64 @@ function pt(c) {
|
|
|
183
183
|
{ col: 3, colSpan: 1, row: 4, rowSpan: 1 },
|
|
184
184
|
{ col: 4, colSpan: 1, row: 4, rowSpan: 1 }
|
|
185
185
|
]
|
|
186
|
-
}[
|
|
187
|
-
return
|
|
186
|
+
}[n] || [];
|
|
187
|
+
return o.length > 0 && (T[n] = o), o;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return Object.keys(
|
|
189
|
+
function dt() {
|
|
190
|
+
return Object.keys(S);
|
|
191
191
|
}
|
|
192
|
-
const
|
|
192
|
+
const st = { class: "layout-icon" }, ht = {
|
|
193
193
|
key: 0,
|
|
194
194
|
viewBox: "0 0 48 48",
|
|
195
195
|
fill: "none"
|
|
196
|
-
},
|
|
196
|
+
}, wt = {
|
|
197
197
|
key: 1,
|
|
198
198
|
viewBox: "0 0 48 48",
|
|
199
199
|
fill: "none"
|
|
200
|
-
},
|
|
200
|
+
}, ut = {
|
|
201
201
|
key: 2,
|
|
202
202
|
viewBox: "0 0 48 48",
|
|
203
203
|
fill: "none"
|
|
204
|
-
},
|
|
204
|
+
}, pt = {
|
|
205
205
|
key: 3,
|
|
206
206
|
viewBox: "0 0 48 48",
|
|
207
207
|
fill: "none"
|
|
208
|
-
},
|
|
208
|
+
}, vt = {
|
|
209
209
|
key: 4,
|
|
210
210
|
viewBox: "0 0 48 48",
|
|
211
211
|
fill: "none"
|
|
212
|
-
},
|
|
212
|
+
}, yt = {
|
|
213
213
|
key: 5,
|
|
214
214
|
viewBox: "0 0 48 48",
|
|
215
215
|
fill: "none"
|
|
216
|
-
},
|
|
216
|
+
}, kt = {
|
|
217
217
|
key: 6,
|
|
218
218
|
viewBox: "0 0 48 48",
|
|
219
219
|
fill: "none"
|
|
220
|
-
},
|
|
220
|
+
}, gt = {
|
|
221
221
|
key: 7,
|
|
222
222
|
viewBox: "0 0 48 48",
|
|
223
223
|
fill: "none"
|
|
224
|
-
},
|
|
224
|
+
}, St = {
|
|
225
225
|
key: 8,
|
|
226
226
|
viewBox: "0 0 54 48",
|
|
227
227
|
fill: "none"
|
|
228
|
-
},
|
|
228
|
+
}, Ct = {
|
|
229
229
|
key: 9,
|
|
230
230
|
viewBox: "0 0 48 48",
|
|
231
231
|
fill: "none"
|
|
232
|
-
},
|
|
232
|
+
}, ft = {
|
|
233
233
|
key: 10,
|
|
234
234
|
viewBox: "0 0 48 48",
|
|
235
235
|
fill: "none"
|
|
236
|
-
},
|
|
236
|
+
}, xt = /* @__PURE__ */ F({
|
|
237
237
|
__name: "VideoLayoutIcon",
|
|
238
238
|
props: {
|
|
239
239
|
type: {}
|
|
240
240
|
},
|
|
241
|
-
setup(
|
|
242
|
-
return (k,
|
|
243
|
-
|
|
241
|
+
setup(n) {
|
|
242
|
+
return (k, o) => (i(), c("div", st, [
|
|
243
|
+
n.type === "1" ? (i(), c("svg", ht, [...o[0] || (o[0] = [
|
|
244
244
|
d("rect", {
|
|
245
245
|
x: "4",
|
|
246
246
|
y: "4",
|
|
@@ -249,7 +249,7 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
249
249
|
stroke: "currentColor",
|
|
250
250
|
"stroke-width": "2"
|
|
251
251
|
}, null, -1)
|
|
252
|
-
])])) :
|
|
252
|
+
])])) : n.type === "2" ? (i(), c("svg", wt, [...o[1] || (o[1] = [
|
|
253
253
|
d("rect", {
|
|
254
254
|
x: "4",
|
|
255
255
|
y: "4",
|
|
@@ -266,7 +266,7 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
266
266
|
stroke: "currentColor",
|
|
267
267
|
"stroke-width": "1.5"
|
|
268
268
|
}, null, -1)
|
|
269
|
-
])])) :
|
|
269
|
+
])])) : n.type === "3" ? (i(), c("svg", ut, [...o[2] || (o[2] = [
|
|
270
270
|
d("rect", {
|
|
271
271
|
x: "4",
|
|
272
272
|
y: "4",
|
|
@@ -291,7 +291,7 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
291
291
|
stroke: "currentColor",
|
|
292
292
|
"stroke-width": "1.5"
|
|
293
293
|
}, null, -1)
|
|
294
|
-
])])) :
|
|
294
|
+
])])) : n.type === "4" ? (i(), c("svg", pt, [...o[3] || (o[3] = [
|
|
295
295
|
d("rect", {
|
|
296
296
|
x: "4",
|
|
297
297
|
y: "4",
|
|
@@ -324,38 +324,38 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
324
324
|
stroke: "currentColor",
|
|
325
325
|
"stroke-width": "1.5"
|
|
326
326
|
}, null, -1)
|
|
327
|
-
])])) :
|
|
328
|
-
|
|
329
|
-
])])) :
|
|
330
|
-
|
|
331
|
-
])])) :
|
|
332
|
-
|
|
333
|
-
])])) :
|
|
334
|
-
|
|
335
|
-
])])) :
|
|
336
|
-
|
|
337
|
-
])])) :
|
|
338
|
-
|
|
339
|
-
])])) :
|
|
340
|
-
|
|
341
|
-
])])) :
|
|
327
|
+
])])) : n.type === "6" ? (i(), c("svg", vt, [...o[4] || (o[4] = [
|
|
328
|
+
g('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 6)
|
|
329
|
+
])])) : n.type === "7" ? (i(), c("svg", yt, [...o[5] || (o[5] = [
|
|
330
|
+
g('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 7)
|
|
331
|
+
])])) : n.type === "8" ? (i(), c("svg", kt, [...o[6] || (o[6] = [
|
|
332
|
+
g('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 8)
|
|
333
|
+
])])) : n.type === "9" ? (i(), c("svg", gt, [...o[7] || (o[7] = [
|
|
334
|
+
g('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 9)
|
|
335
|
+
])])) : n.type === "10" ? (i(), c("svg", St, [...o[8] || (o[8] = [
|
|
336
|
+
g('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 10)
|
|
337
|
+
])])) : n.type === "13" ? (i(), c("svg", Ct, [...o[9] || (o[9] = [
|
|
338
|
+
g('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 13)
|
|
339
|
+
])])) : n.type === "16" ? (i(), c("svg", ft, [...o[10] || (o[10] = [
|
|
340
|
+
g('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 16)
|
|
341
|
+
])])) : U("", !0)
|
|
342
342
|
]));
|
|
343
343
|
}
|
|
344
|
-
}),
|
|
345
|
-
const
|
|
346
|
-
for (const [
|
|
347
|
-
|
|
348
|
-
return
|
|
349
|
-
},
|
|
344
|
+
}), Y = (n, k) => {
|
|
345
|
+
const o = n.__vccOpts || n;
|
|
346
|
+
for (const [C, w] of k)
|
|
347
|
+
o[C] = w;
|
|
348
|
+
return o;
|
|
349
|
+
}, j = /* @__PURE__ */ Y(xt, [["__scopeId", "data-v-31e0404d"]]), mt = {
|
|
350
350
|
key: 0,
|
|
351
351
|
class: "layout-toolbar",
|
|
352
352
|
role: "toolbar",
|
|
353
353
|
"aria-label": "布局切换工具栏"
|
|
354
|
-
},
|
|
354
|
+
}, bt = { class: "layout-buttons" }, Dt = ["onClick", "title", "aria-label", "aria-pressed"], Lt = { class: "layout-label" }, _t = {
|
|
355
355
|
class: "video-grid-container",
|
|
356
356
|
role: "region",
|
|
357
357
|
"aria-label": "视频网格"
|
|
358
|
-
},
|
|
358
|
+
}, $t = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], It = { class: "video-placeholder" }, At = { class: "placeholder-number" }, Bt = 0.5, Vt = "grabbing", Tt = "0.8", Gt = /* @__PURE__ */ F({
|
|
359
359
|
__name: "VideoGridLayout",
|
|
360
360
|
props: {
|
|
361
361
|
videos: {},
|
|
@@ -368,159 +368,128 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
368
368
|
placeholders: {}
|
|
369
369
|
},
|
|
370
370
|
emits: ["layoutChange", "videosChange"],
|
|
371
|
-
setup(
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
setup(n, { emit: k }) {
|
|
372
|
+
const o = n, C = k, w = A(o.layout);
|
|
373
|
+
L(() => o.layout, (t) => {
|
|
374
|
+
w.value = t;
|
|
375
375
|
});
|
|
376
|
-
const
|
|
376
|
+
const z = y(() => o.availableLayouts && o.availableLayouts.length > 0 ? o.availableLayouts : dt()), v = E([]);
|
|
377
377
|
function _(t) {
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
const e = Array.isArray(t) ? t : o.videos || [], a = I.value, r = {};
|
|
379
|
+
v.value.forEach((s, p) => {
|
|
380
|
+
s && s.id !== void 0 && (r[s.id] = s.__labelNumber ?? p + 1);
|
|
381
381
|
});
|
|
382
|
-
const
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
const
|
|
386
|
-
return { ...
|
|
382
|
+
const l = Array.from({ length: a }).map((s, p) => {
|
|
383
|
+
const h = e[p];
|
|
384
|
+
if (h) {
|
|
385
|
+
const rt = r[h.id] ?? h.__labelNumber ?? p + 1;
|
|
386
|
+
return { ...h, __labelNumber: rt };
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
|
-
|
|
389
|
+
v.value = l;
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
L(() => o.videos, (t) => {
|
|
392
392
|
if (!Array.isArray(t)) {
|
|
393
393
|
console.warn("[VideoGridLayout] Invalid videos prop, expected array");
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
396
|
_(t);
|
|
397
397
|
}, { flush: "post" });
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
let $ = !1;
|
|
399
|
+
L(v, (t) => {
|
|
400
|
+
!$ && Array.isArray(t) && C("videosChange", t);
|
|
401
401
|
});
|
|
402
|
-
const
|
|
403
|
-
const t =
|
|
404
|
-
return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${
|
|
405
|
-
}),
|
|
402
|
+
const G = y(() => {
|
|
403
|
+
const t = S[w.value];
|
|
404
|
+
return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${w.value}, fallback to '4'`), S[4]);
|
|
405
|
+
}), f = y(() => it(w.value)), I = y(() => {
|
|
406
406
|
var t;
|
|
407
|
-
return ((t =
|
|
408
|
-
}), D =
|
|
409
|
-
_(
|
|
410
|
-
_(
|
|
407
|
+
return ((t = G.value) == null ? void 0 : t.count) || 4;
|
|
408
|
+
}), D = y(() => v.value.slice(0, I.value).map((t) => t).filter(Boolean));
|
|
409
|
+
_(o.videos), L(I, () => {
|
|
410
|
+
_(o.videos);
|
|
411
411
|
});
|
|
412
|
-
const
|
|
413
|
-
const t =
|
|
414
|
-
return t.sort((
|
|
415
|
-
}),
|
|
416
|
-
|
|
417
|
-
const Z = g(() => {
|
|
418
|
-
const t = Y.value;
|
|
412
|
+
const O = y(() => {
|
|
413
|
+
const t = f.value.map((e, a) => ({ p: e, idx: a }));
|
|
414
|
+
return t.sort((e, a) => e.p.row === a.p.row ? (e.p.col || 0) - (a.p.col || 0) : (e.p.row || 0) - (a.p.row || 0)), t.map((e) => e.idx);
|
|
415
|
+
}), u = A(-1), x = A(-1), m = E(null), H = y(() => {
|
|
416
|
+
const t = G.value;
|
|
419
417
|
return {
|
|
420
418
|
display: "grid",
|
|
421
419
|
gridTemplateColumns: (t == null ? void 0 : t.colTemplate) || `repeat(${(t == null ? void 0 : t.cols) || 2}, 1fr)`,
|
|
422
420
|
gridTemplateRows: (t == null ? void 0 : t.rowTemplate) || `repeat(${(t == null ? void 0 : t.rows) || 2}, 1fr)`,
|
|
423
421
|
gap: "4px",
|
|
424
|
-
width:
|
|
425
|
-
height:
|
|
422
|
+
width: o.width || "100%",
|
|
423
|
+
height: o.height || "100%"
|
|
426
424
|
};
|
|
427
|
-
}),
|
|
428
|
-
width:
|
|
429
|
-
height:
|
|
425
|
+
}), W = y(() => ({
|
|
426
|
+
width: o.width || "100%",
|
|
427
|
+
height: o.height || "100%"
|
|
430
428
|
}));
|
|
431
|
-
function
|
|
432
|
-
const
|
|
433
|
-
if (Array.isArray(
|
|
434
|
-
return String(
|
|
435
|
-
if (typeof
|
|
429
|
+
function q(t) {
|
|
430
|
+
const e = t, a = O.value[e];
|
|
431
|
+
if (Array.isArray(o.placeholders) && o.placeholders[a] !== void 0)
|
|
432
|
+
return String(o.placeholders[a]);
|
|
433
|
+
if (typeof o.placeholderText == "function")
|
|
436
434
|
try {
|
|
437
|
-
return
|
|
435
|
+
return o.placeholderText(e);
|
|
438
436
|
} catch {
|
|
439
|
-
return String(
|
|
437
|
+
return String(e + 1);
|
|
440
438
|
}
|
|
441
|
-
return
|
|
439
|
+
return o.placeholderText ? String(o.placeholderText) : String(e + 1);
|
|
442
440
|
}
|
|
443
|
-
function
|
|
444
|
-
const
|
|
445
|
-
return !
|
|
446
|
-
gridColumn: `${
|
|
447
|
-
gridRow: `${
|
|
441
|
+
function J(t) {
|
|
442
|
+
const e = f.value[t];
|
|
443
|
+
return !e || typeof e.col != "number" || typeof e.row != "number" ? {} : {
|
|
444
|
+
gridColumn: `${e.col} / span ${e.colSpan}`,
|
|
445
|
+
gridRow: `${e.row} / span ${e.rowSpan}`
|
|
448
446
|
};
|
|
449
447
|
}
|
|
450
|
-
function
|
|
451
|
-
const
|
|
452
|
-
return (
|
|
448
|
+
function K(t) {
|
|
449
|
+
const e = f.value[t];
|
|
450
|
+
return (e == null ? void 0 : e.isMain) || !1;
|
|
453
451
|
}
|
|
454
|
-
function
|
|
455
|
-
|
|
452
|
+
function Q(t) {
|
|
453
|
+
w.value = t, C("layoutChange", w.value);
|
|
456
454
|
}
|
|
457
|
-
function
|
|
458
|
-
if (
|
|
455
|
+
function b() {
|
|
456
|
+
if (m.value && document.body.contains(m.value)) {
|
|
459
457
|
try {
|
|
460
|
-
document.body.removeChild(
|
|
458
|
+
document.body.removeChild(m.value);
|
|
461
459
|
} catch (t) {
|
|
462
460
|
console.warn("[VideoGridLayout] Failed to cleanup drag image:", t);
|
|
463
461
|
}
|
|
464
|
-
|
|
462
|
+
m.value = null;
|
|
465
463
|
}
|
|
466
|
-
if (h.value && document.body.contains(h.value)) {
|
|
467
|
-
try {
|
|
468
|
-
document.body.removeChild(h.value);
|
|
469
|
-
} catch {
|
|
470
|
-
}
|
|
471
|
-
h.value = null;
|
|
472
|
-
}
|
|
473
|
-
A && (document.removeEventListener("mousemove", A), A = null), L && (document.removeEventListener("drag", L), L = null);
|
|
474
464
|
}
|
|
475
|
-
function
|
|
476
|
-
if (
|
|
477
|
-
console.warn("[VideoGridLayout] Invalid drag index:",
|
|
465
|
+
function X(t, e) {
|
|
466
|
+
if (e < 0 || e >= v.value.length) {
|
|
467
|
+
console.warn("[VideoGridLayout] Invalid drag index:", e);
|
|
478
468
|
return;
|
|
479
469
|
}
|
|
480
|
-
if (
|
|
470
|
+
if (u.value = e, !t.dataTransfer) return;
|
|
481
471
|
t.dataTransfer.effectAllowed = "move";
|
|
482
472
|
const r = t.target.closest(".video-item");
|
|
483
473
|
if (r)
|
|
484
474
|
try {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
try {
|
|
493
|
-
l.style.transition = "none", l.style.animation = "none";
|
|
494
|
-
} catch {
|
|
495
|
-
}
|
|
496
|
-
}), n.style.position = "fixed", n.style.margin = "0", n.style.pointerEvents = "none", n.style.opacity = Nt, n.style.zIndex = "9999", document.body.appendChild(n), h.value = n;
|
|
497
|
-
try {
|
|
498
|
-
const l = r.getBoundingClientRect();
|
|
499
|
-
n.style.width = `${l.width}px`, n.style.height = `${l.height}px`;
|
|
500
|
-
} catch {
|
|
501
|
-
}
|
|
502
|
-
A = (l) => {
|
|
503
|
-
if (!h.value) return;
|
|
504
|
-
const f = h.value.offsetWidth || 0, T = h.value.offsetHeight || 0, G = Math.max(0, l.clientX - f / 2), M = Math.max(0, l.clientY - T / 2);
|
|
505
|
-
h.value.style.left = `${G}px`, h.value.style.top = `${M}px`;
|
|
506
|
-
}, document.addEventListener("mousemove", A), L = (l) => {
|
|
507
|
-
if (!h.value) return;
|
|
508
|
-
const f = h.value.offsetWidth || 0, T = h.value.offsetHeight || 0, G = Math.max(0, (l.clientX || 0) - f / 2), M = Math.max(0, (l.clientY || 0) - T / 2);
|
|
509
|
-
h.value.style.left = `${G}px`, h.value.style.top = `${M}px`;
|
|
510
|
-
}, document.addEventListener("drag", L), r.style.opacity = String(Ot), r.style.cursor = Rt, r.style.borderColor = "#ff6b6b";
|
|
511
|
-
} catch (n) {
|
|
512
|
-
console.error("[VideoGridLayout] Drag start error:", n), B();
|
|
475
|
+
b();
|
|
476
|
+
const l = r.cloneNode(!0);
|
|
477
|
+
l.style.width = `${r.offsetWidth}px`, l.style.height = `${r.offsetHeight}px`, l.style.opacity = Tt, l.style.position = "absolute", l.style.top = "-9999px", l.style.pointerEvents = "none", document.body.appendChild(l), m.value = l, t.dataTransfer.setDragImage(l, r.offsetWidth / 2, r.offsetHeight / 2), setTimeout(() => {
|
|
478
|
+
b();
|
|
479
|
+
}, 100), r.style.opacity = String(Bt), r.style.cursor = Vt;
|
|
480
|
+
} catch (l) {
|
|
481
|
+
console.error("[VideoGridLayout] Drag start error:", l), b();
|
|
513
482
|
}
|
|
514
483
|
}
|
|
515
|
-
function
|
|
484
|
+
function Z(t, e) {
|
|
516
485
|
t.preventDefault(), t.stopPropagation();
|
|
517
|
-
const a =
|
|
518
|
-
if (a === -1 || a ===
|
|
519
|
-
|
|
486
|
+
const a = u.value;
|
|
487
|
+
if (a === -1 || a === e) {
|
|
488
|
+
u.value = -1;
|
|
520
489
|
return;
|
|
521
490
|
}
|
|
522
|
-
if (
|
|
523
|
-
console.warn("[VideoGridLayout] Invalid drop index:",
|
|
491
|
+
if (e < 0 || e >= f.value.length) {
|
|
492
|
+
console.warn("[VideoGridLayout] Invalid drop index:", e), u.value = -1;
|
|
524
493
|
return;
|
|
525
494
|
}
|
|
526
495
|
try {
|
|
@@ -528,112 +497,112 @@ const yt = { class: "layout-icon" }, gt = {
|
|
|
528
497
|
r && (r.style.backgroundColor = "rgba(66, 184, 131, 0.3)", r.style.borderColor = "#42b883", setTimeout(() => {
|
|
529
498
|
r.style.backgroundColor = "", r.style.borderColor = "";
|
|
530
499
|
}, 200));
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
500
|
+
const l = [...v.value], s = l[a], p = l[e];
|
|
501
|
+
l[a] = p, l[e] = s, $ = !0, v.value = l, setTimeout(() => {
|
|
502
|
+
$ = !1, C("videosChange", v.value.filter(Boolean));
|
|
534
503
|
}, 0);
|
|
535
504
|
} catch (r) {
|
|
536
505
|
console.error("[VideoGridLayout] Drop error:", r);
|
|
537
506
|
} finally {
|
|
538
|
-
|
|
507
|
+
u.value = -1;
|
|
539
508
|
}
|
|
540
509
|
}
|
|
541
|
-
function
|
|
542
|
-
t.preventDefault(),
|
|
510
|
+
function tt(t, e) {
|
|
511
|
+
t.preventDefault(), u.value !== -1 && u.value !== e && (x.value = e);
|
|
543
512
|
}
|
|
544
|
-
function
|
|
513
|
+
function ot(t, e) {
|
|
545
514
|
t.preventDefault();
|
|
546
515
|
const a = t.target, r = t.relatedTarget;
|
|
547
|
-
a.contains(r) ||
|
|
516
|
+
a.contains(r) || x.value === e && (x.value = -1);
|
|
548
517
|
}
|
|
549
|
-
function
|
|
518
|
+
function et(t) {
|
|
550
519
|
const a = t.target.closest(".video-item");
|
|
551
|
-
a && (a.style.opacity = "1", a.style.cursor = "move"
|
|
520
|
+
a && (a.style.opacity = "1", a.style.cursor = "move"), b(), u.value = -1, x.value = -1;
|
|
552
521
|
}
|
|
553
|
-
return
|
|
554
|
-
|
|
555
|
-
}), (t,
|
|
522
|
+
return at(() => {
|
|
523
|
+
b();
|
|
524
|
+
}), (t, e) => (i(), c("div", {
|
|
556
525
|
class: "video-grid-layout",
|
|
557
526
|
role: "application",
|
|
558
527
|
"aria-label": "视频分屏布局",
|
|
559
|
-
style:
|
|
528
|
+
style: B(W.value)
|
|
560
529
|
}, [
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
d("div",
|
|
564
|
-
(
|
|
565
|
-
var r,
|
|
566
|
-
return
|
|
530
|
+
n.showToolbar ? (i(), c("div", mt, [
|
|
531
|
+
e[1] || (e[1] = d("div", { class: "toolbar-title" }, "分屏布局", -1)),
|
|
532
|
+
d("div", bt, [
|
|
533
|
+
(i(!0), c(N, null, M(z.value, (a) => {
|
|
534
|
+
var r, l, s;
|
|
535
|
+
return i(), c("button", {
|
|
567
536
|
key: a,
|
|
568
|
-
class:
|
|
569
|
-
onClick: (
|
|
570
|
-
title: ((r =
|
|
571
|
-
"aria-label": `切换到${((
|
|
572
|
-
"aria-pressed":
|
|
537
|
+
class: R(["layout-btn", { active: w.value === a }]),
|
|
538
|
+
onClick: (p) => Q(a),
|
|
539
|
+
title: ((r = V(S)[a]) == null ? void 0 : r.label) || "",
|
|
540
|
+
"aria-label": `切换到${((l = V(S)[a]) == null ? void 0 : l.label) || ""}布局`,
|
|
541
|
+
"aria-pressed": w.value === a,
|
|
573
542
|
type: "button"
|
|
574
543
|
}, [
|
|
575
|
-
|
|
576
|
-
d("span",
|
|
577
|
-
], 10,
|
|
544
|
+
lt(j, { type: a }, null, 8, ["type"]),
|
|
545
|
+
d("span", Lt, P(((s = V(S)[a]) == null ? void 0 : s.label) || ""), 1)
|
|
546
|
+
], 10, Dt);
|
|
578
547
|
}), 128))
|
|
579
548
|
])
|
|
580
|
-
])) :
|
|
581
|
-
d("div",
|
|
549
|
+
])) : U("", !0),
|
|
550
|
+
d("div", _t, [
|
|
582
551
|
d("div", {
|
|
583
552
|
class: "video-grid",
|
|
584
|
-
style:
|
|
553
|
+
style: B(H.value)
|
|
585
554
|
}, [
|
|
586
|
-
(
|
|
587
|
-
var
|
|
588
|
-
return
|
|
589
|
-
key: ((
|
|
590
|
-
class:
|
|
591
|
-
"main-video":
|
|
592
|
-
dragging:
|
|
593
|
-
"drag-over":
|
|
555
|
+
(i(!0), c(N, null, M(f.value, (a, r) => {
|
|
556
|
+
var l, s, p;
|
|
557
|
+
return i(), c("div", {
|
|
558
|
+
key: ((l = D.value[r]) == null ? void 0 : l.id) ?? r,
|
|
559
|
+
class: R(["video-item", {
|
|
560
|
+
"main-video": K(r),
|
|
561
|
+
dragging: u.value === r,
|
|
562
|
+
"drag-over": x.value === r && u.value !== r
|
|
594
563
|
}]),
|
|
595
|
-
style:
|
|
564
|
+
style: B(J(r)),
|
|
596
565
|
draggable: !0,
|
|
597
|
-
"aria-label": `视频 ${r + 1}: ${((
|
|
566
|
+
"aria-label": `视频 ${r + 1}: ${((s = D.value[r]) == null ? void 0 : s.title) || ((p = D.value[r]) == null ? void 0 : p.id) || ""}`,
|
|
598
567
|
role: "article",
|
|
599
568
|
tabindex: "0",
|
|
600
|
-
onDragstart: (
|
|
601
|
-
onDragover:
|
|
569
|
+
onDragstart: (h) => X(h, r),
|
|
570
|
+
onDragover: e[0] || (e[0] = nt(() => {
|
|
602
571
|
}, ["prevent"])),
|
|
603
|
-
onDragenter: (
|
|
604
|
-
onDragleave: (
|
|
605
|
-
onDrop: (
|
|
606
|
-
onDragend:
|
|
572
|
+
onDragenter: (h) => tt(h, r),
|
|
573
|
+
onDragleave: (h) => ot(h, r),
|
|
574
|
+
onDrop: (h) => Z(h, r),
|
|
575
|
+
onDragend: et
|
|
607
576
|
}, [
|
|
608
|
-
|
|
577
|
+
ct(t.$slots, "video", {
|
|
609
578
|
video: D.value[r],
|
|
610
579
|
index: r
|
|
611
580
|
}, () => [
|
|
612
|
-
d("div",
|
|
613
|
-
d("div",
|
|
581
|
+
d("div", It, [
|
|
582
|
+
d("div", At, P(q(O.value.indexOf(r))), 1)
|
|
614
583
|
])
|
|
615
584
|
], !0)
|
|
616
|
-
], 46,
|
|
585
|
+
], 46, $t);
|
|
617
586
|
}), 128))
|
|
618
587
|
], 4)
|
|
619
588
|
])
|
|
620
589
|
], 4));
|
|
621
590
|
}
|
|
622
|
-
}),
|
|
623
|
-
VideoGridLayout:
|
|
624
|
-
VideoLayoutIcon:
|
|
625
|
-
},
|
|
626
|
-
install(
|
|
627
|
-
Object.entries(
|
|
628
|
-
|
|
591
|
+
}), Ot = /* @__PURE__ */ Y(Gt, [["__scopeId", "data-v-1b7d75db"]]), Et = {
|
|
592
|
+
VideoGridLayout: Ot,
|
|
593
|
+
VideoLayoutIcon: j
|
|
594
|
+
}, Mt = {
|
|
595
|
+
install(n) {
|
|
596
|
+
Object.entries(Et).forEach(([k, o]) => {
|
|
597
|
+
n.component(k, o);
|
|
629
598
|
});
|
|
630
599
|
}
|
|
631
600
|
};
|
|
632
601
|
export {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
602
|
+
S as LAYOUT_CONFIGS,
|
|
603
|
+
Ot as VideoGridLayout,
|
|
604
|
+
j as VideoLayoutIcon,
|
|
605
|
+
Mt as default,
|
|
606
|
+
dt as getAllLayoutTypes,
|
|
607
|
+
it as getLayoutPositions
|
|
639
608
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.video-grid-layout{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title{font-size:14px;font-weight:600;color:#333}.layout-buttons{display:flex;gap:8px;flex-wrap:wrap}.layout-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active{border-color:#42b883;background:#42b883;color:#fff}.layout-label{font-size:12px}.video-grid-container{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;transition:border-color .2s ease,background .2s ease,box-shadow .2s ease,transform .2s ease;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element;will-change:transform}.video-item.dragging{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video{border-width:1px}.video-item>*{width:100%;height:100%}.video-placeholder{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar{flex-direction:column;align-items:flex-start}.layout-label{display:none}}.layout-icon[data-v-31e0404d]{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center}.layout-icon svg[data-v-31e0404d]{width:100%;height:100%}.video-grid-layout[data-v-
|
|
1
|
+
.video-grid-layout{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title{font-size:14px;font-weight:600;color:#333}.layout-buttons{display:flex;gap:8px;flex-wrap:wrap}.layout-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active{border-color:#42b883;background:#42b883;color:#fff}.layout-label{font-size:12px}.video-grid-container{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;transition:border-color .2s ease,background .2s ease,box-shadow .2s ease,transform .2s ease;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element;will-change:transform}.video-item.dragging{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video{border-width:1px}.video-item>*{width:100%;height:100%}.video-placeholder{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar{flex-direction:column;align-items:flex-start}.layout-label{display:none}}.layout-icon[data-v-31e0404d]{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center}.layout-icon svg[data-v-31e0404d]{width:100%;height:100%}.video-grid-layout[data-v-1b7d75db]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-1b7d75db]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-1b7d75db]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-1b7d75db]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-1b7d75db]{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn[data-v-1b7d75db]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-1b7d75db]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-1b7d75db]{font-size:12px}.video-grid-container[data-v-1b7d75db]{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid[data-v-1b7d75db]{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item[data-v-1b7d75db]{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element}.video-item.dragging[data-v-1b7d75db]{opacity:.5;cursor:grabbing}.video-item[data-v-1b7d75db]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-1b7d75db]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-1b7d75db]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-1b7d75db]{border-width:1px}.video-item[data-v-1b7d75db]>*{width:100%;height:100%}.video-placeholder[data-v-1b7d75db]{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number[data-v-1b7d75db]{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar[data-v-1b7d75db]{flex-direction:column;align-items:flex-start}.layout-label[data-v-1b7d75db]{display:none}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "video-split-screen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Vue 3 视频分屏组件(VideoSplitScreen)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
],
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/laylwenl/videoSplitScreen.git"
|
|
24
24
|
},
|
|
25
|
-
"homepage": "https://github.com/
|
|
25
|
+
"homepage": "https://github.com/laylwenl/videoSplitScreen#readme",
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|