Fixed for Ordelist PickList components #3447
parent
8bc2c630e5
commit
537f01a5a3
|
@ -31,7 +31,7 @@
|
|||
v-bind="listProps"
|
||||
>
|
||||
<template v-for="(item, i) of modelValue" :key="getItemKey(item, i)">
|
||||
<li :id="id + '_' + i" v-ripple role="option" :class="itemClass(item, `${id}_${i}`)" @click="onItemClick($event, item, i)" @touchend="onItemTouchEnd" :aria-selected="isSelected(item)">
|
||||
<li :id="id + '_' + i" v-ripple role="option" :class="itemClass(item, `${id}_${i}`)" @click="onItemClick($event, item, i)" @touchend="onItemTouchEnd" :aria-selected="isSelected(item)" @mousedown="onOptionMouseDown(i)">
|
||||
<slot name="item" :item="item" :index="i"> </slot>
|
||||
</li>
|
||||
</template>
|
||||
|
@ -148,9 +148,12 @@ export default {
|
|||
},
|
||||
onListFocus(event) {
|
||||
const selectedFirstItem = DomHandler.findSingle(this.list, 'li.p-orderlist-item.p-highlight');
|
||||
const index = selectedFirstItem ? ObjectUtils.findIndexInList(selectedFirstItem, this.list.children) : '0';
|
||||
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.list.children);
|
||||
|
||||
this.focused = true;
|
||||
|
||||
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
||||
|
||||
this.changeFocusedOptionIndex(index);
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
|
@ -195,6 +198,10 @@ export default {
|
|||
break;
|
||||
}
|
||||
},
|
||||
onOptionMouseDown(index) {
|
||||
this.focused = true;
|
||||
this.focusedOptionIndex = index;
|
||||
},
|
||||
onArrowDownKey(event) {
|
||||
const optionIndex = this.findNextOptionIndex(this.focusedOptionIndex);
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
@click="onItemClick($event, item, i, 0)"
|
||||
@dblclick="onItemDblClick($event, item, 0)"
|
||||
@touchend="onItemTouchEnd"
|
||||
@mousedown="onOptionMouseDown(i, 'sourceList')"
|
||||
role="option"
|
||||
:aria-selected="isSelected(item, 0)"
|
||||
>
|
||||
|
@ -80,6 +81,7 @@
|
|||
@click="onItemClick($event, item, i, 1)"
|
||||
@dblclick="onItemDblClick($event, item, 1)"
|
||||
@keydown="onItemKeyDown($event, 'targetList')"
|
||||
@mousedown="onOptionMouseDown(i, 'targetList')"
|
||||
@touchend="onItemTouchEnd"
|
||||
role="option"
|
||||
:aria-selected="isSelected(item, 1)"
|
||||
|
@ -236,9 +238,12 @@ export default {
|
|||
},
|
||||
onListFocus(event, listType) {
|
||||
const selectedFirstItem = DomHandler.findSingle(this.$refs[listType].$el, 'li.p-picklist-item.p-highlight');
|
||||
const index = selectedFirstItem ? ObjectUtils.findIndexInList(selectedFirstItem, this.$refs[listType].$el.children) : '0';
|
||||
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.$refs[listType].$el.children);
|
||||
|
||||
this.focused[listType] = true;
|
||||
|
||||
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
||||
|
||||
this.changeFocusedOptionIndex(index, listType);
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
|
@ -247,6 +252,10 @@ export default {
|
|||
this.focusedOptionIndex = -1;
|
||||
this.$emit('blur', event);
|
||||
},
|
||||
onOptionMouseDown(index, listType) {
|
||||
this.focused[listType] = true;
|
||||
this.focusedOptionIndex = index;
|
||||
},
|
||||
moveUp(event, listIndex) {
|
||||
if (this.d_selection && this.d_selection[listIndex]) {
|
||||
let valueList = [...this.modelValue[listIndex]];
|
||||
|
|
Loading…
Reference in New Issue