@xui/pagination 2.0.0-alpha.11 → 2.0.0-alpha.12
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/README.md +142 -156
- package/fesm2022/xui-pagination.mjs +27 -33
- package/fesm2022/xui-pagination.mjs.map +1 -1
- package/package.json +5 -2
- package/types/xui-pagination.d.ts +24 -1
package/README.md
CHANGED
|
@@ -1,89 +1,103 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
1
|
+
<h1 align="center">xUI</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>90 Angular components, one npm package each, themed from a single token layer.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://xuijs.org">Documentation</a> ·
|
|
9
|
+
<a href="https://develop--67d2b4c756077a325913e5d9.chromatic.com/?globals=theme:dark">Storybook</a> ·
|
|
10
|
+
<a href="https://stackblitz.com/fork/xui">StackBlitz</a> ·
|
|
11
|
+
<a href="#components">Components</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://github.com/rikarin/xui/actions/workflows/release.yml"><img src="https://github.com/rikarin/xui/actions/workflows/release.yml/badge.svg?branch=master" alt="Build status" /></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@xui/core"><img src="https://img.shields.io/npm/v/%40xui/core.svg" alt="npm version" /></a>
|
|
17
|
+
<a href="https://www.npmjs.com/org/xui"><img src="https://img.shields.io/npm/dm/%40xui/core.svg" alt="Downloads" /></a>
|
|
18
|
+
<a href="https://app.netlify.com/sites/xui/deploys"><img src="https://api.netlify.com/api/v1/badges/fa0cfd14-97df-47fa-8a7c-152e6d4cfda2/deploy-status" alt="Netlify status" /></a>
|
|
3
19
|
</p>
|
|
4
20
|
|
|
5
21
|
---
|
|
6
22
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[](https://app.netlify.com/sites/xui/deploys)
|
|
23
|
+
xUI is an Angular 22 component library styled with Tailwind CSS 4. You compose it from directives and
|
|
24
|
+
standalone components rather than configuring one monolith, and the set goes well past the
|
|
25
|
+
primitives: data tables, dock managers, omnibars, node graphs and date ranges are packages here, not
|
|
26
|
+
things you are left to build.
|
|
12
27
|
|
|
13
|
-
|
|
28
|
+
```ts
|
|
29
|
+
import { XuiButtonImports } from '@xui/button';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
imports: [XuiButtonImports],
|
|
33
|
+
template: `<button xuiButton color="primary">Save changes</button>`
|
|
34
|
+
})
|
|
35
|
+
export class Example {}
|
|
36
|
+
```
|
|
14
37
|
|
|
15
38
|
## Features
|
|
16
39
|
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| Spinner | [](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://www.npmjs.com/package/%40xui/spinner)<br />[](https://bundlephobia.com/result?p=%40xui/spinner) | Spinner component |
|
|
53
|
-
| Status | [](https://www.npmjs.com/package/%40xui/status)<br />[](https://www.npmjs.com/package/%40xui/status)<br />[](https://bundlephobia.com/result?p=%40xui/status) | Status component |
|
|
54
|
-
| Table | [](https://www.npmjs.com/package/%40xui/table)<br />[](https://www.npmjs.com/package/%40xui/table)<br />[](https://bundlephobia.com/result?p=%40xui/table) | Table component |
|
|
55
|
-
|
|
56
|
-
## Installation
|
|
57
|
-
|
|
58
|
-
Install package with **PNPM**
|
|
40
|
+
- **One package per component.** Install `@xui/button` and you ship a button, not a library. Each
|
|
41
|
+
package exports an imports barrel for standalone components.
|
|
42
|
+
- **Signals throughout.** Signal inputs, `OnPush` and zoneless change detection; no `zone.js`
|
|
43
|
+
required.
|
|
44
|
+
- **Themed by tokens, not overrides.** Components style themselves with `bg-surface`,
|
|
45
|
+
`text-foreground-muted`, `border-error-muted`. Light and dark both work without a single `dark:`
|
|
46
|
+
class, and re-colouring an intent is one CSS variable.
|
|
47
|
+
- **Typed variants.** Every visual axis is a typed input backed by
|
|
48
|
+
[CVA](https://cva.style), and the `class` input merges through `tailwind-merge` — your utility
|
|
49
|
+
wins instead of fighting the component's.
|
|
50
|
+
- **Angular CDK underneath.** Overlays, focus traps, roving tabindex, typeahead, drag and drop and
|
|
51
|
+
bidi come from `@angular/cdk`, so keyboard behaviour and RTL are not reimplemented per component.
|
|
52
|
+
- **Built for coding agents.** An MCP server and an agent skill expose the real API of every
|
|
53
|
+
package — see [AI coding agents](#ai-coding-agents).
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
| | |
|
|
58
|
+
| ----------------------- | --- |
|
|
59
|
+
| Angular | 22 |
|
|
60
|
+
| Tailwind CSS | 4 |
|
|
61
|
+
| Node (development only) | 24 |
|
|
62
|
+
|
|
63
|
+
## Getting started
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
ng add @xui/core
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
That installs the core package and wires your global stylesheet: the theme import, the CDK overlay
|
|
70
|
+
stylesheet, and a `@source` glob pointing at the published packages. It is idempotent, so running it
|
|
71
|
+
again only adds what is missing. Use `nx add @xui/core` in an Nx workspace, and `--skip-overlay` if
|
|
72
|
+
you will not use dialogs, drawers, popovers, tooltips, menus or toasts.
|
|
73
|
+
|
|
74
|
+
Then add the components you need:
|
|
59
75
|
|
|
60
76
|
```bash
|
|
61
|
-
pnpm
|
|
77
|
+
pnpm add @xui/button @xui/dialog @xui/icon
|
|
62
78
|
```
|
|
63
79
|
|
|
64
80
|
## Theming
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
`text-foreground-muted`, `border-error-muted` — that resolve through the token layer shipped with
|
|
68
|
-
`@xui/core`. Import it once, after Tailwind:
|
|
82
|
+
To wire the styles by hand, import the token layer once after Tailwind:
|
|
69
83
|
|
|
70
84
|
```css
|
|
71
85
|
@import 'tailwindcss';
|
|
72
86
|
@import '@xui/core/styles/theme.css';
|
|
73
87
|
|
|
74
|
-
/* Only needed
|
|
75
|
-
|
|
88
|
+
/* Only needed for an overlay surface — popover, tooltip, menu, dialog, drawer
|
|
89
|
+
or toast. Without it, overlays render in the document flow. */
|
|
76
90
|
@import '@angular/cdk/overlay-prebuilt.css';
|
|
77
91
|
|
|
78
|
-
/*
|
|
92
|
+
/* Tailwind only emits utilities it can see, and it cannot see node_modules by default. */
|
|
79
93
|
@source '../node_modules/@xui';
|
|
80
94
|
```
|
|
81
95
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
Put `.dark` (or `[data-theme='dark']`) on `<html>` to switch themes; with neither present the theme
|
|
97
|
+
follows `prefers-color-scheme`. Both selectors work on any element, so a subtree can render in the
|
|
98
|
+
opposite theme.
|
|
85
99
|
|
|
86
|
-
Re-theme by overriding tokens after the import
|
|
100
|
+
Re-theme by overriding tokens after the import. The `darker` / `lighter` / `subtle` / `muted` /
|
|
87
101
|
`emphasis` steps of each intent are derived, so one declaration re-colours the whole ramp:
|
|
88
102
|
|
|
89
103
|
```css
|
|
@@ -93,37 +107,48 @@ Re-theme by overriding tokens after the import — the `darker` / `lighter` / `s
|
|
|
93
107
|
}
|
|
94
108
|
```
|
|
95
109
|
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
Controls share one density scale — 24 / 30 / 40px for `sm` / default / `lg` — so a button, an input
|
|
111
|
+
and a date field on the same row line up. Override `--control-height-md` to re-tune the library.
|
|
98
112
|
|
|
99
|
-
|
|
113
|
+
The full token reference, rendered in both themes, is the **Design tokens** page in Storybook.
|
|
100
114
|
|
|
101
|
-
|
|
115
|
+
## Components
|
|
102
116
|
|
|
103
|
-
|
|
117
|
+
<details>
|
|
118
|
+
<summary><strong>All 90 packages</strong>, grouped as they appear in Storybook</summary>
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
<br />
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
**Foundations** — [`@xui/icon`](https://www.npmjs.com/package/@xui/icon) · [`@xui/link`](https://www.npmjs.com/package/@xui/link) · [`@xui/text`](https://www.npmjs.com/package/@xui/text)
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
pnpm start
|
|
111
|
-
```
|
|
124
|
+
**Actions** — [`@xui/button`](https://www.npmjs.com/package/@xui/button) · [`@xui/button-group`](https://www.npmjs.com/package/@xui/button-group) · [`@xui/hotkeys`](https://www.npmjs.com/package/@xui/hotkeys)
|
|
112
125
|
|
|
113
|
-
|
|
126
|
+
**Forms** — [`@xui/cascader`](https://www.npmjs.com/package/@xui/cascader) · [`@xui/checkbox`](https://www.npmjs.com/package/@xui/checkbox) · [`@xui/color-picker`](https://www.npmjs.com/package/@xui/color-picker) · [`@xui/control-card`](https://www.npmjs.com/package/@xui/control-card) · [`@xui/control-group`](https://www.npmjs.com/package/@xui/control-group) · [`@xui/editable-text`](https://www.npmjs.com/package/@xui/editable-text) · [`@xui/file-input`](https://www.npmjs.com/package/@xui/file-input) · [`@xui/form-field`](https://www.npmjs.com/package/@xui/form-field) · [`@xui/html-select`](https://www.npmjs.com/package/@xui/html-select) · [`@xui/input`](https://www.npmjs.com/package/@xui/input) · [`@xui/input-otp`](https://www.npmjs.com/package/@xui/input-otp) · [`@xui/label`](https://www.npmjs.com/package/@xui/label) · [`@xui/multi-select`](https://www.npmjs.com/package/@xui/multi-select) · [`@xui/numeric-input`](https://www.npmjs.com/package/@xui/numeric-input) · [`@xui/radio`](https://www.npmjs.com/package/@xui/radio) · [`@xui/rate`](https://www.npmjs.com/package/@xui/rate) · [`@xui/rich-text-editor`](https://www.npmjs.com/package/@xui/rich-text-editor) · [`@xui/segmented-control`](https://www.npmjs.com/package/@xui/segmented-control) · [`@xui/select`](https://www.npmjs.com/package/@xui/select) · [`@xui/slider`](https://www.npmjs.com/package/@xui/slider) · [`@xui/suggest`](https://www.npmjs.com/package/@xui/suggest) · [`@xui/switch`](https://www.npmjs.com/package/@xui/switch) · [`@xui/tag-input`](https://www.npmjs.com/package/@xui/tag-input) · [`@xui/textarea`](https://www.npmjs.com/package/@xui/textarea) · [`@xui/transfer`](https://www.npmjs.com/package/@xui/transfer) · [`@xui/tree-select`](https://www.npmjs.com/package/@xui/tree-select) · [`@xui/upload`](https://www.npmjs.com/package/@xui/upload)
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
**Date & time** — [`@xui/date-input`](https://www.npmjs.com/package/@xui/date-input) · [`@xui/date-picker`](https://www.npmjs.com/package/@xui/date-picker) · [`@xui/date-range-input`](https://www.npmjs.com/package/@xui/date-range-input) · [`@xui/date-range-picker`](https://www.npmjs.com/package/@xui/date-range-picker) · [`@xui/time-picker`](https://www.npmjs.com/package/@xui/time-picker) · [`@xui/timezone-select`](https://www.npmjs.com/package/@xui/timezone-select)
|
|
129
|
+
|
|
130
|
+
**Data display** — [`@xui/avatar`](https://www.npmjs.com/package/@xui/avatar) · [`@xui/badge`](https://www.npmjs.com/package/@xui/badge) · [`@xui/card`](https://www.npmjs.com/package/@xui/card) · [`@xui/card-list`](https://www.npmjs.com/package/@xui/card-list) · [`@xui/carousel`](https://www.npmjs.com/package/@xui/carousel) · [`@xui/data-table`](https://www.npmjs.com/package/@xui/data-table) · [`@xui/descriptions`](https://www.npmjs.com/package/@xui/descriptions) · [`@xui/entity-title`](https://www.npmjs.com/package/@xui/entity-title) · [`@xui/kbd`](https://www.npmjs.com/package/@xui/kbd) · [`@xui/statistic`](https://www.npmjs.com/package/@xui/statistic) · [`@xui/status`](https://www.npmjs.com/package/@xui/status) · [`@xui/table`](https://www.npmjs.com/package/@xui/table) · [`@xui/tag`](https://www.npmjs.com/package/@xui/tag) · [`@xui/timeline`](https://www.npmjs.com/package/@xui/timeline) · [`@xui/tree`](https://www.npmjs.com/package/@xui/tree)
|
|
131
|
+
|
|
132
|
+
**Navigation** — [`@xui/breadcrumb`](https://www.npmjs.com/package/@xui/breadcrumb) · [`@xui/menubar`](https://www.npmjs.com/package/@xui/menubar) · [`@xui/navbar`](https://www.npmjs.com/package/@xui/navbar) · [`@xui/navigation-menu`](https://www.npmjs.com/package/@xui/navigation-menu) · [`@xui/pagination`](https://www.npmjs.com/package/@xui/pagination) · [`@xui/panel-stack`](https://www.npmjs.com/package/@xui/panel-stack) · [`@xui/steps`](https://www.npmjs.com/package/@xui/steps) · [`@xui/tabs`](https://www.npmjs.com/package/@xui/tabs)
|
|
133
|
+
|
|
134
|
+
**Overlays** — [`@xui/alert`](https://www.npmjs.com/package/@xui/alert) · [`@xui/alert-dialog`](https://www.npmjs.com/package/@xui/alert-dialog) · [`@xui/context-menu`](https://www.npmjs.com/package/@xui/context-menu) · [`@xui/dialog`](https://www.npmjs.com/package/@xui/dialog) · [`@xui/drawer`](https://www.npmjs.com/package/@xui/drawer) · [`@xui/menu`](https://www.npmjs.com/package/@xui/menu) · [`@xui/omnibar`](https://www.npmjs.com/package/@xui/omnibar) · [`@xui/popover`](https://www.npmjs.com/package/@xui/popover) · [`@xui/toast`](https://www.npmjs.com/package/@xui/toast) · [`@xui/tooltip`](https://www.npmjs.com/package/@xui/tooltip)
|
|
135
|
+
|
|
136
|
+
**Feedback** — [`@xui/callout`](https://www.npmjs.com/package/@xui/callout) · [`@xui/non-ideal-state`](https://www.npmjs.com/package/@xui/non-ideal-state) · [`@xui/progress-bar`](https://www.npmjs.com/package/@xui/progress-bar) · [`@xui/result`](https://www.npmjs.com/package/@xui/result) · [`@xui/skeleton`](https://www.npmjs.com/package/@xui/skeleton) · [`@xui/spinner`](https://www.npmjs.com/package/@xui/spinner)
|
|
137
|
+
|
|
138
|
+
**Layout** — [`@xui/accordion`](https://www.npmjs.com/package/@xui/accordion) · [`@xui/aspect-ratio`](https://www.npmjs.com/package/@xui/aspect-ratio) · [`@xui/collapse`](https://www.npmjs.com/package/@xui/collapse) · [`@xui/divider`](https://www.npmjs.com/package/@xui/divider) · [`@xui/dock-manager`](https://www.npmjs.com/package/@xui/dock-manager) · [`@xui/overflow-list`](https://www.npmjs.com/package/@xui/overflow-list) · [`@xui/scroll-area`](https://www.npmjs.com/package/@xui/scroll-area) · [`@xui/section`](https://www.npmjs.com/package/@xui/section) · [`@xui/splitter`](https://www.npmjs.com/package/@xui/splitter)
|
|
139
|
+
|
|
140
|
+
**Visualisation** — [`@xui/echarts`](https://www.npmjs.com/package/@xui/echarts) · [`@xui/konva`](https://www.npmjs.com/package/@xui/konva) · [`@xui/node-graph`](https://www.npmjs.com/package/@xui/node-graph)
|
|
141
|
+
|
|
142
|
+
</details>
|
|
118
143
|
|
|
119
144
|
## AI coding agents
|
|
120
145
|
|
|
121
146
|
Two pieces of tooling teach coding agents how to build with xUI.
|
|
122
147
|
|
|
123
|
-
**MCP server** — [`@xui/mcp`](
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
**MCP server** — [`@xui/mcp`](libs/mcp/README.md) exposes every package's real API (selectors, signal
|
|
149
|
+
inputs, variant axes, outputs), the design tokens, the docs and the Storybook examples as MCP tools.
|
|
150
|
+
It extracts them from the library sources, so every package is covered and the answers match the
|
|
151
|
+
installed version.
|
|
127
152
|
|
|
128
153
|
```json
|
|
129
154
|
{
|
|
@@ -133,85 +158,46 @@ answers match the installed version.
|
|
|
133
158
|
}
|
|
134
159
|
```
|
|
135
160
|
|
|
136
|
-
In this
|
|
137
|
-
once so it exists.
|
|
161
|
+
In this repository `.mcp.json` already points at `dist/libs/mcp/src/server.js` — run
|
|
162
|
+
`pnpm nx build mcp` once so it exists.
|
|
138
163
|
|
|
139
|
-
**Skill** — [`skills/xui`](
|
|
164
|
+
**Skill** — [`skills/xui`](skills/xui/SKILL.md) is the procedural knowledge: the three-layer
|
|
140
165
|
architecture, discovery through the MCP server, composition and styling rules, theming, the
|
|
141
166
|
generators, and the conventions for authoring a package inside the monorepo. `.claude/skills/xui`
|
|
142
167
|
links to it for agents working in this repository.
|
|
143
168
|
|
|
144
|
-
##
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
- [ ] Input OTP
|
|
180
|
-
- [ ] Toggle Group
|
|
181
|
-
|
|
182
|
-
### Additional
|
|
183
|
-
|
|
184
|
-
- [ ] Decagram
|
|
185
|
-
- [ ] Settings
|
|
186
|
-
- [ ] Drawer
|
|
187
|
-
- [ ] Panel Bar
|
|
188
|
-
- [ ] Textarea
|
|
189
|
-
- [ ] Time Picker
|
|
190
|
-
- [ ] Image Upload
|
|
191
|
-
- [ ] Banner
|
|
192
|
-
- [ ] Snack bar
|
|
193
|
-
|
|
194
|
-
## Opinionated "components"
|
|
195
|
-
|
|
196
|
-
- [ ] Graph View (Nodes)
|
|
197
|
-
- [ ] Analysis
|
|
198
|
-
- [ ] Charts (NG Charts?)
|
|
199
|
-
|
|
200
|
-
## CLI
|
|
201
|
-
|
|
202
|
-
Make cli to install the components
|
|
203
|
-
|
|
204
|
-
## TODO
|
|
205
|
-
|
|
206
|
-
- Button
|
|
207
|
-
|
|
208
|
-
- Icon
|
|
209
|
-
- Shine
|
|
210
|
-
|
|
211
|
-
- Breadcrumb
|
|
212
|
-
|
|
213
|
-
- fix styling issues
|
|
214
|
-
- on hover stuff
|
|
215
|
-
- data driven component
|
|
216
|
-
|
|
217
|
-
- adjust generator to generate stories into the apps/storybook
|
|
169
|
+
## Browser support
|
|
170
|
+
|
|
171
|
+
The browsers Angular itself supports — see the
|
|
172
|
+
[Angular browser support policy](https://angular.dev/reference/versions#browser-support).
|
|
173
|
+
|
|
174
|
+
## Development
|
|
175
|
+
|
|
176
|
+
The workspace is [Nx](https://nx.dev) + pnpm.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
pnpm install
|
|
180
|
+
pnpm start # documentation site on :4200
|
|
181
|
+
pnpm storybook # component gallery on :4400
|
|
182
|
+
pnpm nx serve admin # the example admin application
|
|
183
|
+
pnpm test # unit tests
|
|
184
|
+
pnpm nx test-storybook ui-storybook # render every story in headless Chromium
|
|
185
|
+
pnpm build # build every package
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Commits follow [Conventional Commits](https://www.conventionalcommits.org) and are linted — the
|
|
189
|
+
release is cut from them. See [docs/releasing.md](docs/releasing.md) for how a version is published,
|
|
190
|
+
[apps/ui-storybook/README.md](apps/ui-storybook/README.md) before writing stories, and
|
|
191
|
+
[apps/app/README.md](apps/app/README.md) for the documentation site, whose component pages are
|
|
192
|
+
generated from those same stories, and [apps/admin/README.md](apps/admin/README.md) for the example
|
|
193
|
+
admin application — a full app built from these packages, which is the fastest way to see how they
|
|
194
|
+
fit together.
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Bugs and ideas are welcome in [issues](https://github.com/Rikarin/xui/issues). For a change of any
|
|
199
|
+
size, open an issue first so the API can be agreed before the code exists.
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
See [LICENSE](LICENSE).
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, numberAttribute, model, booleanAttribute, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { provideIcons, NgIcon } from '@ng-icons/core';
|
|
4
|
+
import { matChevronRightRound, matChevronLeftRound } from '@ng-icons/material-icons/round';
|
|
5
|
+
import { createXConfigToken, xui } from '@xui/core';
|
|
6
|
+
import { XuiIcon } from '@xui/icon';
|
|
7
|
+
|
|
8
|
+
const [injectXuiPaginationConfig, provideXuiPaginationConfig] = createXConfigToken('XuiPaginationConfig', {
|
|
9
|
+
siblingCount: 1,
|
|
10
|
+
pageSizeOptions: [10, 20, 50, 100],
|
|
11
|
+
showSizeChanger: false,
|
|
12
|
+
showTotal: false,
|
|
13
|
+
simple: false
|
|
14
|
+
});
|
|
4
15
|
|
|
5
16
|
/**
|
|
6
17
|
* Page navigation for a paged collection. Two-way `pageIndex` (1-based) and
|
|
@@ -12,6 +23,7 @@ import { xui } from '@xui/core';
|
|
|
12
23
|
* ```
|
|
13
24
|
*/
|
|
14
25
|
class XuiPagination {
|
|
26
|
+
config = injectXuiPaginationConfig();
|
|
15
27
|
class = input('', /* @ts-ignore */
|
|
16
28
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
17
29
|
total = input(0, { ...(ngDevMode ? { debugName: "total" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
@@ -19,14 +31,14 @@ class XuiPagination {
|
|
|
19
31
|
...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
|
|
20
32
|
pageSize = model(10, /* @ts-ignore */
|
|
21
33
|
...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
22
|
-
pageSizeOptions = input(
|
|
34
|
+
pageSizeOptions = input(this.config.pageSizeOptions, /* @ts-ignore */
|
|
23
35
|
...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : /* istanbul ignore next */ []));
|
|
24
|
-
showSizeChanger = input(
|
|
25
|
-
showTotal = input(
|
|
26
|
-
simple = input(
|
|
36
|
+
showSizeChanger = input(this.config.showSizeChanger, { ...(ngDevMode ? { debugName: "showSizeChanger" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
37
|
+
showTotal = input(this.config.showTotal, { ...(ngDevMode ? { debugName: "showTotal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
38
|
+
simple = input(this.config.simple, { ...(ngDevMode ? { debugName: "simple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
27
39
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
28
40
|
/** Pages shown on each side of the current page. */
|
|
29
|
-
siblingCount = input(
|
|
41
|
+
siblingCount = input(this.config.siblingCount, { ...(ngDevMode ? { debugName: "siblingCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
30
42
|
totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())), /* @ts-ignore */
|
|
31
43
|
...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
|
|
32
44
|
pages = computed(() => paginationRange(this.pageIndex(), this.totalPages(), this.siblingCount()), /* @ts-ignore */
|
|
@@ -63,7 +75,7 @@ class XuiPagination {
|
|
|
63
75
|
}
|
|
64
76
|
computedClass = computed(() => xui('inline-flex items-center gap-1', this.class()), /* @ts-ignore */
|
|
65
77
|
...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
|
|
66
|
-
selectClass = computed(() => xui('border-border bg-surface text-foreground ms-2 h-(--control-height-md) rounded-md border px-(--control-padding-sm) text-sm'
|
|
78
|
+
selectClass = computed(() => xui('border-border bg-surface text-foreground ms-2 h-(--control-height-md) rounded-md border px-(--control-padding-sm) text-sm'), /* @ts-ignore */
|
|
67
79
|
...(ngDevMode ? [{ debugName: "selectClass" }] : /* istanbul ignore next */ []));
|
|
68
80
|
stepClass() {
|
|
69
81
|
return xui('border-border text-foreground hover:bg-surface-inset flex size-(--control-height-md) items-center justify-center rounded-md border disabled:pointer-events-none disabled:opacity-40');
|
|
@@ -86,15 +98,7 @@ class XuiPagination {
|
|
|
86
98
|
(click)="go(pageIndex() - 1)"
|
|
87
99
|
aria-label="Previous page"
|
|
88
100
|
>
|
|
89
|
-
<
|
|
90
|
-
<path
|
|
91
|
-
d="M15 6l-6 6 6 6"
|
|
92
|
-
stroke="currentColor"
|
|
93
|
-
stroke-width="2"
|
|
94
|
-
stroke-linecap="round"
|
|
95
|
-
stroke-linejoin="round"
|
|
96
|
-
/>
|
|
97
|
-
</svg>
|
|
101
|
+
<ng-icon xui size="sm" name="matChevronLeftRound" />
|
|
98
102
|
</button>
|
|
99
103
|
|
|
100
104
|
@if (simple()) {
|
|
@@ -124,9 +128,7 @@ class XuiPagination {
|
|
|
124
128
|
(click)="go(pageIndex() + 1)"
|
|
125
129
|
aria-label="Next page"
|
|
126
130
|
>
|
|
127
|
-
<
|
|
128
|
-
<path d="M9 6l6 6-6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
129
|
-
</svg>
|
|
131
|
+
<ng-icon xui size="sm" name="matChevronRightRound" />
|
|
130
132
|
</button>
|
|
131
133
|
|
|
132
134
|
@if (showSizeChanger()) {
|
|
@@ -141,7 +143,7 @@ class XuiPagination {
|
|
|
141
143
|
}
|
|
142
144
|
</select>
|
|
143
145
|
}
|
|
144
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
146
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: XuiIcon, selector: "ng-icon[xui]", inputs: ["class", "size", "color", "label"], exportAs: ["xuiIcon"] }], viewProviders: [provideIcons({ matChevronLeftRound, matChevronRightRound })], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
145
147
|
}
|
|
146
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: XuiPagination, decorators: [{
|
|
147
149
|
type: Component,
|
|
@@ -159,15 +161,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
159
161
|
(click)="go(pageIndex() - 1)"
|
|
160
162
|
aria-label="Previous page"
|
|
161
163
|
>
|
|
162
|
-
<
|
|
163
|
-
<path
|
|
164
|
-
d="M15 6l-6 6 6 6"
|
|
165
|
-
stroke="currentColor"
|
|
166
|
-
stroke-width="2"
|
|
167
|
-
stroke-linecap="round"
|
|
168
|
-
stroke-linejoin="round"
|
|
169
|
-
/>
|
|
170
|
-
</svg>
|
|
164
|
+
<ng-icon xui size="sm" name="matChevronLeftRound" />
|
|
171
165
|
</button>
|
|
172
166
|
|
|
173
167
|
@if (simple()) {
|
|
@@ -197,9 +191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
197
191
|
(click)="go(pageIndex() + 1)"
|
|
198
192
|
aria-label="Next page"
|
|
199
193
|
>
|
|
200
|
-
<
|
|
201
|
-
<path d="M9 6l6 6-6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
202
|
-
</svg>
|
|
194
|
+
<ng-icon xui size="sm" name="matChevronRightRound" />
|
|
203
195
|
</button>
|
|
204
196
|
|
|
205
197
|
@if (showSizeChanger()) {
|
|
@@ -220,6 +212,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
220
212
|
role: 'navigation',
|
|
221
213
|
'aria-label': 'Pagination'
|
|
222
214
|
},
|
|
215
|
+
imports: [NgIcon, XuiIcon],
|
|
216
|
+
viewProviders: [provideIcons({ matChevronLeftRound, matChevronRightRound })],
|
|
223
217
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
224
218
|
encapsulation: ViewEncapsulation.None
|
|
225
219
|
}]
|
|
@@ -254,5 +248,5 @@ const XuiPaginationImports = [XuiPagination];
|
|
|
254
248
|
* Generated bundle index. Do not edit.
|
|
255
249
|
*/
|
|
256
250
|
|
|
257
|
-
export { XuiPagination, XuiPaginationImports, paginationRange };
|
|
251
|
+
export { XuiPagination, XuiPaginationImports, injectXuiPaginationConfig, paginationRange, provideXuiPaginationConfig };
|
|
258
252
|
//# sourceMappingURL=xui-pagination.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-pagination.mjs","sources":["../../../../../../libs/ui/pagination/xui/src/lib/pagination.ts","../../../../../../libs/ui/pagination/xui/src/index.ts","../../../../../../libs/ui/pagination/xui/src/xui-pagination.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n ViewEncapsulation\n} from '@angular/core';\nimport { xui } from '@xui/core';\nimport type { ClassValue } from 'clsx';\n\n/**\n * Page navigation for a paged collection. Two-way `pageIndex` (1-based) and\n * `pageSize`; `total` is the item count. Renders prev/next, numbered pages with\n * ellipses, an optional size changer and an item-count summary.\n *\n * ```html\n * <xui-pagination [total]=\"248\" [(pageIndex)]=\"page\" [(pageSize)]=\"size\" showSizeChanger showTotal />\n * ```\n */\n@Component({\n selector: 'xui-pagination',\n template: `\n @if (showTotal()) {\n <span class=\"text-foreground-muted me-1 text-sm\">{{ totalLabel() }}</span>\n }\n\n <button\n type=\"button\"\n [class]=\"stepClass()\"\n [disabled]=\"disabled() || pageIndex() <= 1\"\n (click)=\"go(pageIndex() - 1)\"\n aria-label=\"Previous page\"\n >\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\">\n <path\n d=\"M15 6l-6 6 6 6\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n\n @if (simple()) {\n <span class=\"text-foreground px-2 text-sm tabular-nums\">{{ pageIndex() }} / {{ totalPages() }}</span>\n } @else {\n @for (item of pages(); track $index) {\n @if (item === '...') {\n <span class=\"text-foreground-muted px-1 select-none\">…</span>\n } @else {\n <button\n type=\"button\"\n [class]=\"pageClass(item === pageIndex())\"\n [attr.aria-current]=\"item === pageIndex() ? 'page' : null\"\n [disabled]=\"disabled()\"\n (click)=\"go(item)\"\n >\n {{ item }}\n </button>\n }\n }\n }\n\n <button\n type=\"button\"\n [class]=\"stepClass()\"\n [disabled]=\"disabled() || pageIndex() >= totalPages()\"\n (click)=\"go(pageIndex() + 1)\"\n aria-label=\"Next page\"\n >\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\">\n <path d=\"M9 6l6 6-6 6\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </button>\n\n @if (showSizeChanger()) {\n <select\n [class]=\"selectClass()\"\n [disabled]=\"disabled()\"\n (change)=\"changeSize($any($event.target).value)\"\n aria-label=\"Page size\"\n >\n @for (option of pageSizeOptions(); track option) {\n <option [value]=\"option\" [selected]=\"option === pageSize()\">{{ option }} / page</option>\n }\n </select>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'navigation',\n 'aria-label': 'Pagination'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiPagination {\n readonly class = input<ClassValue>('');\n\n readonly total = input<number, NumberInput>(0, { transform: numberAttribute });\n readonly pageIndex = model<number>(1);\n readonly pageSize = model<number>(10);\n readonly pageSizeOptions = input<number[]>([10, 20, 50, 100]);\n readonly showSizeChanger = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly showTotal = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly simple = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Pages shown on each side of the current page. */\n readonly siblingCount = input<number, NumberInput>(1, { transform: numberAttribute });\n\n protected readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())));\n protected readonly pages = computed(() => paginationRange(this.pageIndex(), this.totalPages(), this.siblingCount()));\n\n protected readonly totalLabel = computed(() => {\n const total = this.total();\n if (total === 0) {\n return '0 items';\n }\n const start = (this.pageIndex() - 1) * this.pageSize() + 1;\n const end = Math.min(this.pageIndex() * this.pageSize(), total);\n return `${start}-${end} of ${total} items`;\n });\n\n protected go(page: number): void {\n if (this.disabled()) {\n return;\n }\n const next = Math.max(1, Math.min(this.totalPages(), page));\n if (next !== this.pageIndex()) {\n this.pageIndex.set(next);\n }\n }\n\n protected changeSize(value: string): void {\n const size = Number(value);\n if (!Number.isFinite(size) || size <= 0) {\n return;\n }\n this.pageSize.set(size);\n // Keep the current page in range after the size changes.\n if (this.pageIndex() > this.totalPages()) {\n this.pageIndex.set(this.totalPages());\n }\n }\n\n protected readonly computedClass = computed(() => xui('inline-flex items-center gap-1', this.class()));\n protected readonly selectClass = computed(() =>\n xui(\n 'border-border bg-surface text-foreground ms-2 h-(--control-height-md) rounded-md border px-(--control-padding-sm) text-sm',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus'\n )\n );\n\n protected stepClass(): string {\n return xui(\n 'border-border text-foreground hover:bg-surface-inset flex size-(--control-height-md) items-center justify-center rounded-md border disabled:pointer-events-none disabled:opacity-40'\n );\n }\n\n protected pageClass(active: boolean): string {\n return xui(\n 'flex h-(--control-height-md) min-w-(--control-height-md) items-center justify-center rounded-md border px-(--control-padding-sm) text-sm tabular-nums disabled:pointer-events-none disabled:opacity-40',\n active\n ? 'border-primary bg-primary text-primary-foreground font-medium'\n : 'border-border text-foreground hover:bg-surface-inset'\n );\n }\n}\n\nconst range = (start: number, end: number): number[] =>\n Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => start + i);\n\n/**\n * The page items to display: page numbers with `'...'` ellipsis markers where\n * the range is collapsed. `siblingCount` is how many pages flank the current one.\n */\nexport function paginationRange(current: number, totalPages: number, siblingCount = 1): (number | '...')[] {\n const totalShown = siblingCount * 2 + 5;\n if (totalPages <= totalShown) {\n return range(1, totalPages);\n }\n\n const leftSibling = Math.max(current - siblingCount, 1);\n const rightSibling = Math.min(current + siblingCount, totalPages);\n const showLeftDots = leftSibling > 2;\n const showRightDots = rightSibling < totalPages - 1;\n const edgeCount = 3 + 2 * siblingCount;\n\n if (!showLeftDots && showRightDots) {\n return [...range(1, edgeCount), '...', totalPages];\n }\n if (showLeftDots && !showRightDots) {\n return [1, '...', ...range(totalPages - edgeCount + 1, totalPages)];\n }\n return [1, '...', ...range(leftSibling, rightSibling), '...', totalPages];\n}\n","import { XuiPagination } from './lib/pagination';\n\nexport * from './lib/pagination';\n\nexport const XuiPaginationImports = [XuiPagination] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAcA;;;;;;;;AAQG;MA+EU,aAAa,CAAA;IACf,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;IAE7B,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IACrE,SAAS,GAAG,KAAK,CAAS,CAAC;kFAAC;IAC5B,QAAQ,GAAG,KAAK,CAAS,EAAE;iFAAC;IAC5B,eAAe,GAAG,KAAK,CAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;wFAAC;IACpD,eAAe,GAAG,KAAK,CAAwB,KAAK,uFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IACtF,SAAS,GAAG,KAAK,CAAwB,KAAK,iFAAI,SAAS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C,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC;AAC3E;;ACpMO,MAAM,oBAAoB,GAAG,CAAC,aAAa;;ACJlD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-pagination.mjs","sources":["../../../../../../libs/ui/pagination/xui/src/lib/pagination.token.ts","../../../../../../libs/ui/pagination/xui/src/lib/pagination.ts","../../../../../../libs/ui/pagination/xui/src/index.ts","../../../../../../libs/ui/pagination/xui/src/xui-pagination.ts"],"sourcesContent":["import { createXConfigToken } from '@xui/core';\n\n/**\n * Application-wide defaults for XuiPagination.\n *\n * Provide it once at the app root to change every pagination bar without\n * touching call sites; individual inputs still override the configured value.\n */\nexport interface XuiPaginationConfig {\n /** Pages shown on each side of the current page. */\n siblingCount: number;\n /** Choices offered by the size changer. */\n pageSizeOptions: number[];\n /** Render the page-size `<select>` by default. */\n showSizeChanger: boolean;\n /** Render the item-count summary by default. */\n showTotal: boolean;\n /** Collapse the numbered pages to a `current / total` readout. */\n simple: boolean;\n}\n\nexport const [injectXuiPaginationConfig, provideXuiPaginationConfig] = createXConfigToken<XuiPaginationConfig>(\n 'XuiPaginationConfig',\n {\n siblingCount: 1,\n pageSizeOptions: [10, 20, 50, 100],\n showSizeChanger: false,\n showTotal: false,\n simple: false\n }\n);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n ViewEncapsulation\n} from '@angular/core';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matChevronLeftRound, matChevronRightRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\nimport { injectXuiPaginationConfig } from './pagination.token';\n\n/**\n * Page navigation for a paged collection. Two-way `pageIndex` (1-based) and\n * `pageSize`; `total` is the item count. Renders prev/next, numbered pages with\n * ellipses, an optional size changer and an item-count summary.\n *\n * ```html\n * <xui-pagination [total]=\"248\" [(pageIndex)]=\"page\" [(pageSize)]=\"size\" showSizeChanger showTotal />\n * ```\n */\n@Component({\n selector: 'xui-pagination',\n template: `\n @if (showTotal()) {\n <span class=\"text-foreground-muted me-1 text-sm\">{{ totalLabel() }}</span>\n }\n\n <button\n type=\"button\"\n [class]=\"stepClass()\"\n [disabled]=\"disabled() || pageIndex() <= 1\"\n (click)=\"go(pageIndex() - 1)\"\n aria-label=\"Previous page\"\n >\n <ng-icon xui size=\"sm\" name=\"matChevronLeftRound\" />\n </button>\n\n @if (simple()) {\n <span class=\"text-foreground px-2 text-sm tabular-nums\">{{ pageIndex() }} / {{ totalPages() }}</span>\n } @else {\n @for (item of pages(); track $index) {\n @if (item === '...') {\n <span class=\"text-foreground-muted px-1 select-none\">…</span>\n } @else {\n <button\n type=\"button\"\n [class]=\"pageClass(item === pageIndex())\"\n [attr.aria-current]=\"item === pageIndex() ? 'page' : null\"\n [disabled]=\"disabled()\"\n (click)=\"go(item)\"\n >\n {{ item }}\n </button>\n }\n }\n }\n\n <button\n type=\"button\"\n [class]=\"stepClass()\"\n [disabled]=\"disabled() || pageIndex() >= totalPages()\"\n (click)=\"go(pageIndex() + 1)\"\n aria-label=\"Next page\"\n >\n <ng-icon xui size=\"sm\" name=\"matChevronRightRound\" />\n </button>\n\n @if (showSizeChanger()) {\n <select\n [class]=\"selectClass()\"\n [disabled]=\"disabled()\"\n (change)=\"changeSize($any($event.target).value)\"\n aria-label=\"Page size\"\n >\n @for (option of pageSizeOptions(); track option) {\n <option [value]=\"option\" [selected]=\"option === pageSize()\">{{ option }} / page</option>\n }\n </select>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'navigation',\n 'aria-label': 'Pagination'\n },\n imports: [NgIcon, XuiIcon],\n viewProviders: [provideIcons({ matChevronLeftRound, matChevronRightRound })],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiPagination {\n private readonly config = injectXuiPaginationConfig();\n\n readonly class = input<ClassValue>('');\n\n readonly total = input<number, NumberInput>(0, { transform: numberAttribute });\n readonly pageIndex = model<number>(1);\n readonly pageSize = model<number>(10);\n readonly pageSizeOptions = input<number[]>(this.config.pageSizeOptions);\n readonly showSizeChanger = input<boolean, BooleanInput>(this.config.showSizeChanger, {\n transform: booleanAttribute\n });\n readonly showTotal = input<boolean, BooleanInput>(this.config.showTotal, { transform: booleanAttribute });\n readonly simple = input<boolean, BooleanInput>(this.config.simple, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Pages shown on each side of the current page. */\n readonly siblingCount = input<number, NumberInput>(this.config.siblingCount, { transform: numberAttribute });\n\n protected readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())));\n protected readonly pages = computed(() => paginationRange(this.pageIndex(), this.totalPages(), this.siblingCount()));\n\n protected readonly totalLabel = computed(() => {\n const total = this.total();\n if (total === 0) {\n return '0 items';\n }\n const start = (this.pageIndex() - 1) * this.pageSize() + 1;\n const end = Math.min(this.pageIndex() * this.pageSize(), total);\n return `${start}-${end} of ${total} items`;\n });\n\n protected go(page: number): void {\n if (this.disabled()) {\n return;\n }\n const next = Math.max(1, Math.min(this.totalPages(), page));\n if (next !== this.pageIndex()) {\n this.pageIndex.set(next);\n }\n }\n\n protected changeSize(value: string): void {\n const size = Number(value);\n if (!Number.isFinite(size) || size <= 0) {\n return;\n }\n this.pageSize.set(size);\n // Keep the current page in range after the size changes.\n if (this.pageIndex() > this.totalPages()) {\n this.pageIndex.set(this.totalPages());\n }\n }\n\n protected readonly computedClass = computed(() => xui('inline-flex items-center gap-1', this.class()));\n protected readonly selectClass = computed(() =>\n xui(\n 'border-border bg-surface text-foreground ms-2 h-(--control-height-md) rounded-md border px-(--control-padding-sm) text-sm'\n )\n );\n\n protected stepClass(): string {\n return xui(\n 'border-border text-foreground hover:bg-surface-inset flex size-(--control-height-md) items-center justify-center rounded-md border disabled:pointer-events-none disabled:opacity-40'\n );\n }\n\n protected pageClass(active: boolean): string {\n return xui(\n 'flex h-(--control-height-md) min-w-(--control-height-md) items-center justify-center rounded-md border px-(--control-padding-sm) text-sm tabular-nums disabled:pointer-events-none disabled:opacity-40',\n active\n ? 'border-primary bg-primary text-primary-foreground font-medium'\n : 'border-border text-foreground hover:bg-surface-inset'\n );\n }\n}\n\nconst range = (start: number, end: number): number[] =>\n Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => start + i);\n\n/**\n * The page items to display: page numbers with `'...'` ellipsis markers where\n * the range is collapsed. `siblingCount` is how many pages flank the current one.\n */\nexport function paginationRange(current: number, totalPages: number, siblingCount = 1): (number | '...')[] {\n const totalShown = siblingCount * 2 + 5;\n if (totalPages <= totalShown) {\n return range(1, totalPages);\n }\n\n const leftSibling = Math.max(current - siblingCount, 1);\n const rightSibling = Math.min(current + siblingCount, totalPages);\n const showLeftDots = leftSibling > 2;\n const showRightDots = rightSibling < totalPages - 1;\n const edgeCount = 3 + 2 * siblingCount;\n\n if (!showLeftDots && showRightDots) {\n return [...range(1, edgeCount), '...', totalPages];\n }\n if (showLeftDots && !showRightDots) {\n return [1, '...', ...range(totalPages - edgeCount + 1, totalPages)];\n }\n return [1, '...', ...range(leftSibling, rightSibling), '...', totalPages];\n}\n","import { XuiPagination } from './lib/pagination';\n\nexport * from './lib/pagination';\nexport * from './lib/pagination.token';\n\nexport const XuiPaginationImports = [XuiPagination] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAqBO,MAAM,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,GAAG,kBAAkB,CACvF,qBAAqB,EACrB;AACE,IAAA,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;AAClC,IAAA,eAAe,EAAE,KA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a,EAAE;AAClC,QAAA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC;IACpD;AACA,IAAA,IAAI,YAAY,IAAI,CAAC,aAAa,EAAE;AAClC,QAAA,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,GAAG,SAAS,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IACrE;AACA,IAAA,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC;AAC3E;;AClMO,MAAM,oBAAoB,GAAG,CAAC,aAAa;;ACLlD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xui/pagination",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -38,7 +38,10 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@angular/cdk": "22",
|
|
40
40
|
"@angular/core": "22",
|
|
41
|
-
"@
|
|
41
|
+
"@ng-icons/core": "34",
|
|
42
|
+
"@ng-icons/material-icons": "34",
|
|
43
|
+
"@xui/core": "2.0.0-alpha.12",
|
|
44
|
+
"@xui/icon": "2.0.0-alpha.12",
|
|
42
45
|
"clsx": "^2.1.1"
|
|
43
46
|
},
|
|
44
47
|
"publishConfig": {
|
|
@@ -12,6 +12,7 @@ import { ClassValue } from 'clsx';
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare class XuiPagination {
|
|
15
|
+
private readonly config;
|
|
15
16
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
16
17
|
readonly total: _angular_core.InputSignalWithTransform<number, NumberInput>;
|
|
17
18
|
readonly pageIndex: _angular_core.ModelSignal<number>;
|
|
@@ -41,6 +42,28 @@ declare class XuiPagination {
|
|
|
41
42
|
*/
|
|
42
43
|
declare function paginationRange(current: number, totalPages: number, siblingCount?: number): (number | '...')[];
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Application-wide defaults for XuiPagination.
|
|
47
|
+
*
|
|
48
|
+
* Provide it once at the app root to change every pagination bar without
|
|
49
|
+
* touching call sites; individual inputs still override the configured value.
|
|
50
|
+
*/
|
|
51
|
+
interface XuiPaginationConfig {
|
|
52
|
+
/** Pages shown on each side of the current page. */
|
|
53
|
+
siblingCount: number;
|
|
54
|
+
/** Choices offered by the size changer. */
|
|
55
|
+
pageSizeOptions: number[];
|
|
56
|
+
/** Render the page-size `<select>` by default. */
|
|
57
|
+
showSizeChanger: boolean;
|
|
58
|
+
/** Render the item-count summary by default. */
|
|
59
|
+
showTotal: boolean;
|
|
60
|
+
/** Collapse the numbered pages to a `current / total` readout. */
|
|
61
|
+
simple: boolean;
|
|
62
|
+
}
|
|
63
|
+
declare const injectXuiPaginationConfig: () => XuiPaginationConfig;
|
|
64
|
+
declare const provideXuiPaginationConfig: (config: Partial<XuiPaginationConfig>) => _angular_core.ValueProvider;
|
|
65
|
+
|
|
44
66
|
declare const XuiPaginationImports: readonly [typeof XuiPagination];
|
|
45
67
|
|
|
46
|
-
export { XuiPagination, XuiPaginationImports, paginationRange };
|
|
68
|
+
export { XuiPagination, XuiPaginationImports, injectXuiPaginationConfig, paginationRange, provideXuiPaginationConfig };
|
|
69
|
+
export type { XuiPaginationConfig };
|