PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.2.2
JetFormBuilder — Dynamic Blocks Form Builder v1.2.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / framework / vue-ui / assets / src / js / components / layout / pagination.js
jetformbuilder / framework / vue-ui / assets / src / js / components / layout Last commit date
button.js 5 years ago collapse.js 5 years ago component-wrapper.js 5 years ago list-table-heading.js 5 years ago list-table-item.js 5 years ago list-table.js 5 years ago notice-component.js 5 years ago notice.js 5 years ago pagination.js 5 years ago popup.js 5 years ago repeater-item.js 5 years ago repeater.js 5 years ago tabs-panel.js 5 years ago tabs.js 5 years ago title.js 5 years ago
pagination.js
184 lines
1 import { oneOf } from '../../utils/assist';
2 import { checkConditions } from '../../mixins/check-conditions';
3
4 const Pagination = {
5 name: 'cx-vui-pagination',
6 template: '#cx-vui-pagination',
7 mixins: [ checkConditions ],
8 props: {
9 current: {
10 type: Number,
11 default: 1
12 },
13 total: {
14 type: Number,
15 default: 0
16 },
17 pageSize: {
18 type: Number,
19 default: 10
20 },
21 prevText: {
22 type: String,
23 default: ''
24 },
25 nextText: {
26 type: String,
27 default: ''
28 },
29 customCss: {
30 type: String,
31 default: ''
32 },
33 elementId: {
34 type: String,
35 default: ''
36 },
37 conditions: {
38 type: Array,
39 default() {
40 return [];
41 }
42 },
43 },
44
45 data() {
46 return {
47 baseClass: 'cx-vui-pagination',
48 currentPage: this.current,
49 currentPageSize: this.pageSize
50 };
51 },
52
53 watch: {
54 total ( val ) {
55 let maxPage = Math.ceil( val / this.currentPageSize );
56
57 if ( maxPage < this.currentPage ) {
58 this.currentPage = ( maxPage === 0 ? 1 : maxPage );
59 }
60 },
61 current ( val ) {
62 this.currentPage = val;
63 },
64 pageSize ( val ) {
65 this.currentPageSize = val;
66 }
67 },
68
69 computed: {
70 classesList() {
71
72 let classesList = [
73 this.baseClass,
74 ];
75
76 if ( this.customCss ) {
77 classesList.push( this.customCss );
78 }
79
80 return classesList;
81 },
82
83 prevClasses () {
84 return [
85 `${this.baseClass}-item`,
86 `${this.baseClass}-prev`,
87 {
88 [`${this.baseClass}-disabled`]: this.currentPage === 1 || false,
89 [`${this.baseClass}-custom-text`]: this.prevText !== ''
90 }
91 ];
92 },
93
94 nextClasses () {
95 return [
96 `${this.baseClass}-item`,
97 `${this.baseClass}-next`,
98 {
99 [`${this.baseClass}-disabled`]: this.currentPage === this.allPages || false,
100 [`${this.baseClass}-custom-text`]: this.nextText !== ''
101 }
102 ];
103 },
104
105 firstPageClasses () {
106 return [
107 `${this.baseClass}-item`,
108 {
109 [`${this.baseClass}-item-active`]: this.currentPage === 1
110 }
111 ];
112 },
113
114 lastPageClasses () {
115 return [
116 `${this.baseClass}-item`,
117 {
118 [`${this.baseClass}-item-active`]: this.currentPage === this.allPages
119 }
120 ];
121 },
122
123 allPages () {
124 const allPage = Math.ceil( this.total / this.currentPageSize );
125
126 return ( allPage === 0 ) ? 1 : allPage;
127 },
128 },
129 methods: {
130 changePage ( page ) {
131
132 if ( this.currentPage !== page ) {
133
134 this.currentPage = page;
135 this.$emit( 'update:current', page );
136 this.$emit( 'on-change', page );
137 }
138 },
139
140 prev () {
141 const current = this.currentPage;
142
143 if ( current <= 1 ) {
144 return false;
145 }
146
147 this.changePage( current - 1 );
148 },
149
150 next () {
151 const current = this.currentPage;
152
153 if ( current >= this.allPages ) {
154 return false;
155 }
156
157 this.changePage(current + 1);
158 },
159
160 fastPrev () {
161
162 const page = this.currentPage - 5;
163
164 if ( page > 0 ) {
165 this.changePage( page );
166 } else {
167 this.changePage( 1 );
168 }
169 },
170
171 fastNext () {
172 const page = this.currentPage + 5;
173
174 if ( page > this.allPages ) {
175 this.changePage( this.allPages );
176 } else {
177 this.changePage( page );
178 }
179 },
180 },
181 };
182
183 export default Pagination;
184