svelte-common 6.7.3 → 6.7.5

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/pagination.mjs +7 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.7.3",
3
+ "version": "6.7.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "svelte-command": "^1.1.50",
45
- "svelte-entitlement": "^1.2.65"
45
+ "svelte-entitlement": "^1.2.66"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@semantic-release/commit-analyzer": "^11.0.0",
@@ -53,13 +53,13 @@
53
53
  "c8": "^8.0.1",
54
54
  "documentation": "^14.0.2",
55
55
  "mf-styling": "^3.0.5",
56
- "npm-pkgbuild": "^12.1.3",
56
+ "npm-pkgbuild": "^12.1.5",
57
57
  "semantic-release": "^22.0.5",
58
58
  "stylelint": "^15.10.3",
59
59
  "stylelint-config-standard": "^34.0.0",
60
60
  "svelte": "^4.2.1",
61
61
  "testcafe": "^3.3.0",
62
- "vite": "^4.4.9",
62
+ "vite": "^4.4.11",
63
63
  "vite-plugin-compression2": "^0.10.5"
64
64
  },
65
65
  "optionalDependencies": {
@@ -28,6 +28,7 @@ export class Pagination {
28
28
 
29
29
  set filter(filter) {
30
30
  this.#filter = filter;
31
+ this.recalibrateCurrentPage();
31
32
  this.fireSubscriptions();
32
33
  }
33
34
 
@@ -44,11 +45,15 @@ export class Pagination {
44
45
  return this.#sorter;
45
46
  }
46
47
 
47
- set _data(data) {
48
- this.#data = data;
48
+ recalibrateCurrentPage() {
49
49
  if (this.page > this.numberOfPages) {
50
50
  this.page = this.numberOfPages;
51
51
  }
52
+ }
53
+
54
+ set _data(data) {
55
+ this.#data = data;
56
+ this.recalibrateCurrentPage();
52
57
  this.fireSubscriptions();
53
58
  }
54
59
 
@@ -261,30 +266,4 @@ export function* navigationItems(
261
266
  yield n;
262
267
  }
263
268
  }
264
-
265
- /*
266
- const pageJumps = [
267
- { maxPages: 10, stepping: [1] },
268
- { maxPages: 100, stepping: [1, 10] },
269
- { maxPages: 1000, stepping: [1, 10, 100] },
270
- { maxPages: 10000, stepping: [1, 100, 1000] },
271
- { maxPages: 100000, stepping: [1, 1000, 10000] }
272
- ];
273
-
274
- for (const j of pageJumps) {
275
- if (numberOfPages <= j.maxPages) {
276
- yield 1;
277
- for (const s of j.stepping) {
278
- for (let n = currentPage - s; n < currentPage + s; n++) {
279
- yield n;
280
- }
281
- yield currentPage;
282
- }
283
-
284
- yield numberOfPages;
285
-
286
- break;
287
- }
288
- }
289
- */
290
269
  }