svelte-common 6.3.1 → 6.4.0
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 +9 -9
- package/src/pagination.mjs +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"description": "common components and utils used in svelte apps",
|
|
14
14
|
"keywords": [
|
|
15
15
|
"component",
|
|
16
|
+
"filtering",
|
|
17
|
+
"paginator",
|
|
18
|
+
"sorting",
|
|
16
19
|
"svelte",
|
|
17
20
|
"vite",
|
|
18
|
-
"web"
|
|
19
|
-
"sorting",
|
|
20
|
-
"filtering",
|
|
21
|
-
"paginator"
|
|
21
|
+
"web"
|
|
22
22
|
],
|
|
23
23
|
"contributors": [
|
|
24
24
|
{
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
"ava": "^5.3.1",
|
|
53
53
|
"c8": "^8.0.0",
|
|
54
54
|
"documentation": "^14.0.2",
|
|
55
|
-
"mf-styling": "^3.0.
|
|
56
|
-
"npm-pkgbuild": "^11.
|
|
55
|
+
"mf-styling": "^3.0.2",
|
|
56
|
+
"npm-pkgbuild": "^11.9.1",
|
|
57
57
|
"semantic-release": "^21.0.7",
|
|
58
58
|
"stylelint": "^15.10.1",
|
|
59
59
|
"stylelint-config-standard": "^34.0.0",
|
|
60
60
|
"svelte": "^4.0.5",
|
|
61
61
|
"testcafe": "^3.0.1",
|
|
62
|
-
"vite": "^4.4.
|
|
62
|
+
"vite": "^4.4.4"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
65
|
"mf-hosting-cloudflare": "^1.0.5",
|
|
66
|
-
"mf-hosting-frontend": "^1.
|
|
66
|
+
"mf-hosting-frontend": "^1.11.3"
|
|
67
67
|
},
|
|
68
68
|
"repository": {
|
|
69
69
|
"type": "git",
|
package/src/pagination.mjs
CHANGED
|
@@ -149,6 +149,16 @@ export class Pagination {
|
|
|
149
149
|
const nav = document.createElement("nav");
|
|
150
150
|
nav.setAttribute("aria-label", "pagination");
|
|
151
151
|
|
|
152
|
+
// TODO attach to nav ?
|
|
153
|
+
window.onkeyup = event => {
|
|
154
|
+
switch(event.key) {
|
|
155
|
+
case 'ArrowLeft': this.page = this.page - 1;
|
|
156
|
+
break;
|
|
157
|
+
case 'ArrowRight': this.page = this.page + 1;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
152
162
|
this.subscribe(pg => {
|
|
153
163
|
const items = [];
|
|
154
164
|
const np = this.numberOfPages;
|
|
@@ -162,12 +172,12 @@ export class Pagination {
|
|
|
162
172
|
a.innerText = innerText;
|
|
163
173
|
|
|
164
174
|
if (targetPage < 1 || targetPage > np) {
|
|
165
|
-
a.
|
|
175
|
+
a.setAttribute("aria-disabled", "true");
|
|
166
176
|
a.tabIndex=-1;
|
|
167
177
|
} else {
|
|
168
178
|
if (targetPage === this.page) {
|
|
169
|
-
a.ariaDisabled = "true";
|
|
170
179
|
a.classList.add("active");
|
|
180
|
+
a.setAttribute("aria-disabled", "true");
|
|
171
181
|
a.setAttribute("aria-current", "page");
|
|
172
182
|
} else {
|
|
173
183
|
a.onclick = e => {
|