Merge branch 'master' of https://github.com/primefaces/primevue
commit
bb82b6aae1
|
@ -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: {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
onChange(value) {
|
||||
this.$emit('page-change', value);
|
||||
this.$emit('page-change', value - 1);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -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"
|
||||
@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: {
|
||||
|
|
Loading…
Reference in New Issue