2022-09-06 12:03:37 +00:00
|
|
|
<template>
|
2023-01-10 08:09:59 +00:00
|
|
|
<JTPInput ref="jtpInput" v-model="d_page" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled"></JTPInput>
|
2022-09-06 12:03:37 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import InputNumber from 'primevue/inputnumber';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'JumpToPageInput',
|
|
|
|
inheritAttrs: false,
|
|
|
|
emits: ['page-change'],
|
|
|
|
props: {
|
|
|
|
page: Number,
|
|
|
|
pageCount: Number,
|
|
|
|
disabled: Boolean
|
|
|
|
},
|
2023-01-10 07:57:30 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2023-01-10 08:09:59 +00:00
|
|
|
d_page: null
|
2023-01-10 07:57:30 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
2023-01-10 08:09:59 +00:00
|
|
|
d_page(newValue) {
|
2023-01-10 07:57:30 +00:00
|
|
|
if (this.$refs.jtpInput && !this.$refs.jtpInput.focused) return;
|
|
|
|
|
|
|
|
this.$emit('page-change', newValue - 1);
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
},
|
2023-01-10 07:57:30 +00:00
|
|
|
mounted() {
|
2023-01-10 08:09:59 +00:00
|
|
|
this.d_page = this.page;
|
2023-01-10 07:57:30 +00:00
|
|
|
},
|
2022-12-08 11:04:25 +00:00
|
|
|
computed: {
|
|
|
|
inputArialabel() {
|
|
|
|
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.jumpToPageInputLabel : undefined;
|
|
|
|
}
|
|
|
|
},
|
2022-09-06 12:03:37 +00:00
|
|
|
components: {
|
2022-09-14 11:26:01 +00:00
|
|
|
JTPInput: InputNumber
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
</script>
|