edit: ajout method open folder/file dans link pannel
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import CloseIcon from '../assets/icons/close.svg'
|
import CloseIcon from '../assets/icons/close.svg'
|
||||||
import FolderIcon from '../assets/icons/folder.svg'
|
import FolderIcon from '../assets/icons/folder.svg'
|
||||||
import FileIcon from '../assets/icons/file.svg'
|
import FileIcon from '../assets/icons/file.svg'
|
||||||
|
import ReloadIcon from '../assets/icons/reload.svg'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -16,24 +17,35 @@
|
|||||||
<div class="windowTitle">
|
<div class="windowTitle">
|
||||||
<div class="titleContent">
|
<div class="titleContent">
|
||||||
<p>./ExternalLinks.333</p>
|
<p>./ExternalLinks.333</p>
|
||||||
<button type="button" class="titleBtn" @mousedown.stop @touchstart="$emit('close')" @click="$emit('close')">
|
<button type="button" class="titleBtn" id="rootBtn" v-show="isNotRoot" @mousedown.stop @touchstart="dataFirstLoad" @click="dataFirstLoad">
|
||||||
|
<ReloadIcon name="close" class="icon"/>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="titleBtn" @mousedown.stop @touchstart="$emit('close')" @click="closeClicked">
|
||||||
<CloseIcon name="close" class="icon"/>
|
<CloseIcon name="close" class="icon"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--CONTENU-->
|
<!--CONTENU-->
|
||||||
<div class="theMatrix" @mousedown.stop @touchstart.stop>
|
<p id="emptyFolderText" class="itemCaption" v-show="emptyFolder">Oops! There is nothing to display here...</p>
|
||||||
<div class="itemStyle" v-for="item in displayedItems" :key="item.caption">
|
<div class="theMatrix" @mousedown.stop @touchstart.stop @reload="dataFirstLoad">
|
||||||
|
<div class="itemStyle" v-for="item in displayedItems" :key="item.caption" @click="openClickedFile(item)">
|
||||||
<component :is="item.type==='folder'? FolderIcon : FileIcon" class="icon"/>
|
<component :is="item.type==='folder'? FolderIcon : FileIcon" class="icon"/>
|
||||||
<p class="itemCaption">{{item.caption}}</p>
|
<p class="itemCaption">{{item.caption}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/*=====================LinkPannel CSS*/
|
/*=====================LinkPannel CSS*/
|
||||||
|
#rootBtn{
|
||||||
|
margin-left: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#emptyFolderText{
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.theMatrix{
|
.theMatrix{
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
@@ -43,6 +55,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemStyle{
|
.itemStyle{
|
||||||
@@ -88,6 +101,9 @@
|
|||||||
#linkPannel{
|
#linkPannel{
|
||||||
background-color: var(--dark-color);
|
background-color: var(--dark-color);
|
||||||
cursor:grab;
|
cursor:grab;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=====================format pc*/
|
/*=====================format pc*/
|
||||||
@@ -95,6 +111,10 @@
|
|||||||
#linkPannel{
|
#linkPannel{
|
||||||
width:666px;
|
width:666px;
|
||||||
height:666px;
|
height:666px;
|
||||||
|
margin-left: -333px;
|
||||||
|
}
|
||||||
|
#rootBtn{
|
||||||
|
margin-left: 390px;
|
||||||
}
|
}
|
||||||
.theMatrix{
|
.theMatrix{
|
||||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
@@ -109,6 +129,9 @@
|
|||||||
width:333px;
|
width:333px;
|
||||||
height:666px;
|
height:666px;
|
||||||
}
|
}
|
||||||
|
#rootBtn{
|
||||||
|
margin-left: 59px;
|
||||||
|
}
|
||||||
.theMatrix{
|
.theMatrix{
|
||||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||||
grid-auto-rows: 180px;
|
grid-auto-rows: 180px;
|
||||||
@@ -121,23 +144,37 @@
|
|||||||
const linksData = [
|
const linksData = [
|
||||||
{
|
{
|
||||||
type: "folder",
|
type: "folder",
|
||||||
caption: "Folder001"
|
caption: "Folder001",
|
||||||
},
|
children: [{
|
||||||
{
|
|
||||||
type: "folder",
|
type: "folder",
|
||||||
caption: "Folder002"
|
caption: "test-open",
|
||||||
},
|
children: []
|
||||||
{
|
|
||||||
type: "folder",
|
|
||||||
caption: "Folder333"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "folder",
|
|
||||||
caption: "test"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "file",
|
type: "file",
|
||||||
caption: "READ-ME.txt"
|
caption: "READ-ME002.txt",
|
||||||
|
src: ""
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "folder",
|
||||||
|
caption: "Folder002",
|
||||||
|
children: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "folder",
|
||||||
|
caption: "Folder333",
|
||||||
|
children: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "folder",
|
||||||
|
caption: "test",
|
||||||
|
children: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "file",
|
||||||
|
caption: "READ-ME.txt",
|
||||||
|
src: ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -174,8 +211,30 @@
|
|||||||
observer.observe(container);
|
observer.observe(container);
|
||||||
},
|
},
|
||||||
dataFirstLoad(){
|
dataFirstLoad(){
|
||||||
this.displayedItems = linksData;
|
this.displayedItems = [...linksData];
|
||||||
console.log(this.displayedItems);
|
console.log(this.displayedItems);
|
||||||
|
this.isNotRoot = false;
|
||||||
|
this.checkEmptyFolder();
|
||||||
|
},
|
||||||
|
openClickedFile(e){
|
||||||
|
if(e.type === 'folder'){
|
||||||
|
this.displayedItems = [...e.children];
|
||||||
|
this.checkEmptyFolder();
|
||||||
|
this.isNotRoot = true;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkEmptyFolder(){
|
||||||
|
if (this.displayedItems.length === 0){
|
||||||
|
this.emptyFolder = true;
|
||||||
|
}else{
|
||||||
|
this.emptyFolder = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeClicked(){
|
||||||
|
this.dataFirstLoad();
|
||||||
|
this.$emit('close');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
@@ -184,7 +243,9 @@
|
|||||||
bodyWidth:0,
|
bodyWidth:0,
|
||||||
coordX:0,
|
coordX:0,
|
||||||
coordY:0,
|
coordY:0,
|
||||||
displayedItems:[]
|
displayedItems:[],
|
||||||
|
emptyFolder: false,
|
||||||
|
isNotRoot : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
|||||||
Reference in New Issue
Block a user