@m3e/paginator 1.1.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/LICENSE +22 -0
- package/NOTICE.md +8 -0
- package/README.md +130 -0
- package/dist/css-custom-data.json +42 -0
- package/dist/custom-elements.json +3276 -0
- package/dist/html-custom-data.json +90 -0
- package/dist/index.js +693 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +37 -0
- package/dist/index.min.js.map +1 -0
- package/dist/src/PageEventDetail.d.ts +12 -0
- package/dist/src/PageEventDetail.d.ts.map +1 -0
- package/dist/src/PaginatorElement.d.ts +168 -0
- package/dist/src/PaginatorElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from Angular Material Paginator
|
|
3
|
+
* Source: https://github.com/angular/components/blob/main/src/material/paginator/paginator.ts
|
|
4
|
+
*
|
|
5
|
+
* @license MIT
|
|
6
|
+
* Copyright (c) 2025 Google LLC
|
|
7
|
+
* See LICENSE file in the project root for full license text.
|
|
8
|
+
*/
|
|
9
|
+
import { CSSResultGroup, LitElement } from "lit";
|
|
10
|
+
import type { FormFieldVariant } from "@m3e/form-field";
|
|
11
|
+
import { PageEventDetail } from "./PageEventDetail";
|
|
12
|
+
declare const M3ePaginatorElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
13
|
+
/**
|
|
14
|
+
* Provides navigation for paged information, typically used with a table.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* The `m3e-paginator` component is a compact, accessible paginator control for navigating
|
|
18
|
+
* paged data sets. It provides semantic first/previous/next/last navigation controls and an
|
|
19
|
+
* optional page-size selector that integrates with Material design tokens and `m3e-form-field` variants
|
|
20
|
+
* to ensure consistent typography, density, and spacing across applications.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* The following example illustrates use of the `m3e-paginator`. In this example, there are 300 total
|
|
24
|
+
* records and the first/last navigation controls are shown.
|
|
25
|
+
* ```html
|
|
26
|
+
* <m3e-paginator show-first-last-buttons length="300"></m3e-paginator>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @tag m3e-paginator
|
|
30
|
+
*
|
|
31
|
+
* @slot first-page-icon - Slot for a custom first-page icon.
|
|
32
|
+
* @slot previous-page-icon - Slot for a custom previous-page icon.
|
|
33
|
+
* @slot next-page-icon - Slot for a custom next-page icon.
|
|
34
|
+
* @slot last-page-icon - Slot for a custom last-page icon.
|
|
35
|
+
*
|
|
36
|
+
* @attr disabled - Whether the element is disabled.
|
|
37
|
+
* @attr first-page-label - The accessible label given to the button used to move to the first page.
|
|
38
|
+
* @attr hide-page-size - Whether to hide page size selection.
|
|
39
|
+
* @attr items-per-page-label - The label for the page size selector.
|
|
40
|
+
* @attr last-page-label - The accessible label given to the button used to move to the last page.
|
|
41
|
+
* @attr length - The length of the total number of items which are being paginated.
|
|
42
|
+
* @attr next-page-label - The accessible label given to the button used to move to the next page.
|
|
43
|
+
* @attr page-index - The zero-based page index of the displayed list of items.
|
|
44
|
+
* @attr page-size - The number of items to display in a page.
|
|
45
|
+
* @attr page-sizes - A comma separated list of available page sizes.
|
|
46
|
+
* @attr page-size-variant - The appearance variant of the page size field.
|
|
47
|
+
* @attr previous-page-label - The accessible label given to the button used to move to the previous page.
|
|
48
|
+
* @attr show-first-last-buttons - Whether to show first/last buttons.
|
|
49
|
+
*
|
|
50
|
+
* @fires page - Emitted when a user selects a different page size or navigates to another page.
|
|
51
|
+
*
|
|
52
|
+
* @cssprop --m3e-paginator-font-size - The font size used for paginator text.
|
|
53
|
+
* @cssprop --m3e-paginator-font-weight - The font weight used for paginator text.
|
|
54
|
+
* @cssprop --m3e-paginator-line-height - The line height used for paginator text.
|
|
55
|
+
* @cssprop --m3e-paginator-tracking - The letter-spacing used for paginator text.
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export declare class M3ePaginatorElement extends M3ePaginatorElement_base {
|
|
59
|
+
#private;
|
|
60
|
+
/** The styles of the element. */
|
|
61
|
+
static styles: CSSResultGroup;
|
|
62
|
+
private static __nextId;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the element is disabled.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
disabled: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The zero-based page index of the displayed list of items.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
pageIndex: number;
|
|
73
|
+
/**
|
|
74
|
+
* The length of the total number of items which are being paginated.
|
|
75
|
+
* @default 0
|
|
76
|
+
*/
|
|
77
|
+
length: number;
|
|
78
|
+
/**
|
|
79
|
+
* The number of items to display in a page.
|
|
80
|
+
* @default 50
|
|
81
|
+
*/
|
|
82
|
+
pageSize: number | "all";
|
|
83
|
+
/**
|
|
84
|
+
* A comma separated list of available page sizes.
|
|
85
|
+
* @default "5,10,25,50,100"
|
|
86
|
+
*/
|
|
87
|
+
pageSizes: string;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to hide page size selection.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
hidePageSize: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to show first/last buttons.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
showFirstLastButtons: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The label for the page size selector.
|
|
100
|
+
* @default "Items per page:"
|
|
101
|
+
*/
|
|
102
|
+
itemsPerPageLabel: string;
|
|
103
|
+
/**
|
|
104
|
+
* The accessible label given to the button used to move to the previous page.
|
|
105
|
+
* @default "Previous page"
|
|
106
|
+
*/
|
|
107
|
+
previousPageLabel: string;
|
|
108
|
+
/**
|
|
109
|
+
* The accessible label given to the button used to move to the next page.
|
|
110
|
+
* @default "Next page"
|
|
111
|
+
*/
|
|
112
|
+
nextPageLabel: string;
|
|
113
|
+
/**
|
|
114
|
+
* The accessible label given to the button used to move to the first page.
|
|
115
|
+
* @default "First page"
|
|
116
|
+
*/
|
|
117
|
+
firstPageLabel: string;
|
|
118
|
+
/**
|
|
119
|
+
* The accessible label given to the button used to move to the last page.
|
|
120
|
+
* @default "Last page"
|
|
121
|
+
*/
|
|
122
|
+
lastPageLabel: string;
|
|
123
|
+
/**
|
|
124
|
+
* The appearance variant of the page size field.
|
|
125
|
+
* @default "outlined"
|
|
126
|
+
*/
|
|
127
|
+
pageSizeVariant: FormFieldVariant;
|
|
128
|
+
/** The total number of pages. */
|
|
129
|
+
get pageCount(): number;
|
|
130
|
+
/** Whether a previous page can be displayed. */
|
|
131
|
+
get hasPreviousPage(): boolean;
|
|
132
|
+
/** Whether a next page can be displayed. */
|
|
133
|
+
get hasNextPage(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* A function used to format the range label.
|
|
136
|
+
* @param {number} pageIndex The zero-based index of the current page.
|
|
137
|
+
* @param {number | "all"} pageSize The current number of items to display in a page.
|
|
138
|
+
* @param {number} length The current length of the total number of items which are being paginated.
|
|
139
|
+
* @returns {string} The range label.
|
|
140
|
+
*/
|
|
141
|
+
rangeLabelFormatter?: (pageIndex: number, pageSize: number | "all", length: number) => string;
|
|
142
|
+
/** Move to the first page. */
|
|
143
|
+
firstPage(): void;
|
|
144
|
+
/** Move to the previous page. */
|
|
145
|
+
previousPage(): void;
|
|
146
|
+
/** Move to the next page. */
|
|
147
|
+
nextPage(): void;
|
|
148
|
+
/** Move to the last page. */
|
|
149
|
+
lastPage(): void;
|
|
150
|
+
/** @inheritdoc */
|
|
151
|
+
protected render(): unknown;
|
|
152
|
+
}
|
|
153
|
+
interface M3ePaginatorElementEventMap extends HTMLElementEventMap {
|
|
154
|
+
page: CustomEvent<PageEventDetail>;
|
|
155
|
+
}
|
|
156
|
+
export interface M3ePaginatorElement {
|
|
157
|
+
addEventListener<K extends keyof M3ePaginatorElementEventMap>(type: K, listener: (this: M3ePaginatorElement, ev: M3ePaginatorElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
158
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
159
|
+
removeEventListener<K extends keyof M3ePaginatorElementEventMap>(type: K, listener: (this: M3ePaginatorElement, ev: M3ePaginatorElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
160
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
161
|
+
}
|
|
162
|
+
declare global {
|
|
163
|
+
interface HTMLElementTagNameMap {
|
|
164
|
+
"m3e-paginator": M3ePaginatorElement;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export {};
|
|
168
|
+
//# sourceMappingURL=PaginatorElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginatorElement.d.ts","sourceRoot":"","sources":["../../src/PaginatorElement.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAKrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBACa,mBAAoB,SAAQ,wBAAiD;;IACxF,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CA2DpC;IAEa,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAK;IAe3C;;;OAGG;IACyC,QAAQ,UAAS;IAE7D;;;OAGG;IACkD,SAAS,SAAK;IAEnE;;;OAGG;IACyB,MAAM,SAAK;IAEvC;;;OAGG;IAEH,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAM;IAE9B;;;OAGG;IACoC,SAAS,SA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AC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IAER,mBAAmB,CAAC,CAAC,SAAS,MAAM,2BAA2B,EAC7D,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,EAAE,2BAA2B,CAAC,CAAC,CAAC,KAAK,IAAI,EACjF,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;IAER,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;CACT;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,mBAAmB,CAAC;KACtC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@m3e/paginator",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Paginator for M3E",
|
|
5
|
+
"author": "matraic <matraic@yahoo.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://matraic.github.io/m3e/#/components/paginator.html",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/matraic/m3e.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"material design",
|
|
14
|
+
"web components",
|
|
15
|
+
"paginator"
|
|
16
|
+
],
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"browser": "dist/index.min.js",
|
|
20
|
+
"unpkg": "dist/index.min.js",
|
|
21
|
+
"types": "dist/src/index.d.ts",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rollup -c",
|
|
25
|
+
"cem": "cem analyze --config cem.config.mjs",
|
|
26
|
+
"lint": "npx eslint ./src",
|
|
27
|
+
"clean": "rimraf dist"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@m3e/core": "1.1.0",
|
|
31
|
+
"@m3e/form-field": "1.1.0",
|
|
32
|
+
"@m3e/select": "1.1.0",
|
|
33
|
+
"@m3e/icon-button": "1.1.0",
|
|
34
|
+
"@m3e/tooltip": "1.1.0",
|
|
35
|
+
"lit": "^3.3.0"
|
|
36
|
+
},
|
|
37
|
+
"customElements": "dist/custom-elements.json"
|
|
38
|
+
}
|