xdriver 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/table.d.ts +0 -2
- package/lib/table.js +10 -16
- package/package.json +1 -1
- package/src/table.ts +10 -22
package/lib/table.d.ts
CHANGED
package/lib/table.js
CHANGED
|
@@ -152,30 +152,24 @@ export class Pagination {
|
|
|
152
152
|
return this._pageSize;
|
|
153
153
|
}
|
|
154
154
|
get hasNext() {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
get hasPrev() {
|
|
158
|
-
return this._pageIndex > 1;
|
|
159
|
-
}
|
|
160
|
-
get data() {
|
|
161
|
-
let start = (this._pageIndex - 1) * this._pageSize;
|
|
162
|
-
let end = start + this._pageSize;
|
|
163
|
-
return this._data.slice(start, end);
|
|
164
|
-
}
|
|
165
|
-
prev() {
|
|
166
|
-
if (this.hasPrev) {
|
|
167
|
-
this._pageIndex--;
|
|
155
|
+
if (this._pageIndex * this._pageSize < this._total) {
|
|
156
|
+
this._pageIndex++;
|
|
168
157
|
return true;
|
|
169
158
|
}
|
|
170
159
|
return false;
|
|
171
160
|
}
|
|
172
|
-
|
|
173
|
-
if (this.
|
|
174
|
-
this._pageIndex
|
|
161
|
+
get hasPrev() {
|
|
162
|
+
if (this._pageIndex > 1) {
|
|
163
|
+
this._pageIndex--;
|
|
175
164
|
return true;
|
|
176
165
|
}
|
|
177
166
|
return false;
|
|
178
167
|
}
|
|
168
|
+
get data() {
|
|
169
|
+
let start = (this._pageIndex - 1) * this._pageSize;
|
|
170
|
+
let end = start + this._pageSize;
|
|
171
|
+
return this._data.slice(start, end);
|
|
172
|
+
}
|
|
179
173
|
}
|
|
180
174
|
export default class Table {
|
|
181
175
|
constructor(table, database) {
|
package/package.json
CHANGED
package/src/table.ts
CHANGED
|
@@ -251,14 +251,22 @@ export class Pagination<T extends Row> {
|
|
|
251
251
|
* 是否有下一页
|
|
252
252
|
*/
|
|
253
253
|
get hasNext(): boolean {
|
|
254
|
-
|
|
254
|
+
if (this._pageIndex * this._pageSize < this._total) {
|
|
255
|
+
this._pageIndex++;
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
/**
|
|
258
262
|
* 是否有上一页
|
|
259
263
|
*/
|
|
260
264
|
get hasPrev(): boolean {
|
|
261
|
-
|
|
265
|
+
if (this._pageIndex > 1) {
|
|
266
|
+
this._pageIndex--;
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
/**
|
|
@@ -269,26 +277,6 @@ export class Pagination<T extends Row> {
|
|
|
269
277
|
let end = start + this._pageSize;
|
|
270
278
|
return this._data.slice(start, end);
|
|
271
279
|
}
|
|
272
|
-
/**
|
|
273
|
-
* 上一页
|
|
274
|
-
*/
|
|
275
|
-
prev(): boolean {
|
|
276
|
-
if (this.hasPrev) {
|
|
277
|
-
this._pageIndex--;
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* 下一页
|
|
284
|
-
*/
|
|
285
|
-
next(): boolean {
|
|
286
|
-
if (this.hasNext) {
|
|
287
|
-
this._pageIndex++;
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
280
|
}
|
|
293
281
|
|
|
294
282
|
export default class Table implements ITable{
|