matrix_components 2.0.500 → 2.0.501
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ComponentDemo/FormDemo.vue +1 -118
- package/dist/ComponentDemo/MDDemo.vue +245 -18
- package/dist/ComponentDemo/ReadMe.vue +25 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 2.vue +1516 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 3.vue +1546 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 4.vue +1557 -0
- package/dist/ComponentDemo/SaturationLineDemo copy.vue +1366 -0
- package/dist/ComponentDemo/SaturationLineDemo.vue +576 -4
- package/dist/matrix-components.d.ts +2 -0
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +93 -18
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +2 -1
|
@@ -66,20 +66,6 @@
|
|
|
66
66
|
gapV="10px"
|
|
67
67
|
></NsForm>
|
|
68
68
|
</NsFormTitle>
|
|
69
|
-
<NsFormTitle title="一维数组配置(新功能)">
|
|
70
|
-
<NsForm
|
|
71
|
-
ref="row5Ref"
|
|
72
|
-
:readOnly="state.readOnly"
|
|
73
|
-
backgroundColor="#fff"
|
|
74
|
-
:model="state.model"
|
|
75
|
-
:rows="state.rows5"
|
|
76
|
-
formPropKey="rows5"
|
|
77
|
-
labelColor="#606266"
|
|
78
|
-
labelWidth="150"
|
|
79
|
-
gapH="300px"
|
|
80
|
-
gapV="10px"
|
|
81
|
-
></NsForm>
|
|
82
|
-
</NsFormTitle>
|
|
83
69
|
</el-form>
|
|
84
70
|
</div>
|
|
85
71
|
</div>
|
|
@@ -129,7 +115,6 @@ const row1Ref = ref()
|
|
|
129
115
|
const row2Ref = ref()
|
|
130
116
|
const row3Ref = ref()
|
|
131
117
|
const row4Ref = ref()
|
|
132
|
-
const row5Ref = ref()
|
|
133
118
|
|
|
134
119
|
const state = reactive({
|
|
135
120
|
formData: {},
|
|
@@ -496,104 +481,6 @@ const state = reactive({
|
|
|
496
481
|
},
|
|
497
482
|
],
|
|
498
483
|
],
|
|
499
|
-
// 一维数组配置示例 - 使用span属性控制布局,支持自动换行
|
|
500
|
-
// 说明:当一行中的span总和达到24时,会自动换到下一行
|
|
501
|
-
// 第一行:field1(6) + field2(6) + field3(6) + field4(6) = 24(满行)
|
|
502
|
-
// 第二行:field5(12) + field6(12) = 24(满行)
|
|
503
|
-
// 第三行:field7(8) + field8(8) + field9(8) = 24(满行)
|
|
504
|
-
// 第四行:field10(40%≈10) + field11(60%≈14) = 24(满行)
|
|
505
|
-
// 第五行:field12和field13未配置span,自动平分剩余空间
|
|
506
|
-
rows5: [
|
|
507
|
-
{
|
|
508
|
-
key: 'field1',
|
|
509
|
-
label: '字段1(25%)',
|
|
510
|
-
value: '',
|
|
511
|
-
component: 'ElInput',
|
|
512
|
-
span: 6,
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
key: 'field2',
|
|
516
|
-
label: '字段2(25%)',
|
|
517
|
-
value: '',
|
|
518
|
-
component: 'ElInput',
|
|
519
|
-
span: 6,
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
key: 'field3',
|
|
523
|
-
label: '字段3(25%)',
|
|
524
|
-
value: '',
|
|
525
|
-
component: 'ElInput',
|
|
526
|
-
span: 6,
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
key: 'field4',
|
|
530
|
-
label: '字段4(25%)',
|
|
531
|
-
value: '',
|
|
532
|
-
component: 'ElInput',
|
|
533
|
-
span: 6,
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
key: 'field5',
|
|
537
|
-
label: '字段5(50%)',
|
|
538
|
-
value: '',
|
|
539
|
-
component: 'ElInput',
|
|
540
|
-
span: 12,
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
key: 'field6',
|
|
544
|
-
label: '字段6(50%)',
|
|
545
|
-
value: '',
|
|
546
|
-
component: 'ElInput',
|
|
547
|
-
span: 12,
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
key: 'field7',
|
|
551
|
-
label: '字段7(33.33%)',
|
|
552
|
-
value: '',
|
|
553
|
-
component: 'ElInput',
|
|
554
|
-
span: 8,
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
key: 'field8',
|
|
558
|
-
label: '字段8(33.33%)',
|
|
559
|
-
value: '',
|
|
560
|
-
component: 'ElInput',
|
|
561
|
-
span: 8,
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
key: 'field9',
|
|
565
|
-
label: '字段9(33.33%)',
|
|
566
|
-
value: '',
|
|
567
|
-
component: 'ElInput',
|
|
568
|
-
span: 8,
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
key: 'field10',
|
|
572
|
-
label: '字段10(使用百分比40%)',
|
|
573
|
-
value: '',
|
|
574
|
-
component: 'ElInput',
|
|
575
|
-
span: '40%',
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
key: 'field11',
|
|
579
|
-
label: '字段11(使用百分比60%)',
|
|
580
|
-
value: '',
|
|
581
|
-
component: 'ElInput',
|
|
582
|
-
span: '60%',
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
key: 'field12',
|
|
586
|
-
label: '字段12(自动平分)',
|
|
587
|
-
value: '',
|
|
588
|
-
component: 'ElInput',
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
key: 'field13',
|
|
592
|
-
label: '字段13(自动平分)',
|
|
593
|
-
value: '',
|
|
594
|
-
component: 'ElInput',
|
|
595
|
-
},
|
|
596
|
-
],
|
|
597
484
|
})
|
|
598
485
|
|
|
599
486
|
function changeHandler(v) {
|
|
@@ -640,8 +527,7 @@ async function getFormData() {
|
|
|
640
527
|
const data2 = row2Ref.value?.getFormKvData?.()
|
|
641
528
|
const data3 = row3Ref.value?.getFormKvData?.()
|
|
642
529
|
const data4 = row4Ref.value?.getFormKvData?.()
|
|
643
|
-
const
|
|
644
|
-
const data = { ...data1, ...data2, ...data3, ...data4, ...data5 }
|
|
530
|
+
const data = { ...data1, ...data2, ...data3, ...data4 }
|
|
645
531
|
state.formData = data
|
|
646
532
|
ElMessage.success('表单校验成功')
|
|
647
533
|
return data
|
|
@@ -656,7 +542,6 @@ async function resetFormData() {
|
|
|
656
542
|
row2Ref.value?.resetForm?.()
|
|
657
543
|
row3Ref.value?.resetForm?.()
|
|
658
544
|
row4Ref.value?.resetForm?.()
|
|
659
|
-
row5Ref.value?.resetForm?.()
|
|
660
545
|
setTimeout(() => {
|
|
661
546
|
// 重置表单验证状态
|
|
662
547
|
formRef.value?.clearValidate?.()
|
|
@@ -687,13 +572,11 @@ async function getDetail() {
|
|
|
687
572
|
row2Ref.value?.resetForm()
|
|
688
573
|
row3Ref.value?.resetForm()
|
|
689
574
|
row4Ref.value?.resetForm()
|
|
690
|
-
row5Ref.value?.resetForm()
|
|
691
575
|
setTimeout(() => {
|
|
692
576
|
row1Ref.value?.setFormData?.(res)
|
|
693
577
|
row2Ref.value?.setFormData?.(res)
|
|
694
578
|
row3Ref.value?.setFormData?.(res)
|
|
695
579
|
row4Ref.value?.setFormData?.(res)
|
|
696
|
-
row5Ref.value?.setFormData?.(res)
|
|
697
580
|
}, 10)
|
|
698
581
|
return
|
|
699
582
|
// 特殊处理
|
|
@@ -1,25 +1,252 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<div class="control-panel">
|
|
4
|
+
<h3>Markdown 文档预览演示</h3>
|
|
5
|
+
|
|
6
|
+
<!-- 文件上传方式 -->
|
|
7
|
+
<div class="upload-section">
|
|
8
|
+
<h4>方式一:文件上传</h4>
|
|
9
|
+
<input
|
|
10
|
+
type="file"
|
|
11
|
+
@change="importMd(($event.target as any)?.files?.[0])"
|
|
12
|
+
accept=".md,.markdown"
|
|
13
|
+
/>
|
|
14
|
+
<button @click="clearFile" :disabled="!file">清除文件</button>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<!-- URL方式 -->
|
|
18
|
+
<div class="url-section">
|
|
19
|
+
<h4>方式二:URL地址</h4>
|
|
20
|
+
<input
|
|
21
|
+
v-model="mdUrl"
|
|
22
|
+
type="text"
|
|
23
|
+
placeholder="请输入Markdown文档的URL地址"
|
|
24
|
+
class="url-input"
|
|
25
|
+
/>
|
|
26
|
+
<button @click="loadFromUrl" :disabled="!mdUrl.trim()">加载URL</button>
|
|
27
|
+
<button @click="clearUrl" :disabled="!mdUrl">清除URL</button>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<!-- 模式切换 -->
|
|
31
|
+
<div class="mode-section">
|
|
32
|
+
<h4>显示模式</h4>
|
|
33
|
+
<button
|
|
34
|
+
@click="toggleMode"
|
|
35
|
+
:class="['mode-btn', { active: mode === 'dark' }]"
|
|
36
|
+
>
|
|
37
|
+
{{ mode === 'light' ? '切换到深色模式' : '切换到浅色模式' }}
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
4
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<!-- Markdown组件 -->
|
|
43
|
+
<div class="md-container">
|
|
44
|
+
<NsMD
|
|
45
|
+
v-if="showComponent"
|
|
46
|
+
:content="currentContent"
|
|
47
|
+
:mode="mode"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
5
51
|
</template>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
52
|
+
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
import { ref, nextTick } from 'vue'
|
|
55
|
+
|
|
56
|
+
const showComponent = ref(true)
|
|
57
|
+
const file = ref()
|
|
58
|
+
const mdUrl = ref(
|
|
59
|
+
'https://raw.githubusercontent.com/microsoft/vscode/main/README.md',
|
|
60
|
+
)
|
|
61
|
+
const currentContent = ref('')
|
|
62
|
+
const mode = ref<'light' | 'dark'>('light')
|
|
63
|
+
|
|
64
|
+
async function importMd(f: any) {
|
|
65
|
+
// 清除URL,使用文件上传
|
|
66
|
+
mdUrl.value = ''
|
|
67
|
+
file.value = f
|
|
68
|
+
|
|
69
|
+
if (f && (f.name.endsWith('.md') || f.name.endsWith('.markdown'))) {
|
|
70
|
+
try {
|
|
71
|
+
// 读取文件内容
|
|
72
|
+
const text = await f.text()
|
|
73
|
+
currentContent.value = text
|
|
74
|
+
reloadComponent()
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error('读取文件失败:', error)
|
|
77
|
+
alert('读取文件失败,请重试')
|
|
78
|
+
clearFile()
|
|
79
|
+
}
|
|
80
|
+
} else if (f) {
|
|
81
|
+
alert('请选择Markdown文件(.md或.markdown)')
|
|
82
|
+
clearFile()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function loadFromUrl() {
|
|
87
|
+
if (mdUrl.value.trim()) {
|
|
88
|
+
// 清除文件,使用URL
|
|
89
|
+
clearFile()
|
|
90
|
+
try {
|
|
91
|
+
// 从URL获取Markdown内容
|
|
92
|
+
const response = await fetch(mdUrl.value.trim())
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
95
|
+
}
|
|
96
|
+
const text = await response.text()
|
|
97
|
+
currentContent.value = text
|
|
98
|
+
reloadComponent()
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('加载URL失败:', error)
|
|
101
|
+
clearUrl()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function clearFile() {
|
|
107
|
+
file.value = null
|
|
108
|
+
currentContent.value = ''
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function clearUrl() {
|
|
112
|
+
mdUrl.value = ''
|
|
113
|
+
currentContent.value = ''
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function toggleMode() {
|
|
117
|
+
mode.value = mode.value === 'light' ? 'dark' : 'light'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 重新加载组件
|
|
121
|
+
function reloadComponent() {
|
|
122
|
+
showComponent.value = false
|
|
123
|
+
nextTick(() => {
|
|
124
|
+
showComponent.value = true
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 初始化时加载默认URL
|
|
129
|
+
loadFromUrl()
|
|
15
130
|
</script>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
131
|
+
|
|
132
|
+
<style scoped lang="scss">
|
|
133
|
+
.demo-container {
|
|
134
|
+
padding: 20px;
|
|
135
|
+
max-width: 1400px;
|
|
136
|
+
margin: 0 auto;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.control-panel {
|
|
140
|
+
background: #f5f5f5;
|
|
141
|
+
padding: 20px;
|
|
142
|
+
border-radius: 8px;
|
|
143
|
+
margin-bottom: 20px;
|
|
144
|
+
|
|
145
|
+
h3 {
|
|
146
|
+
margin: 0 0 20px 0;
|
|
147
|
+
color: #333;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
h4 {
|
|
151
|
+
margin: 15px 0 10px 0;
|
|
152
|
+
color: #666;
|
|
153
|
+
font-size: 14px;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.upload-section,
|
|
158
|
+
.url-section,
|
|
159
|
+
.mode-section {
|
|
160
|
+
margin-bottom: 20px;
|
|
161
|
+
padding: 15px;
|
|
162
|
+
background: white;
|
|
163
|
+
border-radius: 6px;
|
|
164
|
+
border: 1px solid #e0e0e0;
|
|
165
|
+
|
|
166
|
+
input[type='file'] {
|
|
167
|
+
margin-right: 10px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.url-input {
|
|
171
|
+
width: 300px;
|
|
172
|
+
padding: 8px 12px;
|
|
173
|
+
border: 1px solid #ddd;
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
margin-right: 10px;
|
|
176
|
+
font-size: 14px;
|
|
177
|
+
|
|
178
|
+
&:focus {
|
|
179
|
+
outline: none;
|
|
180
|
+
border-color: #409eff;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
button {
|
|
185
|
+
padding: 8px 16px;
|
|
186
|
+
background: #409eff;
|
|
187
|
+
color: white;
|
|
188
|
+
border: none;
|
|
189
|
+
border-radius: 4px;
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
margin-right: 10px;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
|
|
194
|
+
&:hover:not(:disabled) {
|
|
195
|
+
background: #337ecc;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&:disabled {
|
|
199
|
+
background: #c0c4cc;
|
|
200
|
+
cursor: not-allowed;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.mode-btn {
|
|
204
|
+
background: #666;
|
|
205
|
+
|
|
206
|
+
&:hover:not(:disabled) {
|
|
207
|
+
background: #555;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.active {
|
|
211
|
+
background: #1890ff;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
background: #096dd9;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.md-container {
|
|
222
|
+
min-height: 600px;
|
|
223
|
+
border: 1px solid #e0e0e0;
|
|
224
|
+
border-radius: 8px;
|
|
225
|
+
padding: 20px;
|
|
226
|
+
background: white;
|
|
227
|
+
overflow: auto;
|
|
228
|
+
margin-bottom: 20px;
|
|
229
|
+
|
|
230
|
+
// 深色模式样式
|
|
231
|
+
&:has(.markdown-view) {
|
|
232
|
+
transition: background-color 0.3s ease;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (max-width: 768px) {
|
|
237
|
+
.url-input {
|
|
238
|
+
width: 100% !important;
|
|
239
|
+
margin-bottom: 10px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.control-panel {
|
|
243
|
+
padding: 15px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.upload-section,
|
|
247
|
+
.url-section,
|
|
248
|
+
.mode-section {
|
|
249
|
+
padding: 10px;
|
|
23
250
|
}
|
|
24
251
|
}
|
|
25
252
|
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dm">
|
|
3
|
+
<NsMD class="dm-ui" :msg="msg"></NsMD>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script setup lang="ts" name="">
|
|
7
|
+
import { onMounted, ref } from 'vue';
|
|
8
|
+
const msg = ref()
|
|
9
|
+
|
|
10
|
+
onMounted(async () => {
|
|
11
|
+
const readme = await fetch(`${import.meta.env.VITE_BASE_URL}README.md`)
|
|
12
|
+
const txt = await readme.text();
|
|
13
|
+
msg.value = txt
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
<style lang="scss" scoped>
|
|
17
|
+
.dm {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
.dm-ui {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|