mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-24 01:50:38 +00:00
- fileinfodetail renamed to clipboard
This commit is contained in:
+31
-33
@@ -5,12 +5,14 @@ import router from '@/router'
|
||||
import i18n from '@/i18n/index'
|
||||
|
||||
const defaultState = {
|
||||
fileInfoDetail: [],
|
||||
currentFolder: undefined,
|
||||
navigation: undefined,
|
||||
|
||||
isSearching: false,
|
||||
browseHistory: [],
|
||||
isLoading: true,
|
||||
|
||||
browseHistory: [],
|
||||
clipboard: [],
|
||||
data: [],
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ const actions = {
|
||||
// Set folder location
|
||||
payload.folder.location = payload.folder.deleted_at || payload.folder.location === 'trash' ? 'trash' : 'base'
|
||||
|
||||
if (! payload.back && !payload.sorting)
|
||||
if (!payload.back && !payload.sorting)
|
||||
commit('STORE_PREVIOUS_FOLDER', getters.currentFolder)
|
||||
|
||||
let url = payload.folder.location === 'trash'
|
||||
@@ -77,7 +79,7 @@ const actions = {
|
||||
})
|
||||
|
||||
axios
|
||||
.get(getters.api + '/browse/latest' )
|
||||
.get(getters.api + '/browse/latest')
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
events.$emit('scrollTop')
|
||||
@@ -175,7 +177,6 @@ const actions = {
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
},
|
||||
getFolderTree: ({commit, getters}) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
// Get route
|
||||
@@ -204,14 +205,14 @@ const actions = {
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
UPDATE_FOLDER_TREE(state, tree) {
|
||||
state.navigation = tree
|
||||
},
|
||||
LOADING_STATE(state, payload) {
|
||||
state.fileInfoDetail= []
|
||||
state.clipboard = []
|
||||
state.data = payload.data
|
||||
state.isLoading = payload.loading
|
||||
},
|
||||
UPDATE_FOLDER_TREE(state, tree) {
|
||||
state.navigation = tree
|
||||
},
|
||||
FLUSH_FOLDER_HISTORY(state) {
|
||||
state.browseHistory = []
|
||||
},
|
||||
@@ -227,9 +228,10 @@ const mutations = {
|
||||
state.browseHistory.pop()
|
||||
},
|
||||
CHANGE_ITEM_NAME(state, updatedFile) {
|
||||
// Rename filename in file info detail
|
||||
if (state.fileInfoDetail && state.fileInfoDetail.id === updatedFile.id) {
|
||||
state.fileInfoDetail = updatedFile
|
||||
|
||||
// Rename filename in clipboard
|
||||
if (state.clipboard && state.clipboard.id === updatedFile.id) {
|
||||
state.clipboard = updatedFile
|
||||
}
|
||||
|
||||
// Rename item name in data view
|
||||
@@ -241,26 +243,6 @@ const mutations = {
|
||||
}
|
||||
})
|
||||
},
|
||||
REMOVE_ITEM_FILEINFO_DETAIL(state,item) {
|
||||
state.fileInfoDetail = state.fileInfoDetail.filter(element => element.id !== item.id)
|
||||
},
|
||||
CLEAR_FILEINFO_DETAIL(state) {
|
||||
state.fileInfoDetail = []
|
||||
},
|
||||
LOAD_FILEINFO_DETAIL(state, item) {
|
||||
state.fileInfoDetail = []
|
||||
state.fileInfoDetail.push(item)
|
||||
},
|
||||
GET_FILEINFO_DETAIL(state, item) {
|
||||
let selectedItem = state.data.find(el => el.id === item.id)
|
||||
|
||||
if(state.fileInfoDetail.includes(selectedItem)) return
|
||||
|
||||
state.fileInfoDetail.push(selectedItem ? selectedItem : state.currentFolder)
|
||||
},
|
||||
SELECT_ALL_FILES(state){
|
||||
state.fileInfoDetail = state.data
|
||||
},
|
||||
CHANGE_SEARCHING_STATE(state, searchState) {
|
||||
state.isSearching = searchState
|
||||
},
|
||||
@@ -286,10 +268,26 @@ const mutations = {
|
||||
STORE_CURRENT_FOLDER(state, folder) {
|
||||
state.currentFolder = folder
|
||||
},
|
||||
REMOVE_ITEM_FROM_CLIPBOARD(state, item) {
|
||||
state.clipboard = state.clipboard.filter(element => element.id !== item.id)
|
||||
},
|
||||
ADD_ALL_ITEMS_TO_CLIPBOARD(state) {
|
||||
state.clipboard = state.data
|
||||
},
|
||||
ADD_ITEM_TO_CLIPBOARD(state, item) {
|
||||
let selectedItem = state.data.find(el => el.id === item.id)
|
||||
|
||||
if (state.clipboard.includes(selectedItem)) return
|
||||
|
||||
state.clipboard.push(selectedItem ? selectedItem : state.currentFolder)
|
||||
},
|
||||
CLIPBOARD_CLEAR(state) {
|
||||
state.clipboard = []
|
||||
},
|
||||
}
|
||||
|
||||
const getters = {
|
||||
fileInfoDetail: state => state.fileInfoDetail,
|
||||
clipboard: state => state.clipboard,
|
||||
currentFolder: state => state.currentFolder,
|
||||
browseHistory: state => state.browseHistory,
|
||||
isSearching: state => state.isSearching,
|
||||
|
||||
Reference in New Issue
Block a user