Discover: sidebarFilter - Sequence -> Sequnce add dblclick teature done.

This commit is contained in:
chiayin
2023-06-12 09:30:52 +08:00
parent 6b3251e9eb
commit d9b43b9f4e
3 changed files with 63 additions and 53 deletions

View File

@@ -13,10 +13,10 @@
<th class="font-semibold leading-10 px-2 border-b border-neutral-500 text-start" colspan="3">Occurrences</th>
</tr>
</thead>
<Draggable :list="data" group="people" itemKey="name" tag="tbody" animation="300" @end="onEnd">
<Draggable :list="data" group="people" itemKey="name" tag="tbody" animation="300" @end="onEnd" :fallbackTolerance="5" >
<template #item="{ element, index }">
<tr>
<td class="px-4 py-2">{{ element.label }}</td>
<tr @dblclick="moveActItem(index, element)">
<td class="px-4 py-2" :id="element.label">{{ element.label }}</td>
<td class="px-4 py-2 w-24">
<div class="h-4 min-w-[96px] bg-neutral-300 rounded-sm overflow-hidden">
<div class="h-full bg-primary" :style="progressWidth(element.occ_value)"></div>
@@ -39,11 +39,11 @@
</div>
<!-- Have Data -->
<div class="py-4 m-auto w-full h-[calc(100%_-_56px)]">
<div class="w-full h-full overflow-y-auto overflow-x-auto scrollbar px-4 text-center">
<div class="w-full h-full overflow-y-auto overflow-x-auto scrollbar px-4 text-center ">
<draggable class="h-full" :list="listSequence" group="people" itemKey="name" animation="300" @end="onEnd">
<template #item="{ element, index }">
<div>
<div class="w-full p-2 border border-primary rounded text-primary">
<div class="w-full p-2 border border-primary rounded text-primary" @dblclick="moveSeqItem(index, element)">
<span>{{ element.label }}</span>
</div>
<span v-show="index !== listSeq.length - 1" class="pi pi-chevron-down !text-lg inline-block py-2 "></span>
@@ -86,6 +86,15 @@ export default {
}
},
methods: {
moveActItem(index, element){
this.data.splice(index, 1);
this.listSequence.push(element)
},
moveSeqItem(index, element){
this.listSequence.splice(index, 1);
this.data.push(element);
},
onEnd() {
this.$emit('update:listSeq', this.listSequence);
}

View File

@@ -131,7 +131,6 @@ export default{
},
watch:{
selectTimeFrame(newValue, oldValue) {
console.log(newValue); // []
if(newValue.length === 0) {
this.startTime = new Date(getMoment(this.filterTimeframe.x_axis.min).format());
this.endTime = new Date(getMoment(this.filterTimeframe.x_axis.max).format());