Fixed #3409 JumToPageInput issue
parent
e62a65f2fa
commit
9052f5ac5b
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<JTPInput :modelValue="page" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled" @update:modelValue="onChange($event)"></JTPInput>
|
<JTPInput ref="jtpInput" v-model="inputVal" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled"></JTPInput>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -14,11 +14,21 @@ export default {
|
||||||
pageCount: Number,
|
pageCount: Number,
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
methods: {
|
data() {
|
||||||
onChange(value) {
|
return {
|
||||||
this.$emit('page-change', value - 1);
|
inputVal: null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
inputVal(newValue) {
|
||||||
|
if (this.$refs.jtpInput && !this.$refs.jtpInput.focused) return;
|
||||||
|
|
||||||
|
this.$emit('page-change', newValue - 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.inputVal = this.page;
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
inputArialabel() {
|
inputArialabel() {
|
||||||
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.jumpToPageInputLabel : undefined;
|
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.jumpToPageInputLabel : undefined;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
/>
|
/>
|
||||||
<RowsPerPageDropdown v-else-if="item === 'RowsPerPageDropdown' && rowsPerPageOptions" :aria-label="getAriaLabel('rowsPerPageLabel')" :rows="d_rows" :options="rowsPerPageOptions" @rows-change="onRowChange($event)" :disabled="empty" />
|
<RowsPerPageDropdown v-else-if="item === 'RowsPerPageDropdown' && rowsPerPageOptions" :aria-label="getAriaLabel('rowsPerPageLabel')" :rows="d_rows" :options="rowsPerPageOptions" @rows-change="onRowChange($event)" :disabled="empty" />
|
||||||
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :aria-label="getAriaLabel('jumpToPageDropdownLabel')" :page="page" :pageCount="pageCount" @page-change="changePage($event)" :disabled="empty" />
|
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :aria-label="getAriaLabel('jumpToPageDropdownLabel')" :page="page" :pageCount="pageCount" @page-change="changePage($event)" :disabled="empty" />
|
||||||
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="currentPage" @page-change="changePage($event)" :disabled="empty" />
|
<JumpToPageInput v-else-if="item === 'JumpToPageInput' && currentPage" :page="currentPage" @page-change="changePage($event)" :disabled="empty" />
|
||||||
</template>
|
</template>
|
||||||
<div v-if="$slots.end" class="p-paginator-right-content">
|
<div v-if="$slots.end" class="p-paginator-right-content">
|
||||||
<slot name="end" :state="currentState"></slot>
|
<slot name="end" :state="currentState"></slot>
|
||||||
|
|
Loading…
Reference in New Issue