svelte-common 6.8.3 → 6.8.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.
- package/package.json +3 -3
- package/src/pagination.mjs +12 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"ava": "^5.3.1",
|
|
53
53
|
"c8": "^8.0.1",
|
|
54
54
|
"documentation": "^14.0.2",
|
|
55
|
-
"mf-styling": "^3.0.
|
|
56
|
-
"npm-pkgbuild": "^12.1.
|
|
55
|
+
"mf-styling": "^3.0.6",
|
|
56
|
+
"npm-pkgbuild": "^12.1.6",
|
|
57
57
|
"semantic-release": "^22.0.5",
|
|
58
58
|
"stylelint": "^15.10.3",
|
|
59
59
|
"stylelint-config-standard": "^34.0.0",
|
package/src/pagination.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pagination support store.
|
|
3
3
|
* Pages go from 1 ... numberOfPages
|
|
4
|
-
* @param {Map|Array|Store} data
|
|
4
|
+
* @param {Map|Set|Array|Store} data
|
|
5
5
|
* @param {Object} options
|
|
6
6
|
* @param {number} [options.itemsPerPage]
|
|
7
7
|
* @param {Function} [options.sorter]
|
|
@@ -51,22 +51,22 @@ export class Pagination {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
set _data(data) {
|
|
55
|
-
this.#data = data;
|
|
56
|
-
this.recalibrateCurrentPage();
|
|
57
|
-
this.fireSubscriptions();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
set data(data) {
|
|
61
55
|
if (this.#unsubscribeData) {
|
|
62
56
|
this.#unsubscribeData();
|
|
63
57
|
this.#unsubscribeData = undefined;
|
|
64
58
|
}
|
|
65
59
|
|
|
60
|
+
const d = data => {
|
|
61
|
+
this.#data = data;
|
|
62
|
+
this.recalibrateCurrentPage();
|
|
63
|
+
this.fireSubscriptions();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
66
|
if (data?.subscribe) {
|
|
67
|
-
this.#unsubscribeData = data.subscribe(newData => (
|
|
67
|
+
this.#unsubscribeData = data.subscribe(newData => d(newData));
|
|
68
68
|
} else {
|
|
69
|
-
|
|
69
|
+
d(data);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -155,12 +155,9 @@ export class Pagination {
|
|
|
155
155
|
|
|
156
156
|
const n = this.page - 1;
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
n * this.itemsPerPage,
|
|
160
|
-
(
|
|
161
|
-
)) {
|
|
162
|
-
yield item;
|
|
163
|
-
}
|
|
158
|
+
yield* data
|
|
159
|
+
.slice(n * this.itemsPerPage, (n + 1) * this.itemsPerPage)
|
|
160
|
+
[Symbol.iterator]();
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
/**
|