fixed EmployeesIndexSettingsModal: Handle empty right->left action and empty leftList... #24

This commit is contained in:
Sockenklaus
2021-11-15 22:04:24 +01:00
parent 174cb17b04
commit bcbfa09edd
6 changed files with 72 additions and 63 deletions

View File

@@ -39,9 +39,16 @@
</div>
</div>
</div>
<div class="modal-footer"></div>
<div class="modal-footer">
Clicked Right:<br>
{{clickedRight}}<br>
<br>
Clicke left:<br>
{{clickedLeft}}
</div>
</div>
</div>
</div>
@@ -77,13 +84,21 @@ const clickedLeft = ref('')
const clickedRight = ref('')
function moveLeft() {
leftColumn.value.push(clickedRight.value)
_pull(rightColumn.value, clickedRight.value)
if(clickedRight.value){
let index = rightColumn.value.indexOf(clickedRight.value)
leftColumn.value.push(clickedRight.value)
_pull(rightColumn.value, clickedRight.value)
clickedRight.value = rightColumn.value[index <= rightColumn.value.length ? index : rightColumn.value.length]
}
}
function moveRight() {
rightColumn.value.push(clickedLeft.value)
_pull(leftColumn.value, clickedLeft.value)
if(clickedLeft.value){
let index = leftColumn.value.indexOf(clickedLeft.value)
rightColumn.value.push(clickedLeft.value)
_pull(leftColumn.value, clickedLeft.value)
clickedLeft.value = leftColumn.value[index <= leftColumn.value.length ? index : leftColumn.value.length]
}
}
function colUp(clicked : string, array : string[]){

View File

@@ -2,7 +2,7 @@
AddEmployeeModal(
:searchData="store.rows"
:searchData="store.state.rows"
:searchFields="['first_name', 'last_name']"
:searchRow="addEmployeeRow"
:modalId="modalId"

View File

@@ -65,8 +65,7 @@ function onCancel() {
transition: all .1s ease-in-out
}
&enter-from,
&leave-to {
&enter-from {
@include animation-target(15px)
}