svelte-common 6.6.13 → 6.7.1
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/filter.mjs +9 -1
- package/src/pagination.mjs +14 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"semantic-release": "^22.0.0",
|
|
58
58
|
"stylelint": "^15.10.3",
|
|
59
59
|
"stylelint-config-standard": "^34.0.0",
|
|
60
|
-
"svelte": "^4.2.
|
|
60
|
+
"svelte": "^4.2.1",
|
|
61
61
|
"testcafe": "^3.3.0",
|
|
62
62
|
"vite": "^4.4.9",
|
|
63
|
-
"vite-plugin-compression2": "^0.10.
|
|
63
|
+
"vite-plugin-compression2": "^0.10.5"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
66
|
"mf-hosting-cloudflare": "^1.0.5",
|
package/src/filter.mjs
CHANGED
|
@@ -16,7 +16,14 @@ function collectionOp(value, against, op) {
|
|
|
16
16
|
|
|
17
17
|
function allOp(value, against, op) {
|
|
18
18
|
switch (typeof value) {
|
|
19
|
-
case "
|
|
19
|
+
case "undefined":
|
|
20
|
+
return false;
|
|
21
|
+
|
|
22
|
+
case "object":
|
|
23
|
+
if (value === null) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
if (value instanceof Map) {
|
|
21
28
|
return collectionOp(value.keys(), against, op);
|
|
22
29
|
}
|
|
@@ -138,6 +145,7 @@ function allOp(value, against, op) {
|
|
|
138
145
|
return value == against;
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
console.log("C", value, against);
|
|
141
149
|
return false;
|
|
142
150
|
}
|
|
143
151
|
|
package/src/pagination.mjs
CHANGED
|
@@ -109,22 +109,25 @@ export class Pagination {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
+
* Total number of items (filtered).
|
|
112
113
|
* @return {number}
|
|
113
114
|
*/
|
|
114
|
-
get
|
|
115
|
-
let n;
|
|
116
|
-
|
|
115
|
+
get numberOfItems() {
|
|
117
116
|
if (this.filter) {
|
|
118
|
-
|
|
117
|
+
const data = Array.isArray(this.data)
|
|
119
118
|
? this.#data
|
|
120
119
|
: [...this.#data.values()];
|
|
121
|
-
|
|
122
|
-
n = data.length;
|
|
123
|
-
} else {
|
|
124
|
-
n = Array.isArray(this.#data) ? this.#data.length : this.#data.size;
|
|
120
|
+
return data.filter(this.filter).length;
|
|
125
121
|
}
|
|
126
122
|
|
|
127
|
-
return
|
|
123
|
+
return Array.isArray(this.#data) ? this.#data.length : this.#data.size;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @return {number}
|
|
128
|
+
*/
|
|
129
|
+
get numberOfPages() {
|
|
130
|
+
return Math.ceil(this.numberOfItems / this.itemsPerPage);
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
/**
|
|
@@ -247,7 +250,8 @@ export function* navigationItems(
|
|
|
247
250
|
) {
|
|
248
251
|
const edge = 2;
|
|
249
252
|
const side = 1;
|
|
250
|
-
const step =
|
|
253
|
+
const step =
|
|
254
|
+
numberOfPages >= 100 ? Math.floor(numberOfPages / 10) : undefined;
|
|
251
255
|
|
|
252
256
|
for (let n = 1; n <= numberOfPages; n++) {
|
|
253
257
|
if (
|