Compare commits
30
Commits
2.0.0
..
ff7d0d8d51
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff7d0d8d51 | ||
|
|
0e631a6f34 | ||
|
|
0ab58b24d9 | ||
|
|
b0cf5b312a | ||
|
|
ec4ed10afd | ||
|
|
3a18bb3cbd | ||
|
|
282bf327bb | ||
|
|
4d2bd3867f | ||
|
|
afb2440d8b | ||
|
|
8b55ac2854 | ||
|
|
f0748997be | ||
|
|
b2c5c7cc6d | ||
|
|
d16f11c263 | ||
|
|
0f6e817966 | ||
|
|
6b8f7aa6b4 | ||
|
|
78dac7482c | ||
|
|
9aec221ea3 | ||
|
|
938dde4c1c | ||
|
|
8e884eb178 | ||
|
|
8c65e66ab6 | ||
|
|
a34e27cc65 | ||
|
|
de2e53cbcf | ||
|
|
b3c6dad1b1 | ||
|
|
fcb2fe8f7f | ||
|
|
c02f6743e3 | ||
|
|
3e24d4a363 | ||
|
|
7574acdad2 | ||
|
|
704c80e019 | ||
|
|
210e251b23 | ||
|
|
93ca2a29a6 |
No files matched your search
+2
-1
@@ -26,4 +26,5 @@ dist-ssr
|
|||||||
serve
|
serve
|
||||||
miao-directory.exe
|
miao-directory.exe
|
||||||
miao-directory-amd64-linux
|
miao-directory-amd64-linux
|
||||||
miao-directory-amd64-win.exe
|
miao-directory-amd64-win.exe
|
||||||
|
test
|
||||||
@@ -1,11 +1,29 @@
|
|||||||
todo: 标签页,miaoDirectory切换动画 [finish]
|
## TODO list:
|
||||||
todo: 重构virtualPage,所有page以插件形式使用 [finish]
|
|
||||||
todo: miaoDirectory插件化,为后续插件功能开发做准备 [finish]
|
| 计划 | 状态 |
|
||||||
todo: miaoPopupInput, 弹出一个输入框 [finish]
|
|---|---|
|
||||||
todo: miaoDirectory的重命名功能 [finish]
|
| 拆分miaoDirectory | ✅ |
|
||||||
todo: miaoDirectory的剪切功能 [finish]
|
| 完善视频插件 | ✅ |
|
||||||
todo: miaoDirectory的上传按钮 [finish]
|
| 完善PDF插件 | ✅ |
|
||||||
todo: miaoDirectory的新建文件/文件夹功能 [finish]
|
| 完善Code插件 | ✅ |
|
||||||
todo: miaoDirectory的多选功能 [finish]
|
| 实现miaoDirectory的搜索功能 | ✅ |
|
||||||
todo: VirtualDirectory更新时更新文件信息
|
| 重构miaoFetchApi.getFile, 增加进度 | ❌ |
|
||||||
todo: miaoDirectory的复制文件/文件夹功能
|
| plugin增加些属性,icon, disable, group之类的 | ❌ |
|
||||||
|
| 完善miaoDirectory的搜索功能 | ❌ |
|
||||||
|
| 实现miaoDirectory的排序功能 | ❌ |
|
||||||
|
| 完善图片浏览插件 | ❌ |
|
||||||
|
| VirtualDirectory更新时更新文件信息 | ❌ |
|
||||||
|
| 创建音乐播放器组件(仿QQ音乐移动端吧) | ❌ |
|
||||||
|
| miaoDirectory的复制文件/文件夹功能 | ❌ |
|
||||||
|
| 重构miaoDropHandler的实现 | ❌ |
|
||||||
|
| 重构主界面,拆分主界面组件的实现 | ❌ |
|
||||||
|
|
||||||
|
|
||||||
|
| 长期计划 |
|
||||||
|
|---|
|
||||||
|
| 重构virtualDirectory,使其不用直接拥有父文件夹 |
|
||||||
|
| 重构virtualDirectory,使其不用直接拥有父文件夹 |
|
||||||
|
|
||||||
|
## 碎碎念:
|
||||||
|
|
||||||
|
为什么不直接做成类似于windows的风格呢?其实技术实现上问题应该不大,重构也不用重构太多东西(APP.vue改改,插件部分改改这样),但是开学了事情一大堆,实习又没法比较美好地推掉。平时每天到宿舍都精疲力竭还要准备秋招和学校的破事。更何况搞不好还会被两个学分卡得没法毕业,好烦好烦。md想这么多干嘛,反正都快岩壁了,mdmdmdmd
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="./public/favicon.ico" />
|
<link rel="icon" type="image/svg+xml" href="./icon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>MiaoDirectory</title>
|
<title>MiaoDirectory</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+7
-2
@@ -7,7 +7,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"dev:host": "vite --host 0.0.0.0",
|
"dev:host": "vite --host 0.0.0.0",
|
||||||
"build": "vue-tsc -b && vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"build:auto": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go build && mv ./miao-directory.exe ../",
|
"build:auto": "pnpm run build && go env -w GOOS=windows GOARCH=amd64 && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go env -w GOOS=windows && go build -o ../miao-directory.exe",
|
||||||
"build:auto:release": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go env -w GOOS=windows GOARCH=amd64 && go build -o ../miao-directory-amd64-win.exe && go env -w GOOS=linux GOARCH=amd64 && go build -o ../miao-directory-amd64-linux",
|
"build:auto:release": "pnpm run build && rm -rf ./serve/web/* && cp -r ./dist/* ./serve/web/ && cd ./serve && go env -w GOOS=windows GOARCH=amd64 && go build -o ../miao-directory-amd64-win.exe && go env -w GOOS=linux GOARCH=amd64 && go build -o ../miao-directory-amd64-linux",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
@@ -24,19 +24,24 @@
|
|||||||
"@codemirror/lang-xml": "^6.1.0",
|
"@codemirror/lang-xml": "^6.1.0",
|
||||||
"@codemirror/lang-yaml": "^6.1.1",
|
"@codemirror/lang-yaml": "^6.1.1",
|
||||||
"@vicons/ionicons5": "^0.12.0",
|
"@vicons/ionicons5": "^0.12.0",
|
||||||
|
"aes-js": "^3.1.2",
|
||||||
"axios": "^1.7.3",
|
"axios": "^1.7.3",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"markdown-it": "^14.1.0",
|
||||||
"naive-ui": "^2.39.0",
|
"naive-ui": "^2.39.0",
|
||||||
"pdfjs-dist": "^4.5.136",
|
"pdfjs-dist": "^4.5.136",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"vue": "^3.4.35",
|
"vue": "3.5.0",
|
||||||
"vue-codemirror": "^6.1.1",
|
"vue-codemirror": "^6.1.1",
|
||||||
"xgplayer": "^3.0.20",
|
"xgplayer": "^3.0.20",
|
||||||
"xgplayer-subtitles": "^3.0.20"
|
"xgplayer-subtitles": "^3.0.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/aes-js": "^3.1.4",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.7",
|
||||||
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@types/node": "^22.1.0",
|
"@types/node": "^22.1.0",
|
||||||
"@types/pdfjs-dist": "^2.10.378",
|
"@types/pdfjs-dist": "^2.10.378",
|
||||||
"@vitejs/plugin-vue": "^5.1.2",
|
"@vitejs/plugin-vue": "^5.1.2",
|
||||||
|
|||||||
Generated
+205
-69
@@ -44,18 +44,27 @@ importers:
|
|||||||
'@vicons/ionicons5':
|
'@vicons/ionicons5':
|
||||||
specifier: ^0.12.0
|
specifier: ^0.12.0
|
||||||
version: 0.12.0
|
version: 0.12.0
|
||||||
|
aes-js:
|
||||||
|
specifier: ^3.1.2
|
||||||
|
version: 3.1.2
|
||||||
axios:
|
axios:
|
||||||
specifier: ^1.7.3
|
specifier: ^1.7.3
|
||||||
version: 1.7.3
|
version: 1.7.3
|
||||||
codemirror:
|
codemirror:
|
||||||
specifier: ^6.0.1
|
specifier: ^6.0.1
|
||||||
version: 6.0.1(@lezer/common@1.2.1)
|
version: 6.0.1(@lezer/common@1.2.1)
|
||||||
|
copy-to-clipboard:
|
||||||
|
specifier: ^3.3.3
|
||||||
|
version: 3.3.3
|
||||||
lodash:
|
lodash:
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
|
markdown-it:
|
||||||
|
specifier: ^14.1.0
|
||||||
|
version: 14.1.0
|
||||||
naive-ui:
|
naive-ui:
|
||||||
specifier: ^2.39.0
|
specifier: ^2.39.0
|
||||||
version: 2.39.0(vue@3.4.37(typescript@5.5.4))
|
version: 2.39.0(vue@3.5.0(typescript@5.5.4))
|
||||||
pdfjs-dist:
|
pdfjs-dist:
|
||||||
specifier: ^4.5.136
|
specifier: ^4.5.136
|
||||||
version: 4.5.136
|
version: 4.5.136
|
||||||
@@ -63,11 +72,11 @@ importers:
|
|||||||
specifier: ^1.77.8
|
specifier: ^1.77.8
|
||||||
version: 1.77.8
|
version: 1.77.8
|
||||||
vue:
|
vue:
|
||||||
specifier: ^3.4.35
|
specifier: 3.5.0
|
||||||
version: 3.4.37(typescript@5.5.4)
|
version: 3.5.0(typescript@5.5.4)
|
||||||
vue-codemirror:
|
vue-codemirror:
|
||||||
specifier: ^6.1.1
|
specifier: ^6.1.1
|
||||||
version: 6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.4.37(typescript@5.5.4))
|
version: 6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.5.0(typescript@5.5.4))
|
||||||
xgplayer:
|
xgplayer:
|
||||||
specifier: ^3.0.20
|
specifier: ^3.0.20
|
||||||
version: 3.0.20(core-js@3.38.1)
|
version: 3.0.20(core-js@3.38.1)
|
||||||
@@ -75,9 +84,15 @@ importers:
|
|||||||
specifier: ^3.0.20
|
specifier: ^3.0.20
|
||||||
version: 3.0.20(core-js@3.38.1)
|
version: 3.0.20(core-js@3.38.1)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@types/aes-js':
|
||||||
|
specifier: ^3.1.4
|
||||||
|
version: 3.1.4
|
||||||
'@types/lodash':
|
'@types/lodash':
|
||||||
specifier: ^4.17.7
|
specifier: ^4.17.7
|
||||||
version: 4.17.7
|
version: 4.17.7
|
||||||
|
'@types/markdown-it':
|
||||||
|
specifier: ^14.1.2
|
||||||
|
version: 14.1.2
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.1.0
|
specifier: ^22.1.0
|
||||||
version: 22.1.0
|
version: 22.1.0
|
||||||
@@ -86,7 +101,7 @@ importers:
|
|||||||
version: 2.10.378
|
version: 2.10.378
|
||||||
'@vitejs/plugin-vue':
|
'@vitejs/plugin-vue':
|
||||||
specifier: ^5.1.2
|
specifier: ^5.1.2
|
||||||
version: 5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.4.37(typescript@5.5.4))
|
version: 5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.5.0(typescript@5.5.4))
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.5.3
|
specifier: ^5.5.3
|
||||||
version: 5.5.4
|
version: 5.5.4
|
||||||
@@ -474,18 +489,30 @@ packages:
|
|||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
|
'@types/aes-js@3.1.4':
|
||||||
|
resolution: {integrity: sha512-v3D66IptpUqh+pHKVNRxY8yvp2ESSZXe0rTzsGdzUhEwag7ljVfgCllkWv2YgiYXDhWFBrEywll4A5JToyTNFA==}
|
||||||
|
|
||||||
'@types/estree@1.0.5':
|
'@types/estree@1.0.5':
|
||||||
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
|
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
|
||||||
|
|
||||||
'@types/katex@0.16.7':
|
'@types/katex@0.16.7':
|
||||||
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
|
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
|
||||||
|
|
||||||
|
'@types/linkify-it@5.0.0':
|
||||||
|
resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
|
||||||
|
|
||||||
'@types/lodash-es@4.17.12':
|
'@types/lodash-es@4.17.12':
|
||||||
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
|
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
|
||||||
|
|
||||||
'@types/lodash@4.17.7':
|
'@types/lodash@4.17.7':
|
||||||
resolution: {integrity: sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==}
|
resolution: {integrity: sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==}
|
||||||
|
|
||||||
|
'@types/markdown-it@14.1.2':
|
||||||
|
resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==}
|
||||||
|
|
||||||
|
'@types/mdurl@2.0.0':
|
||||||
|
resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==}
|
||||||
|
|
||||||
'@types/node@22.1.0':
|
'@types/node@22.1.0':
|
||||||
resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==}
|
resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==}
|
||||||
|
|
||||||
@@ -515,14 +542,20 @@ packages:
|
|||||||
'@vue/compiler-core@3.4.37':
|
'@vue/compiler-core@3.4.37':
|
||||||
resolution: {integrity: sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ==}
|
resolution: {integrity: sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ==}
|
||||||
|
|
||||||
|
'@vue/compiler-core@3.5.0':
|
||||||
|
resolution: {integrity: sha512-ja7cpqAOfw4tyFAxgBz70Z42miNDeaqTxExTsnXDLomRpqfyCgyvZvFp482fmsElpfvsoMJUsvzULhvxUTW6Iw==}
|
||||||
|
|
||||||
'@vue/compiler-dom@3.4.37':
|
'@vue/compiler-dom@3.4.37':
|
||||||
resolution: {integrity: sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag==}
|
resolution: {integrity: sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag==}
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.4.37':
|
'@vue/compiler-dom@3.5.0':
|
||||||
resolution: {integrity: sha512-vCfetdas40Wk9aK/WWf8XcVESffsbNkBQwS5t13Y/PcfqKfIwJX2gF+82th6dOpnpbptNMlMjAny80li7TaCIg==}
|
resolution: {integrity: sha512-xYjUybWZXl+1R/toDy815i4PbeehL2hThiSGkcpmIOCy2HoYyeeC/gAWK/Y/xsoK+GSw198/T5O31bYuQx5uvQ==}
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.4.37':
|
'@vue/compiler-sfc@3.5.0':
|
||||||
resolution: {integrity: sha512-TyAgYBWrHlFrt4qpdACh8e9Ms6C/AZQ6A6xLJaWrCL8GCX5DxMzxyeFAEMfU/VFr4tylHm+a2NpfJpcd7+20XA==}
|
resolution: {integrity: sha512-B9DgLtrqok2GLuaFjLlSL15ZG3ZDBiitUH1ecex9guh/ZcA5MCdwuVE6nsfQxktuZY/QY0awJ35/ripIviCQTQ==}
|
||||||
|
|
||||||
|
'@vue/compiler-ssr@3.5.0':
|
||||||
|
resolution: {integrity: sha512-E263QZmA1dqRd7c3u/sWTLRMpQOT0aZ8av/L9SoD/v/BVMZaWFHPUUBswS+bzrfvG2suJF8vSLKx6k6ba5SUdA==}
|
||||||
|
|
||||||
'@vue/compiler-vue2@2.7.16':
|
'@vue/compiler-vue2@2.7.16':
|
||||||
resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==}
|
resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==}
|
||||||
@@ -535,26 +568,32 @@ packages:
|
|||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@vue/reactivity@3.4.37':
|
'@vue/reactivity@3.5.0':
|
||||||
resolution: {integrity: sha512-UmdKXGx0BZ5kkxPqQr3PK3tElz6adTey4307NzZ3whZu19i5VavYal7u2FfOmAzlcDVgE8+X0HZ2LxLb/jgbYw==}
|
resolution: {integrity: sha512-Ew3F5riP3B3ZDGjD3ZKb9uZylTTPSqt8hAf4sGbvbjrjDjrFb3Jm15Tk1/w7WwTE5GbQ2Qhwxx1moc9hr8A/OQ==}
|
||||||
|
|
||||||
'@vue/runtime-core@3.4.37':
|
'@vue/runtime-core@3.5.0':
|
||||||
resolution: {integrity: sha512-MNjrVoLV/sirHZoD7QAilU1Ifs7m/KJv4/84QVbE6nyAZGQNVOa1HGxaOzp9YqCG+GpLt1hNDC4RbH+KtanV7w==}
|
resolution: {integrity: sha512-mQyW0F9FaNRdt8ghkAs+BMG3iQ7LGgWKOpkzUzR5AI5swPNydHGL5hvVTqFaeMzwecF1g0c86H4yFQsSxJhH1w==}
|
||||||
|
|
||||||
'@vue/runtime-dom@3.4.37':
|
'@vue/runtime-dom@3.5.0':
|
||||||
resolution: {integrity: sha512-Mg2EwgGZqtwKrqdL/FKMF2NEaOHuH+Ks9TQn3DHKyX//hQTYOun+7Tqp1eo0P4Ds+SjltZshOSRq6VsU0baaNg==}
|
resolution: {integrity: sha512-NQQXjpdXgyYVJ2M56FJ+lSJgZiecgQ2HhxhnQBN95FymXegRNY/N2htI7vOTwpP75pfxhIeYOJ8mE8sW8KAW6A==}
|
||||||
|
|
||||||
'@vue/server-renderer@3.4.37':
|
'@vue/server-renderer@3.5.0':
|
||||||
resolution: {integrity: sha512-jZ5FAHDR2KBq2FsRUJW6GKDOAG9lUTX8aBEGq4Vf6B/35I9fPce66BornuwmqmKgfiSlecwuOb6oeoamYMohkg==}
|
resolution: {integrity: sha512-HyDIFUg+l7L4PKrEnJlCYWHUOlm6NxZhmSxIefZ5MTYjkIPfDfkwhX7hqxAQHfgIAE1uLMLQZwuNR/ozI0NhZg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
vue: 3.4.37
|
vue: 3.5.0
|
||||||
|
|
||||||
'@vue/shared@3.4.37':
|
'@vue/shared@3.4.37':
|
||||||
resolution: {integrity: sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg==}
|
resolution: {integrity: sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg==}
|
||||||
|
|
||||||
|
'@vue/shared@3.5.0':
|
||||||
|
resolution: {integrity: sha512-m9IgiteBpCkFaMNwCOBkFksA7z8QiKc30ooRuoXWUFRDu0mGyNPlFHmbncF0/Kra1RlX8QrmBbRaIxVvikaR0Q==}
|
||||||
|
|
||||||
abbrev@1.1.1:
|
abbrev@1.1.1:
|
||||||
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
|
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
|
||||||
|
|
||||||
|
aes-js@3.1.2:
|
||||||
|
resolution: {integrity: sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==}
|
||||||
|
|
||||||
agent-base@6.0.2:
|
agent-base@6.0.2:
|
||||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||||
engines: {node: '>= 6.0.0'}
|
engines: {node: '>= 6.0.0'}
|
||||||
@@ -575,6 +614,9 @@ packages:
|
|||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
deprecated: This package is no longer supported.
|
deprecated: This package is no longer supported.
|
||||||
|
|
||||||
|
argparse@2.0.1:
|
||||||
|
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
||||||
|
|
||||||
async-validator@4.2.5:
|
async-validator@4.2.5:
|
||||||
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
|
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
|
||||||
|
|
||||||
@@ -633,6 +675,9 @@ packages:
|
|||||||
console-control-strings@1.1.0:
|
console-control-strings@1.1.0:
|
||||||
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
|
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
|
||||||
|
|
||||||
|
copy-to-clipboard@3.3.3:
|
||||||
|
resolution: {integrity: sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==}
|
||||||
|
|
||||||
core-js@3.38.1:
|
core-js@3.38.1:
|
||||||
resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==}
|
resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==}
|
||||||
|
|
||||||
@@ -700,6 +745,10 @@ packages:
|
|||||||
emoji-regex@8.0.0:
|
emoji-regex@8.0.0:
|
||||||
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
||||||
|
|
||||||
|
entities@4.5.0:
|
||||||
|
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
||||||
|
engines: {node: '>=0.12'}
|
||||||
|
|
||||||
entities@5.0.0:
|
entities@5.0.0:
|
||||||
resolution: {integrity: sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==}
|
resolution: {integrity: sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==}
|
||||||
engines: {node: '>=0.12'}
|
engines: {node: '>=0.12'}
|
||||||
@@ -826,6 +875,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
||||||
engines: {node: '>=0.12.0'}
|
engines: {node: '>=0.12.0'}
|
||||||
|
|
||||||
|
linkify-it@5.0.0:
|
||||||
|
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
|
||||||
|
|
||||||
lodash-es@4.17.21:
|
lodash-es@4.17.21:
|
||||||
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
|
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
|
||||||
|
|
||||||
@@ -839,6 +891,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
|
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
markdown-it@14.1.0:
|
||||||
|
resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
mdurl@2.0.0:
|
||||||
|
resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
|
||||||
|
|
||||||
micromatch@4.0.7:
|
micromatch@4.0.7:
|
||||||
resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==}
|
resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==}
|
||||||
engines: {node: '>=8.6'}
|
engines: {node: '>=8.6'}
|
||||||
@@ -956,9 +1015,17 @@ packages:
|
|||||||
resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==}
|
resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
|
postcss@8.4.44:
|
||||||
|
resolution: {integrity: sha512-Aweb9unOEpQ3ezu4Q00DPvvM2ZTUitJdNKeP/+uQgr1IBIqu574IaZoURId7BKtWMREwzKa9OgzPzezWGPWFQw==}
|
||||||
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
proxy-from-env@1.1.0:
|
proxy-from-env@1.1.0:
|
||||||
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
|
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
|
||||||
|
|
||||||
|
punycode.js@2.3.1:
|
||||||
|
resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
readable-stream@3.6.2:
|
readable-stream@3.6.2:
|
||||||
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
|
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
@@ -1042,6 +1109,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||||
engines: {node: '>=8.0'}
|
engines: {node: '>=8.0'}
|
||||||
|
|
||||||
|
toggle-selection@1.0.6:
|
||||||
|
resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==}
|
||||||
|
|
||||||
tr46@0.0.3:
|
tr46@0.0.3:
|
||||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||||
|
|
||||||
@@ -1056,6 +1126,9 @@ packages:
|
|||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
uc.micro@2.1.0:
|
||||||
|
resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
|
||||||
|
|
||||||
undici-types@6.13.0:
|
undici-types@6.13.0:
|
||||||
resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==}
|
resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==}
|
||||||
|
|
||||||
@@ -1125,8 +1198,8 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=5.0.0'
|
typescript: '>=5.0.0'
|
||||||
|
|
||||||
vue@3.4.37:
|
vue@3.5.0:
|
||||||
resolution: {integrity: sha512-3vXvNfkKTBsSJ7JP+LyR7GBuwQuckbWvuwAid3xbqK9ppsKt/DUvfqgZ48fgOLEfpy1IacL5f8QhUVl77RaI7A==}
|
resolution: {integrity: sha512-1t70favYoFijwfWJ7g81aTd32obGaAnKYE9FNyMgnEzn3F4YncRi/kqAHHKloG0VXTD8vBYMhbgLKCA+Sk6QDw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '*'
|
typescript: '*'
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
@@ -1350,9 +1423,9 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
css-render: 0.15.14
|
css-render: 0.15.14
|
||||||
|
|
||||||
'@css-render/vue3-ssr@0.15.14(vue@3.4.37(typescript@5.5.4))':
|
'@css-render/vue3-ssr@0.15.14(vue@3.5.0(typescript@5.5.4))':
|
||||||
dependencies:
|
dependencies:
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
'@emotion/hash@0.8.0': {}
|
'@emotion/hash@0.8.0': {}
|
||||||
|
|
||||||
@@ -1562,16 +1635,27 @@ snapshots:
|
|||||||
'@rollup/rollup-win32-x64-msvc@4.20.0':
|
'@rollup/rollup-win32-x64-msvc@4.20.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@types/aes-js@3.1.4': {}
|
||||||
|
|
||||||
'@types/estree@1.0.5': {}
|
'@types/estree@1.0.5': {}
|
||||||
|
|
||||||
'@types/katex@0.16.7': {}
|
'@types/katex@0.16.7': {}
|
||||||
|
|
||||||
|
'@types/linkify-it@5.0.0': {}
|
||||||
|
|
||||||
'@types/lodash-es@4.17.12':
|
'@types/lodash-es@4.17.12':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/lodash': 4.17.7
|
'@types/lodash': 4.17.7
|
||||||
|
|
||||||
'@types/lodash@4.17.7': {}
|
'@types/lodash@4.17.7': {}
|
||||||
|
|
||||||
|
'@types/markdown-it@14.1.2':
|
||||||
|
dependencies:
|
||||||
|
'@types/linkify-it': 5.0.0
|
||||||
|
'@types/mdurl': 2.0.0
|
||||||
|
|
||||||
|
'@types/mdurl@2.0.0': {}
|
||||||
|
|
||||||
'@types/node@22.1.0':
|
'@types/node@22.1.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 6.13.0
|
undici-types: 6.13.0
|
||||||
@@ -1585,10 +1669,10 @@ snapshots:
|
|||||||
|
|
||||||
'@vicons/ionicons5@0.12.0': {}
|
'@vicons/ionicons5@0.12.0': {}
|
||||||
|
|
||||||
'@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.4.37(typescript@5.5.4))':
|
'@vitejs/plugin-vue@5.1.2(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8))(vue@3.5.0(typescript@5.5.4))':
|
||||||
dependencies:
|
dependencies:
|
||||||
vite: 5.4.0(@types/node@22.1.0)(sass@1.77.8)
|
vite: 5.4.0(@types/node@22.1.0)(sass@1.77.8)
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
'@volar/language-core@2.4.0-alpha.18':
|
'@volar/language-core@2.4.0-alpha.18':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1610,27 +1694,40 @@ snapshots:
|
|||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
source-map-js: 1.2.0
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
|
'@vue/compiler-core@3.5.0':
|
||||||
|
dependencies:
|
||||||
|
'@babel/parser': 7.25.3
|
||||||
|
'@vue/shared': 3.5.0
|
||||||
|
entities: 4.5.0
|
||||||
|
estree-walker: 2.0.2
|
||||||
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
'@vue/compiler-dom@3.4.37':
|
'@vue/compiler-dom@3.4.37':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-core': 3.4.37
|
'@vue/compiler-core': 3.4.37
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.4.37
|
||||||
|
|
||||||
'@vue/compiler-sfc@3.4.37':
|
'@vue/compiler-dom@3.5.0':
|
||||||
|
dependencies:
|
||||||
|
'@vue/compiler-core': 3.5.0
|
||||||
|
'@vue/shared': 3.5.0
|
||||||
|
|
||||||
|
'@vue/compiler-sfc@3.5.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/parser': 7.25.3
|
'@babel/parser': 7.25.3
|
||||||
'@vue/compiler-core': 3.4.37
|
'@vue/compiler-core': 3.5.0
|
||||||
'@vue/compiler-dom': 3.4.37
|
'@vue/compiler-dom': 3.5.0
|
||||||
'@vue/compiler-ssr': 3.4.37
|
'@vue/compiler-ssr': 3.5.0
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
magic-string: 0.30.11
|
magic-string: 0.30.11
|
||||||
postcss: 8.4.41
|
postcss: 8.4.44
|
||||||
source-map-js: 1.2.0
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
'@vue/compiler-ssr@3.4.37':
|
'@vue/compiler-ssr@3.5.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-dom': 3.4.37
|
'@vue/compiler-dom': 3.5.0
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
|
|
||||||
'@vue/compiler-vue2@2.7.16':
|
'@vue/compiler-vue2@2.7.16':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1650,33 +1747,37 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
typescript: 5.5.4
|
typescript: 5.5.4
|
||||||
|
|
||||||
'@vue/reactivity@3.4.37':
|
'@vue/reactivity@3.5.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
|
|
||||||
'@vue/runtime-core@3.4.37':
|
'@vue/runtime-core@3.5.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/reactivity': 3.4.37
|
'@vue/reactivity': 3.5.0
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
|
|
||||||
'@vue/runtime-dom@3.4.37':
|
'@vue/runtime-dom@3.5.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/reactivity': 3.4.37
|
'@vue/reactivity': 3.5.0
|
||||||
'@vue/runtime-core': 3.4.37
|
'@vue/runtime-core': 3.5.0
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
csstype: 3.1.3
|
csstype: 3.1.3
|
||||||
|
|
||||||
'@vue/server-renderer@3.4.37(vue@3.4.37(typescript@5.5.4))':
|
'@vue/server-renderer@3.5.0(vue@3.5.0(typescript@5.5.4))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-ssr': 3.4.37
|
'@vue/compiler-ssr': 3.5.0
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
'@vue/shared@3.4.37': {}
|
'@vue/shared@3.4.37': {}
|
||||||
|
|
||||||
|
'@vue/shared@3.5.0': {}
|
||||||
|
|
||||||
abbrev@1.1.1:
|
abbrev@1.1.1:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
aes-js@3.1.2: {}
|
||||||
|
|
||||||
agent-base@6.0.2:
|
agent-base@6.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 4.3.6
|
debug: 4.3.6
|
||||||
@@ -1701,6 +1802,8 @@ snapshots:
|
|||||||
readable-stream: 3.6.2
|
readable-stream: 3.6.2
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
argparse@2.0.1: {}
|
||||||
|
|
||||||
async-validator@4.2.5: {}
|
async-validator@4.2.5: {}
|
||||||
|
|
||||||
asynckit@0.4.0: {}
|
asynckit@0.4.0: {}
|
||||||
@@ -1783,6 +1886,10 @@ snapshots:
|
|||||||
console-control-strings@1.1.0:
|
console-control-strings@1.1.0:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
copy-to-clipboard@3.3.3:
|
||||||
|
dependencies:
|
||||||
|
toggle-selection: 1.0.6
|
||||||
|
|
||||||
core-js@3.38.1: {}
|
core-js@3.38.1: {}
|
||||||
|
|
||||||
crelt@1.0.6: {}
|
crelt@1.0.6: {}
|
||||||
@@ -1840,6 +1947,8 @@ snapshots:
|
|||||||
emoji-regex@8.0.0:
|
emoji-regex@8.0.0:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
entities@4.5.0: {}
|
||||||
|
|
||||||
entities@5.0.0: {}
|
entities@5.0.0: {}
|
||||||
|
|
||||||
es5-ext@0.10.64:
|
es5-ext@0.10.64:
|
||||||
@@ -1999,6 +2108,10 @@ snapshots:
|
|||||||
|
|
||||||
is-number@7.0.0: {}
|
is-number@7.0.0: {}
|
||||||
|
|
||||||
|
linkify-it@5.0.0:
|
||||||
|
dependencies:
|
||||||
|
uc.micro: 2.1.0
|
||||||
|
|
||||||
lodash-es@4.17.21: {}
|
lodash-es@4.17.21: {}
|
||||||
|
|
||||||
lodash@4.17.21: {}
|
lodash@4.17.21: {}
|
||||||
@@ -2012,6 +2125,17 @@ snapshots:
|
|||||||
semver: 6.3.1
|
semver: 6.3.1
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
markdown-it@14.1.0:
|
||||||
|
dependencies:
|
||||||
|
argparse: 2.0.1
|
||||||
|
entities: 4.5.0
|
||||||
|
linkify-it: 5.0.0
|
||||||
|
mdurl: 2.0.0
|
||||||
|
punycode.js: 2.3.1
|
||||||
|
uc.micro: 2.1.0
|
||||||
|
|
||||||
|
mdurl@2.0.0: {}
|
||||||
|
|
||||||
micromatch@4.0.7:
|
micromatch@4.0.7:
|
||||||
dependencies:
|
dependencies:
|
||||||
braces: 3.0.3
|
braces: 3.0.3
|
||||||
@@ -2057,10 +2181,10 @@ snapshots:
|
|||||||
|
|
||||||
muggle-string@0.4.1: {}
|
muggle-string@0.4.1: {}
|
||||||
|
|
||||||
naive-ui@2.39.0(vue@3.4.37(typescript@5.5.4)):
|
naive-ui@2.39.0(vue@3.5.0(typescript@5.5.4)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@css-render/plugin-bem': 0.15.14(css-render@0.15.14)
|
'@css-render/plugin-bem': 0.15.14(css-render@0.15.14)
|
||||||
'@css-render/vue3-ssr': 0.15.14(vue@3.4.37(typescript@5.5.4))
|
'@css-render/vue3-ssr': 0.15.14(vue@3.5.0(typescript@5.5.4))
|
||||||
'@types/katex': 0.16.7
|
'@types/katex': 0.16.7
|
||||||
'@types/lodash': 4.17.7
|
'@types/lodash': 4.17.7
|
||||||
'@types/lodash-es': 4.17.12
|
'@types/lodash-es': 4.17.12
|
||||||
@@ -2075,10 +2199,10 @@ snapshots:
|
|||||||
lodash-es: 4.17.21
|
lodash-es: 4.17.21
|
||||||
seemly: 0.3.8
|
seemly: 0.3.8
|
||||||
treemate: 0.3.11
|
treemate: 0.3.11
|
||||||
vdirs: 0.1.8(vue@3.4.37(typescript@5.5.4))
|
vdirs: 0.1.8(vue@3.5.0(typescript@5.5.4))
|
||||||
vooks: 0.2.12(vue@3.4.37(typescript@5.5.4))
|
vooks: 0.2.12(vue@3.5.0(typescript@5.5.4))
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
vueuc: 0.4.58(vue@3.4.37(typescript@5.5.4))
|
vueuc: 0.4.58(vue@3.5.0(typescript@5.5.4))
|
||||||
|
|
||||||
nan@2.20.0:
|
nan@2.20.0:
|
||||||
optional: true
|
optional: true
|
||||||
@@ -2141,8 +2265,16 @@ snapshots:
|
|||||||
picocolors: 1.0.1
|
picocolors: 1.0.1
|
||||||
source-map-js: 1.2.0
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
|
postcss@8.4.44:
|
||||||
|
dependencies:
|
||||||
|
nanoid: 3.3.7
|
||||||
|
picocolors: 1.0.1
|
||||||
|
source-map-js: 1.2.0
|
||||||
|
|
||||||
proxy-from-env@1.1.0: {}
|
proxy-from-env@1.1.0: {}
|
||||||
|
|
||||||
|
punycode.js@2.3.1: {}
|
||||||
|
|
||||||
readable-stream@3.6.2:
|
readable-stream@3.6.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
inherits: 2.0.4
|
inherits: 2.0.4
|
||||||
@@ -2252,6 +2384,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-number: 7.0.0
|
is-number: 7.0.0
|
||||||
|
|
||||||
|
toggle-selection@1.0.6: {}
|
||||||
|
|
||||||
tr46@0.0.3:
|
tr46@0.0.3:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -2261,15 +2395,17 @@ snapshots:
|
|||||||
|
|
||||||
typescript@5.5.4: {}
|
typescript@5.5.4: {}
|
||||||
|
|
||||||
|
uc.micro@2.1.0: {}
|
||||||
|
|
||||||
undici-types@6.13.0: {}
|
undici-types@6.13.0: {}
|
||||||
|
|
||||||
util-deprecate@1.0.2:
|
util-deprecate@1.0.2:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
vdirs@0.1.8(vue@3.4.37(typescript@5.5.4)):
|
vdirs@0.1.8(vue@3.5.0(typescript@5.5.4)):
|
||||||
dependencies:
|
dependencies:
|
||||||
evtd: 0.2.4
|
evtd: 0.2.4
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
vite-plugin-singlefile@2.0.2(rollup@4.20.0)(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8)):
|
vite-plugin-singlefile@2.0.2(rollup@4.20.0)(vite@5.4.0(@types/node@22.1.0)(sass@1.77.8)):
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2287,21 +2423,21 @@ snapshots:
|
|||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
sass: 1.77.8
|
sass: 1.77.8
|
||||||
|
|
||||||
vooks@0.2.12(vue@3.4.37(typescript@5.5.4)):
|
vooks@0.2.12(vue@3.5.0(typescript@5.5.4)):
|
||||||
dependencies:
|
dependencies:
|
||||||
evtd: 0.2.4
|
evtd: 0.2.4
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
vscode-uri@3.0.8: {}
|
vscode-uri@3.0.8: {}
|
||||||
|
|
||||||
vue-codemirror@6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.4.37(typescript@5.5.4)):
|
vue-codemirror@6.1.1(codemirror@6.0.1(@lezer/common@1.2.1))(vue@3.5.0(typescript@5.5.4)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@codemirror/commands': 6.6.0
|
'@codemirror/commands': 6.6.0
|
||||||
'@codemirror/language': 6.10.2
|
'@codemirror/language': 6.10.2
|
||||||
'@codemirror/state': 6.4.1
|
'@codemirror/state': 6.4.1
|
||||||
'@codemirror/view': 6.33.0
|
'@codemirror/view': 6.33.0
|
||||||
codemirror: 6.0.1(@lezer/common@1.2.1)
|
codemirror: 6.0.1(@lezer/common@1.2.1)
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
vue-tsc@2.0.29(typescript@5.5.4):
|
vue-tsc@2.0.29(typescript@5.5.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2310,26 +2446,26 @@ snapshots:
|
|||||||
semver: 7.6.3
|
semver: 7.6.3
|
||||||
typescript: 5.5.4
|
typescript: 5.5.4
|
||||||
|
|
||||||
vue@3.4.37(typescript@5.5.4):
|
vue@3.5.0(typescript@5.5.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/compiler-dom': 3.4.37
|
'@vue/compiler-dom': 3.5.0
|
||||||
'@vue/compiler-sfc': 3.4.37
|
'@vue/compiler-sfc': 3.5.0
|
||||||
'@vue/runtime-dom': 3.4.37
|
'@vue/runtime-dom': 3.5.0
|
||||||
'@vue/server-renderer': 3.4.37(vue@3.4.37(typescript@5.5.4))
|
'@vue/server-renderer': 3.5.0(vue@3.5.0(typescript@5.5.4))
|
||||||
'@vue/shared': 3.4.37
|
'@vue/shared': 3.5.0
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
typescript: 5.5.4
|
typescript: 5.5.4
|
||||||
|
|
||||||
vueuc@0.4.58(vue@3.4.37(typescript@5.5.4)):
|
vueuc@0.4.58(vue@3.5.0(typescript@5.5.4)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@css-render/vue3-ssr': 0.15.14(vue@3.4.37(typescript@5.5.4))
|
'@css-render/vue3-ssr': 0.15.14(vue@3.5.0(typescript@5.5.4))
|
||||||
'@juggle/resize-observer': 3.4.0
|
'@juggle/resize-observer': 3.4.0
|
||||||
css-render: 0.15.14
|
css-render: 0.15.14
|
||||||
evtd: 0.2.4
|
evtd: 0.2.4
|
||||||
seemly: 0.3.8
|
seemly: 0.3.8
|
||||||
vdirs: 0.1.8(vue@3.4.37(typescript@5.5.4))
|
vdirs: 0.1.8(vue@3.5.0(typescript@5.5.4))
|
||||||
vooks: 0.2.12(vue@3.4.37(typescript@5.5.4))
|
vooks: 0.2.12(vue@3.5.0(typescript@5.5.4))
|
||||||
vue: 3.4.37(typescript@5.5.4)
|
vue: 3.5.0(typescript@5.5.4)
|
||||||
|
|
||||||
w3c-keyname@2.2.8: {}
|
w3c-keyname@2.2.8: {}
|
||||||
|
|
||||||
|
|||||||
+36
-19
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { h, onMounted, reactive, ref, shallowRef } from 'vue'
|
import { h, onMounted, provide, reactive, ref, shallowRef, useTemplateRef } from 'vue'
|
||||||
import { NIcon, NScrollbar, NDropdown, NQrCode } from 'naive-ui'
|
import { NIcon, NScrollbar, NDropdown } from 'naive-ui'
|
||||||
import {
|
import {
|
||||||
EyeOffOutline,
|
EyeOffOutline,
|
||||||
EyeOutline,
|
EyeOutline,
|
||||||
@@ -9,12 +9,14 @@ import {
|
|||||||
EllipsisVertical,
|
EllipsisVertical,
|
||||||
QrCodeOutline
|
QrCodeOutline
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
import miaoDirectory from '@/views/miaoDirectory.vue'
|
|
||||||
import VirtualDirectory, { VirtualFile } from './class/VirtualDirectory'
|
import VirtualDirectory, { VirtualFile } from './class/VirtualDirectory'
|
||||||
import MiaoMask from './components/miaoMask.vue'
|
import MiaoMask from './components/miaoMask.vue'
|
||||||
|
import MiaoMessageProvider from './components/miaoAlertTipProvider.vue'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import useVirtualPages from './hooks/useVirtualPages'
|
import useVirtualPages from './hooks/useVirtualPages'
|
||||||
import init from './hooks/init'
|
import init from './hooks/init'
|
||||||
|
import usePluginCenter from './hooks/usePluginCenter'
|
||||||
|
import PluginCenter from './class/PluginCenter'
|
||||||
|
|
||||||
const { baseUrl } = config
|
const { baseUrl } = config
|
||||||
|
|
||||||
@@ -25,7 +27,10 @@ const modalData = shallowRef<{
|
|||||||
props: any
|
props: any
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const messageProviderRef = useTemplateRef('messageProviderRef')
|
||||||
|
|
||||||
const views = useVirtualPages()
|
const views = useVirtualPages()
|
||||||
|
let pluginCenter: PluginCenter
|
||||||
|
|
||||||
const rootDirectory = reactive(
|
const rootDirectory = reactive(
|
||||||
new VirtualDirectory({
|
new VirtualDirectory({
|
||||||
@@ -42,24 +47,25 @@ const rootDirectory = reactive(
|
|||||||
// component就是一个vue组件,类似于miaoDirectory
|
// component就是一个vue组件,类似于miaoDirectory
|
||||||
const createView = (
|
const createView = (
|
||||||
component: any,
|
component: any,
|
||||||
currentDirectorys?: VirtualDirectory[],
|
currentDirectories?: VirtualDirectory[],
|
||||||
currentFiles?: VirtualFile[],
|
currentFiles?: VirtualFile[],
|
||||||
index?: number
|
index?: number
|
||||||
) => {
|
) => {
|
||||||
views.push(component, currentDirectorys, currentFiles, index)
|
views.push(component, currentDirectories, currentFiles, { index })
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteView = (index: number) => {
|
const deleteView = (index: number) => {
|
||||||
views.deleteView(index)
|
views.deleteView(index)
|
||||||
if (views.length === 0) {
|
if (views.length === 0) {
|
||||||
createView(miaoDirectory, [rootDirectory])
|
pluginCenter.usePlugin('miaoDirectory', [rootDirectory], [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击标题是隐藏其他标签或显示其他标签,还挺好用的
|
// 点击标题是隐藏其他标签或显示其他标签,还挺好用的
|
||||||
const handleClickTitle = (index: number) => {
|
const handleClickTitle = (index: number) => {
|
||||||
let count = views._views.filter((v) => v.visible).length
|
let count = views._views.filter((v) => v.visible).length
|
||||||
let op = !views._views[index].visible || count > 1 ? 'hideOthers' : 'showOthers'
|
let op =
|
||||||
|
!views._views[index].visible || count > 1 ? 'hideOthers' : 'showOthers'
|
||||||
let _index = 0
|
let _index = 0
|
||||||
while (_index < views._views.length) {
|
while (_index < views._views.length) {
|
||||||
if (_index !== index) {
|
if (_index !== index) {
|
||||||
@@ -88,11 +94,11 @@ const openMenuOption = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const handleMenuSelect = (key: string) => {
|
const handleMenuSelect = async (key: string) => {
|
||||||
if (key === 'share') {
|
if (key === 'share') {
|
||||||
showModal.value = true
|
showModal.value = true
|
||||||
modalData.value = {
|
modalData.value = {
|
||||||
component: NQrCode,
|
component: (await import('naive-ui/es/qr-code')).NQrCode,
|
||||||
props: {
|
props: {
|
||||||
value: baseUrl,
|
value: baseUrl,
|
||||||
size: 300,
|
size: 300,
|
||||||
@@ -102,14 +108,20 @@ const handleMenuSelect = (key: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
init()
|
// @ts-ignore
|
||||||
createView(miaoDirectory, [rootDirectory])
|
await init(messageProviderRef.value?.alertTip)
|
||||||
|
pluginCenter = usePluginCenter()
|
||||||
|
pluginCenter.usePlugin('miaoDirectory', [rootDirectory], [])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
provide('globalAlertTip', messageProviderRef.value?.alertTip)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="view">
|
<div class="view">
|
||||||
|
<miao-message-provider ref="messageProviderRef">
|
||||||
<div class="view-controller">
|
<div class="view-controller">
|
||||||
<n-scrollbar x-scrollable>
|
<n-scrollbar x-scrollable>
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
@@ -117,7 +129,7 @@ onMounted(() => {
|
|||||||
<div
|
<div
|
||||||
class="tab"
|
class="tab"
|
||||||
v-for="(view, index) of views._views"
|
v-for="(view, index) of views._views"
|
||||||
:key="view.uid">
|
:key="view.id">
|
||||||
<span
|
<span
|
||||||
class="tab-title"
|
class="tab-title"
|
||||||
:title="view.title"
|
:title="view.title"
|
||||||
@@ -147,7 +159,7 @@ onMounted(() => {
|
|||||||
@click="
|
@click="
|
||||||
createView(
|
createView(
|
||||||
view.component,
|
view.component,
|
||||||
view.currentDirectorys,
|
view.currentDirectories,
|
||||||
view.currentFiles,
|
view.currentFiles,
|
||||||
index + 1
|
index + 1
|
||||||
)
|
)
|
||||||
@@ -183,22 +195,25 @@ onMounted(() => {
|
|||||||
class="view-container-item"
|
class="view-container-item"
|
||||||
v-for="(view, index) of views._views"
|
v-for="(view, index) of views._views"
|
||||||
v-show="view.visible"
|
v-show="view.visible"
|
||||||
:key="view.uid">
|
:key="view.id">
|
||||||
<component
|
<component
|
||||||
:is="view.component"
|
:is="view.component"
|
||||||
v-model:current-directorys="view.currentDirectorys"
|
v-model:current-directories="view.currentDirectories"
|
||||||
v-model:current-files="view.currentFiles"
|
v-model:current-files="view.currentFiles"
|
||||||
:id="view.uid"
|
:id="view.id"
|
||||||
:color="view.color"
|
:color="view.color"
|
||||||
|
:view="view"
|
||||||
|
:views="views"
|
||||||
@exit="deleteView(index)"></component>
|
@exit="deleteView(index)"></component>
|
||||||
</div>
|
</div>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
</div>
|
</div>
|
||||||
|
</miao-message-provider>
|
||||||
</div>
|
</div>
|
||||||
<!-- 模态框展示,用来显示分享二维码,设置菜单之类的东西 -->
|
<!-- 模态框展示,用来显示分享二维码,设置菜单之类的东西 -->
|
||||||
<MiaoMask v-model:show="showModal" @click="showModal = false">
|
<MiaoMask v-model:show="showModal" @click="showModal = false">
|
||||||
<component
|
<component
|
||||||
@click="(e:any) => e.stopPropagation()"
|
@click="(e: any) => e.stopPropagation()"
|
||||||
:is="modalData?.component"
|
:is="modalData?.component"
|
||||||
v-bind="modalData?.props"></component>
|
v-bind="modalData?.props"></component>
|
||||||
</MiaoMask>
|
</MiaoMask>
|
||||||
@@ -246,6 +261,7 @@ $tag-width: 170px;
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -333,7 +349,7 @@ $tag-width: 170px;
|
|||||||
.view-container-item {
|
.view-container-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-width: 200px;
|
min-width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
@@ -369,6 +385,7 @@ $tag-width: 170px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tab-leave-active {
|
.tab-leave-active {
|
||||||
|
opacity: 0;
|
||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+110
-66
@@ -1,75 +1,119 @@
|
|||||||
import useVirtualPages from '@/hooks/useVirtualPages'
|
import useVirtualPages from "@/hooks/useVirtualPages";
|
||||||
import VirtualDirectory, { VirtualFile } from './VirtualDirectory'
|
import VirtualDirectory, { VirtualFile } from "./VirtualDirectory";
|
||||||
|
import { ShallowRef, shallowRef } from "vue";
|
||||||
|
import { alertTipType, usePluginHooksType } from "@/types/type";
|
||||||
|
|
||||||
type plugin = {
|
export enum PluginGroup {
|
||||||
// 用于显示的名字
|
default = "default",
|
||||||
name: string
|
mainMenu = "mainMenu"
|
||||||
// 判断是否可以使用这个组件
|
|
||||||
// 使用组件即调用下面的func
|
|
||||||
filter: (VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) => boolean
|
|
||||||
func: (VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) => void
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface registerComponentOption {
|
||||||
|
key: string;
|
||||||
|
name: string;
|
||||||
|
icon?: any;
|
||||||
|
getComponent: () => Promise<any>;
|
||||||
|
group?: PluginGroup[];
|
||||||
|
filter: (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => boolean;
|
||||||
|
disable?: boolean;
|
||||||
|
exitConfirm?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Plugin = {
|
||||||
|
// 用于显示的名字
|
||||||
|
name: string;
|
||||||
|
// 代表插件的icon
|
||||||
|
icon?: ShallowRef<any>;
|
||||||
|
// 是否禁用插件
|
||||||
|
disable: boolean;
|
||||||
|
// 插件所属的group,用于区分插件使用的场合
|
||||||
|
group: PluginGroup[];
|
||||||
|
// 判断在未禁用时是否可以使用这个组件
|
||||||
|
// 使用组件即调用下面的func
|
||||||
|
filter: (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => boolean;
|
||||||
|
func: (
|
||||||
|
VDirectories: VirtualDirectory[],
|
||||||
|
VFiles: VirtualFile[],
|
||||||
|
hooks: usePluginHooksType,
|
||||||
|
...args: any[]
|
||||||
|
) => void;
|
||||||
|
};
|
||||||
|
|
||||||
export default class PluginCenter {
|
export default class PluginCenter {
|
||||||
constructor() {
|
constructor(globalAlertTip: alertTipType) {
|
||||||
this.pluginsMap = {}
|
this.pluginsMap = {};
|
||||||
}
|
this.globalAlertTip = globalAlertTip;
|
||||||
pluginsMap: {
|
}
|
||||||
[key: string]: plugin
|
pluginsMap: {
|
||||||
}
|
[key: string]: Plugin;
|
||||||
|
};
|
||||||
|
|
||||||
register(key: string, plugin: plugin) {
|
globalAlertTip: alertTipType;
|
||||||
this.pluginsMap[key] = plugin
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
register(key: string, plugin: Plugin) {
|
||||||
* 便捷地注册一个组件为插件,触发时直接用新页面打开
|
this.pluginsMap[key] = plugin;
|
||||||
*/
|
}
|
||||||
registerComponent(
|
|
||||||
key: string,
|
|
||||||
name: string,
|
|
||||||
getComponent: () => Promise<any>,
|
|
||||||
filter: (
|
|
||||||
VDirectorys: VirtualDirectory[],
|
|
||||||
VFiles: VirtualFile[]
|
|
||||||
) => boolean
|
|
||||||
): void {
|
|
||||||
let _component: any
|
|
||||||
const views = useVirtualPages()
|
|
||||||
this.register(key, {
|
|
||||||
name,
|
|
||||||
filter,
|
|
||||||
func: async (
|
|
||||||
VDirectorys: VirtualDirectory[],
|
|
||||||
VFiles: VirtualFile[]
|
|
||||||
) => {
|
|
||||||
if (filter(VDirectorys, VFiles) === false) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (_component === undefined) _component = await getComponent()
|
|
||||||
views.push(_component, VDirectorys, VFiles)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
getUsablePlugin(VDirectorys: VirtualDirectory[], VFiles: VirtualFile[]) {
|
/**
|
||||||
const usableList = []
|
* 便捷地注册一个组件为插件,触发时直接用新页面打开
|
||||||
for (let key of Object.keys(this.pluginsMap)) {
|
*/
|
||||||
if (this.pluginsMap[key].filter(VDirectorys, VFiles)) {
|
registerComponent(option: registerComponentOption): void {
|
||||||
usableList.push(key)
|
const { key, name, getComponent, icon, filter, group = [PluginGroup.default], disable = false, exitConfirm = false } = option;
|
||||||
}
|
let _component: any;
|
||||||
}
|
const views = useVirtualPages();
|
||||||
return usableList.map((key) => ({
|
this.register(key, {
|
||||||
key,
|
name,
|
||||||
...this.pluginsMap[key]
|
filter,
|
||||||
}))
|
icon: shallowRef(icon),
|
||||||
}
|
group,
|
||||||
|
disable,
|
||||||
|
func: async (VDirectories: VirtualDirectory[], VFiles: VirtualFile[]) => {
|
||||||
|
if (filter(VDirectories, VFiles) === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
usePlugin(
|
if (_component === undefined) {
|
||||||
key: string,
|
const setAlertTip = key !== "miaoDirectory" && this.globalAlertTip(`加载 ${name} 插件中`);
|
||||||
VDirectorys: VirtualDirectory[],
|
_component = await getComponent();
|
||||||
VFiles: VirtualFile[]
|
setAlertTip &&
|
||||||
) {
|
setAlertTip(`加载 ${name} 插件完成`, {
|
||||||
this.pluginsMap[key].func(VDirectorys, VFiles)
|
type: "success",
|
||||||
}
|
timeout: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
views.push(_component, VDirectories, VFiles, {
|
||||||
|
VirtualPageOption: {
|
||||||
|
exitConfirm
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getUsablePlugin(
|
||||||
|
VDirectories: VirtualDirectory[],
|
||||||
|
VFiles: VirtualFile[],
|
||||||
|
option?: {
|
||||||
|
group?: PluginGroup[];
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const { group = [PluginGroup.default] } = option ?? {};
|
||||||
|
const usableList = [];
|
||||||
|
for (let key of Object.keys(this.pluginsMap)) {
|
||||||
|
const _plugin = this.pluginsMap[key];
|
||||||
|
if (!_plugin.disable && _plugin.group.filter(v => group.includes(v)).length > 0 && _plugin.filter(VDirectories, VFiles)) {
|
||||||
|
usableList.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return usableList.map(key => ({
|
||||||
|
key,
|
||||||
|
...this.pluginsMap[key]
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
usePlugin(key: string, VDirectories?: VirtualDirectory[], VFiles?: VirtualFile[], ...args: any[]) {
|
||||||
|
this.pluginsMap[key].func(VDirectories ?? [], VFiles ?? [], {
|
||||||
|
globalAlertTip: this.globalAlertTip
|
||||||
|
}, ...args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,14 +13,14 @@ export class VirtualFile {
|
|||||||
this.stats = info.stats;
|
this.stats = info.stats;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.type = "file";
|
this.type = "file";
|
||||||
this.uid = generateId();
|
this.id = generateId();
|
||||||
}
|
}
|
||||||
name: string;
|
name: string;
|
||||||
type: "file";
|
type: "file";
|
||||||
size: number;
|
size: number;
|
||||||
stats: stats;
|
stats: stats;
|
||||||
parent: VirtualDirectory;
|
parent: VirtualDirectory;
|
||||||
uid: number;
|
id: number;
|
||||||
get path() {
|
get path() {
|
||||||
return `${this.parent.path}${this.name}`;
|
return `${this.parent.path}${this.name}`;
|
||||||
}
|
}
|
||||||
@@ -36,14 +36,14 @@ class VirtualDirectory {
|
|||||||
this.type = "directory";
|
this.type = "directory";
|
||||||
this.stats = info.stats;
|
this.stats = info.stats;
|
||||||
this.parent = parent ?? undefined;
|
this.parent = parent ?? undefined;
|
||||||
this.uid = generateId();
|
this.id = generateId();
|
||||||
}
|
}
|
||||||
// 文件夹名
|
// 文件夹名
|
||||||
name: string;
|
name: string;
|
||||||
// 子文件
|
// 子文件
|
||||||
files?: VirtualFile[];
|
files?: VirtualFile[];
|
||||||
// 子目录
|
// 子目录
|
||||||
directorys?: VirtualDirectory[];
|
directories?: VirtualDirectory[];
|
||||||
// 没啥意义,标注一下就是了
|
// 没啥意义,标注一下就是了
|
||||||
type: "directory";
|
type: "directory";
|
||||||
// 文件夹创建时间等杂项属性
|
// 文件夹创建时间等杂项属性
|
||||||
@@ -51,7 +51,7 @@ class VirtualDirectory {
|
|||||||
// 父文件夹
|
// 父文件夹
|
||||||
parent?: VirtualDirectory;
|
parent?: VirtualDirectory;
|
||||||
|
|
||||||
uid: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取相对于根目录的路径的层数
|
* 获取相对于根目录的路径的层数
|
||||||
@@ -98,9 +98,9 @@ class VirtualDirectory {
|
|||||||
|
|
||||||
updateContent(content: (file | directory)[]) {
|
updateContent(content: (file | directory)[]) {
|
||||||
this.files = this.files ?? [];
|
this.files = this.files ?? [];
|
||||||
this.directorys = this.directorys ?? [];
|
this.directories = this.directories ?? [];
|
||||||
const fileNames: string[] = this.files.map(v => v.name);
|
const fileNames: string[] = this.files.map(v => v.name);
|
||||||
const dirNames: string[] = this.directorys.map(v => v.name);
|
const dirNames: string[] = this.directories.map(v => v.name);
|
||||||
const itemNames: string[] = content.map(v => v.name);
|
const itemNames: string[] = content.map(v => v.name);
|
||||||
// 删去远程端已不存在的文件与文件夹
|
// 删去远程端已不存在的文件与文件夹
|
||||||
const _delete = (target: (VirtualFile | VirtualDirectory)[]) => {
|
const _delete = (target: (VirtualFile | VirtualDirectory)[]) => {
|
||||||
@@ -114,7 +114,7 @@ class VirtualDirectory {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
_delete(this.files);
|
_delete(this.files);
|
||||||
_delete(this.directorys);
|
_delete(this.directories);
|
||||||
// 加入新的文件与文件夹
|
// 加入新的文件与文件夹
|
||||||
for (let item of content) {
|
for (let item of content) {
|
||||||
if (item.type === "file") {
|
if (item.type === "file") {
|
||||||
@@ -123,7 +123,7 @@ class VirtualDirectory {
|
|||||||
}
|
}
|
||||||
} else if (item.type === "directory") {
|
} else if (item.type === "directory") {
|
||||||
if (!dirNames.includes(item.name)) {
|
if (!dirNames.includes(item.name)) {
|
||||||
this.directorys.push(new VirtualDirectory(item, this));
|
this.directories.push(new VirtualDirectory(item, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ class VirtualDirectory {
|
|||||||
|
|
||||||
hasChild(item: VirtualDirectory | VirtualFile): boolean {
|
hasChild(item: VirtualDirectory | VirtualFile): boolean {
|
||||||
if (item.type === "directory") {
|
if (item.type === "directory") {
|
||||||
return this.directorys?.includes(item) ?? false;
|
return this.directories?.includes(item) ?? false;
|
||||||
} else {
|
} else {
|
||||||
return this.files?.includes(item) ?? false;
|
return this.files?.includes(item) ?? false;
|
||||||
}
|
}
|
||||||
|
|||||||
+143
-108
@@ -1,123 +1,158 @@
|
|||||||
import { reactive, shallowRef } from "vue";
|
import { reactive, shallowRef } from 'vue'
|
||||||
import VirtualDirectory, { VirtualFile } from "./VirtualDirectory";
|
import VirtualDirectory, { VirtualFile } from './VirtualDirectory'
|
||||||
import generateId from "@/hooks/generateId";
|
import generateId from '@/hooks/generateId'
|
||||||
|
|
||||||
|
export interface VirtualPageOption {
|
||||||
|
exitConfirm?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ViewsPushOption {
|
||||||
|
index?: number
|
||||||
|
VirtualPageOption?: VirtualPageOption
|
||||||
|
}
|
||||||
|
|
||||||
const getRandomWebSafeColor = (() => {
|
const getRandomWebSafeColor = (() => {
|
||||||
const webSafeColors = ["#009900", "#999900", "#009999", "#990099", "#0000ee"];
|
const webSafeColors = [
|
||||||
let counter = 0;
|
'#009900',
|
||||||
return () => {
|
'#999900',
|
||||||
const color = webSafeColors[counter % webSafeColors.length];
|
'#009999',
|
||||||
counter += 1;
|
'#990099',
|
||||||
return color;
|
'#0000ee'
|
||||||
};
|
]
|
||||||
})();
|
let counter = 0
|
||||||
|
return () => {
|
||||||
|
const color = webSafeColors[counter % webSafeColors.length]
|
||||||
|
counter += 1
|
||||||
|
return color
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
export default class VirtualPage {
|
export default class VirtualPage {
|
||||||
constructor(component: any, initObjects?: { directorys?: VirtualDirectory[]; files?: VirtualFile[] }) {
|
constructor(
|
||||||
this.component = shallowRef(component);
|
component: any,
|
||||||
this.currentDirectorys = initObjects?.directorys ?? [];
|
initObjects?: {
|
||||||
this.currentFiles = initObjects?.files ?? [];
|
directories?: VirtualDirectory[]
|
||||||
this.visible = true;
|
files?: VirtualFile[]
|
||||||
this.uid = generateId();
|
option?: VirtualPageOption
|
||||||
this.refreshKey = Math.random();
|
}
|
||||||
this.color = getRandomWebSafeColor();
|
) {
|
||||||
}
|
this.component = shallowRef(component)
|
||||||
// 页面使用的组件
|
this.currentDirectories = initObjects?.directories ?? []
|
||||||
component: any;
|
this.currentFiles = initObjects?.files ?? []
|
||||||
// 是否可见
|
this.visible = true
|
||||||
visible: boolean;
|
this.id = generateId()
|
||||||
// 当前正在使用的文件夹
|
this.refreshKey = Math.random()
|
||||||
currentDirectorys: VirtualDirectory[];
|
this.color = getRandomWebSafeColor()
|
||||||
// 当前正在使用的文件
|
this.exitConfirm = initObjects?.option?.exitConfirm ?? false
|
||||||
currentFiles: VirtualFile[];
|
}
|
||||||
// 区分每一个页面的唯一id
|
// 页面使用的组件
|
||||||
uid: number;
|
component: any
|
||||||
// 当refreshKey改变时需要刷新页面,目前还没接入刷新
|
// 是否可见
|
||||||
refreshKey: number;
|
visible: boolean
|
||||||
// 为了区分,每个虚拟页面都会分配一个color,这个color会体现在tab上
|
// 当前正在使用的文件夹
|
||||||
color: string;
|
currentDirectories: VirtualDirectory[]
|
||||||
// 用于展示的title
|
// 当前正在使用的文件
|
||||||
_title?: string;
|
currentFiles: VirtualFile[]
|
||||||
|
// 区分每一个页面的唯一id
|
||||||
|
id: number
|
||||||
|
// 当refreshKey改变时需要刷新页面,目前还没接入刷新
|
||||||
|
refreshKey: number
|
||||||
|
// 为了区分,每个虚拟页面都会分配一个color,这个color会体现在tab上
|
||||||
|
color: string
|
||||||
|
// 用于展示的title
|
||||||
|
_title?: string
|
||||||
|
// 关闭时是否需要确认
|
||||||
|
exitConfirm: boolean
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
if (this._title) {
|
if (this._title) {
|
||||||
return this._title;
|
return this._title
|
||||||
}
|
}
|
||||||
return this?.currentDirectorys[0]?.name ?? this?.currentFiles[0]?.name ?? "未命名标签";
|
return (
|
||||||
}
|
this?.currentDirectories[0]?.name ??
|
||||||
|
this?.currentFiles[0]?.name ??
|
||||||
|
'未命名标签'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
setTitle(title: string) {
|
setTitle(title: string) {
|
||||||
this._title = title;
|
this._title = title
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换显示状态
|
// 切换显示状态
|
||||||
switchShow() {
|
switchShow() {
|
||||||
this.visible = !this.visible;
|
this.visible = !this.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新,不过好像没有用得到的时候吧
|
// 刷新,不过好像没有用得到的时候吧
|
||||||
// 事实上也不应该用得到,因为更新应该是响应式的
|
// 事实上也不应该用得到,因为更新应该是响应式的
|
||||||
refresh() {
|
refresh() {
|
||||||
this.refreshKey = Math.random();
|
this.refreshKey = Math.random()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VirtualPages {
|
export class VirtualPages {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._views = reactive<VirtualPage[]>([]);
|
this._views = reactive<VirtualPage[]>([])
|
||||||
}
|
}
|
||||||
_views: VirtualPage[];
|
_views: VirtualPage[]
|
||||||
|
|
||||||
get length() {
|
get length() {
|
||||||
return this._views.length;
|
return this._views.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询一个页面位于_views中的次序
|
* 查询一个页面位于_views中的次序
|
||||||
* @param {any} id 要查询的页面的id
|
* @param {any} id 要查询的页面的id
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
getIndex(id: number) {
|
getIndex(id: number) {
|
||||||
for (let i in this._views) {
|
for (let i in this._views) {
|
||||||
if (this._views[i].uid === id) {
|
if (this._views[i].id === id) {
|
||||||
return parseInt(i);
|
return parseInt(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 根据id得到view
|
* 根据id得到view
|
||||||
* @param {any} id 要查询的页面的id
|
* @param {any} id 要查询的页面的id
|
||||||
*/
|
*/
|
||||||
getView(id: number) {
|
getView(id: number) {
|
||||||
for (let v of this._views) {
|
for (let v of this._views) {
|
||||||
if (v.uid === id) {
|
if (v.id === id) {
|
||||||
return v;
|
return v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推入一个新的页面
|
* 推入一个新的页面
|
||||||
*/
|
*/
|
||||||
push(component: any, currentDirectorys?: VirtualDirectory[], currentFiles?: VirtualFile[], index?: number) {
|
push(
|
||||||
index ?? (index = this.length);
|
component: any,
|
||||||
this._views.splice(
|
currentDirectories?: VirtualDirectory[],
|
||||||
index,
|
currentFiles?: VirtualFile[],
|
||||||
0,
|
option?: ViewsPushOption
|
||||||
reactive<VirtualPage>(
|
) {
|
||||||
new VirtualPage(component, {
|
const { index = this.length, VirtualPageOption } = option ?? {}
|
||||||
directorys: [...(currentDirectorys ?? [])],
|
this._views.splice(
|
||||||
files: [...(currentFiles ?? [])]
|
index,
|
||||||
})
|
0,
|
||||||
)
|
reactive<VirtualPage>(
|
||||||
);
|
new VirtualPage(component, {
|
||||||
}
|
directories: [...(currentDirectories ?? [])],
|
||||||
/**
|
files: [...(currentFiles ?? [])],
|
||||||
* 根据次序删除一个页面
|
option: VirtualPageOption
|
||||||
*/
|
})
|
||||||
deleteView(index: number) {
|
)
|
||||||
this._views.splice(index, 1);
|
)
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据次序删除一个页面
|
||||||
|
*/
|
||||||
|
deleteView(index: number) {
|
||||||
|
this._views.splice(index, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<template>
|
||||||
|
<div class="miao-message-provider" ref="rootRef">
|
||||||
|
<slot></slot>
|
||||||
|
<transition-group name="message-fade" tag="div" class="miao-message-provider-container">
|
||||||
|
<div class="miao-message" v-for="msg in messageList" :key="msg.id"
|
||||||
|
:style="{ maxWidth: maxMessageWidth + 'px' }">
|
||||||
|
<n-icon class="miao-message-item" size="18" :color="msg.iconColor">
|
||||||
|
<component :is="msg.icon"></component>
|
||||||
|
</n-icon>
|
||||||
|
<div class="miao-message-item miao-message-item-content">{{ msg.content }}</div>
|
||||||
|
</div>
|
||||||
|
</transition-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import generateId from '@/hooks/generateId';
|
||||||
|
import { NIcon } from 'naive-ui';
|
||||||
|
import { computed, onMounted, ref, shallowReactive } from 'vue';
|
||||||
|
import { InformationCircle, CheckmarkCircle, CloseCircle } from '@vicons/ionicons5'
|
||||||
|
import { AlertTipMessageOptions } from '@/types/type';
|
||||||
|
|
||||||
|
interface Message {
|
||||||
|
icon: any,
|
||||||
|
timer: any,
|
||||||
|
iconColor: string,
|
||||||
|
content: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
const iconMap = {
|
||||||
|
'info': { icon: InformationCircle, color: 'blue' },
|
||||||
|
'success': { icon: CheckmarkCircle, color: 'green' },
|
||||||
|
'error': { icon: CloseCircle, color: 'red' },
|
||||||
|
}
|
||||||
|
|
||||||
|
const messageMap = shallowReactive<Record<string, Message | undefined>>({})
|
||||||
|
const rootRef = ref<HTMLDivElement>()
|
||||||
|
const maxMessageWidth = ref<number>(-1)
|
||||||
|
|
||||||
|
const messageList = computed(() => {
|
||||||
|
return Object.keys(messageMap).map(v => ({
|
||||||
|
id: v,
|
||||||
|
...messageMap[v],
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
const alertTip = (content: string, options?: AlertTipMessageOptions) => {
|
||||||
|
let timer: any
|
||||||
|
const { timeout = 0, type = 'info', id = generateId() } = options ?? {}
|
||||||
|
if (timeout > 0) {
|
||||||
|
messageMap[id]?.timer && clearTimeout(messageMap[id]?.timer)
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
delete messageMap[id]
|
||||||
|
}, timeout)
|
||||||
|
}
|
||||||
|
messageMap[id] = {
|
||||||
|
icon: iconMap[type].icon,
|
||||||
|
iconColor: iconMap[type].color,
|
||||||
|
content,
|
||||||
|
timer
|
||||||
|
}
|
||||||
|
return (newContent: string, newOptions?: AlertTipMessageOptions) => {
|
||||||
|
newOptions = newOptions ?? {}
|
||||||
|
newOptions.id = id
|
||||||
|
alertTip(newContent, newOptions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
// const set = message('test', { timeout: 5000 })
|
||||||
|
// setTimeout(() => {
|
||||||
|
// set('miao', { type: 'success' })
|
||||||
|
// }, 1000);
|
||||||
|
const observer = new ResizeObserver(entries => {
|
||||||
|
for (let entry of entries) {
|
||||||
|
maxMessageWidth.value = entry.contentRect.width * 0.8;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (rootRef.value) {
|
||||||
|
observer.observe(rootRef.value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({ alertTip });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miao-message-provider {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.miao-message-provider-container {
|
||||||
|
position: absolute;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
left: 50%;
|
||||||
|
top: 30px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
overflow: visible;
|
||||||
|
z-index: 70582140539943419;
|
||||||
|
|
||||||
|
.miao-message {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: max-content;
|
||||||
|
background-color: rgb(249, 249, 249);
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: rgb(255 255 255);
|
||||||
|
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05);
|
||||||
|
border-radius: 5px;
|
||||||
|
user-select: none;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.miao-message-item {
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miao-message-item-content {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-fade-move,
|
||||||
|
.message-fade-enter-active,
|
||||||
|
.message-fade-leave-active {
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-fade-enter-from,
|
||||||
|
.message-fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(30px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-fade-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="container" @dragover="handleDragOver" @dragleave="handleDragLeave" @drop="handleDrop">
|
||||||
class="container"
|
|
||||||
@dragover="handleDragOver"
|
|
||||||
@dragleave="handleDragLeave"
|
|
||||||
@drop="handleDrop">
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<miao-mask v-model:show="showMask"></miao-mask>
|
<miao-mask v-model:show="showMask"></miao-mask>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,8 +59,11 @@ const removeDirectory = async (files: File[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDragOver = async (event: DragEvent) => {
|
const handleDragOver = async (event: DragEvent) => {
|
||||||
showMask.value += 1
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
if (showMask.value === 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showMask.value = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDragLeave = async () => {
|
const handleDragLeave = async () => {
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<!-- 只适合用于渲染过程较为复杂的组件,不然可能得不偿失
|
||||||
|
这么泛用的组件,性能差点也能理解 -->
|
||||||
|
<template>
|
||||||
|
<div class="miao-lazy" ref="miaoLazyRoot" :style="!show ? { minHeight, minWidth } : {}">
|
||||||
|
<slot v-if="show" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
disableLazy: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
// 仅在内容未加载时生效,用于占位
|
||||||
|
minHeight: {
|
||||||
|
type: String,
|
||||||
|
default: 'none',
|
||||||
|
},
|
||||||
|
minWidth: {
|
||||||
|
type: String,
|
||||||
|
default: 'none',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const miaoLazyRoot = ref<HTMLDivElement>()
|
||||||
|
|
||||||
|
const show = ref<boolean>(props.disableLazy)
|
||||||
|
|
||||||
|
const isVisible = (dom: HTMLDivElement) => {
|
||||||
|
const offset = dom.getBoundingClientRect().top
|
||||||
|
return offset > 0 && offset < 2000
|
||||||
|
}
|
||||||
|
|
||||||
|
const { showSlot, hideSlot, clearTimer } = (() => {
|
||||||
|
let timer: any
|
||||||
|
let timerInterval: any
|
||||||
|
const clearTimer = () => {
|
||||||
|
timer && clearTimeout(timer)
|
||||||
|
timerInterval && clearInterval(timerInterval)
|
||||||
|
timer = undefined
|
||||||
|
timerInterval = undefined
|
||||||
|
}
|
||||||
|
const hideSlot = () => {
|
||||||
|
clearTimer()
|
||||||
|
show.value = false
|
||||||
|
}
|
||||||
|
const showSlot = () => {
|
||||||
|
if (show.value === true) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
clearTimer()
|
||||||
|
// timer = setTimeout(() => {
|
||||||
|
if (!miaoLazyRoot.value || isVisible(miaoLazyRoot.value) === false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
show.value = true
|
||||||
|
timerInterval = setInterval(() => {
|
||||||
|
if (show.value === false || miaoLazyRoot.value === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isVisible(miaoLazyRoot.value) === false) {
|
||||||
|
hideSlot()
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
return { showSlot, hideSlot, clearTimer }
|
||||||
|
})()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (show.value === false) {
|
||||||
|
let options = {
|
||||||
|
threshold: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
let observer: IntersectionObserver | undefined = new IntersectionObserver((entries) => {
|
||||||
|
if (entries[0].isIntersecting) {
|
||||||
|
showSlot()
|
||||||
|
// miaoLazyRoot.value && observer?.unobserve(miaoLazyRoot.value)
|
||||||
|
// observer = undefined
|
||||||
|
} else {
|
||||||
|
hideSlot()
|
||||||
|
}
|
||||||
|
}, options);
|
||||||
|
miaoLazyRoot.value && observer.observe(miaoLazyRoot.value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
clearTimer()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,83 +1,102 @@
|
|||||||
<template>
|
<template>
|
||||||
<miao-mask v-model:show="showMask">
|
<miao-mask v-model:show="showMask">
|
||||||
<n-card class="popup-card" :title="popupConfig?.title" size="medium">
|
<n-card class="popup-card" :title="popupConfig?.title" size="medium">
|
||||||
{{ popupConfig?.content }}
|
{{ popupConfig?.content }}
|
||||||
<n-input class="popup-input" v-model:value="inputValue" type="text" v-bind="popupConfig?.inputProps"
|
<n-input
|
||||||
v-if="popupConfig?.inputProps" />
|
class="popup-input"
|
||||||
<div class="popup-button-container">
|
v-model:value="inputValue"
|
||||||
<n-button class="popup-button-container-button" v-for="option in popupConfig?.options" :key="option.label"
|
type="text"
|
||||||
:type="option.type" @click="_resolve && _resolve(option.key)">{{ option.label }}</n-button>
|
v-bind="popupConfig?.inputProps"
|
||||||
</div>
|
passively-activated
|
||||||
</n-card>
|
autofocus
|
||||||
</miao-mask>
|
v-if="popupConfig?.inputProps" />
|
||||||
|
<div class="popup-button-container">
|
||||||
|
<n-button
|
||||||
|
class="popup-button-container-button"
|
||||||
|
v-for="option in popupConfig?.options"
|
||||||
|
:key="option.label"
|
||||||
|
:type="option.type"
|
||||||
|
@click="_resolve && _resolve(option.key)">
|
||||||
|
{{ option.label }}
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</miao-mask>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick } from "vue";
|
import { ref, nextTick } from 'vue'
|
||||||
import { NCard, NInput, NButton } from "naive-ui";
|
import { NCard, NInput, NButton } from 'naive-ui'
|
||||||
import miaoMask from "./miaoMask.vue";
|
import miaoMask from './miaoMask.vue'
|
||||||
import { InputProps } from "naive-ui";
|
import { InputProps } from 'naive-ui'
|
||||||
|
|
||||||
const showMask = ref(false);
|
const showMask = ref(false)
|
||||||
const inputValue = ref<string>("");
|
const inputValue = ref<string>('')
|
||||||
const _resolve = ref()
|
const _resolve = ref()
|
||||||
|
|
||||||
type popupConfigType = {
|
type popupConfigType = {
|
||||||
title: string
|
title: string
|
||||||
content?: string
|
content?: string
|
||||||
inputValue?: string,
|
inputValue?: string
|
||||||
inputProps?: InputProps
|
inputProps?: InputProps
|
||||||
options: {
|
options: {
|
||||||
label: string
|
label: string
|
||||||
key: unknown
|
key: unknown
|
||||||
type: 'default' | 'tertiary' | 'primary' | 'success' | 'info' | 'warning' | 'error'
|
type:
|
||||||
}[]
|
| 'default'
|
||||||
|
| 'tertiary'
|
||||||
|
| 'primary'
|
||||||
|
| 'success'
|
||||||
|
| 'info'
|
||||||
|
| 'warning'
|
||||||
|
| 'error'
|
||||||
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const popupConfig = ref<popupConfigType>()
|
const popupConfig = ref<popupConfigType>()
|
||||||
|
|
||||||
const popup = async (config: popupConfigType) => {
|
const popup = async (config: popupConfigType) => {
|
||||||
popupConfig.value = config
|
popupConfig.value = config
|
||||||
inputValue.value = config.inputValue ?? ''
|
inputValue.value = config.inputValue ?? ''
|
||||||
showMask.value = true
|
showMask.value = true
|
||||||
const key = await new Promise((resolve: (key: unknown) => unknown) => {
|
const key = await new Promise((resolve: (key: unknown) => unknown) => {
|
||||||
_resolve.value = resolve
|
_resolve.value = resolve
|
||||||
})
|
})
|
||||||
const text = inputValue.value
|
const text = inputValue.value
|
||||||
showMask.value = false;
|
showMask.value = false
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
inputValue.value = ''
|
inputValue.value = ''
|
||||||
_resolve.value = undefined
|
_resolve.value = undefined
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
text,
|
text,
|
||||||
key
|
key
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
defineExpose({ popup });
|
defineExpose({ popup })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.popup-card {
|
.popup-card {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
||||||
.popup-input {
|
.popup-input {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-button-container {
|
.popup-button-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.popup-button-container-button {
|
.popup-button-container-button {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
&:not(:last-child) {
|
&:not(:last-child) {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const idList: number[] = [];
|
const idList: number[] = []
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成一个唯一的id
|
* 生成一个唯一的id
|
||||||
@@ -6,11 +6,11 @@ const idList: number[] = [];
|
|||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export default function generateId(length?: number) {
|
export default function generateId(length?: number) {
|
||||||
length || (length = 16);
|
length || (length = 16)
|
||||||
let id;
|
let id
|
||||||
while (!id || idList.includes(id)) {
|
while (!id || idList.includes(id)) {
|
||||||
id = Math.ceil(Math.random() * 10 ** 16);
|
id = Math.ceil(Math.random() * 10 ** 16)
|
||||||
}
|
}
|
||||||
idList.push(id)
|
idList.push(id)
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
+4
-99
@@ -1,101 +1,6 @@
|
|||||||
import MiaoDirectory from '@/views/miaoDirectory.vue'
|
import { alertTipType } from "@/types/type";
|
||||||
import usePluginCenter from './usePluginCenter'
|
import initPlugin from "./init/initPlugin";
|
||||||
|
|
||||||
export default function init() {
|
export default async function init(globalAlertTip: alertTipType) {
|
||||||
const pluginCenter = usePluginCenter()
|
await initPlugin(globalAlertTip)
|
||||||
pluginCenter.registerComponent(
|
|
||||||
'miaoDirectory',
|
|
||||||
'文件夹',
|
|
||||||
async () => MiaoDirectory,
|
|
||||||
(vDirs, vFiles) => {
|
|
||||||
if (vFiles.length) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return vDirs.length === 1
|
|
||||||
}
|
|
||||||
)
|
|
||||||
pluginCenter.registerComponent(
|
|
||||||
'miaoVideoPlayer',
|
|
||||||
'视频',
|
|
||||||
async () => (await import('@/views/miaoVideoPlayer.vue')).default,
|
|
||||||
(vDirs, vFiles) => {
|
|
||||||
if (vDirs.length !== 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (vFiles.length === 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for (let i of vFiles) {
|
|
||||||
for (let s of ['mp4', 'm3u8', 'hls']) {
|
|
||||||
if (i.name.endsWith(s)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
pluginCenter.registerComponent(
|
|
||||||
'miaoIframe',
|
|
||||||
'框架',
|
|
||||||
async () => (await import('@/views/miaoIframe.vue')).default,
|
|
||||||
(vDirs, vFiles) => {
|
|
||||||
if (vDirs.length !== 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (vFiles.length !== 1) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return vFiles[0].name.endsWith('html')
|
|
||||||
}
|
|
||||||
)
|
|
||||||
pluginCenter.registerComponent(
|
|
||||||
'miaoPDF',
|
|
||||||
'PDF浏览',
|
|
||||||
async () => (await import('@/views/miaoPDF.vue')).default,
|
|
||||||
(vDirs, vFiles) => {
|
|
||||||
if (vDirs.length !== 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (vFiles.length !== 1) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return vFiles[0].name.endsWith('pdf')
|
|
||||||
}
|
|
||||||
)
|
|
||||||
pluginCenter.registerComponent(
|
|
||||||
'miaoCodeMirror',
|
|
||||||
'代码编辑',
|
|
||||||
async () => (await import('@/views/miaoCodeMirror.vue')).default,
|
|
||||||
(vDirs, vFiles) => {
|
|
||||||
if (vDirs.length !== 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (vFiles.length !== 1) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for (let end of [
|
|
||||||
'js',
|
|
||||||
'ts',
|
|
||||||
'jsx',
|
|
||||||
'tsx',
|
|
||||||
'py',
|
|
||||||
'html',
|
|
||||||
'css',
|
|
||||||
'scss',
|
|
||||||
'go',
|
|
||||||
'json',
|
|
||||||
'md',
|
|
||||||
'yaml',
|
|
||||||
'txt',
|
|
||||||
'xml',
|
|
||||||
'vue',
|
|
||||||
]) {
|
|
||||||
if (vFiles[0].name.endsWith(end)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import usePluginCenter, { initPluginCenter } from "@/hooks/usePluginCenter";
|
||||||
|
import { Plugin, registerComponentOption } from "@/class/PluginCenter";
|
||||||
|
import { alertTipType, PluginExportType } from "@/types/type";
|
||||||
|
|
||||||
|
const initPlugin = async (globalAlertTip: alertTipType) => {
|
||||||
|
initPluginCenter(globalAlertTip)
|
||||||
|
const modulesFiles = import.meta.glob("@/plugins/**/export.ts");
|
||||||
|
const pluginCenter = usePluginCenter();
|
||||||
|
const promiseArray = [];
|
||||||
|
for (let pluginConfig of Object.values(modulesFiles)) {
|
||||||
|
promiseArray.push(
|
||||||
|
new Promise(async resolve => {
|
||||||
|
const _config = pluginConfig as () => Promise<{
|
||||||
|
default: registerComponentOption | Plugin;
|
||||||
|
type: PluginExportType
|
||||||
|
key?: string
|
||||||
|
}>;
|
||||||
|
const {type, key} = await _config()
|
||||||
|
if(type === PluginExportType.component) {
|
||||||
|
// @ts-ignore
|
||||||
|
resolve(pluginCenter.registerComponent((await _config()).default));
|
||||||
|
} else if (type === PluginExportType.default) {
|
||||||
|
// @ts-ignore
|
||||||
|
resolve(pluginCenter.register(key as string, (await _config()).default));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await Promise.all(promiseArray);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default initPlugin;
|
||||||
+55
-43
@@ -1,47 +1,59 @@
|
|||||||
|
import { NIcon } from 'naive-ui'
|
||||||
|
import { h } from 'vue'
|
||||||
|
|
||||||
export const filePicker = (() => {
|
export const filePicker = (() => {
|
||||||
let _resolve: ((files: File[]) => void) | undefined;
|
let _resolve: ((files: File[]) => void) | undefined
|
||||||
return (option?: { accept?: "string"; multiple: boolean }) => {
|
return (option?: { accept?: 'string'; multiple: boolean }) => {
|
||||||
if (_resolve) {
|
if (_resolve) {
|
||||||
_resolve([]);
|
_resolve([])
|
||||||
_resolve = undefined;
|
_resolve = undefined
|
||||||
}
|
}
|
||||||
return new Promise<File[]>(resolve => {
|
return new Promise<File[]>((resolve) => {
|
||||||
const inpEle = document.createElement("input");
|
const inpEle = document.createElement('input')
|
||||||
inpEle.id = `__file_${Math.ceil(Math.random() * 100000000)}`;
|
inpEle.id = `__file_${Math.ceil(Math.random() * 100000000)}`
|
||||||
inpEle.type = "file";
|
inpEle.type = 'file'
|
||||||
inpEle.style.display = "none";
|
inpEle.style.display = 'none'
|
||||||
_resolve = resolve;
|
_resolve = resolve
|
||||||
// 文件类型限制
|
// 文件类型限制
|
||||||
// inpEle.accept="image/*"
|
// inpEle.accept="image/*"
|
||||||
option?.accept && (inpEle.accept = option?.accept);
|
option?.accept && (inpEle.accept = option?.accept)
|
||||||
// 多选限制
|
// 多选限制
|
||||||
option?.multiple && (inpEle.multiple = option?.multiple);
|
option?.multiple && (inpEle.multiple = option?.multiple)
|
||||||
// inpEle.addEventListener("change", event => fn.call(inpEle, event, inpEle.files), { once: true });
|
// inpEle.addEventListener("change", event => fn.call(inpEle, event, inpEle.files), { once: true });
|
||||||
inpEle.addEventListener(
|
inpEle.addEventListener(
|
||||||
"change",
|
'change',
|
||||||
() => {
|
() => {
|
||||||
if (!inpEle.files) {
|
if (!inpEle.files) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
const files: File[] = [];
|
const files: File[] = []
|
||||||
let i = 0;
|
let i = 0
|
||||||
while (i < inpEle.files?.length) {
|
while (i < inpEle.files?.length) {
|
||||||
const _file = inpEle?.files?.item(i);
|
const _file = inpEle?.files?.item(i)
|
||||||
if (_file !== null) {
|
if (_file !== null) {
|
||||||
files.push(_file);
|
files.push(_file)
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1
|
||||||
}
|
}
|
||||||
resolve(files);
|
resolve(files)
|
||||||
_resolve = undefined
|
_resolve = undefined
|
||||||
},
|
},
|
||||||
{ once: true }
|
{ once: true }
|
||||||
);
|
)
|
||||||
inpEle.click();
|
inpEle.click()
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
})();
|
})()
|
||||||
|
|
||||||
|
export const renderIcon = (icon: any) => {
|
||||||
|
return () => {
|
||||||
|
return h(NIcon, null, {
|
||||||
|
default: () => h(icon)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
filePicker
|
filePicker,
|
||||||
};
|
renderIcon
|
||||||
|
}
|
||||||
+252
-265
@@ -1,287 +1,274 @@
|
|||||||
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
import VirtualDirectory, { VirtualFile } from "@/class/VirtualDirectory";
|
||||||
import {
|
import {
|
||||||
getOption,
|
getOption,
|
||||||
getResponse,
|
getResponse,
|
||||||
miaoFetchConfig,
|
miaoFetchConfig,
|
||||||
deleteOption,
|
deleteOption,
|
||||||
uploadOption,
|
uploadOption,
|
||||||
queryOption,
|
queryOption,
|
||||||
renameOption,
|
renameOption,
|
||||||
cutOption,
|
cutOption,
|
||||||
mkdirOption
|
mkdirOption,
|
||||||
} from '@/types/fetch'
|
getFileOption
|
||||||
import Config from '@/config'
|
} from "@/types/fetch";
|
||||||
import axios, { AxiosRequestConfig } from 'axios'
|
import Config from "@/config";
|
||||||
|
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
||||||
|
|
||||||
export const useMiaoFetch = (option?: miaoFetchConfig) => {
|
export const useMiaoFetch = (option?: miaoFetchConfig) => {
|
||||||
const retry = option?.retry ?? 0
|
const retry = option?.retry ?? 0;
|
||||||
const controller = new AbortController()
|
const controller = new AbortController();
|
||||||
let flag = true
|
let flag = true;
|
||||||
return {
|
return {
|
||||||
miaoFetch: async (config: AxiosRequestConfig<any>) => {
|
miaoFetch: async (config: AxiosRequestConfig<any>): Promise<AxiosResponse<any, any>> => {
|
||||||
let counter = 0
|
let counter = 0;
|
||||||
let response: any
|
let response: any;
|
||||||
let errList = []
|
let errList = [];
|
||||||
while (flag && counter <= retry) {
|
while (flag && counter <= retry) {
|
||||||
try {
|
try {
|
||||||
response = await axios({
|
response = await axios({
|
||||||
...config,
|
...config,
|
||||||
signal: controller.signal
|
signal: controller.signal
|
||||||
})
|
});
|
||||||
return response
|
return response;
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
errList.push(_e)
|
errList.push(_e);
|
||||||
counter += 1
|
counter += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw errList
|
throw errList;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 强制终止miaoFetch
|
* 强制终止miaoFetch
|
||||||
*/
|
*/
|
||||||
abortMiaoFetch: () => {
|
abortMiaoFetch: () => {
|
||||||
flag = false
|
flag = false;
|
||||||
controller.abort()
|
controller.abort();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
const miaoFetchApi = {
|
const miaoFetchApi = {
|
||||||
/**
|
/**
|
||||||
* 获取对应文件夹下的数据
|
* 获取对应文件夹下的数据
|
||||||
*/
|
*/
|
||||||
async get(
|
async get(vDirectory: VirtualDirectory, option?: getOption): Promise<getResponse> {
|
||||||
vDirectory: VirtualDirectory,
|
const { baseUrl, api } = Config;
|
||||||
option?: getOption
|
const url = `${baseUrl}${api.get}${vDirectory.path}`;
|
||||||
): Promise<getResponse> {
|
const retry = option?.retry ?? 0;
|
||||||
const { baseUrl, api } = Config
|
|
||||||
const url = `${baseUrl}${api.get}${vDirectory.path}`
|
|
||||||
const retry = option?.retry ?? 0
|
|
||||||
|
|
||||||
const { miaoFetch } = useMiaoFetch({
|
const { miaoFetch } = useMiaoFetch({
|
||||||
retry
|
retry
|
||||||
})
|
});
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url
|
url
|
||||||
})
|
});
|
||||||
return response.data
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取对应文件夹下的数据
|
* 获取对应文件下的数据
|
||||||
*/
|
*/
|
||||||
async getFile(
|
getFile(vFile: VirtualFile, option?: getFileOption) {
|
||||||
vFile: VirtualFile,
|
// const { baseUrl, api } = Config
|
||||||
option?: getOption
|
const url = vFile.url;
|
||||||
): Promise<getResponse> {
|
const retry = option?.retry ?? 0;
|
||||||
// const { baseUrl, api } = Config
|
const axiosOption = option?.axiosOption ?? {};
|
||||||
const url = vFile.url
|
|
||||||
const retry = option?.retry ?? 0
|
|
||||||
const axiosOption = option?.axiosOption ?? {}
|
|
||||||
|
|
||||||
const { miaoFetch } = useMiaoFetch({
|
const { miaoFetch, abortMiaoFetch: abort } = useMiaoFetch({
|
||||||
retry
|
retry
|
||||||
})
|
});
|
||||||
const response = await miaoFetch({
|
const response = miaoFetch({
|
||||||
url, ...axiosOption
|
url,
|
||||||
})
|
responseType: "arraybuffer",
|
||||||
return response.data
|
onDownloadProgress(progressEvent) {
|
||||||
},
|
option && option.onProcess && option.onProcess(progressEvent.total ? progressEvent.loaded / progressEvent.total : -1);
|
||||||
|
},
|
||||||
|
...axiosOption
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
response: new Promise<Uint8Array>(async resolve => {
|
||||||
|
resolve(new Uint8Array((await response).data));
|
||||||
|
}),
|
||||||
|
abort
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传单个文件到对应文件夹, 后续要将data类型改成buffer以支持分片上传
|
* 上传单个文件到对应文件夹, 后续要将data类型改成buffer以支持分片上传
|
||||||
* 正常上传文件请使用uploadQueue
|
* 正常上传文件请使用uploadQueue
|
||||||
*/
|
*/
|
||||||
upload(data: File, targetVDir: VirtualDirectory, option?: uploadOption) {
|
upload(data: File, targetVDir: VirtualDirectory, option?: uploadOption) {
|
||||||
const { baseUrl, api } = Config
|
const { baseUrl, api } = Config;
|
||||||
const url = `${baseUrl}${api.upload}${targetVDir.path}`
|
const url = `${baseUrl}${api.upload}${targetVDir.path}`;
|
||||||
const retry = option?.retry ?? 0
|
const retry = option?.retry ?? 0;
|
||||||
const { miaoFetch, abortMiaoFetch } = useMiaoFetch({
|
const { miaoFetch, abortMiaoFetch } = useMiaoFetch({
|
||||||
retry
|
retry
|
||||||
})
|
});
|
||||||
const sizeTotal = data.size
|
const sizeTotal = data.size;
|
||||||
|
|
||||||
const opType = option?.type ?? 'write'
|
const opType = option?.type ?? "write";
|
||||||
|
|
||||||
const formData = new FormData()
|
const formData = new FormData();
|
||||||
|
|
||||||
formData.append('file', data)
|
formData.append("file", data);
|
||||||
// 必须这样传,不然中文乱码
|
// 必须这样传,不然中文乱码
|
||||||
formData.append('fileName', data.name)
|
formData.append("fileName", data.name);
|
||||||
formData.append('operateType', opType)
|
formData.append("operateType", opType);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
abort: () => abortMiaoFetch(),
|
abort: () => abortMiaoFetch(),
|
||||||
response: new Promise<{
|
response: new Promise<{
|
||||||
message: 'success' | 'failed'
|
message: "success" | "failed";
|
||||||
error?: string
|
error?: string;
|
||||||
}>(async (resolve) => {
|
}>(async resolve => {
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url,
|
url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: formData,
|
data: formData,
|
||||||
onUploadProgress(progressEvent) {
|
onUploadProgress(progressEvent) {
|
||||||
option &&
|
option && option.onProcess && option.onProcess(progressEvent.loaded / sizeTotal);
|
||||||
option.onProcess &&
|
}
|
||||||
option.onProcess(progressEvent.loaded / sizeTotal)
|
});
|
||||||
}
|
resolve(response.data);
|
||||||
})
|
})
|
||||||
resolve(response.data)
|
};
|
||||||
})
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在目标文件夹下创建新的文件夹
|
* 在目标文件夹下创建新的文件夹
|
||||||
*/
|
*/
|
||||||
mkdir(
|
mkdir(targetVDir: VirtualDirectory, newFolderName: string, option?: mkdirOption) {
|
||||||
targetVDir: VirtualDirectory,
|
const { baseUrl, api } = Config;
|
||||||
newFolderName: string,
|
const url = `${baseUrl}${api.mkdir}${targetVDir.path}`;
|
||||||
option?: mkdirOption
|
const { miaoFetch } = useMiaoFetch({
|
||||||
) {
|
retry: option?.retry ?? 0
|
||||||
const { baseUrl, api } = Config
|
});
|
||||||
const url = `${baseUrl}${api.mkdir}${targetVDir.path}`
|
|
||||||
const { miaoFetch } = useMiaoFetch({
|
|
||||||
retry: option?.retry ?? 0
|
|
||||||
})
|
|
||||||
|
|
||||||
return new Promise<{
|
return new Promise<{
|
||||||
message: 'success' | 'failed'
|
message: "success" | "failed";
|
||||||
error?: string
|
error?: string;
|
||||||
}>(async (resolve) => {
|
}>(async resolve => {
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url,
|
url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
folderName: newFolderName
|
folderName: newFolderName
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
resolve(response.data)
|
resolve(response.data);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 在目标文件夹下创建新的空文件,实际上是通过upload空文件实现
|
* 在目标文件夹下创建新的空文件,实际上是通过upload空文件实现
|
||||||
*/
|
*/
|
||||||
mkFile(
|
mkFile(targetVDir: VirtualDirectory, newFileName: string, option?: uploadOption) {
|
||||||
targetVDir: VirtualDirectory,
|
const emptyBlob = new Blob([]);
|
||||||
newFileName: string,
|
const emptyFile = new File([emptyBlob], newFileName, {
|
||||||
option?: uploadOption
|
type: "text/plain"
|
||||||
) {
|
});
|
||||||
const emptyBlob = new Blob([])
|
return this.upload(emptyFile, targetVDir, option);
|
||||||
const emptyFile = new File([emptyBlob], newFileName, {
|
},
|
||||||
type: 'text/plain'
|
|
||||||
})
|
|
||||||
return this.upload(emptyFile, targetVDir, option)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除对应的文件或文件夹,若为文件夹会递归删除
|
* 删除对应的文件或文件夹,若为文件夹会递归删除
|
||||||
*/
|
*/
|
||||||
delete(target: VirtualFile | VirtualDirectory, option?: deleteOption) {
|
delete(target: VirtualFile | VirtualDirectory, option?: deleteOption) {
|
||||||
const { baseUrl, api } = Config
|
const { baseUrl, api } = Config;
|
||||||
const url = `${baseUrl}${api.delete}${target.path}`
|
const url = `${baseUrl}${api.delete}${target.path}`;
|
||||||
const retry = option?.retry ?? 0
|
const retry = option?.retry ?? 0;
|
||||||
const { miaoFetch } = useMiaoFetch({
|
const { miaoFetch } = useMiaoFetch({
|
||||||
retry
|
retry
|
||||||
})
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
response: new Promise<{
|
response: new Promise<{
|
||||||
eventId: number
|
eventId: number;
|
||||||
}>(async (resolve) => {
|
}>(async resolve => {
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url,
|
url,
|
||||||
method: 'post'
|
method: "post"
|
||||||
})
|
});
|
||||||
resolve(response.data)
|
resolve(response.data);
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 重命名对应的文件或文件夹
|
* 重命名对应的文件或文件夹
|
||||||
*/
|
*/
|
||||||
rename(
|
rename(target: VirtualFile | VirtualDirectory, newName: string, option?: renameOption) {
|
||||||
target: VirtualFile | VirtualDirectory,
|
const { baseUrl, api } = Config;
|
||||||
newName: string,
|
const url = `${baseUrl}${api.rename}${target.path}`;
|
||||||
option?: renameOption
|
const retry = option?.retry ?? 0;
|
||||||
) {
|
const { miaoFetch } = useMiaoFetch({
|
||||||
const { baseUrl, api } = Config
|
retry
|
||||||
const url = `${baseUrl}${api.rename}${target.path}`
|
});
|
||||||
const retry = option?.retry ?? 0
|
|
||||||
const { miaoFetch } = useMiaoFetch({
|
|
||||||
retry
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
response: new Promise<{
|
response: new Promise<{
|
||||||
eventId: number
|
eventId: number;
|
||||||
}>(async (resolve) => {
|
}>(async resolve => {
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url,
|
url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: { newName }
|
data: { newName }
|
||||||
})
|
});
|
||||||
resolve(response.data)
|
resolve(response.data);
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 剪切文件或文件夹
|
* 剪切文件或文件夹
|
||||||
*/
|
*/
|
||||||
cut(
|
cut(target: VirtualFile | VirtualDirectory, to: VirtualDirectory, option?: cutOption) {
|
||||||
target: VirtualFile | VirtualDirectory,
|
const newPath = to.path;
|
||||||
to: VirtualDirectory,
|
const { baseUrl, api } = Config;
|
||||||
option?: cutOption
|
const url = `${baseUrl}${api.cut}${target.path}`;
|
||||||
) {
|
const retry = option?.retry ?? 0;
|
||||||
const newPath = to.path
|
const { miaoFetch } = useMiaoFetch({
|
||||||
const { baseUrl, api } = Config
|
retry
|
||||||
const url = `${baseUrl}${api.cut}${target.path}`
|
});
|
||||||
const retry = option?.retry ?? 0
|
return {
|
||||||
const { miaoFetch } = useMiaoFetch({
|
response: new Promise<{
|
||||||
retry
|
eventId: number;
|
||||||
})
|
}>(async resolve => {
|
||||||
return {
|
const response = await miaoFetch({
|
||||||
response: new Promise<{
|
url,
|
||||||
eventId: number
|
method: "post",
|
||||||
}>(async (resolve) => {
|
data: { newPath }
|
||||||
const response = await miaoFetch({
|
});
|
||||||
url,
|
resolve(response.data);
|
||||||
method: 'post',
|
})
|
||||||
data: { newPath }
|
};
|
||||||
})
|
},
|
||||||
resolve(response.data)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询服务端操作事件的进展
|
* 查询服务端操作事件的进展
|
||||||
*/
|
*/
|
||||||
query(eventId: number, option?: queryOption) {
|
query(eventId: number, option?: queryOption) {
|
||||||
const { baseUrl, api } = Config
|
const { baseUrl, api } = Config;
|
||||||
const url = `${baseUrl}${api.query}`
|
const url = `${baseUrl}${api.query}`;
|
||||||
const retry = option?.retry ?? 0
|
const retry = option?.retry ?? 0;
|
||||||
const { miaoFetch } = useMiaoFetch({
|
const { miaoFetch } = useMiaoFetch({
|
||||||
retry
|
retry
|
||||||
})
|
});
|
||||||
return {
|
return {
|
||||||
response: new Promise<{
|
response: new Promise<{
|
||||||
status: 'process' | 'success' | 'failed'
|
status: "process" | "success" | "failed";
|
||||||
error?: unknown
|
error?: unknown;
|
||||||
}>(async (resolve) => {
|
}>(async resolve => {
|
||||||
const response = await miaoFetch({
|
const response = await miaoFetch({
|
||||||
url,
|
url,
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: {
|
params: {
|
||||||
id: eventId
|
id: eventId
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
resolve(response.data)
|
resolve(response.data);
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default function useMiaoFetchApi() {
|
export default function useMiaoFetchApi() {
|
||||||
return miaoFetchApi
|
return miaoFetchApi;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
import PluginCenter from "@/class/PluginCenter";
|
import PluginCenter from "@/class/PluginCenter";
|
||||||
|
import { alertTipType } from "@/types/type";
|
||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
|
|
||||||
let pluginCenter: PluginCenter
|
let pluginCenter: PluginCenter
|
||||||
|
|
||||||
export default function usePluginCenter(){
|
export const initPluginCenter = (globalAlertTip: alertTipType) => {
|
||||||
if(!pluginCenter) {
|
if(!pluginCenter) {
|
||||||
pluginCenter = reactive(new PluginCenter())
|
pluginCenter = reactive(new PluginCenter(globalAlertTip))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function usePluginCenter(){
|
||||||
return pluginCenter
|
return pluginCenter
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ import { Reactive, reactive } from "vue"
|
|||||||
|
|
||||||
let views: Reactive<VirtualPages>
|
let views: Reactive<VirtualPages>
|
||||||
|
|
||||||
export default function useViretualPages(){
|
export default function useVirtualPages(){
|
||||||
if(views === undefined) {
|
if(views === undefined) {
|
||||||
// views = reactive<VirtualPage[]>([])
|
// views = reactive<VirtualPage[]>([])
|
||||||
views = reactive(new VirtualPages())
|
views = reactive(new VirtualPages())
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { VirtualFile } from "@/class/VirtualDirectory"
|
||||||
|
import config from "@/config"
|
||||||
|
import { usePluginHooksType } from "@/types/type"
|
||||||
|
import copy2Clipboard from 'copy-to-clipboard'
|
||||||
|
|
||||||
|
const copy = (__: any, vFiles: VirtualFile[], hooks: usePluginHooksType) => {
|
||||||
|
const { globalAlertTip } = hooks
|
||||||
|
const vFile = vFiles[0]
|
||||||
|
console.log(vFile.url)
|
||||||
|
copy2Clipboard(`${config.baseUrl}${vFile.url}`)
|
||||||
|
globalAlertTip(`${vFile.name}的链接已复制至剪切板`, {
|
||||||
|
type: 'info',
|
||||||
|
timeout: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export default copy
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { Plugin, PluginGroup } from "@/class/PluginCenter";
|
||||||
|
import Copy from "./copy";
|
||||||
|
import { CopyOutline } from "@vicons/ionicons5";
|
||||||
|
import { PluginExportType } from "@/types/type";
|
||||||
|
import { shallowRef } from "vue";
|
||||||
|
|
||||||
|
const pluginConfig: Plugin = {
|
||||||
|
name: "复制链接",
|
||||||
|
icon: shallowRef(CopyOutline),
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
disable: false,
|
||||||
|
group: [PluginGroup.default],
|
||||||
|
func: Copy
|
||||||
|
};
|
||||||
|
|
||||||
|
export default pluginConfig;
|
||||||
|
|
||||||
|
export const type = PluginExportType.default;
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import { CodeOutline } from '@vicons/ionicons5'
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoCodeMirror',
|
||||||
|
name: '代码编辑',
|
||||||
|
icon: CodeOutline,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoCodeMirror/miaoCodeMirror.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for (let end of [
|
||||||
|
'js',
|
||||||
|
'ts',
|
||||||
|
'jsx',
|
||||||
|
'tsx',
|
||||||
|
'py',
|
||||||
|
'html',
|
||||||
|
'css',
|
||||||
|
'scss',
|
||||||
|
'go',
|
||||||
|
'json',
|
||||||
|
'md',
|
||||||
|
'yaml',
|
||||||
|
'txt',
|
||||||
|
'xml',
|
||||||
|
'vue'
|
||||||
|
]) {
|
||||||
|
if (vFiles[0].name.endsWith(end)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -1,16 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="codemirror-container" ref="rootRef" :class="`codemirror-container-${theme}`">
|
<miao-message-provider ref="miaoMessage">
|
||||||
<div class="codemirror-container-top">
|
<div class="codemirror-container" ref="rootRef" :class="`codemirror-container-${theme}`">
|
||||||
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleSave">保存</div>
|
<div class="codemirror-container-top">
|
||||||
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleReset">恢复到上次保存</div>
|
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleSave">
|
||||||
|
保存
|
||||||
|
</div>
|
||||||
|
<div class="codemirror-container-btn codemirror-container-btn-save" @click="handleReset">
|
||||||
|
恢复到上次保存
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="codemirror-container-main">
|
||||||
|
<NScrollbar style="max-height: calc(100%)">
|
||||||
|
<codemirror v-model="codeData" :extensions="extensions" />
|
||||||
|
</NScrollbar>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<NScrollbar>
|
</miao-message-provider>
|
||||||
<codemirror v-model="codeData" :extensions="extensions" :style="{ height: '100%' }" />
|
|
||||||
</NScrollbar>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import miaoMessageProvider from '@/components/miaoAlertTipProvider.vue'
|
||||||
import { VirtualFile } from '@/class/VirtualDirectory'
|
import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
@@ -23,6 +32,9 @@ const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
|||||||
required: true
|
required: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const decoder = new TextDecoder('utf-8')
|
||||||
|
|
||||||
|
const miaoMessage = ref<InstanceType<typeof miaoMessageProvider>>()
|
||||||
const vFile = ref<VirtualFile>()
|
const vFile = ref<VirtualFile>()
|
||||||
const rootRef = ref<HTMLDivElement>()
|
const rootRef = ref<HTMLDivElement>()
|
||||||
// const _key = ref(Math.random())
|
// const _key = ref(Math.random())
|
||||||
@@ -34,6 +46,10 @@ const theme = ref<'light' | 'dark'>('light')
|
|||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (bakData.value === codeData.value || !vFile.value) {
|
if (bakData.value === codeData.value || !vFile.value) {
|
||||||
|
miaoMessage.value?.alertTip('内容未改动', {
|
||||||
|
timeout: 3000,
|
||||||
|
type: 'info'
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const parentDir = vFile.value?.parent
|
const parentDir = vFile.value?.parent
|
||||||
@@ -43,8 +59,13 @@ const handleSave = async () => {
|
|||||||
)
|
)
|
||||||
const file = new File([new Blob([codeData.value ?? ''])], vFile.value.name)
|
const file = new File([new Blob([codeData.value ?? ''])], vFile.value.name)
|
||||||
bakData.value = codeData.value
|
bakData.value = codeData.value
|
||||||
miaoFetchApi.upload(file, parentDir)
|
const { response } = miaoFetchApi.upload(file, parentDir)
|
||||||
false && miaoFetchApi.upload(file_bak, parentDir)
|
false && miaoFetchApi.upload(file_bak, parentDir)
|
||||||
|
await response
|
||||||
|
miaoMessage.value?.alertTip('保存成功', {
|
||||||
|
timeout: 5000,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleReset = async () => {
|
const handleReset = async () => {
|
||||||
@@ -71,7 +92,12 @@ const getLangExtensions = async (fileName: string) => {
|
|||||||
case 'ts':
|
case 'ts':
|
||||||
case 'tsx':
|
case 'tsx':
|
||||||
const { javascript } = await import('@codemirror/lang-javascript')
|
const { javascript } = await import('@codemirror/lang-javascript')
|
||||||
return [javascript({ jsx: ext.substring(2, 3) === 'x', typescript: ext.substring(0, 2) === 'js', })]
|
return [
|
||||||
|
javascript({
|
||||||
|
jsx: ext.substring(2, 3) === 'x',
|
||||||
|
typescript: ext.substring(0, 2) === 'js'
|
||||||
|
})
|
||||||
|
]
|
||||||
break
|
break
|
||||||
case 'css':
|
case 'css':
|
||||||
case 'scss':
|
case 'scss':
|
||||||
@@ -118,11 +144,15 @@ const getLangExtensions = async (fileName: string) => {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
vFile.value = currentFiles.value[0]
|
vFile.value = currentFiles.value[0]
|
||||||
const fileName = currentFiles.value[0].name
|
const fileName = currentFiles.value[0].name
|
||||||
codeData.value = (
|
codeData.value = decoder.decode(
|
||||||
await miaoFetchApi.getFile(currentFiles.value[0], {
|
await (miaoFetchApi.getFile(currentFiles.value[0], {
|
||||||
axiosOption: { responseType: 'text' }
|
axiosOption: {
|
||||||
})
|
headers: {
|
||||||
).toString()
|
'Cache-Control': 'no-cache'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).response)
|
||||||
|
)
|
||||||
bakData.value = codeData.value
|
bakData.value = codeData.value
|
||||||
extensions.value = [...(await getLangExtensions(fileName))]
|
extensions.value = [...(await getLangExtensions(fileName))]
|
||||||
|
|
||||||
@@ -139,8 +169,10 @@ onMounted(async () => {
|
|||||||
.codemirror-container {
|
.codemirror-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow-y: hidden;
|
||||||
|
|
||||||
.codemirror-container-top {
|
.codemirror-container-top {
|
||||||
|
height: 25px;
|
||||||
display: flex;
|
display: flex;
|
||||||
border-bottom: 1px solid #000;
|
border-bottom: 1px solid #000;
|
||||||
}
|
}
|
||||||
@@ -160,6 +192,11 @@ onMounted(async () => {
|
|||||||
background-color: #e8e8e8;
|
background-color: #e8e8e8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.codemirror-container-main {
|
||||||
|
height: calc(100% - 25px);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.codemirror-container-dark {
|
.codemirror-container-dark {
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoCrypto',
|
||||||
|
name: '文件加密',
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('./miaoCrypto.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
return true
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vFiles[0].name.endsWith('txt')
|
||||||
|
},
|
||||||
|
disable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import aesJs from 'aes-js'
|
||||||
|
import aes_worker from '../workers/aes-worker?worker'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用worker进行aes加密
|
||||||
|
* @param {any} key:string 须保证长度正确
|
||||||
|
* @param {any} data:Uint8Array
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export default (key: string, data: Uint8Array) => {
|
||||||
|
const key_u8i = aesJs.utils.utf8.toBytes(key)
|
||||||
|
return new Promise<Uint8Array>((resolve) => {
|
||||||
|
const aesWorker = new aes_worker()
|
||||||
|
aesWorker.onmessage = (event) => {
|
||||||
|
resolve(event.data)
|
||||||
|
}
|
||||||
|
aesWorker.postMessage({ data, key: key_u8i })
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
<template>
|
||||||
|
<miao-drop-handler @on-virtual-files="handleDropVirtualFiles">
|
||||||
|
<div class="miaoCrypto-container">
|
||||||
|
<div class="miaoCrypto-container-encrypt miaoCrypto-container-item">
|
||||||
|
|
||||||
|
<n-scrollbar style="max-height: 100%">
|
||||||
|
<div v-for="item of workItemList" :key="item.id" class="miaoCrypto-container-item-item">
|
||||||
|
<div class="miaoCrypto-container-item-percentBar" :style="{
|
||||||
|
zIndex: 0,
|
||||||
|
width: item.getBufferProgress !== -1 ? `${item.getBufferProgress * 100}%` : `0%`,
|
||||||
|
backgroundColor: 'blue'
|
||||||
|
}"></div>
|
||||||
|
<div class="miaoCrypto-container-item-percentBar" :style="{
|
||||||
|
zIndex: 1,
|
||||||
|
width: item.status === 'finish' ? `100%` : `0%`,
|
||||||
|
backgroundColor: 'green'
|
||||||
|
}"></div>
|
||||||
|
<span class="miaoCrypto-container-item-content">{{ item.name }}{{ item.status }}</span>
|
||||||
|
</div>
|
||||||
|
</n-scrollbar>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="miaoCrypto-container-decrypt miaoCrypto-container-item"></div> -->
|
||||||
|
</div>
|
||||||
|
</miao-drop-handler>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { NScrollbar } from 'naive-ui'
|
||||||
|
import { onUnmounted, ref, shallowReactive } from 'vue'
|
||||||
|
import aes_ctr_worker from './hooks/AES'
|
||||||
|
import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import miaoDropHandler from '@/components/miaoDropHandler.vue'
|
||||||
|
import { reactive } from 'vue'
|
||||||
|
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const miaoFetchApi = useMiaoFetchApi()
|
||||||
|
|
||||||
|
interface workItem {
|
||||||
|
id: number
|
||||||
|
status: 'wait' | 'process' | 'finish' | 'error'
|
||||||
|
buffer?: Uint8Array
|
||||||
|
getBuffer: () => Promise<Uint8Array>
|
||||||
|
getBufferProgress: number
|
||||||
|
getBufferAbort?: () => void
|
||||||
|
isGettingBuffer: boolean
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
class Work {
|
||||||
|
constructor(func: (key: string, data: Uint8Array) => Promise<Uint8Array>) {
|
||||||
|
this.queue = []
|
||||||
|
this.func = func
|
||||||
|
this.abortLoop = false
|
||||||
|
}
|
||||||
|
queue: workItem[]
|
||||||
|
func: (key: string, data: Uint8Array) => Promise<Uint8Array>
|
||||||
|
abortLoop: boolean
|
||||||
|
get isBusy() {
|
||||||
|
return this.queue.filter((v) => v.status === 'process').length > 0
|
||||||
|
}
|
||||||
|
async funcLoop() {
|
||||||
|
if (this.isBusy || this.abortLoop) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const currentItem = this.queue.filter((v) => v.status === 'wait')[0]
|
||||||
|
if (currentItem === undefined || currentItem.buffer === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
currentItem.status = 'process'
|
||||||
|
try {
|
||||||
|
currentItem.buffer = await this.func(key.value, currentItem.buffer)
|
||||||
|
currentItem.status = 'finish'
|
||||||
|
} catch (e) {
|
||||||
|
currentItem.status = 'error'
|
||||||
|
}
|
||||||
|
this.funcLoop()
|
||||||
|
}
|
||||||
|
async getBufferLoop() {
|
||||||
|
const _list = this.queue.filter(
|
||||||
|
(v) => v.isGettingBuffer === false && v.buffer === undefined
|
||||||
|
)
|
||||||
|
if (_list.length === 0 || this.abortLoop) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const item = _list[0]
|
||||||
|
item.isGettingBuffer = true
|
||||||
|
try {
|
||||||
|
item.buffer = await item.getBuffer()
|
||||||
|
} catch(e) {
|
||||||
|
item.status = 'error'
|
||||||
|
}
|
||||||
|
item.isGettingBuffer = false
|
||||||
|
this.funcLoop()
|
||||||
|
this.getBufferLoop()
|
||||||
|
}
|
||||||
|
push(itemList: workItem[]) {
|
||||||
|
this.queue.push(...itemList)
|
||||||
|
this.getBufferLoop()
|
||||||
|
}
|
||||||
|
pushVFiles(itemList: VirtualFile[]) {
|
||||||
|
this.push(
|
||||||
|
itemList.map((v) => {
|
||||||
|
const item: workItem = shallowReactive({
|
||||||
|
id: Math.random(),
|
||||||
|
status: 'wait',
|
||||||
|
name: v.name,
|
||||||
|
getBuffer: () => {
|
||||||
|
const { response, abort } = miaoFetchApi.getFile(v, {
|
||||||
|
onProcess(percent) {
|
||||||
|
item.getBufferProgress = percent
|
||||||
|
}
|
||||||
|
})
|
||||||
|
item.getBufferAbort = abort
|
||||||
|
return response
|
||||||
|
},
|
||||||
|
isGettingBuffer: false,
|
||||||
|
getBufferProgress: 0
|
||||||
|
})
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const encryptWork = reactive(new Work(aes_ctr_worker))
|
||||||
|
// const decryptWork = reactive(new Work(aes_ctr_worker))
|
||||||
|
|
||||||
|
const workItemList = computed(() => [
|
||||||
|
...encryptWork.queue
|
||||||
|
// ...decryptWork.queue
|
||||||
|
])
|
||||||
|
|
||||||
|
const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
||||||
|
required: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const key = ref('ABlockIs16Bytes!')
|
||||||
|
|
||||||
|
const handleDropVirtualFiles = (vFiles: VirtualFile[]) => {
|
||||||
|
encryptWork.pushVFiles(vFiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
encryptWork.pushVFiles(currentFiles.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
encryptWork.abortLoop = true
|
||||||
|
encryptWork.queue.forEach(item => {
|
||||||
|
item.getBufferAbort && item.getBufferAbort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miaoCrypto-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
max-height: 100%;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
margin: 10px auto;
|
||||||
|
width: 95%;
|
||||||
|
height: 40px;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0 0 15px -7px rgba(0, 0, 0, 0.1725490196),
|
||||||
|
0 0 3px 1px #43434359;
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.miaoCrypto-container-item-percentBar {
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoCrypto-container-item-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import aesJs from 'aes-js'
|
||||||
|
|
||||||
|
self.onmessage = async function (event) {
|
||||||
|
const data = event.data.data as Uint8Array
|
||||||
|
const key = event.data.key as Uint8Array
|
||||||
|
var aesCtr = new aesJs.ModeOfOperation.ctr(key, new aesJs.Counter(7058))
|
||||||
|
const encryptData = aesCtr.encrypt(data)
|
||||||
|
self.postMessage(encryptData)
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<div class="miao-directory-container-bottom" :style="{
|
||||||
|
backgroundColor:
|
||||||
|
index % 2 === 1 ? 'rgb(61 61 61)' : 'rgb(162 162 162)'
|
||||||
|
}">
|
||||||
|
<div class="container-bottom-item">
|
||||||
|
<div class="container-bottom-item-icon">
|
||||||
|
<add-outline :style="{
|
||||||
|
color:
|
||||||
|
index % 2 === 0
|
||||||
|
? 'rgb(0 0 0)'
|
||||||
|
: 'rgb(255 255 255)'
|
||||||
|
}" @click="emit('add-new-item')" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-bottom-item">
|
||||||
|
<div class="container-bottom-item-icon">
|
||||||
|
<cloud-upload-outline :style="{
|
||||||
|
color:
|
||||||
|
index % 2 === 0
|
||||||
|
? 'rgb(0 0 0)'
|
||||||
|
: 'rgb(255 255 255)'
|
||||||
|
}" @click="emit('pick-files-upload')" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { AddOutline, CloudUploadOutline } from '@vicons/ionicons5'
|
||||||
|
defineProps<{
|
||||||
|
index: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'add-new-item': []
|
||||||
|
'pick-files-upload': []
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miao-directory-container-bottom {
|
||||||
|
height: 60px;
|
||||||
|
background-color: bisque;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
user-select: none;
|
||||||
|
box-shadow: 0px 1px 10px #888888;
|
||||||
|
z-index: 2;
|
||||||
|
|
||||||
|
.container-bottom-item {
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.container-bottom-item-icon {
|
||||||
|
svg {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
transition: width 0.3s ease;
|
||||||
|
transition: height 0.3s ease;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
svg {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+41
-100
@@ -1,32 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="miao-item" draggable="true" ref="itemRef" @dragstart="handleDragStart">
|
<div class="miao-item" draggable="true" ref="itemRef" @dragstart="handleDragStart">
|
||||||
<miaoContextMenu :options="dropDownOptions" :touch-time-out="500" @select="handleDropdownSelect">
|
<miaoContextMenu :options="dropDownOptions ?? []" :touch-time-out="500" @select="handleDropdownSelect">
|
||||||
<div class="item-main" :class="selected ? 'item-main-selected' : ''" ref="mainRef">
|
<div class="item-main" :class="selected ? 'item-main-selected' : ''" ref="mainRef">
|
||||||
<div class="item-main-front" :style="{ backgroundColor: props.color }"></div>
|
<div class="item-main-front" :style="{ backgroundColor: props.color }"></div>
|
||||||
<Icon class="item-main-icon" v-show="clientWidth > 250"></Icon>
|
<Icon class="item-main-icon" v-show="clientWidth > 250"></Icon>
|
||||||
<div class="item-main-info">
|
<div class="item-main-info">
|
||||||
<div class="item-main-info-name">
|
<div class="item-main-info-name">
|
||||||
<Icon class="item-main-info-name-icon" v-if="clientWidth <= 250"></Icon>
|
<Icon class="item-main-info-name-icon" v-if="clientWidth <= 250"></Icon>
|
||||||
<n-ellipsis style="max-width: 80%;">{{ name }}</n-ellipsis>
|
<n-ellipsis :style="{ maxWidth: clientWidth > 250 ? '80%' : '75%' }">{{ name }}</n-ellipsis>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-main-info-date" v-if="time">
|
<div class="item-main-info-date" v-if="time">
|
||||||
{{ time }}
|
{{ time }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 菜单现在通过右键/长按呼出 -->
|
|
||||||
<!-- <n-dropdown trigger="click" :options="dropDownOptions" @select="handleDropdownSelect">
|
|
||||||
<div class="item-main-option" @click="(e) => e.stopPropagation()">
|
|
||||||
<EllipsisVertical class="item-main-option-icon" />
|
|
||||||
</div>
|
|
||||||
</n-dropdown> -->
|
|
||||||
</div>
|
</div>
|
||||||
</miaoContextMenu>
|
</miaoContextMenu>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
import miaoContextMenu from '@/components/miaoContextMenu.vue'
|
||||||
import miaoContextMenu from '../miaoContextMenu.vue'
|
|
||||||
import {
|
import {
|
||||||
DocumentText,
|
DocumentText,
|
||||||
FileTray,
|
FileTray,
|
||||||
@@ -39,33 +32,37 @@ import {
|
|||||||
PlayCircle,
|
PlayCircle,
|
||||||
Disc
|
Disc
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
import dateFormatter from '@/hooks/dateFormatter'
|
import dateFormatter from '@/hooks/dateFormatter'
|
||||||
import { NEllipsis } from 'naive-ui'
|
import { NEllipsis } from 'naive-ui'
|
||||||
import usePluginCenter from '@/hooks/usePluginCenter'
|
import { DropdownOption } from 'naive-ui/es/dropdown';
|
||||||
// import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
// import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
||||||
|
|
||||||
// const miaoFetchApi = useMiaoFetchApi()
|
// const miaoFetchApi = useMiaoFetchApi()
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
item: VirtualDirectory | VirtualFile
|
item: {
|
||||||
|
name: string,
|
||||||
|
type: 'directory' | 'file'
|
||||||
|
stats: {
|
||||||
|
mtimeMs: number
|
||||||
|
}
|
||||||
|
}
|
||||||
name?: string
|
name?: string
|
||||||
color: string
|
color: string
|
||||||
selectedItem: (VirtualDirectory | VirtualFile)[]
|
dropDownOptions?: DropdownOption[]
|
||||||
|
selected?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
download: []
|
download: []
|
||||||
delete: []
|
delete: []
|
||||||
rename: []
|
rename: []
|
||||||
dragStart: [event: DragEvent, item: VirtualDirectory | VirtualFile]
|
dragStart: [event: DragEvent]
|
||||||
onSelected: []
|
onSelected: []
|
||||||
|
plugin: [plugin: string]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const pluginCenter = usePluginCenter()
|
|
||||||
|
|
||||||
const itemType = ref<'file' | 'directory'>(props.item.type)
|
|
||||||
|
|
||||||
const mainRef = ref<HTMLDivElement>()
|
const mainRef = ref<HTMLDivElement>()
|
||||||
|
|
||||||
// 使用ResizeObserver实现
|
// 使用ResizeObserver实现
|
||||||
@@ -73,9 +70,11 @@ const clientWidth = ref<number>(666)
|
|||||||
|
|
||||||
const name = props.name ?? props.item.name
|
const name = props.name ?? props.item.name
|
||||||
|
|
||||||
const selected = computed(() => {
|
const observer = new ResizeObserver(entries => {
|
||||||
return props.selectedItem.includes(props.item)
|
for (let entry of entries) {
|
||||||
})
|
clientWidth.value = entry.contentRect.width;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const time = computed(() => {
|
const time = computed(() => {
|
||||||
return dateFormatter(
|
return dateFormatter(
|
||||||
@@ -84,60 +83,8 @@ const time = computed(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const dropDownOptions = computed(() => {
|
|
||||||
const items = [...props.selectedItem]
|
|
||||||
if (!selected.value) {
|
|
||||||
items.push(props.item)
|
|
||||||
}
|
|
||||||
const vDirs = items.filter(v => v.type === 'directory')
|
|
||||||
const vFiles = items.filter(v => v.type === 'file')
|
|
||||||
const options = [
|
|
||||||
{
|
|
||||||
label: '重命名',
|
|
||||||
key: 'rename'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
key: 'delete'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
if (itemType.value === 'file') {
|
|
||||||
options.push(
|
|
||||||
...[
|
|
||||||
{
|
|
||||||
label: '下载',
|
|
||||||
key: 'download'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (selected.value === false) {
|
|
||||||
options.push(
|
|
||||||
...[
|
|
||||||
{
|
|
||||||
label: '多选:选择',
|
|
||||||
key: 'select'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
options.push(
|
|
||||||
...[
|
|
||||||
{
|
|
||||||
label: '多选:取消',
|
|
||||||
key: 'select'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
options.push(...pluginCenter.getUsablePlugin(vDirs, vFiles).map(v => ({
|
|
||||||
label: `插件:${v.name}`,
|
|
||||||
key: `plugin:${v.key}`
|
|
||||||
})))
|
|
||||||
return options
|
|
||||||
})
|
|
||||||
|
|
||||||
// 是不是可以直接在这里面实现?
|
// 是不是可以直接在这里面实现?
|
||||||
|
// 应该将所有事件emit出去才对
|
||||||
const handleDropdownSelect = (key: string) => {
|
const handleDropdownSelect = (key: string) => {
|
||||||
if (key === 'rename') {
|
if (key === 'rename') {
|
||||||
emit('rename')
|
emit('rename')
|
||||||
@@ -148,14 +95,8 @@ const handleDropdownSelect = (key: string) => {
|
|||||||
} else if (key === 'select') {
|
} else if (key === 'select') {
|
||||||
emit('onSelected')
|
emit('onSelected')
|
||||||
} else if (key.startsWith('plugin:')) {
|
} else if (key.startsWith('plugin:')) {
|
||||||
const items = [...props.selectedItem]
|
|
||||||
if (!selected.value) {
|
|
||||||
items.push(props.item)
|
|
||||||
}
|
|
||||||
const vDirs = items.filter(v => v.type === 'directory')
|
|
||||||
const vFiles = items.filter(v => v.type === 'file')
|
|
||||||
const plugin = key.split(':')[1]
|
const plugin = key.split(':')[1]
|
||||||
pluginCenter.usePlugin(plugin, vDirs, vFiles)
|
emit('plugin', plugin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,22 +118,22 @@ const Icon = computed(() => {
|
|||||||
return Disc
|
return Disc
|
||||||
} else if (
|
} else if (
|
||||||
[
|
[
|
||||||
'.xbm',
|
'xbm',
|
||||||
'.tif',
|
'tif',
|
||||||
'pjp',
|
'pjp',
|
||||||
'.svgz',
|
'svgz',
|
||||||
'jpg',
|
'jpg',
|
||||||
'jpeg',
|
'jpeg',
|
||||||
'ico',
|
'ico',
|
||||||
'tiff',
|
'tiff',
|
||||||
'.gif',
|
'gif',
|
||||||
'svg',
|
'svg',
|
||||||
'.jfif',
|
'jfif',
|
||||||
'.webp',
|
'webp',
|
||||||
'.png',
|
'png',
|
||||||
'.bmp',
|
'bmp',
|
||||||
'pjpeg',
|
'pjpeg',
|
||||||
'.avif'
|
'avif'
|
||||||
].includes(aft)
|
].includes(aft)
|
||||||
) {
|
) {
|
||||||
return Image
|
return Image
|
||||||
@@ -217,27 +158,28 @@ const Icon = computed(() => {
|
|||||||
const itemRef = ref()
|
const itemRef = ref()
|
||||||
|
|
||||||
const handleDragStart = (event: DragEvent) => {
|
const handleDragStart = (event: DragEvent) => {
|
||||||
emit('dragStart', event, props.item)
|
emit('dragStart', event)
|
||||||
// dataBus.set('dragData', [props.item])
|
// dataBus.set('dragData', [props.item])
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const observer = new ResizeObserver(entries => {
|
|
||||||
for (let entry of entries) {
|
|
||||||
clientWidth.value = entry.contentRect.width;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (mainRef.value) {
|
if (mainRef.value) {
|
||||||
observer.observe(mainRef.value);
|
observer.observe(mainRef.value);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (mainRef.value) {
|
||||||
|
observer.unobserve(mainRef.value);
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.miao-item {
|
.miao-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
min-width: 170px;
|
// min-width: 170px;
|
||||||
// aspect-ratio: 66/9;
|
// aspect-ratio: 66/9;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -249,7 +191,6 @@ onMounted(() => {
|
|||||||
.item-main {
|
.item-main {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 200px;
|
|
||||||
height: 95%;
|
height: 95%;
|
||||||
background-color: rgb(255, 255, 255);
|
background-color: rgb(255, 255, 255);
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
@@ -276,7 +217,7 @@ onMounted(() => {
|
|||||||
.item-main-info {
|
.item-main-info {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: calc( 100% - 10px );
|
width: calc(100% - 10px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="miao-directory-container-items"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)'
|
||||||
|
}">
|
||||||
|
<n-scrollbar ref="scrollbarRef" style="max-height: 100%">
|
||||||
|
<miao-lazy-div
|
||||||
|
v-for="dir in showData_directory"
|
||||||
|
:key="dir.id"
|
||||||
|
min-height="50px">
|
||||||
|
<miaoDirectoryItem
|
||||||
|
:item="dir"
|
||||||
|
:color="props.color"
|
||||||
|
:selected="selectedItem.includes(dir)"
|
||||||
|
:drop-down-options="itemDropDownOptions(dir).value"
|
||||||
|
@delete="handleItemDelete(dir)"
|
||||||
|
@plugin="(p) => handleItemUsePlugin(dir)(p)"
|
||||||
|
@click="handleItemClick(dir)"
|
||||||
|
@drag-start="(e) => handleItemDragStart(dir)(e)"
|
||||||
|
@rename="handleItemRename(dir)"
|
||||||
|
@on-selected="handleItemSelect(dir)" />
|
||||||
|
</miao-lazy-div>
|
||||||
|
<miao-lazy-div
|
||||||
|
v-for="file in showData_files"
|
||||||
|
:key="file.id"
|
||||||
|
min-height="50px">
|
||||||
|
<miaoDirectoryItem
|
||||||
|
:item="file"
|
||||||
|
:color="props.color"
|
||||||
|
:selected="selectedItem.includes(file)"
|
||||||
|
:drop-down-options="itemDropDownOptions(file).value"
|
||||||
|
@click="handleItemClick(file)"
|
||||||
|
@download="handleItemDownload(file)"
|
||||||
|
@delete="handleItemDelete(file)"
|
||||||
|
@drag-start="(e) => handleItemDragStart(file)(e)"
|
||||||
|
@rename="handleItemRename(file)"
|
||||||
|
@plugin="(p) => handleItemUsePlugin(file)(p)"
|
||||||
|
@on-selected="handleItemSelect(file)" />
|
||||||
|
</miao-lazy-div>
|
||||||
|
</n-scrollbar>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { NScrollbar } from 'naive-ui'
|
||||||
|
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import miaoDirectoryItem from './miaoDirectoryItem.vue'
|
||||||
|
import miaoLazyDiv from '@/components/miaoLazyDiv.vue'
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import usePluginCenter from '@/hooks/usePluginCenter'
|
||||||
|
import { renderIcon } from '@/hooks/miaoTools'
|
||||||
|
|
||||||
|
const pluginCenter = usePluginCenter()
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
color: string
|
||||||
|
index: number
|
||||||
|
showData_directory: VirtualDirectory[]
|
||||||
|
showData_files: VirtualFile[]
|
||||||
|
selectedItem: (VirtualFile | VirtualDirectory)[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'item-click': [item: VirtualDirectory | VirtualFile]
|
||||||
|
'item-download': [item: VirtualFile]
|
||||||
|
'item-delete': [item: VirtualDirectory | VirtualFile]
|
||||||
|
'item-drag-start': [_event: DragEvent, item: VirtualDirectory | VirtualFile]
|
||||||
|
'item-rename': [item: VirtualDirectory | VirtualFile]
|
||||||
|
'item-select': [item: VirtualDirectory | VirtualFile]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const scrollbarRef = ref()
|
||||||
|
|
||||||
|
const itemDropDownOptions = (item: VirtualDirectory | VirtualFile) =>
|
||||||
|
computed(() => {
|
||||||
|
const items = [...props.selectedItem]
|
||||||
|
const selected = props.selectedItem.includes(item)
|
||||||
|
if (!selected) {
|
||||||
|
items.push(item)
|
||||||
|
}
|
||||||
|
const vDirs = items.filter((v) => v.type === 'directory')
|
||||||
|
const vFiles = items.filter((v) => v.type === 'file')
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
label: '重命名',
|
||||||
|
key: 'rename'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
key: 'delete'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
if (item.type === 'file') {
|
||||||
|
options.push(
|
||||||
|
...[
|
||||||
|
{
|
||||||
|
label: '下载',
|
||||||
|
key: 'download'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (selected === false) {
|
||||||
|
options.push(
|
||||||
|
...[
|
||||||
|
{
|
||||||
|
label: '多选:选择',
|
||||||
|
key: 'select'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
options.push(
|
||||||
|
...[
|
||||||
|
{
|
||||||
|
label: '多选:取消',
|
||||||
|
key: 'select'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
options.push(
|
||||||
|
...pluginCenter.getUsablePlugin(vDirs, vFiles).map((v) => ({
|
||||||
|
label: `插件:${v.name}`,
|
||||||
|
key: `plugin:${v.key}`,
|
||||||
|
icon: v.icon ? renderIcon(v.icon) : undefined
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
return options
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleItemClick = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
emit('item-click', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDownload = (item: VirtualFile) => {
|
||||||
|
emit('item-download', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDelete = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
emit('item-delete', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDragStart =
|
||||||
|
(item: VirtualDirectory | VirtualFile) => (_event: DragEvent) => {
|
||||||
|
emit('item-drag-start', _event, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemRename = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
emit('item-rename', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemSelect = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
emit('item-select', item)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemUsePlugin =
|
||||||
|
(item: VirtualDirectory | VirtualFile) => (plugin: string) => {
|
||||||
|
const items = [...props.selectedItem]
|
||||||
|
const selected = props.selectedItem.includes(item)
|
||||||
|
if (!selected) {
|
||||||
|
items.push(item)
|
||||||
|
}
|
||||||
|
const vDirs = items.filter((v) => v.type === 'directory')
|
||||||
|
const vFiles = items.filter((v) => v.type === 'file')
|
||||||
|
pluginCenter.usePlugin(plugin, vDirs, vFiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
scrollTo: (...args: any) => scrollbarRef.value.scrollTo(...args)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miao-directory-container-items {
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<template>
|
||||||
|
<div class="miao-directory-container-top" :style="{
|
||||||
|
backgroundColor:
|
||||||
|
index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)'
|
||||||
|
}">
|
||||||
|
<div class="container-top-colorfulBar" :style="{ backgroundColor: props.color }"></div>
|
||||||
|
<div class="container-top-breadcrumb">
|
||||||
|
<div class="container-top-breadcrumb-container">
|
||||||
|
<n-breadcrumb separator=">" style="margin-left: 5px">
|
||||||
|
<n-breadcrumb-item :clickable="false">
|
||||||
|
<n-icon size="18">
|
||||||
|
<CloudOutline />
|
||||||
|
</n-icon>
|
||||||
|
</n-breadcrumb-item>
|
||||||
|
<n-breadcrumb-item v-for="dir in currentDirectory?.getParents"
|
||||||
|
@click="handleClickBreadcrumbItem(dir)" :clickable="true">
|
||||||
|
<div>{{ dir.name }}</div>
|
||||||
|
</n-breadcrumb-item>
|
||||||
|
</n-breadcrumb>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-top-tools">
|
||||||
|
<n-icon class="container-top-tools-item" size="15" @click="$emit('back')">
|
||||||
|
<ChevronBackOutline />
|
||||||
|
</n-icon>
|
||||||
|
<n-icon class="container-top-tools-item" size="14" @click="$emit('reload')">
|
||||||
|
<ReloadOutline class="container-top-tools-item-reload" />
|
||||||
|
</n-icon>
|
||||||
|
<n-dropdown trigger="click" :options="openMenuOption" @select="(key: string) => emit('menuSelect', key)">
|
||||||
|
<n-icon class="container-top-tools-item" size="14">
|
||||||
|
<EllipsisVertical />
|
||||||
|
</n-icon>
|
||||||
|
</n-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { NBreadcrumbItem, NBreadcrumb, NIcon, NDropdown } from 'naive-ui'
|
||||||
|
import {
|
||||||
|
CloudOutline,
|
||||||
|
ChevronBackOutline,
|
||||||
|
ReloadOutline,
|
||||||
|
EllipsisVertical,
|
||||||
|
} from '@vicons/ionicons5'
|
||||||
|
import VirtualDirectory from '@/class/VirtualDirectory'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
color: string;
|
||||||
|
index: number
|
||||||
|
currentDirectory: VirtualDirectory | undefined;
|
||||||
|
openMenuOption: {
|
||||||
|
key: string,
|
||||||
|
label: string,
|
||||||
|
[key: string]: any,
|
||||||
|
}[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
back: [],
|
||||||
|
reload: [],
|
||||||
|
menuSelect: [key: string]
|
||||||
|
'set-current-directory': [virtualDirectory: VirtualDirectory]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const handleClickBreadcrumbItem = (virtualDirectory: VirtualDirectory) => {
|
||||||
|
emit('set-current-directory', virtualDirectory)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miao-directory-container-top {
|
||||||
|
height: 30px;
|
||||||
|
width: 100%;
|
||||||
|
user-select: none;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
|
||||||
|
.container-top-colorfulBar {
|
||||||
|
height: 70%;
|
||||||
|
width: 5px;
|
||||||
|
margin-left: 10px;
|
||||||
|
border-radius: 3px 0 0 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-top-breadcrumb {
|
||||||
|
position: relative;
|
||||||
|
height: 70%;
|
||||||
|
width: calc(100% - 95px);
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
// overflow: hidden;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: hidden;
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 0 5px;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
|
||||||
|
.container-top-breadcrumb-container {
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
min-width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-top-tools {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
// width: 70px;
|
||||||
|
padding: 0 5px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.container-top-tools-item {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin: 0 1px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #ffffff00;
|
||||||
|
border-radius: 5px;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.container-top-tools-item-reload {
|
||||||
|
transition: transform 0.6s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(128, 128, 128, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active .container-top-tools-item-reload {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import FileTray from '@vicons/ionicons5/es/FileTray'
|
||||||
|
// import MiaoDirectory from '@/plugins/miaoDirectory/miaoDirectory.vue'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoDirectory',
|
||||||
|
name: '文件夹',
|
||||||
|
icon: FileTray,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoDirectory/miaoDirectory.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vFiles.length) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vDirs.length === 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -0,0 +1,641 @@
|
|||||||
|
<template>
|
||||||
|
<miao-drop-handler @on-virtual-directory="handleDropVDirectory" @on-files="handleDropFiles"
|
||||||
|
@on-virtual-files="handleDropVirtualFiles">
|
||||||
|
<div class="miao-directory-item-container" ref="rootDomRef">
|
||||||
|
<!-- 顶部面包屑导航和工具栏 -->
|
||||||
|
<miao-directory-top :color="props.color" :current-directory="currentDirectory" @back="handleBack"
|
||||||
|
:open-menu-option="topBarMenuOption" @reload="handleReload" @exit="emit('exit')" :index="index"
|
||||||
|
@set-current-directory="setCurrentDirectory" @search="handleSearch"
|
||||||
|
@menu-select="handleTopBarMenuSelect" />
|
||||||
|
|
||||||
|
<!-- 文件和文件夹列表 -->
|
||||||
|
<miao-directory-items ref="miaoDirectoryItemRef" :color="props.color"
|
||||||
|
:showData_directory="showData_directory" :showData_files="showData_files"
|
||||||
|
:selected-item="selectedItem.value" :index="index" @item-click="handleItemClick"
|
||||||
|
@item-download="handleItemDownload" @item-delete="handleItemDelete"
|
||||||
|
@item-drag-start="handleItemDragStart" @item-rename="handleItemRename"
|
||||||
|
@item-select="handleItemSelect" />
|
||||||
|
|
||||||
|
<!-- 底部工具栏 -->
|
||||||
|
<miao-directory-bottom :index="index" @add-new-item="handleAddNewItem" v-if="false"
|
||||||
|
@pick-files-upload="handlePickFilesUpload" />
|
||||||
|
|
||||||
|
<miao-mask v-model:show="showModel"></miao-mask>
|
||||||
|
<miao-popup-input ref="popupInput"></miao-popup-input>
|
||||||
|
</div>
|
||||||
|
</miao-drop-handler>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
||||||
|
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import Config from '@/config'
|
||||||
|
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
||||||
|
import useDataBus from '@/hooks/useDataBus'
|
||||||
|
import useUploadQueue from '@/hooks/useUploadQueue'
|
||||||
|
import useVirtualPages from '@/hooks/useVirtualPages'
|
||||||
|
import { filePicker, renderIcon } from '@/hooks/miaoTools'
|
||||||
|
import { uniq } from 'lodash'
|
||||||
|
|
||||||
|
// 导入子组件
|
||||||
|
import miaoDirectoryTop from './components/miaoDirectoryTop.vue'
|
||||||
|
import MiaoDirectoryItems from './components/miaoDirectoryItemsContainer.vue'
|
||||||
|
import MiaoDirectoryBottom from './components/miaoDirectoryBottom.vue'
|
||||||
|
import MiaoMask from '@/components/miaoMask.vue'
|
||||||
|
import MiaoPopupInput from '@/components/miaoPopupInput.vue'
|
||||||
|
import MiaoDropHandler from '@/components/miaoDropHandler.vue'
|
||||||
|
import {
|
||||||
|
CloseOutline,
|
||||||
|
SearchOutline,
|
||||||
|
FilterOutline,
|
||||||
|
CheckmarkDoneOutline,
|
||||||
|
DocumentText,
|
||||||
|
ExtensionPuzzleOutline,
|
||||||
|
FileTray,
|
||||||
|
AddOutline,
|
||||||
|
CloudUploadOutline
|
||||||
|
} from '@vicons/ionicons5'
|
||||||
|
import usePluginCenter from '@/hooks/usePluginCenter'
|
||||||
|
|
||||||
|
const { baseUrl, api } = Config
|
||||||
|
const dataBus = useDataBus()
|
||||||
|
const views = useVirtualPages()
|
||||||
|
const uploadQueue = useUploadQueue()
|
||||||
|
const miaoFetchApi = useMiaoFetchApi()
|
||||||
|
const pluginCenter = usePluginCenter()
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
color: string
|
||||||
|
id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
exit: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const popupInput = ref<InstanceType<typeof MiaoPopupInput>>()
|
||||||
|
// 是否显示模态框
|
||||||
|
const showModel = ref(0)
|
||||||
|
const searchText = ref<string>('')
|
||||||
|
const showDirs = ref<boolean>(true)
|
||||||
|
const showFiles = ref<boolean>(true)
|
||||||
|
const miaoDirectoryItemRef = ref()
|
||||||
|
|
||||||
|
class SelectedItem {
|
||||||
|
constructor() {
|
||||||
|
this._selectedItem = []
|
||||||
|
}
|
||||||
|
_selectedItem: (VirtualDirectory | VirtualFile)[]
|
||||||
|
push(item: VirtualDirectory | VirtualFile) {
|
||||||
|
this._selectedItem = uniq([item, ...this._selectedItem])
|
||||||
|
}
|
||||||
|
pushArray(items: (VirtualDirectory | VirtualFile)[]) {
|
||||||
|
this._selectedItem = uniq([...items, ...this._selectedItem])
|
||||||
|
}
|
||||||
|
remove(item: VirtualDirectory | VirtualFile) {
|
||||||
|
this._selectedItem = this._selectedItem.filter((v) => v !== item)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 仅保留filter为true的元素, filter默认为()=>false
|
||||||
|
*/
|
||||||
|
clear(filter?: (item: VirtualDirectory | VirtualFile) => boolean) {
|
||||||
|
filter || (filter = (__) => false)
|
||||||
|
this._selectedItem = this.value.filter(filter)
|
||||||
|
}
|
||||||
|
// 保证内容仍然存在于dir中且各个元素不重复
|
||||||
|
get value() {
|
||||||
|
const _filterList = [
|
||||||
|
...(currentDirectory.value?.directories ?? []),
|
||||||
|
...(currentDirectory.value?.files ?? [])
|
||||||
|
]
|
||||||
|
return uniq(this._selectedItem).filter((v) => {
|
||||||
|
if (currentDirectory.value === undefined) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// @ts-ignore
|
||||||
|
return _filterList.includes(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 已选择的item,用于多选功能
|
||||||
|
const selectedItem = reactive(new SelectedItem())
|
||||||
|
|
||||||
|
const currentDirectories = defineModel<VirtualDirectory[]>(
|
||||||
|
'currentDirectories',
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 目前展示的Dir
|
||||||
|
const currentDirectory = computed(() => {
|
||||||
|
return currentDirectories.value[0]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 当前组件在views中的序号
|
||||||
|
const index = computed(() => {
|
||||||
|
return views.getIndex(props.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 用于展示的数据,后续会增加排序等操作
|
||||||
|
const showData_directory = computed<VirtualDirectory[]>(() => {
|
||||||
|
if (showDirs.value === false) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
let data = currentDirectory.value?.directories
|
||||||
|
? [...currentDirectory.value?.directories]
|
||||||
|
: []
|
||||||
|
if (searchText.value !== '') {
|
||||||
|
data = data.filter((vd) => vd.name.includes(searchText.value))
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
const showData_files = computed<VirtualFile[]>(() => {
|
||||||
|
if (showFiles.value === false) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
let data = currentDirectory.value?.files
|
||||||
|
? [...currentDirectory.value?.files]
|
||||||
|
: []
|
||||||
|
if (searchText.value !== '') {
|
||||||
|
data = data.filter((vd) => vd.name.includes(searchText.value))
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
|
||||||
|
const topBarMenuOption = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '新建',
|
||||||
|
key: 'create',
|
||||||
|
icon: renderIcon(AddOutline)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '上传',
|
||||||
|
key: 'upload',
|
||||||
|
icon: renderIcon(CloudUploadOutline)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '搜索',
|
||||||
|
key: 'search',
|
||||||
|
icon: renderIcon(SearchOutline)
|
||||||
|
},
|
||||||
|
searchText.value !== ''
|
||||||
|
? {
|
||||||
|
label: '重置搜索',
|
||||||
|
key: 'searchReset',
|
||||||
|
icon: renderIcon(SearchOutline)
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
// selectedItem.value.length !== 0
|
||||||
|
// ? {
|
||||||
|
// label: '重置多选',
|
||||||
|
// key: 'selectedItemReset',
|
||||||
|
// icon: renderIcon(CheckmarkDoneOutline)
|
||||||
|
// }
|
||||||
|
// : undefined,
|
||||||
|
{
|
||||||
|
label: '筛选',
|
||||||
|
key: 'filter',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: `${showDirs.value ? '隐藏' : '显示'}文件夹`,
|
||||||
|
key: 'showDirs',
|
||||||
|
icon: renderIcon(FileTray)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `${showFiles.value ? '隐藏' : '显示'}文件`,
|
||||||
|
key: 'showFiles',
|
||||||
|
icon: renderIcon(DocumentText)
|
||||||
|
}
|
||||||
|
],
|
||||||
|
icon: renderIcon(FilterOutline)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '多选',
|
||||||
|
key: 'multiSelect',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: `全选`,
|
||||||
|
key: 'multiSelect:all'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `全不选`,
|
||||||
|
key: 'multiSelect:reset'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `反选`,
|
||||||
|
key: 'multiSelect:inversion'
|
||||||
|
},
|
||||||
|
selectedItem.value.length === 2 ?
|
||||||
|
{
|
||||||
|
label: `区间内全选`,
|
||||||
|
key: 'multiSelect:range'
|
||||||
|
} : undefined
|
||||||
|
].filter((v) => v !== undefined),
|
||||||
|
icon: renderIcon(CheckmarkDoneOutline),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '插件',
|
||||||
|
key: 'plugin',
|
||||||
|
children: [
|
||||||
|
...pluginCenter
|
||||||
|
.getUsablePlugin([currentDirectories.value[0]], [])
|
||||||
|
.map((v) => ({
|
||||||
|
label: `${v.name}`,
|
||||||
|
key: `plugin:${v.key}`,
|
||||||
|
icon: v.icon ? renderIcon(v.icon) : undefined
|
||||||
|
}))
|
||||||
|
],
|
||||||
|
icon: renderIcon(ExtensionPuzzleOutline)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '关闭',
|
||||||
|
key: 'close',
|
||||||
|
icon: renderIcon(CloseOutline)
|
||||||
|
}
|
||||||
|
].filter((v) => v !== undefined)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 设置显示的dir
|
||||||
|
const setCurrentDirectory = async (virtualDirectory: VirtualDirectory) => {
|
||||||
|
// 若没有缓存数据则同步刷新,有缓存数据则异步刷新
|
||||||
|
if (
|
||||||
|
virtualDirectory.files === undefined ||
|
||||||
|
virtualDirectory.directories === undefined
|
||||||
|
) {
|
||||||
|
await virtualDirectory.update()
|
||||||
|
} else {
|
||||||
|
virtualDirectory.update()
|
||||||
|
}
|
||||||
|
if (currentDirectories.value[0] !== virtualDirectory) {
|
||||||
|
selectedItem.clear()
|
||||||
|
handleSearchReset()
|
||||||
|
nextTick(() => {
|
||||||
|
miaoDirectoryItemRef.value.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'instant'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
currentDirectories.value[0] = virtualDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
setCurrentDirectory(currentDirectory.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const openUrl = (
|
||||||
|
href: string,
|
||||||
|
config?: {
|
||||||
|
download?: string
|
||||||
|
target?: string
|
||||||
|
}
|
||||||
|
) => {
|
||||||
|
let { target, download } = config ?? {}
|
||||||
|
const a = document.createElement('a')
|
||||||
|
a.setAttribute('href', href)
|
||||||
|
a.setAttribute('target', target ?? '_blank')
|
||||||
|
download && a.setAttribute('download', download)
|
||||||
|
a.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleTopBarMenuSelect = (key: string) => {
|
||||||
|
if (key === 'close') {
|
||||||
|
emit('exit')
|
||||||
|
} else if (key === 'search') {
|
||||||
|
handleSearch()
|
||||||
|
} else if (key === 'upload') {
|
||||||
|
handlePickFilesUpload()
|
||||||
|
} else if (key === 'create') {
|
||||||
|
handleAddNewItem()
|
||||||
|
} else if (key === 'searchReset') {
|
||||||
|
handleSearchReset()
|
||||||
|
// } else if (key === 'selectedItemReset') {
|
||||||
|
// selectedItem.clear()
|
||||||
|
} else if (key === 'showDirs') {
|
||||||
|
showDirs.value = !showDirs.value
|
||||||
|
showDirs.value === false && selectedItem.clear(v => v.type !== 'directory')
|
||||||
|
} else if (key === 'showFiles') {
|
||||||
|
showFiles.value = !showFiles.value
|
||||||
|
showFiles.value === false && selectedItem.clear(v => v.type !== 'file')
|
||||||
|
} else if (key.startsWith('plugin:')) {
|
||||||
|
const pluginName = key.split(':')[1]
|
||||||
|
pluginCenter.usePlugin(pluginName, [currentDirectory.value], [])
|
||||||
|
} else if (key.startsWith('multiSelect:')) {
|
||||||
|
const opName = key.split(':')[1]
|
||||||
|
switch (opName) {
|
||||||
|
case 'all':
|
||||||
|
selectedItem.pushArray([...showData_directory.value, ...showData_files.value])
|
||||||
|
break;
|
||||||
|
case 'reset':
|
||||||
|
selectedItem.clear()
|
||||||
|
break
|
||||||
|
case 'inversion':
|
||||||
|
const sArr = selectedItem.value
|
||||||
|
const arr = [...showData_directory.value, ...showData_files.value].filter(i => !sArr.includes(i))
|
||||||
|
selectedItem.clear()
|
||||||
|
selectedItem.pushArray(arr)
|
||||||
|
break
|
||||||
|
case "range":
|
||||||
|
const _sArr = selectedItem.value
|
||||||
|
const _arr = [...showData_directory.value, ...showData_files.value]
|
||||||
|
const _nArr = []
|
||||||
|
let _counter = 0
|
||||||
|
for (const i of _arr) {
|
||||||
|
if (_sArr.includes(i)) {
|
||||||
|
_counter++
|
||||||
|
}
|
||||||
|
if (_counter === 1) {
|
||||||
|
_nArr.push(i)
|
||||||
|
} else if (_counter === 2) {
|
||||||
|
_nArr.push(i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selectedItem.clear()
|
||||||
|
selectedItem.pushArray(_nArr)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleBack = () => {
|
||||||
|
if (currentDirectory.value?.parent) {
|
||||||
|
setCurrentDirectory(currentDirectory.value.parent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReload = () => {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemClick = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
if (selectedItem.value.length > 0) {
|
||||||
|
handleItemSelect(item)
|
||||||
|
} else {
|
||||||
|
if (item.type === 'file') {
|
||||||
|
openUrl(`${baseUrl}${api.get}${item.path}`)
|
||||||
|
} else if (item.type === 'directory') {
|
||||||
|
setCurrentDirectory(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDownload = (item: VirtualFile) => {
|
||||||
|
openUrl(`${baseUrl}${api.get}${item.path}`, {
|
||||||
|
download: item.name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDelete = async (_item: VirtualDirectory | VirtualFile) => {
|
||||||
|
for (let item of uniq([...selectedItem.value, _item])) {
|
||||||
|
; (async () => {
|
||||||
|
const { response } = miaoFetchApi.delete(item, {
|
||||||
|
retry: 5
|
||||||
|
})
|
||||||
|
// todo: 将删除事件统一用一个事件管理中心管理
|
||||||
|
const id = (await response).eventId
|
||||||
|
const { response: res } = miaoFetchApi.query(id)
|
||||||
|
const eventResult = await res
|
||||||
|
if (eventResult.status === 'success') {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemRename = async (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
const popupRes = await popupInput.value?.popup({
|
||||||
|
title: '重命名',
|
||||||
|
inputValue: item.name,
|
||||||
|
inputProps: {
|
||||||
|
placeholder: item.name
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '取消',
|
||||||
|
key: false,
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '确认',
|
||||||
|
key: true,
|
||||||
|
type: 'success'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
if (popupRes?.key === false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const newName = popupRes?.text
|
||||||
|
if (!newName) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const { response } = miaoFetchApi.rename(item, newName, {
|
||||||
|
retry: 5
|
||||||
|
})
|
||||||
|
const id = (await response).eventId
|
||||||
|
const { response: res } = miaoFetchApi.query(id)
|
||||||
|
const eventResult = await res
|
||||||
|
if (eventResult.status === 'success') {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemDragStart = async (
|
||||||
|
_event: DragEvent,
|
||||||
|
item: VirtualDirectory | VirtualFile
|
||||||
|
) => {
|
||||||
|
const items = uniq([item, ...selectedItem.value])
|
||||||
|
dataBus.set(
|
||||||
|
'dragData_vFiles',
|
||||||
|
items.filter((v) => v.type === 'file')
|
||||||
|
)
|
||||||
|
dataBus.set(
|
||||||
|
'dragData_vDirectory',
|
||||||
|
items.filter((v) => v.type === 'directory')
|
||||||
|
)
|
||||||
|
// selectedItem.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDropFiles = async (files: File[]) => {
|
||||||
|
currentDirectory.value &&
|
||||||
|
uploadQueue.push(files, currentDirectory.value, {
|
||||||
|
onFinish() {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDropVDirectory = async (vDirs: VirtualDirectory[]) => {
|
||||||
|
// 不能移到自己或自己的子文件夹内
|
||||||
|
for (let vDir of vDirs) {
|
||||||
|
if (currentDirectory.value.getParents.includes(vDir)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (vDir.parent === currentDirectory.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let dir of vDirs) {
|
||||||
|
; (async () => {
|
||||||
|
const _from = dir.parent
|
||||||
|
const { response } = miaoFetchApi.cut(dir, currentDirectory.value)
|
||||||
|
const id = (await response).eventId
|
||||||
|
const { response: res } = miaoFetchApi.query(id)
|
||||||
|
const eventResult = await res
|
||||||
|
if (eventResult.status === 'success') {
|
||||||
|
reload()
|
||||||
|
_from && _from.update()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDropVirtualFiles = (files: VirtualFile[]) => {
|
||||||
|
if (files[0].parent === currentDirectory.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let file of files) {
|
||||||
|
; (async () => {
|
||||||
|
const _from = file.parent
|
||||||
|
const { response } = miaoFetchApi.cut(file, currentDirectory.value)
|
||||||
|
const id = (await response).eventId
|
||||||
|
const { response: res } = miaoFetchApi.query(id)
|
||||||
|
const eventResult = await res
|
||||||
|
if (eventResult.status === 'success') {
|
||||||
|
reload()
|
||||||
|
_from.update()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePickFilesUpload = async () => {
|
||||||
|
const files = await filePicker({
|
||||||
|
multiple: true
|
||||||
|
})
|
||||||
|
const _currDir = currentDirectory.value
|
||||||
|
uploadQueue.push(files, _currDir, {
|
||||||
|
onFinish() {
|
||||||
|
_currDir.update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAddNewItem = async () => {
|
||||||
|
const popupRes = await popupInput.value?.popup({
|
||||||
|
title: '新建文件/文件夹',
|
||||||
|
inputProps: {
|
||||||
|
placeholder: ''
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '取消',
|
||||||
|
key: 'cancel',
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '文件',
|
||||||
|
key: 'file',
|
||||||
|
type: 'success'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '文件夹',
|
||||||
|
key: 'dir',
|
||||||
|
type: 'success'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
// todo: 上传前如重名文件夹等等的错误提前检查
|
||||||
|
if (popupRes?.key === 'cancel' || popupRes?.text === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const _currDir = currentDirectory.value
|
||||||
|
const name = popupRes?.text
|
||||||
|
if (!name) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// @ts-ignore
|
||||||
|
const opType: 'file' | 'dir' = popupRes?.key
|
||||||
|
if (opType === 'dir') {
|
||||||
|
const res = await miaoFetchApi.mkdir(currentDirectory.value, name)
|
||||||
|
if (res.message === 'success') {
|
||||||
|
_currDir.update()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const { response } = miaoFetchApi.mkFile(currentDirectory.value, name)
|
||||||
|
const res = await response
|
||||||
|
if (res.message === 'success') {
|
||||||
|
_currDir.update()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleItemSelect = (item: VirtualDirectory | VirtualFile) => {
|
||||||
|
if (!selectedItem.value.includes(item)) {
|
||||||
|
selectedItem.push(item)
|
||||||
|
} else {
|
||||||
|
selectedItem.remove(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearch = async () => {
|
||||||
|
const popupRes = await popupInput.value?.popup({
|
||||||
|
title: '搜索当前文件夹',
|
||||||
|
inputValue: searchText.value,
|
||||||
|
inputProps: {
|
||||||
|
placeholder: ''
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '取消',
|
||||||
|
key: 'cancel',
|
||||||
|
type: 'default'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '重置',
|
||||||
|
key: 'reset',
|
||||||
|
type: 'default'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '搜索',
|
||||||
|
key: 'search',
|
||||||
|
type: 'success'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
if (!popupRes) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (popupRes.key === 'search') {
|
||||||
|
searchText.value = popupRes.text
|
||||||
|
} else if (popupRes.key === 'reset') {
|
||||||
|
handleSearchReset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearchReset = () => {
|
||||||
|
searchText.value = ''
|
||||||
|
}
|
||||||
|
onMounted(async () => {
|
||||||
|
await setCurrentDirectory(currentDirectory.value)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
$top-height: 30px;
|
||||||
|
$bottom-bar-height: 60px;
|
||||||
|
|
||||||
|
.miao-directory-item-container {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
width: inherit;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 170px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import LogoChrome from '@vicons/ionicons5/es/LogoChrome'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoIframe',
|
||||||
|
name: '框架',
|
||||||
|
icon: LogoChrome,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoIframe/miaoIframe.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vFiles[0].name.endsWith('html')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="iframe-container">
|
<div class="miao-markdown-container-miaomiaomiao">
|
||||||
<iframe
|
<iframe
|
||||||
:src="iframeSrc"
|
:src="iframeSrc"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
@@ -23,7 +23,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.iframe-container {
|
.miao-markdown-container-miaomiaomiao {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.iframe-container-iframe {
|
.iframe-container-iframe {
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import { Image } from '@vicons/ionicons5'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoImages',
|
||||||
|
name: '图片浏览',
|
||||||
|
icon: Image,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoImages/miaoImages.vue')).default,
|
||||||
|
filter: (vDirs: VirtualDirectory[], vFiles: VirtualFile[]) => {
|
||||||
|
if (vDirs.length === 0 && vFiles.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vDirs.length) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for (let vf of vFiles)
|
||||||
|
for (let end of [
|
||||||
|
'xbm',
|
||||||
|
'tif',
|
||||||
|
'pjp',
|
||||||
|
'svgz',
|
||||||
|
'jpg',
|
||||||
|
'jpeg',
|
||||||
|
'ico',
|
||||||
|
'tiff',
|
||||||
|
'gif',
|
||||||
|
'svg',
|
||||||
|
'jfif',
|
||||||
|
'webp',
|
||||||
|
'png',
|
||||||
|
'.bmp',
|
||||||
|
'pjpeg',
|
||||||
|
'avif'
|
||||||
|
]) {
|
||||||
|
if (vf.name.endsWith(end)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
<template>
|
||||||
|
<miao-drop-handler
|
||||||
|
@on-virtual-directory="handleDrop"
|
||||||
|
@on-virtual-files="handleDrop">
|
||||||
|
<miao-message-provider ref="miaoMessageRef">
|
||||||
|
<div class="miaoImage" ref="rootRef">
|
||||||
|
<n-scrollbar ref="NScrollbarRef" style="max-height: 100%;">
|
||||||
|
<div
|
||||||
|
class="miaoImage-container"
|
||||||
|
v-for="imageGroup in imageGroupList">
|
||||||
|
<div class="miaoImage-container-day">
|
||||||
|
<!-- <div class="miaoImage-container-divide miaoImage-container-divide-before">
|
||||||
|
<div class="miaoImage-container-divide-line"></div>
|
||||||
|
</div> -->
|
||||||
|
<span class="miaoImage-container-day-text">
|
||||||
|
{{ imageGroup.day }}
|
||||||
|
</span>
|
||||||
|
<!-- <div class="miaoImage-container-divide">
|
||||||
|
<div class="miaoImage-container-divide-line"></div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="miaoImage-container-row"
|
||||||
|
v-for="vFile in imageGroup.items"
|
||||||
|
:key="vFile.id">
|
||||||
|
<img
|
||||||
|
:src="vFile.url"
|
||||||
|
class="miaoImage-container-row-image"
|
||||||
|
loading="lazy"
|
||||||
|
:class="
|
||||||
|
activeImage === vFile
|
||||||
|
? 'miaoImage-container-row-image-active'
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
@click="activeImage = vFile" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-scrollbar>
|
||||||
|
<miao-mask
|
||||||
|
:show="activeImage !== undefined"
|
||||||
|
@click="activeImage = undefined"
|
||||||
|
class="miaoImage-mask"
|
||||||
|
@wheel="handleWheel">
|
||||||
|
<ChevronBack
|
||||||
|
class="miaoImage-mask-btn miaoImage-mask-btn-back"
|
||||||
|
@click="handleActiveImageBack" />
|
||||||
|
<img
|
||||||
|
:src="activeImage?.url"
|
||||||
|
class="miaoImage-mask-active"
|
||||||
|
@click="(e) => e.stopPropagation()"
|
||||||
|
draggable="false"
|
||||||
|
:style="{transform: `scale(${imgViewScale})`}" />
|
||||||
|
<ChevronForward
|
||||||
|
class="miaoImage-mask-btn miaoImage-mask-btn-forward"
|
||||||
|
@click="handleActiveImageForward" />
|
||||||
|
</miao-mask>
|
||||||
|
</div>
|
||||||
|
</miao-message-provider>
|
||||||
|
</miao-drop-handler>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import miaoMask from '@/components/miaoMask.vue'
|
||||||
|
import miaoDropHandler from '@/components/miaoDropHandler.vue'
|
||||||
|
import miaoMessageProvider from '@/components/miaoAlertTipProvider.vue'
|
||||||
|
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import { uniq } from 'lodash'
|
||||||
|
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||||
|
import { NScrollbar } from 'naive-ui'
|
||||||
|
import { ChevronBack, ChevronForward } from '@vicons/ionicons5'
|
||||||
|
|
||||||
|
const imageSuffixList = [
|
||||||
|
'xbm',
|
||||||
|
'tif',
|
||||||
|
'pjp',
|
||||||
|
'svgz',
|
||||||
|
'jpg',
|
||||||
|
'jpeg',
|
||||||
|
'ico',
|
||||||
|
'tiff',
|
||||||
|
'gif',
|
||||||
|
'svg',
|
||||||
|
'jfif',
|
||||||
|
'webp',
|
||||||
|
'png',
|
||||||
|
'bmp',
|
||||||
|
'pjpeg',
|
||||||
|
'avif'
|
||||||
|
]
|
||||||
|
|
||||||
|
const currentDirectories = defineModel<VirtualDirectory[]>(
|
||||||
|
'currentDirectories',
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
||||||
|
required: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const NScrollbarRef = ref()
|
||||||
|
const rootRef = ref<any>()
|
||||||
|
const miaoMessageRef = ref<InstanceType<typeof miaoMessageProvider>>()
|
||||||
|
const imgViewScale = ref(1)
|
||||||
|
const imageFileList = ref<VirtualFile[]>([])
|
||||||
|
const activeImage = ref<VirtualFile>()
|
||||||
|
|
||||||
|
const imageGroupList = computed(() => {
|
||||||
|
return groupByDay(imageFileList.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(activeImage, () => {
|
||||||
|
nextTick(scrollToActiveImage)
|
||||||
|
imgViewScale.value = 1
|
||||||
|
})
|
||||||
|
|
||||||
|
const groupByDay = (array: VirtualFile[]) => {
|
||||||
|
const result = []
|
||||||
|
let currentDay = null
|
||||||
|
let currentGroup: VirtualFile[] = []
|
||||||
|
|
||||||
|
for (const item of array) {
|
||||||
|
const date = new Date(item.stats.mtimeMs)
|
||||||
|
const day = `${date.getFullYear()}年 ${String(
|
||||||
|
date.getMonth() + 1
|
||||||
|
).padStart(2, '0')}月 ${String(date.getDate()).padStart(2, '0')}日`
|
||||||
|
|
||||||
|
if (day !== currentDay) {
|
||||||
|
if (currentGroup.length > 0) {
|
||||||
|
result.push({
|
||||||
|
day: currentDay,
|
||||||
|
items: currentGroup
|
||||||
|
})
|
||||||
|
}
|
||||||
|
currentDay = day
|
||||||
|
currentGroup = [item]
|
||||||
|
} else {
|
||||||
|
currentGroup.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentGroup.length > 0) {
|
||||||
|
result.push({
|
||||||
|
day: currentDay,
|
||||||
|
items: currentGroup
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollToActiveImage = () => {
|
||||||
|
const dom = rootRef.value?.querySelector(
|
||||||
|
'.miaoImage-container-row-image-active'
|
||||||
|
)
|
||||||
|
dom && NScrollbarRef.value.scrollTo({
|
||||||
|
top: dom.offsetTop - 30,
|
||||||
|
behavior: 'smooth'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleActiveImageBack = (e: any) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (!activeImage.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = imageFileList.value.indexOf(activeImage.value)
|
||||||
|
activeImage.value =
|
||||||
|
imageFileList.value[
|
||||||
|
(index - 1 + imageFileList.value.length) %
|
||||||
|
imageFileList.value.length
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleActiveImageForward = (e: any) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (!activeImage.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = imageFileList.value.indexOf(activeImage.value)
|
||||||
|
activeImage.value =
|
||||||
|
imageFileList.value[
|
||||||
|
(index + 1 + imageFileList.value.length) %
|
||||||
|
imageFileList.value.length
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDrop = async (vItems: (VirtualFile | VirtualDirectory)[]) => {
|
||||||
|
const length_before = imageFileList.value.length
|
||||||
|
if (vItems[0].type === 'directory') {
|
||||||
|
// @ts-ignore
|
||||||
|
currentDirectories.value = [...currentDirectories.value, ...vItems]
|
||||||
|
for (const i of vItems) {
|
||||||
|
// @ts-ignore
|
||||||
|
await updateImageSrcList(i)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
currentFiles.value = [...currentFiles, ...vItems]
|
||||||
|
// @ts-ignore
|
||||||
|
await updateImageSrcList(vItems)
|
||||||
|
}
|
||||||
|
miaoMessageRef.value?.alertTip(
|
||||||
|
length_before === imageFileList.value.length
|
||||||
|
? '未发现任何可添加图片'
|
||||||
|
: `导入${imageFileList.value.length - length_before}张图片`,
|
||||||
|
{
|
||||||
|
type:
|
||||||
|
length_before === imageFileList.value.length
|
||||||
|
? 'info'
|
||||||
|
: 'success',
|
||||||
|
timeout: 5000
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateImageSrcList = async (source: VirtualFile[] | VirtualDirectory) => {
|
||||||
|
let newFileList: VirtualFile[]
|
||||||
|
if ('type' in source) {
|
||||||
|
await source.update()
|
||||||
|
newFileList = [
|
||||||
|
...(source.files?.filter((v) =>
|
||||||
|
imageSuffixList.includes(v.name.split('.').pop() ?? '')
|
||||||
|
) ?? [])
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
newFileList = [
|
||||||
|
...(source.filter((v) =>
|
||||||
|
imageSuffixList.includes(v.name.split('.').pop() ?? '')
|
||||||
|
) ?? [])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
imageFileList.value = uniq([...imageFileList.value, ...newFileList]).sort(
|
||||||
|
(a, b) => -a.stats.mtimeMs + b.stats.mtimeMs
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleWheel = (e: WheelEvent) => {
|
||||||
|
if (e.deltaY < 0) {
|
||||||
|
imgViewScale.value *= 1.42857
|
||||||
|
} else {
|
||||||
|
imgViewScale.value /= 1.42857
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const length_before = imageFileList.value.length
|
||||||
|
for (const i of [currentFiles.value, ...currentDirectories.value]) {
|
||||||
|
await updateImageSrcList(i)
|
||||||
|
}
|
||||||
|
miaoMessageRef.value?.alertTip(
|
||||||
|
length_before === imageFileList.value.length
|
||||||
|
? '未发现任何新增图片'
|
||||||
|
: `导入${imageFileList.value.length - length_before}张图片`,
|
||||||
|
{
|
||||||
|
type:
|
||||||
|
length_before === imageFileList.value.length
|
||||||
|
? 'info'
|
||||||
|
: 'success',
|
||||||
|
timeout: 5000
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miaoImage {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.miaoImage-container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.miaoImage-container-day {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
margin: 0 20px;
|
||||||
|
|
||||||
|
.miaoImage-container-divide {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-container-divide-line {
|
||||||
|
height: 3px;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: rgb(244 244 244);
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-container-divide-before {
|
||||||
|
flex: 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-container-day-text {
|
||||||
|
margin: 0 0 0 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-container-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 25%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
|
||||||
|
.miaoImage-container-row-image {
|
||||||
|
width: 80%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
object-fit: cover;
|
||||||
|
transition: width 0.25s;
|
||||||
|
box-shadow: 0 0 10px -5px;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-active {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-mask {
|
||||||
|
background-color: rgba(0, 0, 0, 0.444);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-mask-active {
|
||||||
|
max-width: 80%;
|
||||||
|
max-height: 80%;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miaoImage-mask-btn {
|
||||||
|
color: #ffffff99;
|
||||||
|
width: 7%;
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&-back {
|
||||||
|
left: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-forward {
|
||||||
|
right: 1%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import DocumentText from '@vicons/ionicons5/es/DocumentText'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoMarkdown',
|
||||||
|
name: 'markdown浏览',
|
||||||
|
icon: DocumentText,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoMarkdown/miaoMarkdown.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vFiles[0].name.endsWith('md')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
<n-scrollbar>
|
||||||
|
<div class="miao-markdown-container-miaomiaomiao" v-html="renderedMarkdown"></div>
|
||||||
|
<div style="height: 50px; width: 100%;"></div>
|
||||||
|
</n-scrollbar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { NScrollbar } from 'naive-ui';
|
||||||
|
import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import MarkdownIt from 'markdown-it'
|
||||||
|
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi';
|
||||||
|
|
||||||
|
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
|
||||||
|
const miaoFetchApi = useMiaoFetchApi()
|
||||||
|
|
||||||
|
const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
||||||
|
required: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const markdownSrc = ref<string>()
|
||||||
|
const renderedMarkdown = ref<string>('')
|
||||||
|
|
||||||
|
const md = new MarkdownIt()
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
markdownSrc.value = currentFiles.value[0].url
|
||||||
|
const text = decoder.decode(await(miaoFetchApi.getFile(currentFiles.value[0])).response)
|
||||||
|
renderedMarkdown.value = md.render(text)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.miao-markdown-container-miaomiaomiao {
|
||||||
|
width: 95%;
|
||||||
|
margin: 20px;
|
||||||
|
|
||||||
|
table,
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #f2f2f2
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #04AA6D;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import DocumentText from '@vicons/ionicons5/es/DocumentText'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoPDF',
|
||||||
|
name: 'PDF浏览',
|
||||||
|
icon: DocumentText,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoPDF/miaoPDF.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vFiles[0].name.endsWith('pdf')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -1,44 +1,74 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="miao-container">
|
<miao-message-provider ref="miaoMessageRef">
|
||||||
<div class="miao-container-topBar">
|
<div class="miao-container">
|
||||||
<div class="miao-container-topBar-btn" @click="() => handleZoom(10)" title="快速缩小">--</div>
|
<div class="miao-container-topBar">
|
||||||
<div class="miao-container-topBar-btn" @click="() => handleZoom()" title="缩小">-</div>
|
<div
|
||||||
<div class="miao-container-topBar-btn" @click="() => handleResetMargin()" title="还原">还原缩放</div>
|
class="miao-container-topBar-btn"
|
||||||
<div class="miao-container-topBar-btn" @click="() => handleShrink()" title="放大">+</div>
|
@click="() => handleZoom(10)"
|
||||||
<div class="miao-container-topBar-btn" @click="() => handleShrink(10)" title="快速放大">++</div>
|
title="快速缩小">
|
||||||
</div>
|
--
|
||||||
<NScrollbar>
|
</div>
|
||||||
<div class="miao-container-pdf" :style="{alignItems: pdfMargin < 0 ? 'baseline' : 'center'}">
|
<div
|
||||||
<div ref="pdfEl" class="miao-container-pdf-content" :style="{ width: `calc( 100% - ${pdfMargin}px)`}">
|
class="miao-container-topBar-btn"
|
||||||
|
@click="() => handleZoom()"
|
||||||
|
title="缩小">
|
||||||
|
-
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="miao-container-topBar-btn"
|
||||||
|
@click="() => handleResetMargin()"
|
||||||
|
title="还原">
|
||||||
|
还原缩放
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="miao-container-topBar-btn"
|
||||||
|
@click="() => handleShrink()"
|
||||||
|
title="放大">
|
||||||
|
+
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="miao-container-topBar-btn"
|
||||||
|
@click="() => handleShrink(10)"
|
||||||
|
title="快速放大">
|
||||||
|
++
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</NScrollbar>
|
<NScrollbar>
|
||||||
<div class="miao-container-loading" v-if="isLoading">{{ loadingPercent === -1 ? '加载插件中' :
|
<div
|
||||||
`渲染进度:${canvasList.length}/${pdfPageCount}` }}</div>
|
class="miao-container-pdf"
|
||||||
</div>
|
:style="{
|
||||||
|
alignItems: pdfMargin < 0 ? 'baseline' : 'center'
|
||||||
|
}">
|
||||||
|
<div
|
||||||
|
ref="pdfEl"
|
||||||
|
class="miao-container-pdf-content"
|
||||||
|
:style="{
|
||||||
|
width: `calc( 100% - ${pdfMargin}px)`
|
||||||
|
}"></div>
|
||||||
|
</div>
|
||||||
|
</NScrollbar>
|
||||||
|
</div>
|
||||||
|
</miao-message-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, shallowReactive } from 'vue'
|
import miaoMessageProvider from '@/components/miaoAlertTipProvider.vue'
|
||||||
|
import { onMounted, ref, shallowReactive } from 'vue'
|
||||||
import PdfjsWorker from 'pdfjs-dist/build/pdf.worker.mjs?worker'
|
import PdfjsWorker from 'pdfjs-dist/build/pdf.worker.mjs?worker'
|
||||||
import { VirtualFile } from '@/class/VirtualDirectory'
|
import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
import { NScrollbar } from 'naive-ui';
|
import { NScrollbar } from 'naive-ui'
|
||||||
|
|
||||||
const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
||||||
required: true
|
required: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const pdfEl = ref<HTMLDivElement>()
|
const pdfEl = ref<HTMLDivElement>()
|
||||||
|
const miaoMessageRef = ref<InstanceType<typeof miaoMessageProvider>>()
|
||||||
// 通过margin来实现缩小功能
|
// 通过margin来实现缩小功能
|
||||||
const pdfMargin = ref<number>(0)
|
const pdfMargin = ref<number>(0)
|
||||||
|
|
||||||
const pdfPageCount = ref<number>(-1)
|
const pdfPageCount = ref<number>(-1)
|
||||||
|
|
||||||
const isLoading = computed(() => {
|
|
||||||
return canvasList.length !== pdfPageCount.value
|
|
||||||
})
|
|
||||||
|
|
||||||
const canvasList = shallowReactive<HTMLCanvasElement[]>([])
|
const canvasList = shallowReactive<HTMLCanvasElement[]>([])
|
||||||
|
|
||||||
const handleZoom = (index?: number) => {
|
const handleZoom = (index?: number) => {
|
||||||
@@ -58,14 +88,11 @@ const handleResetMargin = () => {
|
|||||||
pdfMargin.value = 0
|
pdfMargin.value = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadingPercent = computed(() => {
|
|
||||||
if (pdfPageCount.value === -1) {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
return canvasList.length / pdfPageCount.value
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
const setLoadingMessage = miaoMessageRef.value?.alertTip('加载PDF插件中', {
|
||||||
|
type: 'info',
|
||||||
|
timeout: -1
|
||||||
|
})
|
||||||
const pdfSrc = currentFiles.value[0].url
|
const pdfSrc = currentFiles.value[0].url
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const PDFJS = await import('pdfjs-dist/build/pdf.mjs')
|
const PDFJS = await import('pdfjs-dist/build/pdf.mjs')
|
||||||
@@ -79,6 +106,7 @@ onMounted(async () => {
|
|||||||
pdfPageCount.value = pdf.numPages
|
pdfPageCount.value = pdf.numPages
|
||||||
// 循环渲染每一页
|
// 循环渲染每一页
|
||||||
for (let i = 1; i <= pdf.numPages; i++) {
|
for (let i = 1; i <= pdf.numPages; i++) {
|
||||||
|
setLoadingMessage && setLoadingMessage(`渲染进度:${i}/${pdf.numPages}`)
|
||||||
const page = await pdf.getPage(i)
|
const page = await pdf.getPage(i)
|
||||||
let pixelRatio = 3
|
let pixelRatio = 3
|
||||||
let viewport = page.getViewport({ scale: 1 })
|
let viewport = page.getViewport({ scale: 1 })
|
||||||
@@ -96,6 +124,11 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
await page.render(renderContext).promise // 一页一页的渲染
|
await page.render(renderContext).promise // 一页一页的渲染
|
||||||
}
|
}
|
||||||
|
setLoadingMessage &&
|
||||||
|
setLoadingMessage(`渲染PDF完成`, {
|
||||||
|
type: 'success',
|
||||||
|
timeout: 3456
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'yourPluginKey',
|
||||||
|
name: 'yourPluginName',
|
||||||
|
// icon: LogoChrome,
|
||||||
|
getComponent: async () => null,
|
||||||
|
// (await import('yourPluginPath')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length !== 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return vFiles[0].name.endsWith('?')
|
||||||
|
},
|
||||||
|
disable: true
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div class="miaoCrypto-container"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
// import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
|
|
||||||
|
// const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
||||||
|
// required: true
|
||||||
|
// })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.miaoCrypto-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { registerComponentOption } from '@/class/PluginCenter'
|
||||||
|
import PlayCircle from '@vicons/ionicons5/es/PlayCircle'
|
||||||
|
|
||||||
|
const pluginConfig: registerComponentOption = {
|
||||||
|
key: 'miaoVideoPlayer',
|
||||||
|
name: '视频',
|
||||||
|
icon: PlayCircle,
|
||||||
|
getComponent: async () =>
|
||||||
|
(await import('@/plugins/miaoVideoPlayer/miaoVideoPlayer.vue')).default,
|
||||||
|
filter: (vDirs, vFiles) => {
|
||||||
|
if (vDirs.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (vFiles.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for (let i of vFiles) {
|
||||||
|
for (let s of ['mp4']) {
|
||||||
|
if (i.name.endsWith(s)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pluginConfig
|
||||||
|
|
||||||
|
|
||||||
|
import { PluginExportType } from '@/types/type'
|
||||||
|
export const type = PluginExportType.component
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
import { VirtualFile } from '@/class/VirtualDirectory'
|
import { VirtualFile } from '@/class/VirtualDirectory'
|
||||||
import miaoDropHandler from '@/components/miaoDropHandler.vue'
|
import miaoDropHandler from '@/components/miaoDropHandler.vue'
|
||||||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
// import useViretualPages from '@/hooks/useVirtualPages';
|
// import useVirtualPages from '@/hooks/useVirtualPages';
|
||||||
import XGPlayer from 'xgplayer'
|
import XGPlayer from 'xgplayer'
|
||||||
import '@/style/xgplayer.scss'
|
import '@/style/xgplayer.scss'
|
||||||
import TextTrack from 'xgplayer/es/plugins/track'
|
import TextTrack from 'xgplayer/es/plugins/track'
|
||||||
@@ -26,7 +26,7 @@ const currentFiles = defineModel<VirtualFile[]>('currentFiles', {
|
|||||||
required: true
|
required: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// const views = useViretualPages()
|
// const views = useVirtualPages()
|
||||||
// const view = views.getView(props.id)
|
// const view = views.getView(props.id)
|
||||||
|
|
||||||
// const videoPath = ref<string>('');
|
// const videoPath = ref<string>('');
|
||||||
@@ -55,7 +55,7 @@ const { setVideo } = (() => {
|
|||||||
// console.log(srtToVtt(response.data))
|
// console.log(srtToVtt(response.data))
|
||||||
const url = setUrl(new Blob([srtToVtt(response.data)]))
|
const url = setUrl(new Blob([srtToVtt(response.data)]))
|
||||||
_list.push({
|
_list.push({
|
||||||
id: i.uid,
|
id: i.id,
|
||||||
url,
|
url,
|
||||||
// 这个language会覆盖id的设置,导致无法切换字幕
|
// 这个language会覆盖id的设置,导致无法切换字幕
|
||||||
// language: 'zh-cn',
|
// language: 'zh-cn',
|
||||||
@@ -66,7 +66,7 @@ const { setVideo } = (() => {
|
|||||||
// console.log(assToVtt(response.data))
|
// console.log(assToVtt(response.data))
|
||||||
const url = setUrl(new Blob([assToVtt(response.data)]))
|
const url = setUrl(new Blob([assToVtt(response.data)]))
|
||||||
_list.push({
|
_list.push({
|
||||||
id: i.uid,
|
id: i.id,
|
||||||
url,
|
url,
|
||||||
text: i.name
|
text: i.name
|
||||||
})
|
})
|
||||||
@@ -75,13 +75,13 @@ const { setVideo } = (() => {
|
|||||||
// console.log(ssaToVtt(response.data))
|
// console.log(ssaToVtt(response.data))
|
||||||
const url = setUrl(new Blob([ssaToVtt(response.data)]))
|
const url = setUrl(new Blob([ssaToVtt(response.data)]))
|
||||||
_list.push({
|
_list.push({
|
||||||
id: i.uid,
|
id: i.id,
|
||||||
url,
|
url,
|
||||||
text: i.name
|
text: i.name
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
_list.push({
|
_list.push({
|
||||||
id: i.uid,
|
id: i.id,
|
||||||
url: i.url,
|
url: i.url,
|
||||||
text: i.name
|
text: i.name
|
||||||
})
|
})
|
||||||
+9
-1
@@ -8,12 +8,20 @@ export type miaoFetchConfig = {
|
|||||||
|
|
||||||
export type getOption = {} & miaoFetchConfig;
|
export type getOption = {} & miaoFetchConfig;
|
||||||
|
|
||||||
|
export type getFileOption = {
|
||||||
|
/**
|
||||||
|
* 下载进度回调函数
|
||||||
|
* @param {any} percent 进度百分比,float类型, 0-1
|
||||||
|
*/
|
||||||
|
onProcess?: (percent: number) => void;
|
||||||
|
} & miaoFetchConfig;
|
||||||
|
|
||||||
export type getResponse = (file | directory)[];
|
export type getResponse = (file | directory)[];
|
||||||
|
|
||||||
export type uploadOption = {
|
export type uploadOption = {
|
||||||
/**
|
/**
|
||||||
* 上传进度回调函数
|
* 上传进度回调函数
|
||||||
* @param {any} percent 进度百分比,float类型
|
* @param {any} percent 进度百分比,float类型, 0-1
|
||||||
*/
|
*/
|
||||||
onProcess?: (percent: number) => void;
|
onProcess?: (percent: number) => void;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,3 +20,20 @@ export type directory = {
|
|||||||
stats: stats;
|
stats: stats;
|
||||||
parent?: directory;
|
parent?: directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type alertTipType = ((content: string, options?: AlertTipMessageOptions) => (newContent: string, newOptions?: AlertTipMessageOptions) => void)
|
||||||
|
|
||||||
|
export interface AlertTipMessageOptions {
|
||||||
|
type?: 'info' | 'success' | 'error'
|
||||||
|
timeout?: number
|
||||||
|
id?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum PluginExportType {
|
||||||
|
default = 'default',
|
||||||
|
component = 'component'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface usePluginHooksType {
|
||||||
|
globalAlertTip: alertTipType;
|
||||||
|
}
|
||||||
@@ -1,611 +0,0 @@
|
|||||||
<template>
|
|
||||||
<miao-drop-handler @on-virtual-directory="handleDropVDirectory" @on-files="handleDropFiles"
|
|
||||||
@on-virtual-files="handleDropVirtualFiles">
|
|
||||||
<div class="miao-directory-item-container" ref="rootDomRef">
|
|
||||||
<div class="container-top" :style="{
|
|
||||||
backgroundColor:
|
|
||||||
index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)'
|
|
||||||
}">
|
|
||||||
<div class="container-top-colorfulBar" :style="{ backgroundColor: props.color }"></div>
|
|
||||||
<div class="container-top-breadcrumb">
|
|
||||||
<!-- <n-scrollbar x-scrollable> -->
|
|
||||||
<div class="container-top-breadcrumb-container">
|
|
||||||
<n-breadcrumb separator=">" style="margin-left: 5px">
|
|
||||||
<n-breadcrumb-item :clickable="false">
|
|
||||||
<n-icon size="18">
|
|
||||||
<CloudOutline />
|
|
||||||
</n-icon>
|
|
||||||
</n-breadcrumb-item>
|
|
||||||
<n-breadcrumb-item v-for="dir in currentDirectory?.getParents"
|
|
||||||
@click="setCurrentDirectory(dir)" :clickable="true">
|
|
||||||
<div>{{ dir.name }}</div>
|
|
||||||
</n-breadcrumb-item>
|
|
||||||
</n-breadcrumb>
|
|
||||||
</div>
|
|
||||||
<!-- </n-scrollbar> -->
|
|
||||||
</div>
|
|
||||||
<div class="container-top-tools">
|
|
||||||
<n-icon class="container-top-tools-item" size="15" @click="handleBack">
|
|
||||||
<ChevronBackOutline />
|
|
||||||
</n-icon>
|
|
||||||
<n-icon class="container-top-tools-item" size="14" @click="handleReload">
|
|
||||||
<ReloadOutline class="container-top-tools-item-reload" />
|
|
||||||
</n-icon>
|
|
||||||
<n-icon class="container-top-tools-item" size="20" @click="emit('exit')">
|
|
||||||
<CloseOutline />
|
|
||||||
</n-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container-items" :style="{
|
|
||||||
backgroundColor:
|
|
||||||
index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)'
|
|
||||||
}">
|
|
||||||
<n-scrollbar>
|
|
||||||
<transition-group name="dirItem">
|
|
||||||
<miaoDirectoryItem v-for="dir in showData_directory" :item="dir" :key="dir.uid"
|
|
||||||
:color="props.color" :selectedItem="selectedItem.value" @delete="handleItemDelete(dir)"
|
|
||||||
@click="handleItemClick(dir)" @drag-start="handleItemDragStart"
|
|
||||||
@rename="handleItemRename(dir)" @on-selected="handleItemSelect(dir)" />
|
|
||||||
</transition-group>
|
|
||||||
<transition-group name="dirItem">
|
|
||||||
<miaoDirectoryItem v-for="file in showData_files" :item="file" :key="file.uid"
|
|
||||||
:color="props.color" :selectedItem="selectedItem.value" @click="handleItemClick(file)"
|
|
||||||
@download="handleItemDownload(file)" @delete="handleItemDelete(file)"
|
|
||||||
@drag-start="handleItemDragStart" @rename="handleItemRename(file)"
|
|
||||||
@on-selected="handleItemSelect(file)" />
|
|
||||||
</transition-group>
|
|
||||||
<!-- <n-virtual-list :item="showData_all" :item-size="50">
|
|
||||||
|
|
||||||
</n-virtual-list> -->
|
|
||||||
</n-scrollbar>
|
|
||||||
</div>
|
|
||||||
<div class="container-bottom" :style="{
|
|
||||||
backgroundColor:
|
|
||||||
index % 2 === 1 ? 'rgb(61 61 61)' : 'rgb(162 162 162)'
|
|
||||||
}">
|
|
||||||
<div class="container-bottom-item">
|
|
||||||
<div class="container-bottom-item-icon">
|
|
||||||
<add-outline :style="{
|
|
||||||
color:
|
|
||||||
index % 2 === 0
|
|
||||||
? 'rgb(0 0 0)'
|
|
||||||
: 'rgb(255 255 255)'
|
|
||||||
}" @click="handleAddNewItem" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container-bottom-item">
|
|
||||||
<div class="container-bottom-item-icon">
|
|
||||||
<cloud-upload-outline :style="{
|
|
||||||
color:
|
|
||||||
index % 2 === 0
|
|
||||||
? 'rgb(0 0 0)'
|
|
||||||
: 'rgb(255 255 255)'
|
|
||||||
}" @click="handlePickFilesUpload" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<miao-mask v-model:show="showModel"></miao-mask>
|
|
||||||
<miao-popup-input ref="popupInput"></miao-popup-input>
|
|
||||||
</div>
|
|
||||||
</miao-drop-handler>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { NBreadcrumbItem, NBreadcrumb, NIcon, NScrollbar } from 'naive-ui'
|
|
||||||
import VirtualDirectory, { VirtualFile } from '@/class/VirtualDirectory'
|
|
||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
|
||||||
import Config from '@/config'
|
|
||||||
import miaoMask from '@/components/miaoMask.vue'
|
|
||||||
import miaoDirectoryItem from '@/components/miaoDirectory/miaoDirectoryItem.vue'
|
|
||||||
import miaoPopupInput from '@/components/miaoPopupInput.vue'
|
|
||||||
import miaoDropHandler from '@/components/miaoDropHandler.vue'
|
|
||||||
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
|
|
||||||
import useDataBus from '@/hooks/useDataBus'
|
|
||||||
import {
|
|
||||||
CloudOutline,
|
|
||||||
ChevronBackOutline,
|
|
||||||
ReloadOutline,
|
|
||||||
CloseOutline,
|
|
||||||
CloudUploadOutline,
|
|
||||||
AddOutline
|
|
||||||
} from '@vicons/ionicons5'
|
|
||||||
import useUploadQueue from '@/hooks/useUploadQueue'
|
|
||||||
import useVirtualPages from '@/hooks/useVirtualPages'
|
|
||||||
import { filePicker } from '@/hooks/miaoTools'
|
|
||||||
import { uniq } from 'lodash'
|
|
||||||
|
|
||||||
const { baseUrl, api } = Config
|
|
||||||
const dataBus = useDataBus()
|
|
||||||
const views = useVirtualPages()
|
|
||||||
|
|
||||||
const miaoFetchApi = useMiaoFetchApi()
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
color: string
|
|
||||||
id: number
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
exit: []
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const popupInput = ref()
|
|
||||||
// 是否显示模态框
|
|
||||||
const showModel = ref(0)
|
|
||||||
|
|
||||||
class SelectedItem {
|
|
||||||
constructor() {
|
|
||||||
this._selectedItem = []
|
|
||||||
}
|
|
||||||
_selectedItem: (VirtualDirectory | VirtualFile)[]
|
|
||||||
push(item: VirtualDirectory | VirtualFile) {
|
|
||||||
this._selectedItem = [item, ...this._selectedItem]
|
|
||||||
}
|
|
||||||
remove(item: VirtualDirectory | VirtualFile) {
|
|
||||||
this._selectedItem = this._selectedItem.filter(v => v !== item)
|
|
||||||
}
|
|
||||||
clear() {
|
|
||||||
this._selectedItem = []
|
|
||||||
}
|
|
||||||
// 保证内容仍然存在于dir中且各个元素不重复
|
|
||||||
get value() {
|
|
||||||
return uniq(this._selectedItem).filter(v => {
|
|
||||||
if (currentDirectory.value === undefined) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// @ts-ignore
|
|
||||||
return [...currentDirectory.value?.directorys, ...currentDirectory.value?.files].includes(v)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 已选择的item,用于多选功能
|
|
||||||
const selectedItem = reactive(new SelectedItem())
|
|
||||||
|
|
||||||
const currentDirectorys = defineModel<VirtualDirectory[]>('currentDirectorys', {
|
|
||||||
required: true
|
|
||||||
})
|
|
||||||
|
|
||||||
// 目前展示的Dir
|
|
||||||
const currentDirectory = computed(() => {
|
|
||||||
return currentDirectorys.value[0]
|
|
||||||
})
|
|
||||||
|
|
||||||
// 当前组件在views中的序号
|
|
||||||
const index = computed(() => {
|
|
||||||
return views.getIndex(props.id)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 用于展示的数据,后续会增加排序等操作
|
|
||||||
const showData_directory = computed<VirtualDirectory[]>(() => {
|
|
||||||
const data = currentDirectory.value?.directorys
|
|
||||||
? [...currentDirectory.value?.directorys]
|
|
||||||
: []
|
|
||||||
return data
|
|
||||||
})
|
|
||||||
const showData_files = computed<VirtualFile[]>(() => {
|
|
||||||
const data = currentDirectory.value?.files
|
|
||||||
? [...currentDirectory.value?.files]
|
|
||||||
: []
|
|
||||||
return data
|
|
||||||
})
|
|
||||||
// const showData_all = computed<(VirtualDirectory | VirtualFile)[]>(() => {
|
|
||||||
// const data = currentDirectory.value?.directorys
|
|
||||||
// ? [...currentDirectory.value?.directorys]
|
|
||||||
// : []
|
|
||||||
// data.push(...currentDirectory.value?.files)
|
|
||||||
// return data
|
|
||||||
// })
|
|
||||||
|
|
||||||
// 用于监听拖拽文件事件
|
|
||||||
const rootDomRef = ref<HTMLDivElement>()
|
|
||||||
|
|
||||||
const uploadQueue = useUploadQueue()
|
|
||||||
|
|
||||||
// 设置显示的dir
|
|
||||||
const setCurrentDirectory = async (virtualDirectory: VirtualDirectory) => {
|
|
||||||
// 若没有缓存数据则同步刷新,有缓存数据则异步刷新
|
|
||||||
if (
|
|
||||||
virtualDirectory.files === undefined ||
|
|
||||||
virtualDirectory.directorys === undefined
|
|
||||||
) {
|
|
||||||
await virtualDirectory.update()
|
|
||||||
} else {
|
|
||||||
virtualDirectory.update()
|
|
||||||
}
|
|
||||||
currentDirectorys.value[0] = virtualDirectory
|
|
||||||
}
|
|
||||||
|
|
||||||
const reload = () => {
|
|
||||||
setCurrentDirectory(currentDirectory.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
const openUrl = (
|
|
||||||
href: string,
|
|
||||||
config?: {
|
|
||||||
download?: string
|
|
||||||
target?: string
|
|
||||||
}
|
|
||||||
) => {
|
|
||||||
let { target, download } = config ?? {}
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.setAttribute('href', href)
|
|
||||||
a.setAttribute('target', target ?? '_blank')
|
|
||||||
download && a.setAttribute('download', download)
|
|
||||||
a.click()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleBack = () => {
|
|
||||||
if (currentDirectory.value?.parent) {
|
|
||||||
setCurrentDirectory(currentDirectory.value.parent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleReload = () => {
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemClick = (item: VirtualDirectory | VirtualFile) => {
|
|
||||||
if (selectedItem.value.length > 0) {
|
|
||||||
handleItemSelect(item)
|
|
||||||
} else {
|
|
||||||
if (item.type === 'file') {
|
|
||||||
openUrl(`${baseUrl}${api.get}${item.path}`)
|
|
||||||
} else if (item.type === 'directory') {
|
|
||||||
setCurrentDirectory(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemDownload = (item: VirtualFile) => {
|
|
||||||
openUrl(`${baseUrl}${api.get}${item.path}`, {
|
|
||||||
download: item.name
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemDelete = async (_item: VirtualDirectory | VirtualFile) => {
|
|
||||||
for (let item of uniq([...selectedItem.value, _item])) {
|
|
||||||
; (async () => {
|
|
||||||
const { response } = miaoFetchApi.delete(item, {
|
|
||||||
retry: 5
|
|
||||||
})
|
|
||||||
// todo: 将删除事件统一用一个事件管理中心管理
|
|
||||||
const id = (await response).eventId
|
|
||||||
const { response: res } = miaoFetchApi.query(id)
|
|
||||||
const eventResult = await res
|
|
||||||
if (eventResult.status === 'success') {
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemRename = async (item: VirtualDirectory | VirtualFile) => {
|
|
||||||
const popupRes = await popupInput.value.popup({
|
|
||||||
title: '重命名',
|
|
||||||
showInput: true,
|
|
||||||
inputValue: item.name,
|
|
||||||
inputProps: {
|
|
||||||
placeholder: item.name
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: '取消',
|
|
||||||
key: false,
|
|
||||||
type: 'error'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '确认',
|
|
||||||
key: true,
|
|
||||||
type: 'success'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
if (popupRes.key === false) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const newName = popupRes.text
|
|
||||||
const { response } = miaoFetchApi.rename(item, newName, {
|
|
||||||
retry: 5
|
|
||||||
})
|
|
||||||
const id = (await response).eventId
|
|
||||||
const { response: res } = miaoFetchApi.query(id)
|
|
||||||
const eventResult = await res
|
|
||||||
if (eventResult.status === 'success') {
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemDragStart = async (
|
|
||||||
_event: DragEvent,
|
|
||||||
item: VirtualDirectory | VirtualFile
|
|
||||||
) => {
|
|
||||||
const items = uniq([item, ...selectedItem.value])
|
|
||||||
dataBus.set('dragData_vFiles', items.filter(v => v.type === 'file'))
|
|
||||||
dataBus.set('dragData_vDirectory', items.filter(v => v.type === 'directory'))
|
|
||||||
// selectedItem.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDropFiles = async (files: File[]) => {
|
|
||||||
currentDirectory.value &&
|
|
||||||
uploadQueue.push(files, currentDirectory.value, {
|
|
||||||
onFinish() {
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDropVDirectory = async (vDirs: VirtualDirectory[]) => {
|
|
||||||
// 不能移到自己或自己的子文件夹内
|
|
||||||
for (let vDir of vDirs) {
|
|
||||||
if (currentDirectory.value.getParents.includes(vDir)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let dir of vDirs) {
|
|
||||||
; (async () => {
|
|
||||||
const _from = dir.parent
|
|
||||||
const { response } = miaoFetchApi.cut(dir, currentDirectory.value)
|
|
||||||
const id = (await response).eventId
|
|
||||||
const { response: res } = miaoFetchApi.query(id)
|
|
||||||
const eventResult = await res
|
|
||||||
if (eventResult.status === 'success') {
|
|
||||||
reload()
|
|
||||||
_from && _from.update()
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDropVirtualFiles = (files: VirtualFile[]) => {
|
|
||||||
if (files[0].parent === currentDirectory.value) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for (let file of files) {
|
|
||||||
; (async () => {
|
|
||||||
const _from = file.parent
|
|
||||||
const { response } = miaoFetchApi.cut(file, currentDirectory.value)
|
|
||||||
const id = (await response).eventId
|
|
||||||
const { response: res } = miaoFetchApi.query(id)
|
|
||||||
const eventResult = await res
|
|
||||||
if (eventResult.status === 'success') {
|
|
||||||
reload()
|
|
||||||
_from.update()
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlePickFilesUpload = async () => {
|
|
||||||
const files = await filePicker({
|
|
||||||
multiple: true
|
|
||||||
})
|
|
||||||
const _currDir = currentDirectory.value
|
|
||||||
uploadQueue.push(files, _currDir, {
|
|
||||||
onFinish() {
|
|
||||||
_currDir.update()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAddNewItem = async () => {
|
|
||||||
const popupRes = await popupInput.value.popup({
|
|
||||||
title: '新建文件/文件夹',
|
|
||||||
showInput: true,
|
|
||||||
inputProps: {
|
|
||||||
placeholder: ''
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: '取消',
|
|
||||||
key: 'cancel',
|
|
||||||
type: 'error'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '文件',
|
|
||||||
key: 'file',
|
|
||||||
type: 'success'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '文件夹',
|
|
||||||
key: 'dir',
|
|
||||||
type: 'success'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
// todo: 上传前如重名文件夹等等的错误提前检查
|
|
||||||
if (popupRes.key === 'cancel' || popupRes.text === '') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const _currDir = currentDirectory.value
|
|
||||||
const name = popupRes.text
|
|
||||||
const opType: 'file' | 'dir' = popupRes.key
|
|
||||||
if (opType === 'dir') {
|
|
||||||
const res = await miaoFetchApi.mkdir(currentDirectory.value, name)
|
|
||||||
if (res.message === 'success') {
|
|
||||||
_currDir.update()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const { response } = miaoFetchApi.mkFile(currentDirectory.value, name)
|
|
||||||
const res = await response
|
|
||||||
if (res.message === 'success') {
|
|
||||||
_currDir.update()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleItemSelect = (item: VirtualDirectory | VirtualFile) => {
|
|
||||||
if (!selectedItem.value.includes(item)) {
|
|
||||||
selectedItem.push(item)
|
|
||||||
} else {
|
|
||||||
selectedItem.remove(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onMounted(async () => {
|
|
||||||
await setCurrentDirectory(currentDirectory.value)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
$top-height: 30px;
|
|
||||||
$bottom-bar-height: 60px;
|
|
||||||
|
|
||||||
.miao-directory-item-container {
|
|
||||||
position: relative;
|
|
||||||
height: 100%;
|
|
||||||
width: inherit;
|
|
||||||
// min-width: 236px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
min-width: 170px;
|
|
||||||
|
|
||||||
.container-top {
|
|
||||||
height: $top-height;
|
|
||||||
width: 100%;
|
|
||||||
user-select: none;
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
overflow: hidden;
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
|
|
||||||
.container-top-colorfulBar {
|
|
||||||
height: 70%;
|
|
||||||
width: 5px;
|
|
||||||
margin-left: 10px;
|
|
||||||
border-radius: 3px 0 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-top-breadcrumb {
|
|
||||||
position: relative;
|
|
||||||
height: 70%;
|
|
||||||
width: calc(100% - 95px);
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
// overflow: hidden;
|
|
||||||
overflow-y: hidden;
|
|
||||||
overflow-x: hidden;
|
|
||||||
background-color: #ffffff;
|
|
||||||
padding: 0 5px;
|
|
||||||
border-radius: 0 3px 3px 0;
|
|
||||||
|
|
||||||
.container-top-breadcrumb-container {
|
|
||||||
position: absolute;
|
|
||||||
height: 100%;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
min-width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-top-tools {
|
|
||||||
position: relative;
|
|
||||||
height: 100%;
|
|
||||||
width: 70px;
|
|
||||||
padding: 0 5px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.container-top-tools-item {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #ffffff00;
|
|
||||||
border-radius: 5px;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
.container-top-tools-item-reload {
|
|
||||||
transition: transform 0.6s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba(128, 128, 128, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active .container-top-tools-item-reload {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// &::after {
|
|
||||||
// content: '';
|
|
||||||
// height: 60%;
|
|
||||||
// position: absolute;
|
|
||||||
// right: -2px;
|
|
||||||
// width: 2px;
|
|
||||||
// background-color: #828282;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-items {
|
|
||||||
width: 100%;
|
|
||||||
height: calc(100% - $top-height - $bottom-bar-height);
|
|
||||||
// flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-bottom {
|
|
||||||
height: $bottom-bar-height;
|
|
||||||
background-color: bisque;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
align-items: center;
|
|
||||||
user-select: none;
|
|
||||||
box-shadow: 0px 1px 10px #888888;
|
|
||||||
z-index: 2;
|
|
||||||
|
|
||||||
.container-bottom-item {
|
|
||||||
height: 40px;
|
|
||||||
width: 40px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.container-bottom-item-icon {
|
|
||||||
svg {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
svg {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// transition动画相关
|
|
||||||
// .miao-directory-item-container {
|
|
||||||
// .container-items {
|
|
||||||
// .dirItem-move {
|
|
||||||
// transition: all 0.2s ease;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .dirItem-leave-active {
|
|
||||||
// transition: none;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .dirItem-enter-from {
|
|
||||||
// opacity: 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .dirItem-leave-active {
|
|
||||||
// position: absolute;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
</style>
|
|
||||||
+9
-14
@@ -59,21 +59,16 @@ export default defineConfig({
|
|||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
main: resolve(__dirname, 'index.html')
|
main: 'index.html'
|
||||||
},
|
},
|
||||||
output: {
|
// output: {
|
||||||
// 配置输出为单文件
|
// entryFileNames: (chunkInfo) => {
|
||||||
// inlineDynamicImports: true,
|
// if (chunkInfo.name === 'main') {
|
||||||
// manualChunks(id) {
|
// return 'main.js'
|
||||||
// 加了会有bug
|
// }
|
||||||
// if (id.includes('@codemirror')) {
|
// return '[name].[hash].js'
|
||||||
// return id.split('@')[1].replace('+', '-')
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
// entryFileNames: 'bundle.js',
|
|
||||||
// format: 'iife', // 立即执行函数格式
|
|
||||||
// name: 'MyBundle'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user