@fluid-topics/ft-pager 1.1.18 → 1.1.19
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/build/ft-pager.d.ts +1 -1
- package/build/ft-pager.js +29 -17
- package/build/ft-pager.light.js +236 -373
- package/build/ft-pager.min.js +287 -431
- package/package.json +6 -6
package/build/ft-pager.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class FtPager extends FtLitElement implements FtPagerProperties {
|
|
|
10
10
|
nextLabel: string;
|
|
11
11
|
previousLabel: string;
|
|
12
12
|
get resolvedMaxPage(): number;
|
|
13
|
-
get resolvedCurrentPage(): number;
|
|
14
13
|
protected render(): import("lit").TemplateResult<1>;
|
|
14
|
+
private onChange;
|
|
15
15
|
private setPage;
|
|
16
16
|
}
|
package/build/ft-pager.js
CHANGED
|
@@ -6,11 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
|
-
import { FtLitElement
|
|
9
|
+
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-pager.css";
|
|
11
11
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
12
12
|
import { FtIcons } from "@fluid-topics/ft-icon";
|
|
13
|
-
import {
|
|
13
|
+
import { FtNumberField } from "@fluid-topics/ft-number-field";
|
|
14
14
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
15
15
|
class FtPager extends FtLitElement {
|
|
16
16
|
constructor() {
|
|
@@ -28,30 +28,42 @@ class FtPager extends FtLitElement {
|
|
|
28
28
|
}
|
|
29
29
|
return 1;
|
|
30
30
|
}
|
|
31
|
-
get resolvedCurrentPage() {
|
|
32
|
-
return minmax(1, this.currentPage, this.resolvedMaxPage);
|
|
33
|
-
}
|
|
34
31
|
render() {
|
|
32
|
+
let maxPage = this.resolvedMaxPage;
|
|
35
33
|
return html `
|
|
34
|
+
<style>
|
|
35
|
+
ft-number-field::part(input) {
|
|
36
|
+
width: ${Math.max(2, ("" + maxPage).length)}ch;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
</style>
|
|
36
40
|
<div part="container">
|
|
37
41
|
<ft-button icon=${FtIcons.THIN_ARROW_LEFT}
|
|
38
|
-
?disabled="${this.
|
|
39
|
-
@click="${() => this.setPage(this.
|
|
40
|
-
label="${this.previousLabel}"
|
|
42
|
+
?disabled="${this.currentPage == 1}"
|
|
43
|
+
@click="${() => this.setPage(this.currentPage - 1)}"
|
|
44
|
+
label="${this.previousLabel}"
|
|
45
|
+
tooltipPosition="top">
|
|
41
46
|
</ft-button>
|
|
42
|
-
<ft-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
<ft-number-field outlined
|
|
48
|
+
value="${this.currentPage}"
|
|
49
|
+
min="1"
|
|
50
|
+
max="${maxPage}"
|
|
51
|
+
@change="${this.onChange}">
|
|
52
|
+
</ft-number-field>
|
|
53
|
+
<ft-typography variant="body1"> / ${maxPage}</ft-typography>
|
|
47
54
|
<ft-button icon=${FtIcons.THIN_ARROW_RIGHT}
|
|
48
|
-
?disabled="${this.
|
|
49
|
-
@click="${() => this.setPage(this.
|
|
50
|
-
label="${this.nextLabel}"
|
|
55
|
+
?disabled="${this.currentPage == maxPage}"
|
|
56
|
+
@click="${() => this.setPage(this.currentPage + 1)}"
|
|
57
|
+
label="${this.nextLabel}"
|
|
58
|
+
tooltipPosition="top">
|
|
51
59
|
</ft-button>
|
|
52
60
|
</div>
|
|
53
61
|
`;
|
|
54
62
|
}
|
|
63
|
+
onChange(event) {
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
this.setPage(event.detail);
|
|
66
|
+
}
|
|
55
67
|
setPage(page) {
|
|
56
68
|
this.currentPage = page;
|
|
57
69
|
this.dispatchEvent(new CustomEvent("change", { detail: page }));
|
|
@@ -59,7 +71,7 @@ class FtPager extends FtLitElement {
|
|
|
59
71
|
}
|
|
60
72
|
FtPager.elementDefinitions = {
|
|
61
73
|
"ft-button": FtButton,
|
|
62
|
-
"ft-
|
|
74
|
+
"ft-number-field": FtNumberField,
|
|
63
75
|
"ft-typography": FtTypography
|
|
64
76
|
};
|
|
65
77
|
FtPager.styles = styles;
|