pull/1613/head
Cagatay Civici 2021-09-24 13:31:28 +03:00
commit bb82b6aae1
4 changed files with 18 additions and 8 deletions

View File

@ -1,8 +1,8 @@
<template>
<div :class="containerClass" @click="onClick($event)" :style="style">
<div class="p-hidden-accessible">
<input ref="input" type="checkbox" :checked="modelValue" v-bind="$attrs" @focus="onFocus($event)" @blur="onBlur($event)" @keydown.enter.prevent="onClick($event)"
role="switch" :aria-checked="modelValue">
<input ref="input" type="checkbox" :checked="checked" v-bind="$attrs" @focus="onFocus($event)" @blur="onBlur($event)" @keydown.enter.prevent="onClick($event)"
role="switch" :aria-checked="checked">
</div>
<span class="p-inputswitch-slider"></span>
</div>
@ -14,7 +14,10 @@ export default {
inheritAttrs: false,
emits: ['click', 'update:modelValue', 'change', 'input'],
props: {
modelValue: Boolean,
modelValue: {
type: null,
default: false
},
class: null,
style: null,
trueValue: {

View File

@ -10,6 +10,10 @@
type: Number,
default: 0
},
currentPage: {
type: Number,
default: 0
},
page: {
type: Number,
default: 0
@ -34,7 +38,7 @@
computed: {
text() {
let text = this.template
.replace("{currentPage}", this.pageCount > 0 ? this.page + 1 : 0)
.replace("{currentPage}", this.currentPage)
.replace("{totalPages}", this.pageCount)
.replace("{first}", this.pageCount > 0 ? this.first + 1 : 0)
.replace("{last}", Math.min(this.first + this.rows, this.totalRecords))

View File

@ -16,7 +16,7 @@ export default {
},
methods: {
onChange(value) {
this.$emit('page-change', value);
this.$emit('page-change', value - 1);
}
},
components: {

View File

@ -9,13 +9,13 @@
<NextPageLink v-else-if="item === 'NextPageLink'" @click="changePageToNext($event)" :disabled="isLastPage || empty" />
<LastPageLink v-else-if="item === 'LastPageLink'" @click="changePageToLast($event)" :disabled="isLastPage || empty" />
<PageLinks v-else-if="item === 'PageLinks'" :value="pageLinks" :page="page" @click="changePageLink($event)" />
<CurrentPageReport v-else-if="item === 'CurrentPageReport'" :template="currentPageReportTemplate"
<CurrentPageReport v-else-if="item === 'CurrentPageReport'" :template="currentPageReportTemplate" :currentPage="currentPage"
:page="page" :pageCount="pageCount" :first="d_first" :rows="d_rows" :totalRecords="totalRecords" />
<RowsPerPageDropdown v-else-if="item === 'RowsPerPageDropdown' && rowsPerPageOptions" :rows="d_rows"
:options="rowsPerPageOptions" @rows-change="onRowChange($event)" :disabled="empty"/>
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :page="page" :pageCount="pageCount"
<JumpToPageDropdown v-else-if="item === 'JumpToPageDropdown'" :page="page" :pageCount="pageCount"
@page-change="changePage($event)" :disabled="empty"/>
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="page" @page-change="changePage($event)" :disabled="empty"/>
<JumpToPageInput v-else-if="item === 'JumpToPageInput'" :page="currentPage" @page-change="changePage($event)" :disabled="empty"/>
</template>
<div class="p-paginator-right-content" v-if="$slots.right">
<slot name="right" :state="currentState"></slot>
@ -194,6 +194,9 @@ export default {
},
empty() {
return this.pageCount === 0;
},
currentPage() {
return this.pageCount > 0 ? this.page + 1 : 0;
}
},
components: {