video-split-screen 1.0.3 → 1.0.8
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 +6 -45
- package/dist/index.js +1 -1
- package/dist/index.mjs +230 -198
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# video-split-screen
|
|
2
2
|
|
|
3
|
-
Vue 3 视频分屏组件(VideoSplitScreen)——可发布到 npm 的插件包。
|
|
4
|
-
|
|
5
|
-
当前包版本: `1.0.1`
|
|
3
|
+
> **v1.0.8** - Vue 3 视频分屏组件(VideoSplitScreen)——可发布到 npm 的插件包。
|
|
6
4
|
|
|
7
5
|
安装(npm)
|
|
8
6
|
|
|
@@ -54,57 +52,20 @@ import 'video-split-screen/dist/style.css'
|
|
|
54
52
|
1. `placeholders[index]`(若存在)
|
|
55
53
|
2. `placeholderText`(若为函数则调用函数并传入视觉索引;若为字符串则直接使用)
|
|
56
54
|
3. 回退为视觉索引 + 1(按从左到右、从上到下的视觉顺序编号)
|
|
55
|
+
示例与截图
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
1. 在 `video-split-screen-package` 目录确认 `package.json` 已填写 `name`, `version`, `repository` 等字段。
|
|
61
|
-
2. 构建并生成类型声明:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
cd video-split-screen-package
|
|
65
|
-
npm install
|
|
66
|
-
npm run build
|
|
67
|
-
npm run build:types
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
3. 登录 / 设置 token(在你的本地环境或 CI):
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
# 如果需要在本地用 token 发布(替换 YOUR_TOKEN)
|
|
74
|
-
npm config set //registry.npmjs.org/:_authToken=YOUR_TOKEN
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
4. 发布:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm publish --access public
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
在示例中测试(示例仓库已包含 `video-split-screen-example`)
|
|
84
|
-
|
|
85
|
-
方法 A(本地 file: 引用,已在示例中设置好,方便本地开发):
|
|
57
|
+
示例项目包含在仓库的 `video-split-screen-example` 目录。运行示例以在本地预览组件并验证交互:
|
|
86
58
|
|
|
87
59
|
```bash
|
|
88
60
|
cd video-split-screen-example
|
|
89
61
|
npm install
|
|
90
62
|
npm run dev
|
|
63
|
+
# 打开 http://localhost:5173
|
|
91
64
|
```
|
|
92
65
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
1. 在 `video-split-screen-example/package.json` 把依赖从 `file:../video-split-screen-package` 改为:
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
"video-split-screen": "^1.0.1"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
2. 然后:
|
|
66
|
+
示例页面截图(本地运行时预览)。截图文件位于仓库:`docs/example-page.png`。
|
|
102
67
|
|
|
103
|
-
|
|
104
|
-
cd video-split-screen-example
|
|
105
|
-
npm install
|
|
106
|
-
npm run dev
|
|
107
|
-
```
|
|
68
|
+

|
|
108
69
|
|
|
109
70
|
注意:当前打包入口同时包含命名导出与默认导出(插件 `install`)——消费者既可以使用 `app.use(VideoSplitScreen)` 全局注册,也可以按需导入 `VideoGridLayout`。如果你更偏好仅命名导出(避免 `default` 导出的歧义),我可以调整构建配置使输出仅使用命名导出。
|
|
110
71
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),p={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}},x={};function V(c){if(x[c])return x[c];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}]}[c]||[];return o.length>0&&(x[c]=o),o}function L(){return Object.keys(p)}const Y={class:"layout-icon"},j={key:0,viewBox:"0 0 48 48",fill:"none"},H={key:1,viewBox:"0 0 48 48",fill:"none"},W={key:2,viewBox:"0 0 48 48",fill:"none"},q={key:3,viewBox:"0 0 48 48",fill:"none"},J={key:4,viewBox:"0 0 48 48",fill:"none"},K={key:5,viewBox:"0 0 48 48",fill:"none"},Q={key:6,viewBox:"0 0 48 48",fill:"none"},X={key:7,viewBox:"0 0 48 48",fill:"none"},Z={key:8,viewBox:"0 0 54 48",fill:"none"},tt={key:9,viewBox:"0 0 48 48",fill:"none"},et={key:10,viewBox:"0 0 48 48",fill:"none"},ot=t.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(c){return(w,o)=>(t.openBlock(),t.createElementBlock("div",Y,[c.type==="1"?(t.openBlock(),t.createElementBlock("svg",j,[...o[0]||(o[0]=[t.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):c.type==="2"?(t.openBlock(),t.createElementBlock("svg",H,[...o[1]||(o[1]=[t.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="3"?(t.openBlock(),t.createElementBlock("svg",W,[...o[2]||(o[2]=[t.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),t.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="4"?(t.openBlock(),t.createElementBlock("svg",q,[...o[3]||(o[3]=[t.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="6"?(t.openBlock(),t.createElementBlock("svg",J,[...o[4]||(o[4]=[t.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)])])):c.type==="7"?(t.openBlock(),t.createElementBlock("svg",K,[...o[5]||(o[5]=[t.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)])])):c.type==="8"?(t.openBlock(),t.createElementBlock("svg",Q,[...o[6]||(o[6]=[t.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)])])):c.type==="9"?(t.openBlock(),t.createElementBlock("svg",X,[...o[7]||(o[7]=[t.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)])])):c.type==="10"?(t.openBlock(),t.createElementBlock("svg",Z,[...o[8]||(o[8]=[t.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)])])):c.type==="13"?(t.openBlock(),t.createElementBlock("svg",tt,[...o[9]||(o[9]=[t.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)])])):c.type==="16"?(t.openBlock(),t.createElementBlock("svg",et,[...o[10]||(o[10]=[t.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)])])):t.createCommentVNode("",!0)]))}}),N=(c,w)=>{const o=c.__vccOpts||c;for(const[k,d]of w)o[k]=d;return o},b=N(ot,[["__scopeId","data-v-31e0404d"]]),rt={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},at={class:"layout-buttons"},lt=["onClick","title","aria-label","aria-pressed"],ct={class:"layout-label"},nt={class:"video-grid-container",role:"region","aria-label":"视频网格"},it=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],dt={class:"video-placeholder"},st={class:"placeholder-number"},ht=.5,wt="grabbing",ut="0.8",pt=t.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(c,{emit:w}){const o=c,k=w,d=t.ref(o.layout);t.watch(()=>o.layout,e=>{d.value=e});const I=t.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:L()),i=t.shallowRef([...o.videos]);t.watch(()=>o.videos,e=>{if(!Array.isArray(e)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}(i.value.length!==e.length||i.value.some((r,l)=>{var a;return r.id!==((a=e[l])==null?void 0:a.id)}))&&(i.value=[...e])},{flush:"post"});let C=!1;t.watch(i,e=>{!C&&Array.isArray(e)&&k("videosChange",e)});const B=t.computed(()=>{const e=p[d.value];return e||(console.warn(`[VideoGridLayout] Invalid layout type: ${d.value}, fallback to '4'`),p[4])}),g=t.computed(()=>V(d.value)),$=t.computed(()=>{var e;return((e=B.value)==null?void 0:e.count)||4}),m=t.computed(()=>i.value.slice(0,$.value)),E=t.computed(()=>{const e=g.value.map((r,l)=>({p:r,idx:l}));return e.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)),e.map(r=>r.idx)}),s=t.ref(-1),v=t.ref(-1),y=t.shallowRef(null),_=t.computed(()=>{const e=B.value;return{display:"grid",gridTemplateColumns:(e==null?void 0:e.colTemplate)||`repeat(${(e==null?void 0:e.cols)||2}, 1fr)`,gridTemplateRows:(e==null?void 0:e.rowTemplate)||`repeat(${(e==null?void 0:e.rows)||2}, 1fr)`,gap:"4px",width:o.width||"100%",height:o.height||"100%"}}),A=t.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function G(e){const r=e,l=E.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 T(e){const r=g.value[e];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function O(e){const r=g.value[e];return(r==null?void 0:r.isMain)||!1}function M(e){d.value=e,k("layoutChange",d.value)}function S(){if(y.value&&document.body.contains(y.value)){try{document.body.removeChild(y.value)}catch(e){console.warn("[VideoGridLayout] Failed to cleanup drag image:",e)}y.value=null}}function R(e,r){if(r<0||r>=i.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(s.value=r,!e.dataTransfer)return;e.dataTransfer.effectAllowed="move";const a=e.target.closest(".video-item");if(a)try{S();const n=a.cloneNode(!0);n.style.width=`${a.offsetWidth}px`,n.style.height=`${a.offsetHeight}px`,n.style.opacity=ut,n.style.position="absolute",n.style.top="-9999px",n.style.pointerEvents="none",document.body.appendChild(n),y.value=n,e.dataTransfer.setDragImage(n,a.offsetWidth/2,a.offsetHeight/2),setTimeout(()=>{S()},100),a.style.opacity=String(ht),a.style.cursor=wt}catch(n){console.error("[VideoGridLayout] Drag start error:",n),S()}}function P(e,r){e.preventDefault(),e.stopPropagation();const l=s.value;if(l===-1||l===r){s.value=-1;return}if(r<0||r>=i.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),s.value=-1;return}try{const a=i.value[l],n=i.value[r];if(a&&n){C=!0;const h=[...i.value];h[l]=n,h[r]=a,i.value=h,setTimeout(()=>{C=!1,k("videosChange",i.value)},0)}}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{s.value=-1}}function F(e,r){e.preventDefault(),s.value!==-1&&s.value!==r&&(v.value=r)}function z(e,r){e.preventDefault();const l=e.target,a=e.relatedTarget;l.contains(a)||v.value===r&&(v.value=-1)}function U(e){const l=e.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),S(),s.value=-1,v.value=-1}return t.onBeforeUnmount(()=>{S()}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:t.normalizeStyle(A.value)},[c.showToolbar?(t.openBlock(),t.createElementBlock("div",rt,[r[1]||(r[1]=t.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),t.createElementVNode("div",at,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,l=>{var a,n,h;return t.openBlock(),t.createElementBlock("button",{key:l,class:t.normalizeClass(["layout-btn",{active:d.value===l}]),onClick:f=>M(l),title:((a=t.unref(p)[l])==null?void 0:a.label)||"","aria-label":`切换到${((n=t.unref(p)[l])==null?void 0:n.label)||""}布局`,"aria-pressed":d.value===l,type:"button"},[t.createVNode(b,{type:l},null,8,["type"]),t.createElementVNode("span",ct,t.toDisplayString(((h=t.unref(p)[l])==null?void 0:h.label)||""),1)],10,lt)}),128))])])):t.createCommentVNode("",!0),t.createElementVNode("div",nt,[t.createElementVNode("div",{class:"video-grid",style:t.normalizeStyle(_.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,(l,a)=>{var n,h,f;return t.openBlock(),t.createElementBlock("div",{key:((n=m.value[a])==null?void 0:n.id)??a,class:t.normalizeClass(["video-item",{"main-video":O(a),dragging:s.value===a,"drag-over":v.value===a&&s.value!==a}]),style:t.normalizeStyle(T(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((h=m.value[a])==null?void 0:h.title)||((f=m.value[a])==null?void 0:f.id)||""}`,role:"article",tabindex:"0",onDragstart:u=>R(u,a),onDragover:r[0]||(r[0]=t.withModifiers(()=>{},["prevent"])),onDragenter:u=>F(u,a),onDragleave:u=>z(u,a),onDrop:u=>P(u,a),onDragend:U},[t.renderSlot(e.$slots,"video",{video:m.value[a],index:a},()=>[t.createElementVNode("div",dt,[t.createElementVNode("div",st,t.toDisplayString(G(E.value.indexOf(a))),1)])],!0)],46,it)}),128))],4)])],4))}}),D=N(pt,[["__scopeId","data-v-fe8c1045"]]),kt={VideoGridLayout:D,VideoLayoutIcon:b},vt={install(c){Object.entries(kt).forEach(([w,o])=>{c.component(w,o)})}};exports.LAYOUT_CONFIGS=p;exports.VideoGridLayout=D;exports.VideoLayoutIcon=b;exports.default=vt;exports.getAllLayoutTypes=L;exports.getLayoutPositions=V;
|
|
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=_;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as Y, createElementBlock as i, openBlock as d, createCommentVNode as z, 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 R, renderList as P, unref as T, normalizeClass as F, createVNode as ct, toDisplayString as U, withModifiers as it, renderSlot as dt } from "vue";
|
|
2
|
+
const C = {
|
|
3
3
|
1: {
|
|
4
4
|
type: "1",
|
|
5
5
|
label: "1分屏",
|
|
@@ -77,11 +77,11 @@ const S = {
|
|
|
77
77
|
cols: 4,
|
|
78
78
|
rows: 4
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
function
|
|
82
|
-
if (
|
|
83
|
-
return
|
|
84
|
-
const
|
|
80
|
+
}, O = {};
|
|
81
|
+
function st(l) {
|
|
82
|
+
if (O[l])
|
|
83
|
+
return O[l];
|
|
84
|
+
const e = {
|
|
85
85
|
1: [
|
|
86
86
|
{ col: 1, colSpan: 1, row: 1, rowSpan: 1 }
|
|
87
87
|
],
|
|
@@ -184,64 +184,64 @@ function nt(l) {
|
|
|
184
184
|
{ col: 4, colSpan: 1, row: 4, rowSpan: 1 }
|
|
185
185
|
]
|
|
186
186
|
}[l] || [];
|
|
187
|
-
return
|
|
187
|
+
return e.length > 0 && (O[l] = e), e;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return Object.keys(
|
|
189
|
+
function ht() {
|
|
190
|
+
return Object.keys(C);
|
|
191
191
|
}
|
|
192
|
-
const
|
|
192
|
+
const wt = { class: "layout-icon" }, ut = {
|
|
193
193
|
key: 0,
|
|
194
194
|
viewBox: "0 0 48 48",
|
|
195
195
|
fill: "none"
|
|
196
|
-
},
|
|
196
|
+
}, pt = {
|
|
197
197
|
key: 1,
|
|
198
198
|
viewBox: "0 0 48 48",
|
|
199
199
|
fill: "none"
|
|
200
|
-
},
|
|
200
|
+
}, vt = {
|
|
201
201
|
key: 2,
|
|
202
202
|
viewBox: "0 0 48 48",
|
|
203
203
|
fill: "none"
|
|
204
|
-
},
|
|
204
|
+
}, yt = {
|
|
205
205
|
key: 3,
|
|
206
206
|
viewBox: "0 0 48 48",
|
|
207
207
|
fill: "none"
|
|
208
|
-
},
|
|
208
|
+
}, gt = {
|
|
209
209
|
key: 4,
|
|
210
210
|
viewBox: "0 0 48 48",
|
|
211
211
|
fill: "none"
|
|
212
|
-
},
|
|
212
|
+
}, kt = {
|
|
213
213
|
key: 5,
|
|
214
214
|
viewBox: "0 0 48 48",
|
|
215
215
|
fill: "none"
|
|
216
|
-
},
|
|
216
|
+
}, St = {
|
|
217
217
|
key: 6,
|
|
218
218
|
viewBox: "0 0 48 48",
|
|
219
219
|
fill: "none"
|
|
220
|
-
},
|
|
220
|
+
}, Ct = {
|
|
221
221
|
key: 7,
|
|
222
222
|
viewBox: "0 0 48 48",
|
|
223
223
|
fill: "none"
|
|
224
|
-
},
|
|
224
|
+
}, ft = {
|
|
225
225
|
key: 8,
|
|
226
226
|
viewBox: "0 0 54 48",
|
|
227
227
|
fill: "none"
|
|
228
|
-
},
|
|
228
|
+
}, xt = {
|
|
229
229
|
key: 9,
|
|
230
230
|
viewBox: "0 0 48 48",
|
|
231
231
|
fill: "none"
|
|
232
|
-
},
|
|
232
|
+
}, mt = {
|
|
233
233
|
key: 10,
|
|
234
234
|
viewBox: "0 0 48 48",
|
|
235
235
|
fill: "none"
|
|
236
|
-
},
|
|
236
|
+
}, bt = /* @__PURE__ */ Y({
|
|
237
237
|
__name: "VideoLayoutIcon",
|
|
238
238
|
props: {
|
|
239
239
|
type: {}
|
|
240
240
|
},
|
|
241
241
|
setup(l) {
|
|
242
|
-
return (
|
|
243
|
-
l.type === "1" ? (
|
|
244
|
-
|
|
242
|
+
return (k, e) => (d(), i("div", wt, [
|
|
243
|
+
l.type === "1" ? (d(), i("svg", ut, [...e[0] || (e[0] = [
|
|
244
|
+
s("rect", {
|
|
245
245
|
x: "4",
|
|
246
246
|
y: "4",
|
|
247
247
|
width: "40",
|
|
@@ -249,8 +249,8 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
249
249
|
stroke: "currentColor",
|
|
250
250
|
"stroke-width": "2"
|
|
251
251
|
}, null, -1)
|
|
252
|
-
])])) : l.type === "2" ? (
|
|
253
|
-
|
|
252
|
+
])])) : l.type === "2" ? (d(), i("svg", pt, [...e[1] || (e[1] = [
|
|
253
|
+
s("rect", {
|
|
254
254
|
x: "4",
|
|
255
255
|
y: "4",
|
|
256
256
|
width: "19",
|
|
@@ -258,7 +258,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
258
258
|
stroke: "currentColor",
|
|
259
259
|
"stroke-width": "1.5"
|
|
260
260
|
}, null, -1),
|
|
261
|
-
|
|
261
|
+
s("rect", {
|
|
262
262
|
x: "25",
|
|
263
263
|
y: "4",
|
|
264
264
|
width: "19",
|
|
@@ -266,8 +266,8 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
266
266
|
stroke: "currentColor",
|
|
267
267
|
"stroke-width": "1.5"
|
|
268
268
|
}, null, -1)
|
|
269
|
-
])])) : l.type === "3" ? (
|
|
270
|
-
|
|
269
|
+
])])) : l.type === "3" ? (d(), i("svg", vt, [...e[2] || (e[2] = [
|
|
270
|
+
s("rect", {
|
|
271
271
|
x: "4",
|
|
272
272
|
y: "4",
|
|
273
273
|
width: "20",
|
|
@@ -275,7 +275,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
275
275
|
stroke: "currentColor",
|
|
276
276
|
"stroke-width": "2"
|
|
277
277
|
}, null, -1),
|
|
278
|
-
|
|
278
|
+
s("rect", {
|
|
279
279
|
x: "26",
|
|
280
280
|
y: "4",
|
|
281
281
|
width: "18",
|
|
@@ -283,7 +283,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
283
283
|
stroke: "currentColor",
|
|
284
284
|
"stroke-width": "1.5"
|
|
285
285
|
}, null, -1),
|
|
286
|
-
|
|
286
|
+
s("rect", {
|
|
287
287
|
x: "26",
|
|
288
288
|
y: "25",
|
|
289
289
|
width: "18",
|
|
@@ -291,8 +291,8 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
291
291
|
stroke: "currentColor",
|
|
292
292
|
"stroke-width": "1.5"
|
|
293
293
|
}, null, -1)
|
|
294
|
-
])])) : l.type === "4" ? (
|
|
295
|
-
|
|
294
|
+
])])) : l.type === "4" ? (d(), i("svg", yt, [...e[3] || (e[3] = [
|
|
295
|
+
s("rect", {
|
|
296
296
|
x: "4",
|
|
297
297
|
y: "4",
|
|
298
298
|
width: "19",
|
|
@@ -300,7 +300,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
300
300
|
stroke: "currentColor",
|
|
301
301
|
"stroke-width": "1.5"
|
|
302
302
|
}, null, -1),
|
|
303
|
-
|
|
303
|
+
s("rect", {
|
|
304
304
|
x: "25",
|
|
305
305
|
y: "4",
|
|
306
306
|
width: "19",
|
|
@@ -308,7 +308,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
308
308
|
stroke: "currentColor",
|
|
309
309
|
"stroke-width": "1.5"
|
|
310
310
|
}, null, -1),
|
|
311
|
-
|
|
311
|
+
s("rect", {
|
|
312
312
|
x: "4",
|
|
313
313
|
y: "25",
|
|
314
314
|
width: "19",
|
|
@@ -316,7 +316,7 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
316
316
|
stroke: "currentColor",
|
|
317
317
|
"stroke-width": "1.5"
|
|
318
318
|
}, null, -1),
|
|
319
|
-
|
|
319
|
+
s("rect", {
|
|
320
320
|
x: "25",
|
|
321
321
|
y: "25",
|
|
322
322
|
width: "19",
|
|
@@ -324,38 +324,38 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
324
324
|
stroke: "currentColor",
|
|
325
325
|
"stroke-width": "1.5"
|
|
326
326
|
}, null, -1)
|
|
327
|
-
])])) : l.type === "6" ? (
|
|
328
|
-
|
|
329
|
-
])])) : l.type === "7" ? (
|
|
330
|
-
|
|
331
|
-
])])) : l.type === "8" ? (
|
|
332
|
-
|
|
333
|
-
])])) : l.type === "9" ? (
|
|
334
|
-
|
|
335
|
-
])])) : l.type === "10" ? (
|
|
336
|
-
|
|
337
|
-
])])) : l.type === "13" ? (
|
|
338
|
-
|
|
339
|
-
])])) : l.type === "16" ? (
|
|
340
|
-
|
|
341
|
-
])])) :
|
|
327
|
+
])])) : l.type === "6" ? (d(), i("svg", gt, [...e[4] || (e[4] = [
|
|
328
|
+
S('<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
|
+
])])) : l.type === "7" ? (d(), i("svg", kt, [...e[5] || (e[5] = [
|
|
330
|
+
S('<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
|
+
])])) : l.type === "8" ? (d(), i("svg", St, [...e[6] || (e[6] = [
|
|
332
|
+
S('<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
|
+
])])) : l.type === "9" ? (d(), i("svg", Ct, [...e[7] || (e[7] = [
|
|
334
|
+
S('<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
|
+
])])) : l.type === "10" ? (d(), i("svg", ft, [...e[8] || (e[8] = [
|
|
336
|
+
S('<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
|
+
])])) : l.type === "13" ? (d(), i("svg", xt, [...e[9] || (e[9] = [
|
|
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
|
+
])])) : l.type === "16" ? (d(), i("svg", mt, [...e[10] || (e[10] = [
|
|
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
|
+
])])) : z("", !0)
|
|
342
342
|
]));
|
|
343
343
|
}
|
|
344
|
-
}),
|
|
345
|
-
const
|
|
346
|
-
for (const [
|
|
347
|
-
|
|
348
|
-
return
|
|
349
|
-
},
|
|
344
|
+
}), j = (l, k) => {
|
|
345
|
+
const e = l.__vccOpts || l;
|
|
346
|
+
for (const [f, u] of k)
|
|
347
|
+
e[f] = u;
|
|
348
|
+
return e;
|
|
349
|
+
}, H = /* @__PURE__ */ j(bt, [["__scopeId", "data-v-31e0404d"]]), Lt = {
|
|
350
350
|
key: 0,
|
|
351
351
|
class: "layout-toolbar",
|
|
352
352
|
role: "toolbar",
|
|
353
353
|
"aria-label": "布局切换工具栏"
|
|
354
|
-
},
|
|
354
|
+
}, Dt = { class: "layout-buttons" }, $t = ["onClick", "title", "aria-label", "aria-pressed"], At = { class: "layout-label" }, It = {
|
|
355
355
|
class: "video-grid-container",
|
|
356
356
|
role: "region",
|
|
357
357
|
"aria-label": "视频网格"
|
|
358
|
-
},
|
|
358
|
+
}, _t = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Bt = { class: "video-placeholder" }, Vt = { class: "placeholder-number" }, Et = 0.5, Gt = "grabbing", Tt = "0.8", Ot = /* @__PURE__ */ Y({
|
|
359
359
|
__name: "VideoGridLayout",
|
|
360
360
|
props: {
|
|
361
361
|
videos: {},
|
|
@@ -365,229 +365,261 @@ const it = { class: "layout-icon" }, dt = {
|
|
|
365
365
|
width: {},
|
|
366
366
|
height: {},
|
|
367
367
|
placeholderText: {},
|
|
368
|
-
placeholders: {}
|
|
368
|
+
placeholders: {},
|
|
369
|
+
dragAnimation: { default: "scale" }
|
|
369
370
|
},
|
|
370
371
|
emits: ["layoutChange", "videosChange"],
|
|
371
|
-
setup(l, { emit:
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
setup(l, { emit: k }) {
|
|
373
|
+
const e = l, f = k, u = V(e.layout);
|
|
374
|
+
A(() => e.layout, (t) => {
|
|
375
|
+
u.value = t;
|
|
375
376
|
});
|
|
376
|
-
const
|
|
377
|
-
I
|
|
377
|
+
const X = g(() => e.availableLayouts && e.availableLayouts.length > 0 ? e.availableLayouts : ht()), v = E([]);
|
|
378
|
+
let I = !1;
|
|
379
|
+
A(v, (t) => {
|
|
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 = {};
|
|
391
|
+
v.value.forEach((c, y) => {
|
|
392
|
+
c && c.id !== void 0 && (r[c.id] = c.__labelNumber ?? y + 1);
|
|
393
|
+
});
|
|
394
|
+
const n = Array.from({ length: a }).map((c, y) => {
|
|
395
|
+
const w = o[y];
|
|
396
|
+
if (w) {
|
|
397
|
+
const lt = r[w.id] ?? w.__labelNumber ?? y + 1;
|
|
398
|
+
return { ...w, __labelNumber: lt };
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
v.value = n;
|
|
402
|
+
}
|
|
403
|
+
const L = g(() => v.value.slice(0, _.value).map((t) => t).filter(Boolean));
|
|
404
|
+
B(e.videos), A(() => e.videos, (t) => {
|
|
378
405
|
if (!Array.isArray(t)) {
|
|
379
406
|
console.warn("[VideoGridLayout] Invalid videos prop, expected array");
|
|
380
407
|
return;
|
|
381
408
|
}
|
|
382
|
-
(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
})) && (s.value = [...t]);
|
|
386
|
-
}, { flush: "post" });
|
|
387
|
-
let D = !1;
|
|
388
|
-
I(s, (t) => {
|
|
389
|
-
!D && Array.isArray(t) && g("videosChange", t);
|
|
409
|
+
B(t);
|
|
410
|
+
}, { flush: "post" }), A(_, () => {
|
|
411
|
+
B(e.videos);
|
|
390
412
|
});
|
|
391
|
-
const
|
|
392
|
-
const t =
|
|
393
|
-
return t || (
|
|
394
|
-
}),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const t = m.value.map((e, a) => ({ p: e, idx: a }));
|
|
399
|
-
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);
|
|
400
|
-
}), w = $(-1), C = $(-1), x = T(null), z = p(() => {
|
|
401
|
-
const t = V.value;
|
|
413
|
+
const M = g(() => {
|
|
414
|
+
const t = x.value.map((o, a) => ({ p: o, idx: a }));
|
|
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
|
+
}), p = V(-1), m = V(-1), D = E(null), h = E(null);
|
|
417
|
+
let b = null;
|
|
418
|
+
const q = g(() => {
|
|
419
|
+
const t = N.value;
|
|
402
420
|
return {
|
|
403
421
|
display: "grid",
|
|
404
422
|
gridTemplateColumns: (t == null ? void 0 : t.colTemplate) || `repeat(${(t == null ? void 0 : t.cols) || 2}, 1fr)`,
|
|
405
423
|
gridTemplateRows: (t == null ? void 0 : t.rowTemplate) || `repeat(${(t == null ? void 0 : t.rows) || 2}, 1fr)`,
|
|
406
424
|
gap: "4px",
|
|
407
|
-
width:
|
|
408
|
-
height:
|
|
425
|
+
width: e.width || "100%",
|
|
426
|
+
height: e.height || "100%"
|
|
409
427
|
};
|
|
410
|
-
}),
|
|
411
|
-
width:
|
|
412
|
-
height:
|
|
428
|
+
}), J = g(() => ({
|
|
429
|
+
width: e.width || "100%",
|
|
430
|
+
height: e.height || "100%"
|
|
413
431
|
}));
|
|
414
|
-
function
|
|
415
|
-
const
|
|
416
|
-
if (Array.isArray(
|
|
417
|
-
return String(
|
|
418
|
-
if (typeof
|
|
432
|
+
function K(t) {
|
|
433
|
+
const o = t, a = M.value[o];
|
|
434
|
+
if (Array.isArray(e.placeholders) && e.placeholders[a] !== void 0)
|
|
435
|
+
return String(e.placeholders[a]);
|
|
436
|
+
if (typeof e.placeholderText == "function")
|
|
419
437
|
try {
|
|
420
|
-
return
|
|
438
|
+
return e.placeholderText(o);
|
|
421
439
|
} catch {
|
|
422
|
-
return String(
|
|
440
|
+
return String(o + 1);
|
|
423
441
|
}
|
|
424
|
-
return
|
|
442
|
+
return e.placeholderText ? String(e.placeholderText) : String(o + 1);
|
|
425
443
|
}
|
|
426
|
-
function
|
|
427
|
-
const
|
|
428
|
-
return !
|
|
429
|
-
gridColumn: `${
|
|
430
|
-
gridRow: `${
|
|
444
|
+
function Q(t) {
|
|
445
|
+
const o = x.value[t];
|
|
446
|
+
return !o || typeof o.col != "number" || typeof o.row != "number" ? {} : {
|
|
447
|
+
gridColumn: `${o.col} / span ${o.colSpan}`,
|
|
448
|
+
gridRow: `${o.row} / span ${o.rowSpan}`
|
|
431
449
|
};
|
|
432
450
|
}
|
|
433
|
-
function
|
|
434
|
-
const
|
|
435
|
-
return (
|
|
451
|
+
function W(t) {
|
|
452
|
+
const o = x.value[t];
|
|
453
|
+
return (o == null ? void 0 : o.isMain) || !1;
|
|
436
454
|
}
|
|
437
|
-
function
|
|
438
|
-
|
|
455
|
+
function Z(t) {
|
|
456
|
+
u.value = t, f("layoutChange", u.value);
|
|
439
457
|
}
|
|
440
|
-
function
|
|
441
|
-
if (
|
|
458
|
+
function $() {
|
|
459
|
+
if (D.value && document.body.contains(D.value)) {
|
|
442
460
|
try {
|
|
443
|
-
document.body.removeChild(
|
|
461
|
+
document.body.removeChild(D.value);
|
|
444
462
|
} catch (t) {
|
|
445
463
|
console.warn("[VideoGridLayout] Failed to cleanup drag image:", t);
|
|
446
464
|
}
|
|
447
|
-
|
|
465
|
+
D.value = null;
|
|
448
466
|
}
|
|
467
|
+
if (h.value && document.body.contains(h.value)) {
|
|
468
|
+
try {
|
|
469
|
+
document.body.removeChild(h.value);
|
|
470
|
+
} catch {
|
|
471
|
+
}
|
|
472
|
+
h.value = null;
|
|
473
|
+
}
|
|
474
|
+
b && (document.removeEventListener("mousemove", b), b = null);
|
|
449
475
|
}
|
|
450
|
-
function
|
|
451
|
-
if (
|
|
452
|
-
console.warn("[VideoGridLayout] Invalid drag index:",
|
|
476
|
+
function tt(t, o) {
|
|
477
|
+
if (o < 0 || o >= v.value.length) {
|
|
478
|
+
console.warn("[VideoGridLayout] Invalid drag index:", o);
|
|
453
479
|
return;
|
|
454
480
|
}
|
|
455
|
-
if (
|
|
481
|
+
if (p.value = o, !t.dataTransfer) return;
|
|
456
482
|
t.dataTransfer.effectAllowed = "move";
|
|
457
483
|
const r = t.target.closest(".video-item");
|
|
458
484
|
if (r)
|
|
459
485
|
try {
|
|
460
|
-
|
|
486
|
+
if ($(), t.dataTransfer) {
|
|
487
|
+
const c = new Image();
|
|
488
|
+
c.src = "", t.dataTransfer.setDragImage(c, 0, 0);
|
|
489
|
+
}
|
|
461
490
|
const n = r.cloneNode(!0);
|
|
462
|
-
n.style.
|
|
463
|
-
|
|
464
|
-
},
|
|
491
|
+
n.style.position = "fixed", n.style.top = "0px", n.style.left = "0px", n.style.margin = "0", n.style.pointerEvents = "none", n.style.opacity = Tt, n.style.transform = "translate(-50%,-50%)", n.style.zIndex = "9999", n.classList.add("drag-preview"), e.dragAnimation && e.dragAnimation !== "none" && n.classList.add(e.dragAnimation), document.body.appendChild(n), h.value = n, b = (c) => {
|
|
492
|
+
h.value && (h.value.style.left = `${c.clientX}px`, h.value.style.top = `${c.clientY}px`);
|
|
493
|
+
}, document.addEventListener("mousemove", b), r.style.opacity = String(Et), r.style.cursor = Gt;
|
|
465
494
|
} catch (n) {
|
|
466
|
-
console.error("[VideoGridLayout] Drag start error:", n),
|
|
495
|
+
console.error("[VideoGridLayout] Drag start error:", n), $();
|
|
467
496
|
}
|
|
468
497
|
}
|
|
469
|
-
function
|
|
498
|
+
function et(t, o) {
|
|
470
499
|
t.preventDefault(), t.stopPropagation();
|
|
471
|
-
const a =
|
|
472
|
-
if (a === -1 || a ===
|
|
473
|
-
|
|
500
|
+
const a = p.value;
|
|
501
|
+
if (a === -1 || a === o) {
|
|
502
|
+
p.value = -1;
|
|
474
503
|
return;
|
|
475
504
|
}
|
|
476
|
-
if (
|
|
477
|
-
console.warn("[VideoGridLayout] Invalid drop index:",
|
|
505
|
+
if (o < 0 || o >= x.value.length) {
|
|
506
|
+
console.warn("[VideoGridLayout] Invalid drop index:", o), p.value = -1;
|
|
478
507
|
return;
|
|
479
508
|
}
|
|
480
509
|
try {
|
|
481
|
-
const r =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
u[a] = n, u[e] = r, s.value = u, setTimeout(() => {
|
|
486
|
-
D = !1, g("videosChange", s.value);
|
|
487
|
-
}, 0);
|
|
488
|
-
}
|
|
510
|
+
const r = [...v.value], n = r[a], c = r[o];
|
|
511
|
+
r[a] = c, r[o] = n, I = !0, v.value = r, setTimeout(() => {
|
|
512
|
+
I = !1, f("videosChange", v.value.filter(Boolean));
|
|
513
|
+
}, 0);
|
|
489
514
|
} catch (r) {
|
|
490
515
|
console.error("[VideoGridLayout] Drop error:", r);
|
|
491
516
|
} finally {
|
|
492
|
-
|
|
517
|
+
p.value = -1;
|
|
493
518
|
}
|
|
494
519
|
}
|
|
495
|
-
function
|
|
496
|
-
t.preventDefault(),
|
|
520
|
+
function ot(t, o) {
|
|
521
|
+
if (t.preventDefault(), p.value !== -1 && p.value !== o) {
|
|
522
|
+
m.value = o;
|
|
523
|
+
try {
|
|
524
|
+
const r = (t.currentTarget || t.target).getBoundingClientRect();
|
|
525
|
+
h.value && (h.value.style.width = `${r.width}px`, h.value.style.height = `${r.height}px`, h.value.style.transform = "translate(-50%,-50%)");
|
|
526
|
+
} catch {
|
|
527
|
+
}
|
|
528
|
+
}
|
|
497
529
|
}
|
|
498
|
-
function
|
|
530
|
+
function rt(t, o) {
|
|
499
531
|
t.preventDefault();
|
|
500
532
|
const a = t.target, r = t.relatedTarget;
|
|
501
|
-
a.contains(r) ||
|
|
533
|
+
a.contains(r) || m.value === o && (m.value = -1);
|
|
502
534
|
}
|
|
503
|
-
function
|
|
535
|
+
function at(t) {
|
|
504
536
|
const a = t.target.closest(".video-item");
|
|
505
|
-
a && (a.style.opacity = "1", a.style.cursor = "move"),
|
|
537
|
+
a && (a.style.opacity = "1", a.style.cursor = "move"), $(), p.value = -1, m.value = -1;
|
|
506
538
|
}
|
|
507
|
-
return
|
|
508
|
-
|
|
509
|
-
}), (t,
|
|
539
|
+
return nt(() => {
|
|
540
|
+
$();
|
|
541
|
+
}), (t, o) => (d(), i("div", {
|
|
510
542
|
class: "video-grid-layout",
|
|
511
543
|
role: "application",
|
|
512
544
|
"aria-label": "视频分屏布局",
|
|
513
|
-
style:
|
|
545
|
+
style: G(J.value)
|
|
514
546
|
}, [
|
|
515
|
-
l.showToolbar ? (
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
(
|
|
519
|
-
var r, n,
|
|
520
|
-
return
|
|
547
|
+
l.showToolbar ? (d(), i("div", Lt, [
|
|
548
|
+
o[1] || (o[1] = s("div", { class: "toolbar-title" }, "分屏布局", -1)),
|
|
549
|
+
s("div", Dt, [
|
|
550
|
+
(d(!0), i(R, null, P(X.value, (a) => {
|
|
551
|
+
var r, n, c;
|
|
552
|
+
return d(), i("button", {
|
|
521
553
|
key: a,
|
|
522
|
-
class:
|
|
523
|
-
onClick: (
|
|
524
|
-
title: ((r =
|
|
525
|
-
"aria-label": `切换到${((n =
|
|
526
|
-
"aria-pressed":
|
|
554
|
+
class: F(["layout-btn", { active: u.value === a }]),
|
|
555
|
+
onClick: (y) => Z(a),
|
|
556
|
+
title: ((r = T(C)[a]) == null ? void 0 : r.label) || "",
|
|
557
|
+
"aria-label": `切换到${((n = T(C)[a]) == null ? void 0 : n.label) || ""}布局`,
|
|
558
|
+
"aria-pressed": u.value === a,
|
|
527
559
|
type: "button"
|
|
528
560
|
}, [
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
], 10,
|
|
561
|
+
ct(H, { type: a }, null, 8, ["type"]),
|
|
562
|
+
s("span", At, U(((c = T(C)[a]) == null ? void 0 : c.label) || ""), 1)
|
|
563
|
+
], 10, $t);
|
|
532
564
|
}), 128))
|
|
533
565
|
])
|
|
534
|
-
])) :
|
|
535
|
-
|
|
536
|
-
|
|
566
|
+
])) : z("", !0),
|
|
567
|
+
s("div", It, [
|
|
568
|
+
s("div", {
|
|
537
569
|
class: "video-grid",
|
|
538
|
-
style:
|
|
570
|
+
style: G(q.value)
|
|
539
571
|
}, [
|
|
540
|
-
(
|
|
541
|
-
var n,
|
|
542
|
-
return
|
|
543
|
-
key: ((n =
|
|
544
|
-
class:
|
|
545
|
-
"main-video":
|
|
546
|
-
dragging:
|
|
547
|
-
"drag-over":
|
|
572
|
+
(d(!0), i(R, null, P(x.value, (a, r) => {
|
|
573
|
+
var n, c, y;
|
|
574
|
+
return d(), i("div", {
|
|
575
|
+
key: ((n = L.value[r]) == null ? void 0 : n.id) ?? r,
|
|
576
|
+
class: F(["video-item", {
|
|
577
|
+
"main-video": W(r),
|
|
578
|
+
dragging: p.value === r,
|
|
579
|
+
"drag-over": m.value === r && p.value !== r
|
|
548
580
|
}]),
|
|
549
|
-
style:
|
|
581
|
+
style: G(Q(r)),
|
|
550
582
|
draggable: !0,
|
|
551
|
-
"aria-label": `视频 ${r + 1}: ${((
|
|
583
|
+
"aria-label": `视频 ${r + 1}: ${((c = L.value[r]) == null ? void 0 : c.title) || ((y = L.value[r]) == null ? void 0 : y.id) || ""}`,
|
|
552
584
|
role: "article",
|
|
553
585
|
tabindex: "0",
|
|
554
|
-
onDragstart: (
|
|
555
|
-
onDragover:
|
|
586
|
+
onDragstart: (w) => tt(w, r),
|
|
587
|
+
onDragover: o[0] || (o[0] = it(() => {
|
|
556
588
|
}, ["prevent"])),
|
|
557
|
-
onDragenter: (
|
|
558
|
-
onDragleave: (
|
|
559
|
-
onDrop: (
|
|
560
|
-
onDragend:
|
|
589
|
+
onDragenter: (w) => ot(w, r),
|
|
590
|
+
onDragleave: (w) => rt(w, r),
|
|
591
|
+
onDrop: (w) => et(w, r),
|
|
592
|
+
onDragend: at
|
|
561
593
|
}, [
|
|
562
|
-
|
|
563
|
-
video:
|
|
594
|
+
dt(t.$slots, "video", {
|
|
595
|
+
video: L.value[r],
|
|
564
596
|
index: r
|
|
565
597
|
}, () => [
|
|
566
|
-
|
|
567
|
-
|
|
598
|
+
s("div", Bt, [
|
|
599
|
+
s("div", Vt, U(K(M.value.indexOf(r))), 1)
|
|
568
600
|
])
|
|
569
601
|
], !0)
|
|
570
|
-
], 46,
|
|
602
|
+
], 46, _t);
|
|
571
603
|
}), 128))
|
|
572
604
|
], 4)
|
|
573
605
|
])
|
|
574
606
|
], 4));
|
|
575
607
|
}
|
|
576
|
-
}),
|
|
577
|
-
VideoGridLayout:
|
|
578
|
-
VideoLayoutIcon:
|
|
579
|
-
},
|
|
608
|
+
}), Nt = /* @__PURE__ */ j(Ot, [["__scopeId", "data-v-70c9cc23"]]), Mt = {
|
|
609
|
+
VideoGridLayout: Nt,
|
|
610
|
+
VideoLayoutIcon: H
|
|
611
|
+
}, Pt = {
|
|
580
612
|
install(l) {
|
|
581
|
-
Object.entries(
|
|
582
|
-
l.component(
|
|
613
|
+
Object.entries(Mt).forEach(([k, e]) => {
|
|
614
|
+
l.component(k, e);
|
|
583
615
|
});
|
|
584
616
|
}
|
|
585
617
|
};
|
|
586
618
|
export {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
619
|
+
C as LAYOUT_CONFIGS,
|
|
620
|
+
Nt as VideoGridLayout,
|
|
621
|
+
H as VideoLayoutIcon,
|
|
622
|
+
Pt as default,
|
|
623
|
+
ht as getAllLayoutTypes,
|
|
624
|
+
st as getLayoutPositions
|
|
593
625
|
};
|
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-70c9cc23]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-70c9cc23]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-70c9cc23]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-70c9cc23]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-70c9cc23]{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-70c9cc23]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-70c9cc23]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-70c9cc23]{font-size:12px}.video-grid-container[data-v-70c9cc23]{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-70c9cc23]{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-70c9cc23]{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-70c9cc23]{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.drag-preview.scale[data-v-70c9cc23]{transition:transform .16s ease}.drag-preview.fade[data-v-70c9cc23]{transition:opacity .16s ease;opacity:.9}.drag-preview.slide[data-v-70c9cc23]{transition:transform .2s cubic-bezier(.2,.8,.2,1)}.video-item[data-v-70c9cc23]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-70c9cc23]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-70c9cc23]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-70c9cc23]{border-width:1px}.video-item[data-v-70c9cc23]>*{width:100%;height:100%}.video-placeholder[data-v-70c9cc23]{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-70c9cc23]{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-70c9cc23]{flex-direction:column;align-items:flex-start}.layout-label[data-v-70c9cc23]{display:none}}
|