Merge pull request #1494 from agalwood/feature/task_file_filter_20230519

This commit is contained in:
Dr_rOot
2023-05-20 08:36:21 +08:00
committed by GitHub
6 changed files with 82 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
import Icon from '@/components/Icons/Icon'
Icon.register({
'document': {
'width': 24,
'height': 24,
'raw': `<rect x="3" y="1" width="18" height="22"></rect>
<line x1="15" y1="6" x2="17" y2="6"></line>
<line x1="15" y1="10" x2="17" y2="10"></line>
<line x1="7" y1="14" x2="17" y2="14"></line>
<line x1="7" y1="18" x2="17" y2="18"></line>
<rect x="7" y="6" width="4" height="4"></rect>`,
'g': {
'stroke': 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': '2',
'fill': 'none'
}
}
})
+4
View File
@@ -3,6 +3,7 @@
custom-class="tab-title-dialog add-task-dialog"
width="67vw"
:visible="visible"
:top="dialogTop"
:show-close="false"
:before-close="beforeClose"
@open="handleOpen"
@@ -244,6 +245,9 @@
}),
taskType () {
return this.type
},
dialogTop () {
return this.showAdvanced ? '8vh' : '15vh'
}
},
watch: {
@@ -65,6 +65,9 @@
<el-button @click="toggleImageSelection()">
<mo-icon name="image" width="12" height="12" />
</el-button>
<el-button @click="toggleDocumentSelection()">
<mo-icon name="document" width="12" height="12" />
</el-button>
</el-button-group>
</el-col>
<el-col
@@ -85,6 +88,7 @@
import '@/components/Icons/video'
import '@/components/Icons/audio'
import '@/components/Icons/image'
import '@/components/Icons/document'
import {
NONE_SELECTED_FILES,
SELECTED_ALL_FILES
@@ -92,9 +96,10 @@
import {
bytesToSize,
calcProgress,
filterVideoFiles,
filterAudioFiles,
filterDocumentFiles,
filterImageFiles,
filterVideoFiles,
removeExtensionDot
} from '@shared/utils'
@@ -192,6 +197,10 @@
const filtered = filterImageFiles(this.files)
this.toggleSelection(filtered)
},
toggleDocumentSelection () {
const filtered = filterDocumentFiles(this.files)
this.toggleSelection(filtered)
},
handleRowDbClick (row, column, event) {
this.$refs.torrentTable.toggleRowSelection(row)
},
+14
View File
@@ -237,6 +237,11 @@
}
}
.el-select-dropdown.is-multiple .el-select-dropdown__item.selected {
background-color: #3d3d3d;
color: $--color-primary;
}
.el-upload-dragger {
background-color: #2d2d2d;
border-color: #606060;
@@ -449,4 +454,13 @@
border-color: $--dk-popover-border-color;
}
.el-tag.el-tag--info.el-tag--light {
background-color: #5b5b5b;
border-color: #606060;
color: #e6e6e6;
}
.el-tag__close.el-icon-close {
color: #2d2d2d;
}
}
+22
View File
@@ -229,7 +229,9 @@ export const IMAGE_SUFFIXES = [
'.ai',
'.bmp',
'.eps',
'.fig',
'.gif',
'.heic',
'.icn',
'.ico',
'.jpeg',
@@ -243,6 +245,7 @@ export const IMAGE_SUFFIXES = [
'.webp',
'.xd'
]
export const AUDIO_SUFFIXES = [
'.aac',
'.ape',
@@ -254,6 +257,7 @@ export const AUDIO_SUFFIXES = [
'.wav',
'.wma'
]
export const VIDEO_SUFFIXES = [
'.avi',
'.m4v',
@@ -275,3 +279,21 @@ export const SUB_SUFFIXES = [
'.sst',
'.sub'
]
export const DOCUMENT_SUFFIXES = [
'.azw3',
'.csv',
'.doc',
'.docx',
'.epub',
'.key',
'.mobi',
'.numbers',
'.pages',
'.pdf',
'.ppt',
'.pptx',
'.txt',
'.xsl',
'.xslx'
]
+11 -1
View File
@@ -28,7 +28,8 @@ import {
SUB_SUFFIXES,
UNKNOWN_PEERID,
SUPPORT_RTL_LOCALES,
UNKNOWN_PEERID_NAME
UNKNOWN_PEERID_NAME,
DOCUMENT_SUFFIXES
} from '@shared/constants'
export const bytesToSize = (bytes, precision = 1) => {
@@ -429,6 +430,7 @@ export const compactUndefined = (arr = []) => {
}
export const splitTextRows = (text = '') => {
text = `${text}`
let result = text
.replace(/(?:\\\r\\\n|\\\r|\\\n)/g, ' ')
.replace(/(?:\r\n|\r|\n)/g, '\n')
@@ -438,6 +440,7 @@ export const splitTextRows = (text = '') => {
}
export const convertCommaToLine = (text = '') => {
text = `${text}`
let arr = text.split(',')
arr = arr.map((row) => row.trim())
const result = arr.join('\n').trim()
@@ -468,6 +471,12 @@ export const filterImageFiles = (files = []) => {
})
}
export const filterDocumentFiles = (files = []) => {
return files.filter((item) => {
return DOCUMENT_SUFFIXES.includes(item.extension)
})
}
export const isAudioOrVideo = (uri = '') => {
const suffixs = [...AUDIO_SUFFIXES, ...VIDEO_SUFFIXES]
const result = suffixs.some((suffix) => {
@@ -570,6 +579,7 @@ export const diffConfig = (current = {}, next = {}) => {
}
return curr[key] === val
})
return result
}