matrix_components 2.0.317 → 2.0.319
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 +2 -1
- package/dist/ComponentDemo/DialogDemo.vue +210 -0
- package/dist/ComponentDemo/ExampleFormConfig.js +270 -0
- package/dist/ComponentDemo/ExcelDemo.vue +263 -0
- package/dist/ComponentDemo/FormDemo.vue +400 -0
- package/dist/ComponentDemo/ImageDemo.vue +143 -0
- package/dist/ComponentDemo/MDDemo.vue +20 -0
- package/dist/ComponentDemo/OfficeDemo.vue +189 -0
- package/dist/ComponentDemo/PdfDemo.vue +207 -0
- package/dist/ComponentDemo/SaturationLineDemo.vue +158 -0
- package/dist/ComponentDemo/SimpleFormConfig.json +97 -0
- package/dist/ComponentDemo/Test.vue +347 -0
- package/dist/ComponentDemo/TestFormConfig.js +129 -0
- package/dist/ComponentDemo/VideoDemo copy 2.vue +268 -0
- package/dist/ComponentDemo/VideoDemo copy 3.vue +356 -0
- package/dist/ComponentDemo/VideoDemo copy.vue +289 -0
- package/dist/ComponentDemo/VideoDemo.vue +356 -0
- package/dist/ComponentDemo/WordDemo.vue +191 -0
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +159 -152
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// 测试表单配置文件 - 用于验证默认值加载功能
|
|
2
|
+
export const formConfig = {
|
|
3
|
+
// 表单数据初始值
|
|
4
|
+
formData: {
|
|
5
|
+
testName: "默认姓名",
|
|
6
|
+
testEmail: "default@example.com",
|
|
7
|
+
testAge: 25,
|
|
8
|
+
testGender: "male",
|
|
9
|
+
testHobbies: ["reading", "music"],
|
|
10
|
+
testIsVip: true,
|
|
11
|
+
testScore: 80,
|
|
12
|
+
testBirthday: "1998-01-01",
|
|
13
|
+
testDescription: "这是默认的描述信息",
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
// 表单配置项
|
|
17
|
+
formItems: [
|
|
18
|
+
{
|
|
19
|
+
label: "姓名",
|
|
20
|
+
prop: "testName",
|
|
21
|
+
component: "input",
|
|
22
|
+
span: 12,
|
|
23
|
+
required: true,
|
|
24
|
+
placeholder: "请输入姓名",
|
|
25
|
+
props: {
|
|
26
|
+
clearable: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "邮箱",
|
|
31
|
+
prop: "testEmail",
|
|
32
|
+
component: "input",
|
|
33
|
+
span: 12,
|
|
34
|
+
required: true,
|
|
35
|
+
props: {
|
|
36
|
+
clearable: true,
|
|
37
|
+
},
|
|
38
|
+
rules: [
|
|
39
|
+
{ type: "email", message: "请输入正确的邮箱地址", trigger: "blur" },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "年龄",
|
|
44
|
+
prop: "testAge",
|
|
45
|
+
component: "number",
|
|
46
|
+
span: 12,
|
|
47
|
+
props: {
|
|
48
|
+
min: 1,
|
|
49
|
+
max: 120,
|
|
50
|
+
controlsPosition: "right",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: "性别",
|
|
55
|
+
prop: "testGender",
|
|
56
|
+
component: "radio-group",
|
|
57
|
+
span: 12,
|
|
58
|
+
options: [
|
|
59
|
+
{ label: "男", value: "male" },
|
|
60
|
+
{ label: "女", value: "female" },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "爱好",
|
|
65
|
+
prop: "testHobbies",
|
|
66
|
+
component: "checkbox-group",
|
|
67
|
+
span: 24,
|
|
68
|
+
options: [
|
|
69
|
+
{ label: "读书", value: "reading" },
|
|
70
|
+
{ label: "运动", value: "sports" },
|
|
71
|
+
{ label: "音乐", value: "music" },
|
|
72
|
+
{ label: "旅行", value: "travel" },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "VIP用户",
|
|
77
|
+
prop: "testIsVip",
|
|
78
|
+
component: "switch",
|
|
79
|
+
span: 12,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: "评分",
|
|
83
|
+
prop: "testScore",
|
|
84
|
+
component: "slider",
|
|
85
|
+
span: 12,
|
|
86
|
+
props: {
|
|
87
|
+
min: 0,
|
|
88
|
+
max: 100,
|
|
89
|
+
showStops: true,
|
|
90
|
+
showTooltip: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "生日",
|
|
95
|
+
prop: "testBirthday",
|
|
96
|
+
component: "date-picker",
|
|
97
|
+
span: 12,
|
|
98
|
+
props: {
|
|
99
|
+
type: "date",
|
|
100
|
+
format: "YYYY-MM-DD",
|
|
101
|
+
valueFormat: "YYYY-MM-DD",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: "描述",
|
|
106
|
+
prop: "testDescription",
|
|
107
|
+
component: "textarea",
|
|
108
|
+
span: 24,
|
|
109
|
+
props: {
|
|
110
|
+
rows: 4,
|
|
111
|
+
maxlength: 200,
|
|
112
|
+
showWordLimit: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
|
|
117
|
+
// 表单验证规则
|
|
118
|
+
formRules: {
|
|
119
|
+
testName: [
|
|
120
|
+
{ required: true, message: "请输入姓名"},
|
|
121
|
+
],
|
|
122
|
+
testEmail: [{ required: true, message: "请输入邮箱地址"}],
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// 下拉框选项数据源
|
|
126
|
+
optionsData: {},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default formConfig;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, reactive, ref } from 'vue'
|
|
3
|
+
import { VideoCanvasDrawer } from './videoCanvasDrawer.js'
|
|
4
|
+
|
|
5
|
+
const nsVideoRef = ref()
|
|
6
|
+
|
|
7
|
+
// 视频信息
|
|
8
|
+
const videoData = reactive({
|
|
9
|
+
// videoModel: 'hk',
|
|
10
|
+
// hkPath: '/martrix/cdn/h5player',
|
|
11
|
+
// 显示视频关闭按钮
|
|
12
|
+
showClose: false,
|
|
13
|
+
// 显示树
|
|
14
|
+
showTree: true,
|
|
15
|
+
// 树数据
|
|
16
|
+
treeData: [
|
|
17
|
+
{
|
|
18
|
+
id: '1',
|
|
19
|
+
label: '分组1',
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
id: '11',
|
|
23
|
+
label: '分组1-1',
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
videoModel: 'easyplayer',
|
|
27
|
+
id: '111',
|
|
28
|
+
label: '视频A--1视频A--1视频A--1',
|
|
29
|
+
url: 'http://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000001/hls.m3u8',
|
|
30
|
+
deviceId: 'a1',
|
|
31
|
+
channelId: 'a11',
|
|
32
|
+
icontype: 'on',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'D',
|
|
36
|
+
label: '视频A--2',
|
|
37
|
+
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000013.live.flv',
|
|
38
|
+
deviceId: 'b1',
|
|
39
|
+
channelId: 'b11',
|
|
40
|
+
icontype: 'off',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'b',
|
|
46
|
+
label: '分组b',
|
|
47
|
+
children: [
|
|
48
|
+
{
|
|
49
|
+
id: 'b1',
|
|
50
|
+
label: '视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1',
|
|
51
|
+
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000003.live.flv',
|
|
52
|
+
deviceId: 'a1',
|
|
53
|
+
channelId: 'a11',
|
|
54
|
+
icontype: 'on',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'b2',
|
|
58
|
+
label: '视频A--2',
|
|
59
|
+
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000015.live.flv',
|
|
60
|
+
deviceId: 'b1',
|
|
61
|
+
channelId: 'b11',
|
|
62
|
+
icontype: 'off',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'b3',
|
|
66
|
+
label: '视频A--3',
|
|
67
|
+
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
68
|
+
deviceId: 'c1',
|
|
69
|
+
channelId: 'c11',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'xxx2',
|
|
78
|
+
label: '视频Zxxxx2',
|
|
79
|
+
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
80
|
+
deviceId: '34020000001110000001',
|
|
81
|
+
channelId: '34020000001320000003',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
// 树节点对应的key(!!!用于改变选中后的颜色)
|
|
85
|
+
treeNodeKey: 'id',
|
|
86
|
+
// 树节点展开的key
|
|
87
|
+
treeExpandedKeys: ['11'],
|
|
88
|
+
// 树节点属性 (videoUrlKey值要和treeData中的播放地址key一致, 默认为url)
|
|
89
|
+
treeOptions: {
|
|
90
|
+
icontype: 'icontype',
|
|
91
|
+
background: 'background',
|
|
92
|
+
videoUrlKey: 'url',
|
|
93
|
+
children: 'children',
|
|
94
|
+
label: 'label',
|
|
95
|
+
},
|
|
96
|
+
// 获取、设置打开的播放视频信息
|
|
97
|
+
videoInfos: [
|
|
98
|
+
{
|
|
99
|
+
index: 0,
|
|
100
|
+
url: 'https://sf3-ttcdn-tos.pstatp.com/obj/developer/bytdance.flv',
|
|
101
|
+
info: {
|
|
102
|
+
videoModel: 'easyplayer',
|
|
103
|
+
id: 'xxx2',
|
|
104
|
+
url: 'https://sf3-ttcdn-tos.pstatp.com/obj/developer/bytdance.flv',
|
|
105
|
+
deviceId: 'c1',
|
|
106
|
+
channelId: 'c11',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
// 其他注释掉的代码保持不变
|
|
110
|
+
],
|
|
111
|
+
// !!! 单点播放
|
|
112
|
+
videoSingleUrl: false,
|
|
113
|
+
// !!! 已经在播放的是否关闭后再点击打开(需要单点播 videoSingleUrl:true)
|
|
114
|
+
videoSingleClose: false,
|
|
115
|
+
// 回调函数后是否继续执行默认播放操作
|
|
116
|
+
callbackContinueExecute: true,
|
|
117
|
+
// 播放模式: 1: 单击,2: 双击
|
|
118
|
+
videoPlayModel: 1,
|
|
119
|
+
// 分屏模式: 1: 单屏, 2: 四屏, 3: 九屏
|
|
120
|
+
videoSplitType: 1,
|
|
121
|
+
// 显示分屏按钮
|
|
122
|
+
showVideoSplit: true,
|
|
123
|
+
// 分屏使用图标
|
|
124
|
+
// videoSplitUseIcon: true,
|
|
125
|
+
// 显示方向控制按钮
|
|
126
|
+
showVideoCtrls: false,
|
|
127
|
+
// 禁止控制按钮默认请求行为(默认false,true则不使用组件的发送请求仅调用自定义回调函数)
|
|
128
|
+
stopVideoCtrlMethods: true,
|
|
129
|
+
// 单个视频错误最大次数
|
|
130
|
+
videoErrorMaxCount: 3,
|
|
131
|
+
// easyplayer配置 (默认一般不需要配置, 加载不出来的时候修改)
|
|
132
|
+
videoConfig: {
|
|
133
|
+
MSE: true,
|
|
134
|
+
WCS: true,
|
|
135
|
+
WASM:true,
|
|
136
|
+
WASMSIMD: true,
|
|
137
|
+
isLive: true,
|
|
138
|
+
hasAudio: false,
|
|
139
|
+
stretch: false
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// 绘图相关引用
|
|
144
|
+
const drawW = ref('0')
|
|
145
|
+
const drawH = ref('0')
|
|
146
|
+
const videoPlayerCoverRef = ref()
|
|
147
|
+
const videoDrawRef = ref()
|
|
148
|
+
const videoCanvasRef = ref()
|
|
149
|
+
|
|
150
|
+
// 创建绘图工具实例
|
|
151
|
+
const canvasDrawer = new VideoCanvasDrawer()
|
|
152
|
+
|
|
153
|
+
// 视频操作事件
|
|
154
|
+
const videoEvent = {
|
|
155
|
+
videoOriginalInfo: (info: any) => {
|
|
156
|
+
console.log('===============>视频原始信息:', info)
|
|
157
|
+
const coverEle = videoPlayerCoverRef.value;
|
|
158
|
+
const currentVideoInfo = info?.[0]
|
|
159
|
+
if(coverEle && currentVideoInfo?.width && currentVideoInfo?.height){
|
|
160
|
+
// 使用绘图工具计算尺寸
|
|
161
|
+
const size = canvasDrawer.calculateDrawSize(
|
|
162
|
+
coverEle.clientWidth,
|
|
163
|
+
coverEle.clientHeight,
|
|
164
|
+
currentVideoInfo.width,
|
|
165
|
+
currentVideoInfo.height
|
|
166
|
+
);
|
|
167
|
+
drawW.value = size.width;
|
|
168
|
+
drawH.value = size.height;
|
|
169
|
+
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
const videoDrawEle = videoDrawRef.value;
|
|
172
|
+
if (videoDrawEle && videoCanvasRef.value) {
|
|
173
|
+
// 初始化画布
|
|
174
|
+
canvasDrawer.initCanvas(videoCanvasRef.value, videoDrawEle);
|
|
175
|
+
// 设置画布可点击
|
|
176
|
+
const coverEle = videoPlayerCoverRef.value;
|
|
177
|
+
if (coverEle) {
|
|
178
|
+
coverEle.style.pointerEvents = 'auto';
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, 1000)
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
onMounted(() => {
|
|
187
|
+
// 添加键盘事件监听,使用绘图工具的方法
|
|
188
|
+
document.addEventListener('keydown', canvasDrawer.handleKeyDown.bind(canvasDrawer));
|
|
189
|
+
|
|
190
|
+
// 在组件卸载时移除事件监听
|
|
191
|
+
const cleanup = () => {
|
|
192
|
+
document.removeEventListener('keydown', canvasDrawer.handleKeyDown.bind(canvasDrawer));
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// 组件卸载时清理
|
|
196
|
+
const vm = getCurrentInstance();
|
|
197
|
+
if (vm && vm.proxy) {
|
|
198
|
+
(vm.proxy as any).__unmount = cleanup;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// 或者使用生命周期钩子
|
|
202
|
+
import('vue').then(({ onBeforeUnmount }) => {
|
|
203
|
+
onBeforeUnmount(cleanup);
|
|
204
|
+
});
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
function changeSplitHandler(num: number) {
|
|
208
|
+
console.log('分屏模式:如1,2,3代表单屏,四屏,九屏', num)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 为了确保TypeScript正确识别getCurrentInstance
|
|
212
|
+
import { getCurrentInstance } from 'vue';
|
|
213
|
+
</script>
|
|
214
|
+
<template>
|
|
215
|
+
<div class="video-demo">
|
|
216
|
+
<h1 class="title" style="color: #fff" v-sline>视频组件(国标28181 + 海康威视)</h1>
|
|
217
|
+
<NsVideo class="nsvideo" ref="nsVideoRef" v-bind="videoData" v-on="videoEvent" @changeSplit='changeSplitHandler'>
|
|
218
|
+
<template #video-player-cover>
|
|
219
|
+
<div class="video-player-cover" ref="videoPlayerCoverRef">
|
|
220
|
+
<div class="video-draw" ref="videoDrawRef">
|
|
221
|
+
<canvas
|
|
222
|
+
ref="videoCanvasRef"
|
|
223
|
+
width="100%"
|
|
224
|
+
height="100%"
|
|
225
|
+
class="video-canvas"
|
|
226
|
+
@click="canvasDrawer.handleCanvasClick"
|
|
227
|
+
@dblclick="canvasDrawer.handleCanvasDoubleClick"
|
|
228
|
+
></canvas>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</template>
|
|
232
|
+
</NsVideo>
|
|
233
|
+
</div>
|
|
234
|
+
</template>
|
|
235
|
+
<style scoped lang="scss">
|
|
236
|
+
.video-demo {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
height: 100%;
|
|
240
|
+
background-color: #0f2a3b;
|
|
241
|
+
.title {
|
|
242
|
+
margin-bottom: 10px;
|
|
243
|
+
}
|
|
244
|
+
.video-player-cover {
|
|
245
|
+
pointer-events: none;
|
|
246
|
+
position: absolute;
|
|
247
|
+
top: 0;
|
|
248
|
+
left: 0;
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 100%;
|
|
251
|
+
// background-color: rgba(255, 0, 0, 0.3);
|
|
252
|
+
display: flex;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
align-items: center;
|
|
255
|
+
.video-draw {
|
|
256
|
+
width: v-bind(drawW);
|
|
257
|
+
height: v-bind(drawH);
|
|
258
|
+
// background-color: rgba(238, 255, 0, 0.1);
|
|
259
|
+
.video-canvas {
|
|
260
|
+
width: 100%;
|
|
261
|
+
height: 100%;
|
|
262
|
+
background-color: transparent;
|
|
263
|
+
cursor: crosshair;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
</style>
|