Skip to content

Commit

Permalink
Refactor #3538
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jan 16, 2023
1 parent 6ba55cd commit d148807
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions components/paginator/JumpToPageInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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>

<script>
Expand All @@ -20,13 +20,18 @@ export default {
};
},
watch: {
d_page(newValue) {
this.$emit('page-change', newValue - 1);
},
page(newValue) {
this.d_page = newValue;
}
},
methods: {
onChange(value) {
if (value !== this.page) {
this.d_page = value;
this.$emit('page-change', value - 1);
}
}
},
computed: {
inputArialabel() {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.jumpToPageInputLabel : undefined;
Expand Down
2 changes: 1 addition & 1 deletion components/paginator/Paginator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
<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>
<div v-if="$slots.end" class="p-paginator-right-content">
<slot name="end" :state="currentState"></slot>
Expand Down

0 comments on commit d148807

Please sign in to comment.