video-split-screen 1.0.8 → 1.0.9
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/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +45 -43
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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}},V={};function _(n){if(V[n])return V[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&&(V[n]=o),o}function A(){return Object.keys(k)}const X={class:"layout-icon"},J={key:0,viewBox:"0 0 48 48",fill:"none"},K={key:1,viewBox:"0 0 48 48",fill:"none"},Q={key:2,viewBox:"0 0 48 48",fill:"none"},W={key:3,viewBox:"0 0 48 48",fill:"none"},Z={key:4,viewBox:"0 0 48 48",fill:"none"},ee={key:5,viewBox:"0 0 48 48",fill:"none"},te={key:6,viewBox:"0 0 48 48",fill:"none"},oe={key:7,viewBox:"0 0 48 48",fill:"none"},re={key:8,viewBox:"0 0 54 48",fill:"none"},ae={key:9,viewBox:"0 0 48 48",fill:"none"},le={key:10,viewBox:"0 0 48 48",fill:"none"},ne=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(n){return(v,o)=>(e.openBlock(),e.createElementBlock("div",X,[n.type==="1"?(e.openBlock(),e.createElementBlock("svg",J,[...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",K,[...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",Q,[...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",W,[...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",Z,[...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",ee,[...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",te,[...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",oe,[...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",re,[...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",ae,[...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",le,[...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)]))}}),I=(n,v)=>{const o=n.__vccOpts||n;for(const[y,h]of v)o[y]=h;return o},L=I(ne,[["__scopeId","data-v-31e0404d"]]),ce={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ie={class:"layout-buttons"},de=["onClick","title","aria-label","aria-pressed"],se={class:"layout-label"},he={class:"video-grid-container",role:"region","aria-label":"视频网格"},we=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ue={class:"video-placeholder"},pe={class:"placeholder-number"},ve=.5,ke="grabbing",ye="0.8",ge=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{},dragAnimation:{default:"scale"}},emits:["layoutChange","videosChange"],setup(n,{emit:v}){const o=n,y=v,h=e.ref(o.layout);e.watch(()=>o.layout,t=>{h.value=t});const T=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:A()),u=e.shallowRef([]);let b=!1;e.watch(u,t=>{!b&&Array.isArray(t)&&y("videosChange",t)});const N=e.computed(()=>{const t=k[h.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${h.value}, fallback to '4'`),k[4])}),g=e.computed(()=>_(h.value)),B=e.computed(()=>{var t;return((t=N.value)==null?void 0:t.count)||4});function E(t){const r=Array.isArray(t)?t:o.videos||[],l=B.value,a={};u.value.forEach((i,p)=>{i&&i.id!==void 0&&(a[i.id]=i.__labelNumber??p+1)});const c=Array.from({length:l}).map((i,p)=>{const s=r[p];if(s){const H=a[s.id]??s.__labelNumber??p+1;return{...s,__labelNumber:H}}});u.value=c}const C=e.computed(()=>u.value.slice(0,B.value).map(t=>t).filter(Boolean));E(o.videos),e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}E(t)},{flush:"post"}),e.watch(B,()=>{E(o.videos)});const D=e.computed(()=>{const t=g.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)}),w=e.ref(-1),S=e.ref(-1),f=e.shallowRef(null),d=e.shallowRef(null);let m=null;const G=e.computed(()=>{const t=N.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%"}}),O=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function M(t){const r=t,l=D.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 R(t){const r=g.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 P(t){const r=g.value[t];return(r==null?void 0:r.isMain)||!1}function z(t){h.value=t,y("layoutChange",h.value)}function x(){if(f.value&&document.body.contains(f.value)){try{document.body.removeChild(f.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}f.value=null}if(d.value&&document.body.contains(d.value)){try{document.body.removeChild(d.value)}catch{}d.value=null}m&&(document.removeEventListener("mousemove",m),m=null)}function F(t,r){if(r<0||r>=u.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(w.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(x(),t.dataTransfer){const i=new Image;i.src="",t.dataTransfer.setDragImage(i,0,0)}const c=a.cloneNode(!0);c.style.position="fixed",c.style.top="0px",c.style.left="0px",c.style.margin="0",c.style.pointerEvents="none",c.style.opacity=ye,c.style.transform="translate(-50%,-50%)",c.style.zIndex="9999",c.classList.add("drag-preview"),o.dragAnimation&&o.dragAnimation!=="none"&&c.classList.add(o.dragAnimation),document.body.appendChild(c),d.value=c,m=i=>{d.value&&(d.value.style.left=`${i.clientX}px`,d.value.style.top=`${i.clientY}px`)},document.addEventListener("mousemove",m),a.style.opacity=String(ve),a.style.cursor=ke}catch(c){console.error("[VideoGridLayout] Drag start error:",c),x()}}function U(t,r){t.preventDefault(),t.stopPropagation();const l=w.value;if(l===-1||l===r){w.value=-1;return}if(r<0||r>=g.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),w.value=-1;return}try{const a=[...u.value],c=a[l],i=a[r];a[l]=i,a[r]=c,b=!0,u.value=a,setTimeout(()=>{b=!1,y("videosChange",u.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{w.value=-1}}function Y(t,r){if(t.preventDefault(),w.value!==-1&&w.value!==r){S.value=r;try{const a=(t.currentTarget||t.target).getBoundingClientRect();d.value&&(d.value.style.width=`${a.width}px`,d.value.style.height=`${a.height}px`,d.value.style.transform="translate(-50%,-50%)")}catch{}}}function j(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||S.value===r&&(S.value=-1)}function q(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),x(),w.value=-1,S.value=-1}return e.onBeforeUnmount(()=>{x()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(O.value)},[n.showToolbar?(e.openBlock(),e.createElementBlock("div",ce,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,l=>{var a,c,i;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:h.value===l}]),onClick:p=>z(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":h.value===l,type:"button"},[e.createVNode(L,{type:l},null,8,["type"]),e.createElementVNode("span",se,e.toDisplayString(((i=e.unref(k)[l])==null?void 0:i.label)||""),1)],10,de)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",he,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(G.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(l,a)=>{var c,i,p;return e.openBlock(),e.createElementBlock("div",{key:((c=C.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":P(a),dragging:w.value===a,"drag-over":S.value===a&&w.value!==a}]),style:e.normalizeStyle(R(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((i=C.value[a])==null?void 0:i.title)||((p=C.value[a])==null?void 0:p.id)||""}`,role:"article",tabindex:"0",onDragstart:s=>F(s,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:s=>Y(s,a),onDragleave:s=>j(s,a),onDrop:s=>U(s,a),onDragend:q},[e.renderSlot(t.$slots,"video",{video:C.value[a],index:a},()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",pe,e.toDisplayString(M(D.value.indexOf(a))),1)])],!0)],46,we)}),128))],4)])],4))}}),$=I(ge,[["__scopeId","data-v-70c9cc23"]]),Se={VideoGridLayout:$,VideoLayoutIcon:L},me={install(n){Object.entries(Se).forEach(([v,o])=>{n.component(v,o)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=$;exports.VideoLayoutIcon=L;exports.default=me;exports.getAllLayoutTypes=A;exports.getLayoutPositions=_;
|
|
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}},V={};function D(n){if(V[n])return V[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&&(V[n]=o),o}function _(){return Object.keys(k)}const X={class:"layout-icon"},J={key:0,viewBox:"0 0 48 48",fill:"none"},K={key:1,viewBox:"0 0 48 48",fill:"none"},Q={key:2,viewBox:"0 0 48 48",fill:"none"},W={key:3,viewBox:"0 0 48 48",fill:"none"},Z={key:4,viewBox:"0 0 48 48",fill:"none"},ee={key:5,viewBox:"0 0 48 48",fill:"none"},te={key:6,viewBox:"0 0 48 48",fill:"none"},oe={key:7,viewBox:"0 0 48 48",fill:"none"},re={key:8,viewBox:"0 0 54 48",fill:"none"},ae={key:9,viewBox:"0 0 48 48",fill:"none"},le={key:10,viewBox:"0 0 48 48",fill:"none"},ne=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(n){return(v,o)=>(e.openBlock(),e.createElementBlock("div",X,[n.type==="1"?(e.openBlock(),e.createElementBlock("svg",J,[...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",K,[...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",Q,[...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",W,[...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",Z,[...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",ee,[...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",te,[...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",oe,[...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",re,[...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",ae,[...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",le,[...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)]))}}),A=(n,v)=>{const o=n.__vccOpts||n;for(const[y,h]of v)o[y]=h;return o},L=A(ne,[["__scopeId","data-v-31e0404d"]]),ce={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ie={class:"layout-buttons"},de=["onClick","title","aria-label","aria-pressed"],se={class:"layout-label"},he={class:"video-grid-container",role:"region","aria-label":"视频网格"},we=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ue={class:"video-placeholder"},pe={class:"placeholder-number"},ve=.5,ke="grabbing",ye="0.8",ge=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{},dragAnimation:{default:"scale"}},emits:["layoutChange","videosChange"],setup(n,{emit:v}){const o=n,y=v,h=e.ref(o.layout);e.watch(()=>o.layout,t=>{h.value=t});const I=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:_()),u=e.shallowRef([]);function b(t){const r=Array.isArray(t)?t:o.videos||[],l=E.value,a={};u.value.forEach((i,p)=>{i&&i.id!==void 0&&(a[i.id]=i.__labelNumber??p+1)});const c=Array.from({length:l}).map((i,p)=>{const s=r[p];if(s){const H=a[s.id]??s.__labelNumber??p+1;return{...s,__labelNumber:H}}});u.value=c}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}b(t)},{flush:"post"}),e.watch(E,()=>{b(o.videos)});let B=!1;e.watch(u,t=>{!B&&Array.isArray(t)&&y("videosChange",t)});const N=e.computed(()=>{const t=k[h.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${h.value}, fallback to '4'`),k[4])}),g=e.computed(()=>D(h.value)),E=e.computed(()=>{var t;return((t=N.value)==null?void 0:t.count)||4}),C=e.computed(()=>u.value.slice(0,E.value).map(t=>t).filter(Boolean));b(o.videos);const T=e.computed(()=>{const t=g.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)}),w=e.ref(-1),S=e.ref(-1),f=e.shallowRef(null),d=e.shallowRef(null);let m=null;const G=e.computed(()=>{const t=N.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%"}}),O=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function M(t){const r=T.value.indexOf(t);if(r===-1)return String(t+1);if(Array.isArray(o.placeholders)&&o.placeholders[r]!==void 0)return String(o.placeholders[r]);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 R(t){const r=g.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 P(t){const r=g.value[t];return(r==null?void 0:r.isMain)||!1}function z(t){h.value=t,y("layoutChange",h.value)}function x(){if(f.value&&document.body.contains(f.value)){try{document.body.removeChild(f.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}f.value=null}if(d.value&&document.body.contains(d.value)){try{document.body.removeChild(d.value)}catch{}d.value=null}m&&(document.removeEventListener("mousemove",m),m=null)}function F(t,r){if(r<0||r>=u.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(w.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(x(),t.dataTransfer){const i=new Image;i.src="",t.dataTransfer.setDragImage(i,0,0)}const c=a.cloneNode(!0);c.style.position="fixed",c.style.top="0px",c.style.left="0px",c.style.margin="0",c.style.pointerEvents="none",c.style.opacity=ye,c.style.transform="translate(-50%,-50%)",c.style.zIndex="9999",c.classList.add("drag-preview"),o.dragAnimation&&o.dragAnimation!=="none"&&c.classList.add(o.dragAnimation),document.body.appendChild(c),d.value=c,m=i=>{d.value&&(d.value.style.left=`${i.clientX}px`,d.value.style.top=`${i.clientY}px`)},document.addEventListener("mousemove",m),a.style.opacity=String(ve),a.style.cursor=ke}catch(c){console.error("[VideoGridLayout] Drag start error:",c),x()}}function U(t,r){t.preventDefault(),t.stopPropagation();const l=w.value;if(l===-1||l===r){w.value=-1;return}if(r<0||r>=g.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),w.value=-1;return}try{const a=[...u.value],c=a[l],i=a[r];a[l]=i,a[r]=c,B=!0,u.value=a,setTimeout(()=>{B=!1,y("videosChange",u.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{w.value=-1}}function Y(t,r){if(t.preventDefault(),w.value!==-1&&w.value!==r){S.value=r;try{const a=(t.currentTarget||t.target).getBoundingClientRect();d.value&&(d.value.style.width=`${a.width}px`,d.value.style.height=`${a.height}px`,d.value.style.transform="translate(-50%,-50%)")}catch{}}}function j(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||S.value===r&&(S.value=-1)}function q(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),x(),w.value=-1,S.value=-1}return e.onBeforeUnmount(()=>{x()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(O.value)},[n.showToolbar?(e.openBlock(),e.createElementBlock("div",ce,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,l=>{var a,c,i;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:h.value===l}]),onClick:p=>z(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":h.value===l,type:"button"},[e.createVNode(L,{type:l},null,8,["type"]),e.createElementVNode("span",se,e.toDisplayString(((i=e.unref(k)[l])==null?void 0:i.label)||""),1)],10,de)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",he,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(G.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(l,a)=>{var c,i,p;return e.openBlock(),e.createElementBlock("div",{key:((c=C.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":P(a),dragging:w.value===a,"drag-over":S.value===a&&w.value!==a}]),style:e.normalizeStyle(R(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((i=C.value[a])==null?void 0:i.title)||((p=C.value[a])==null?void 0:p.id)||""}`,role:"article",tabindex:"0",onDragstart:s=>F(s,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:s=>Y(s,a),onDragleave:s=>j(s,a),onDrop:s=>U(s,a),onDragend:q},[e.renderSlot(t.$slots,"video",{video:C.value[a],index:a},()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",pe,e.toDisplayString(M(a)),1)])],!0)],46,we)}),128))],4)])],4))}}),$=A(ge,[["__scopeId","data-v-df3be083"]]),Se={VideoGridLayout:$,VideoLayoutIcon:L},me={install(n){Object.entries(Se).forEach(([v,o])=>{n.component(v,o)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=$;exports.VideoLayoutIcon=L;exports.default=me;exports.getAllLayoutTypes=_;exports.getLayoutPositions=D;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as U, createElementBlock as i, openBlock as d, createCommentVNode as Y, createElementVNode as s, createStaticVNode as S, ref as V, watch as A, computed as g, shallowRef as E, onBeforeUnmount as nt, normalizeStyle as G, Fragment as M, renderList as R, unref as T, normalizeClass as P, createVNode as ct, toDisplayString as F, withModifiers as it, renderSlot as dt } from "vue";
|
|
2
2
|
const C = {
|
|
3
3
|
1: {
|
|
4
4
|
type: "1",
|
|
@@ -233,7 +233,7 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
233
233
|
key: 10,
|
|
234
234
|
viewBox: "0 0 48 48",
|
|
235
235
|
fill: "none"
|
|
236
|
-
}, bt = /* @__PURE__ */
|
|
236
|
+
}, bt = /* @__PURE__ */ U({
|
|
237
237
|
__name: "VideoLayoutIcon",
|
|
238
238
|
props: {
|
|
239
239
|
type: {}
|
|
@@ -338,24 +338,24 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
338
338
|
S('<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
339
|
])])) : l.type === "16" ? (d(), i("svg", mt, [...e[10] || (e[10] = [
|
|
340
340
|
S('<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
|
-
])])) :
|
|
341
|
+
])])) : Y("", !0)
|
|
342
342
|
]));
|
|
343
343
|
}
|
|
344
|
-
}),
|
|
344
|
+
}), z = (l, k) => {
|
|
345
345
|
const e = l.__vccOpts || l;
|
|
346
346
|
for (const [f, u] of k)
|
|
347
347
|
e[f] = u;
|
|
348
348
|
return e;
|
|
349
|
-
},
|
|
349
|
+
}, j = /* @__PURE__ */ z(bt, [["__scopeId", "data-v-31e0404d"]]), Lt = {
|
|
350
350
|
key: 0,
|
|
351
351
|
class: "layout-toolbar",
|
|
352
352
|
role: "toolbar",
|
|
353
353
|
"aria-label": "布局切换工具栏"
|
|
354
|
-
}, Dt = { class: "layout-buttons" }, $t = ["onClick", "title", "aria-label", "aria-pressed"], At = { class: "layout-label" },
|
|
354
|
+
}, Dt = { class: "layout-buttons" }, $t = ["onClick", "title", "aria-label", "aria-pressed"], At = { class: "layout-label" }, _t = {
|
|
355
355
|
class: "video-grid-container",
|
|
356
356
|
role: "region",
|
|
357
357
|
"aria-label": "视频网格"
|
|
358
|
-
},
|
|
358
|
+
}, It = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Bt = { class: "video-placeholder" }, Vt = { class: "placeholder-number" }, Et = 0.5, Gt = "grabbing", Tt = "0.8", Ot = /* @__PURE__ */ U({
|
|
359
359
|
__name: "VideoGridLayout",
|
|
360
360
|
props: {
|
|
361
361
|
videos: {},
|
|
@@ -374,20 +374,9 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
374
374
|
A(() => e.layout, (t) => {
|
|
375
375
|
u.value = t;
|
|
376
376
|
});
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
!I && Array.isArray(t) && f("videosChange", t);
|
|
381
|
-
});
|
|
382
|
-
const N = g(() => {
|
|
383
|
-
const t = C[u.value];
|
|
384
|
-
return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${u.value}, fallback to '4'`), C[4]);
|
|
385
|
-
}), x = g(() => st(u.value)), _ = g(() => {
|
|
386
|
-
var t;
|
|
387
|
-
return ((t = N.value) == null ? void 0 : t.count) || 4;
|
|
388
|
-
});
|
|
389
|
-
function B(t) {
|
|
390
|
-
const o = Array.isArray(t) ? t : e.videos || [], a = _.value, r = {};
|
|
377
|
+
const H = g(() => e.availableLayouts && e.availableLayouts.length > 0 ? e.availableLayouts : ht()), v = E([]);
|
|
378
|
+
function _(t) {
|
|
379
|
+
const o = Array.isArray(t) ? t : e.videos || [], a = B.value, r = {};
|
|
391
380
|
v.value.forEach((c, y) => {
|
|
392
381
|
c && c.id !== void 0 && (r[c.id] = c.__labelNumber ?? y + 1);
|
|
393
382
|
});
|
|
@@ -400,17 +389,28 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
400
389
|
});
|
|
401
390
|
v.value = n;
|
|
402
391
|
}
|
|
403
|
-
|
|
404
|
-
B(e.videos), A(() => e.videos, (t) => {
|
|
392
|
+
A(() => e.videos, (t) => {
|
|
405
393
|
if (!Array.isArray(t)) {
|
|
406
394
|
console.warn("[VideoGridLayout] Invalid videos prop, expected array");
|
|
407
395
|
return;
|
|
408
396
|
}
|
|
409
|
-
|
|
410
|
-
}, { flush: "post" }), A(
|
|
411
|
-
|
|
397
|
+
_(t);
|
|
398
|
+
}, { flush: "post" }), A(B, () => {
|
|
399
|
+
_(e.videos);
|
|
412
400
|
});
|
|
413
|
-
|
|
401
|
+
let I = !1;
|
|
402
|
+
A(v, (t) => {
|
|
403
|
+
!I && Array.isArray(t) && f("videosChange", t);
|
|
404
|
+
});
|
|
405
|
+
const N = g(() => {
|
|
406
|
+
const t = C[u.value];
|
|
407
|
+
return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${u.value}, fallback to '4'`), C[4]);
|
|
408
|
+
}), x = g(() => st(u.value)), B = g(() => {
|
|
409
|
+
var t;
|
|
410
|
+
return ((t = N.value) == null ? void 0 : t.count) || 4;
|
|
411
|
+
}), L = g(() => v.value.slice(0, B.value).map((t) => t).filter(Boolean));
|
|
412
|
+
_(e.videos);
|
|
413
|
+
const X = g(() => {
|
|
414
414
|
const t = x.value.map((o, a) => ({ p: o, idx: a }));
|
|
415
415
|
return t.sort((o, a) => o.p.row === a.p.row ? (o.p.col || 0) - (a.p.col || 0) : (o.p.row || 0) - (a.p.row || 0)), t.map((o) => o.idx);
|
|
416
416
|
}), p = V(-1), m = V(-1), D = E(null), h = E(null);
|
|
@@ -430,9 +430,11 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
430
430
|
height: e.height || "100%"
|
|
431
431
|
}));
|
|
432
432
|
function K(t) {
|
|
433
|
-
const o =
|
|
434
|
-
if (
|
|
435
|
-
return String(
|
|
433
|
+
const o = X.value.indexOf(t);
|
|
434
|
+
if (o === -1)
|
|
435
|
+
return String(t + 1);
|
|
436
|
+
if (Array.isArray(e.placeholders) && e.placeholders[o] !== void 0)
|
|
437
|
+
return String(e.placeholders[o]);
|
|
436
438
|
if (typeof e.placeholderText == "function")
|
|
437
439
|
try {
|
|
438
440
|
return e.placeholderText(o);
|
|
@@ -547,33 +549,33 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
547
549
|
l.showToolbar ? (d(), i("div", Lt, [
|
|
548
550
|
o[1] || (o[1] = s("div", { class: "toolbar-title" }, "分屏布局", -1)),
|
|
549
551
|
s("div", Dt, [
|
|
550
|
-
(d(!0), i(
|
|
552
|
+
(d(!0), i(M, null, R(H.value, (a) => {
|
|
551
553
|
var r, n, c;
|
|
552
554
|
return d(), i("button", {
|
|
553
555
|
key: a,
|
|
554
|
-
class:
|
|
556
|
+
class: P(["layout-btn", { active: u.value === a }]),
|
|
555
557
|
onClick: (y) => Z(a),
|
|
556
558
|
title: ((r = T(C)[a]) == null ? void 0 : r.label) || "",
|
|
557
559
|
"aria-label": `切换到${((n = T(C)[a]) == null ? void 0 : n.label) || ""}布局`,
|
|
558
560
|
"aria-pressed": u.value === a,
|
|
559
561
|
type: "button"
|
|
560
562
|
}, [
|
|
561
|
-
ct(
|
|
562
|
-
s("span", At,
|
|
563
|
+
ct(j, { type: a }, null, 8, ["type"]),
|
|
564
|
+
s("span", At, F(((c = T(C)[a]) == null ? void 0 : c.label) || ""), 1)
|
|
563
565
|
], 10, $t);
|
|
564
566
|
}), 128))
|
|
565
567
|
])
|
|
566
|
-
])) :
|
|
567
|
-
s("div",
|
|
568
|
+
])) : Y("", !0),
|
|
569
|
+
s("div", _t, [
|
|
568
570
|
s("div", {
|
|
569
571
|
class: "video-grid",
|
|
570
572
|
style: G(q.value)
|
|
571
573
|
}, [
|
|
572
|
-
(d(!0), i(
|
|
574
|
+
(d(!0), i(M, null, R(x.value, (a, r) => {
|
|
573
575
|
var n, c, y;
|
|
574
576
|
return d(), i("div", {
|
|
575
577
|
key: ((n = L.value[r]) == null ? void 0 : n.id) ?? r,
|
|
576
|
-
class:
|
|
578
|
+
class: P(["video-item", {
|
|
577
579
|
"main-video": W(r),
|
|
578
580
|
dragging: p.value === r,
|
|
579
581
|
"drag-over": m.value === r && p.value !== r
|
|
@@ -596,18 +598,18 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
596
598
|
index: r
|
|
597
599
|
}, () => [
|
|
598
600
|
s("div", Bt, [
|
|
599
|
-
s("div", Vt,
|
|
601
|
+
s("div", Vt, F(K(r)), 1)
|
|
600
602
|
])
|
|
601
603
|
], !0)
|
|
602
|
-
], 46,
|
|
604
|
+
], 46, It);
|
|
603
605
|
}), 128))
|
|
604
606
|
], 4)
|
|
605
607
|
])
|
|
606
608
|
], 4));
|
|
607
609
|
}
|
|
608
|
-
}), Nt = /* @__PURE__ */
|
|
610
|
+
}), Nt = /* @__PURE__ */ z(Ot, [["__scopeId", "data-v-df3be083"]]), Mt = {
|
|
609
611
|
VideoGridLayout: Nt,
|
|
610
|
-
VideoLayoutIcon:
|
|
612
|
+
VideoLayoutIcon: j
|
|
611
613
|
}, Pt = {
|
|
612
614
|
install(l) {
|
|
613
615
|
Object.entries(Mt).forEach(([k, e]) => {
|
|
@@ -618,7 +620,7 @@ const wt = { class: "layout-icon" }, ut = {
|
|
|
618
620
|
export {
|
|
619
621
|
C as LAYOUT_CONFIGS,
|
|
620
622
|
Nt as VideoGridLayout,
|
|
621
|
-
|
|
623
|
+
j as VideoLayoutIcon,
|
|
622
624
|
Pt as default,
|
|
623
625
|
ht as getAllLayoutTypes,
|
|
624
626
|
st as getLayoutPositions
|
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-df3be083]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-df3be083]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-df3be083]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-df3be083]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-df3be083]{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-df3be083]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-df3be083]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-df3be083]{font-size:12px}.video-grid-container[data-v-df3be083]{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-df3be083]{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-df3be083]{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[data-v-df3be083]{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.drag-preview.scale[data-v-df3be083]{transition:transform .16s ease}.drag-preview.fade[data-v-df3be083]{transition:opacity .16s ease;opacity:.9}.drag-preview.slide[data-v-df3be083]{transition:transform .2s cubic-bezier(.2,.8,.2,1)}.video-item[data-v-df3be083]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-df3be083]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-df3be083]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-df3be083]{border-width:1px}.video-item[data-v-df3be083]>*{width:100%;height:100%}.video-placeholder[data-v-df3be083]{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-df3be083]{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-df3be083]{flex-direction:column;align-items:flex-start}.layout-label[data-v-df3be083]{display:none}}
|