Merge pull request #3539 from primefaces/issue-3538

JumpToPageInput: changing input value issue fixed
pull/3545/head 3.22.2
Tuğçe Küçükoğlu 2023-01-16 15:25:10 +03:00 committed by GitHub
commit d514ae2bc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<JTPInput ref="jtpInput" v-model="d_page" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled"></JTPInput> <JTPInput ref="jtpInput" :modelValue="d_page" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled" @update:modelValue="onChange"></JTPInput>
</template> </template>
<script> <script>
@ -16,18 +16,21 @@ export default {
}, },
data() { data() {
return { return {
d_page: null d_page: this.page
}; };
}, },
watch: { watch: {
d_page(newValue) { page(newValue) {
if (this.$refs.jtpInput && !this.$refs.jtpInput.focused) return; this.d_page = newValue;
this.$emit('page-change', newValue - 1);
} }
}, },
mounted() { methods: {
this.d_page = this.page; onChange(value) {
if (value !== this.page) {
this.d_page = value;
this.$emit('page-change', value - 1);
}
}
}, },
computed: { computed: {
inputArialabel() { inputArialabel() {

View File

@ -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' && currentPage" :page="currentPage" @page-change="changePage($event)" :disabled="empty" /> <JumpToPageInput v-else-if="item === 'JumpToPageInput'" :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>