@nanahoshi/mona-ui 0.24.5 → 0.24.7

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.
Files changed (78) hide show
  1. package/README.md +2 -0
  2. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +196 -137
  3. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
  4. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +164 -3
  5. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +124 -140
  6. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +205 -202
  7. package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
  8. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-BMCM0W8s.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs} +24 -12
  9. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs +208 -0
  10. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs +1100 -0
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-C2kf5MwO.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs} +34 -21
  12. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Dh42tUui.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs} +2564 -927
  13. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  14. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -8
  15. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +1 -1
  16. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +3 -6
  17. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -8
  18. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -8
  19. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -8
  20. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -8
  21. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -8
  22. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -8
  23. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -8
  24. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -8
  25. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -8
  26. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -8
  27. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -8
  28. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -8
  29. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -8
  30. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +195 -122
  31. package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
  32. package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
  33. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +149 -167
  34. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +182 -137
  35. package/i18n/catalogs/en-US.messages.json +36 -11
  36. package/locales/ar-sa/ar-sa.messages.json +33 -8
  37. package/locales/de-de/de-de.messages.json +33 -8
  38. package/locales/es-es/es-es.messages.json +33 -8
  39. package/locales/fr-fr/fr-fr.messages.json +33 -8
  40. package/locales/id-id/id-id.messages.json +33 -8
  41. package/locales/it-it/it-it.messages.json +33 -8
  42. package/locales/ja-jp/ja-jp.messages.json +33 -8
  43. package/locales/ko-kr/ko-kr.messages.json +33 -8
  44. package/locales/pt-br/pt-br.messages.json +33 -8
  45. package/locales/ru-ru/ru-ru.messages.json +33 -8
  46. package/locales/tr-tr/tr-tr.messages.json +33 -8
  47. package/locales/zh-cn/zh-cn.messages.json +33 -8
  48. package/locales/zh-tw/zh-tw.messages.json +33 -8
  49. package/package.json +2 -2
  50. package/types/nanahoshi-mona-ui-calendar.d.ts +30 -11
  51. package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
  52. package/types/nanahoshi-mona-ui-date-input.d.ts +74 -3
  53. package/types/nanahoshi-mona-ui-date-picker.d.ts +61 -33
  54. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +79 -38
  55. package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
  56. package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
  57. package/types/nanahoshi-mona-ui-i18n.d.ts +47 -6
  58. package/types/nanahoshi-mona-ui-list-view.d.ts +1 -2
  59. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +31 -6
  60. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +31 -6
  61. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +31 -6
  62. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +31 -6
  63. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +31 -6
  64. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +31 -6
  65. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +31 -6
  66. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +31 -6
  67. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +31 -6
  68. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +31 -6
  69. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +31 -6
  70. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +31 -6
  71. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +31 -6
  72. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +57 -16
  73. package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
  74. package/types/nanahoshi-mona-ui-query.d.ts +45 -14
  75. package/types/nanahoshi-mona-ui-time-picker.d.ts +72 -42
  76. package/types/nanahoshi-mona-ui-time-selector.d.ts +78 -46
  77. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-BSlV8Sua.mjs +0 -176
  78. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-CTOdnH29.mjs +0 -946
@@ -7,53 +7,78 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
7
7
  import { VariantInputs } from '@nanahoshi/mona-ui/internal';
8
8
  import { VariantProps } from 'class-variance-authority';
9
9
 
10
- interface InfoTemplateContext {
11
- /** The current page number. */
12
- currentPage: number;
10
+ /**
11
+ * The pager's state and actions, passed to every custom template.
12
+ */
13
+ interface PagerContext {
14
+ /** The current page, starting at 1. */
15
+ readonly currentPage: number;
16
+ /** The position of the last item on the current page, or 0 when there are no items. */
17
+ readonly end: number;
18
+ /** Goes to a page (clamped to the page range) and emits `pageChange`, as a click on a page button does. */
19
+ goToPage(page: number): void;
13
20
  /** The number of items per page. */
14
- pageSize: number;
15
- /** The number of items to skip. */
16
- skip: number;
21
+ readonly pageSize: number;
22
+ /** The page sizes offered by the page-size dropdown. */
23
+ readonly pageSizes: readonly number[];
24
+ /** Changes the page size through the cancelable `pageSizeSelect` event, as the page-size dropdown does. `null` and values below 1 are ignored. */
25
+ setPageSize(pageSize: number | null): void;
26
+ /** The number of items before the current page. */
27
+ readonly skip: number;
28
+ /** The position of the first item on the current page, or 0 when there are no items. */
29
+ readonly start: number;
17
30
  /** The total number of items. */
18
- total: number;
31
+ readonly total: number;
19
32
  /** The total number of pages. */
20
- totalPages: number;
33
+ readonly totalPages: number;
34
+ }
35
+
36
+ interface InfoTemplateContext extends PagerContext {
37
+ readonly $implicit: PagerContext;
21
38
  }
22
39
 
23
40
  declare class PagerInfoTemplateDirective {
24
41
  readonly templateRef: TemplateRef<InfoTemplateContext>;
42
+ static ngTemplateContextGuard(_directive: PagerInfoTemplateDirective, _context: unknown): _context is InfoTemplateContext;
25
43
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PagerInfoTemplateDirective, never>;
26
44
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<PagerInfoTemplateDirective, "ng-template[monaPagerInfoTemplate]", never, {}, {}, never, never, true, never>;
27
45
  }
28
46
 
29
- interface NavigationButtonsTemplateContext {
30
- disabled: boolean;
31
- pageSize: number;
32
- totalPages: number;
47
+ interface NavigationButtonsTemplateContext extends PagerContext {
48
+ readonly $implicit: PagerContext;
49
+ /** True when the button has nowhere to go (the first or last page is current, or there are no pages). */
50
+ readonly disabled: boolean;
51
+ /** Goes to {@link targetPage}. */
52
+ navigate(): void;
53
+ /** The page the button goes to. */
54
+ readonly targetPage: number;
33
55
  }
34
56
 
35
57
  declare class PagerNavigationButtonsTemplateDirective {
36
58
  readonly templateRef: TemplateRef<NavigationButtonsTemplateContext>;
37
59
  readonly type: _angular_core.InputSignal<"first" | "last" | "next" | "previous">;
60
+ static ngTemplateContextGuard(_directive: PagerNavigationButtonsTemplateDirective, _context: unknown): _context is NavigationButtonsTemplateContext;
38
61
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PagerNavigationButtonsTemplateDirective, never>;
39
62
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<PagerNavigationButtonsTemplateDirective, "ng-template[monaPagerNavigationButtonsTemplate]", never, { "type": { "alias": "type"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
40
63
  }
41
64
 
42
- interface NumericButtonsTemplateContext {
43
- totalPages: number;
65
+ /**
66
+ * Context of `monaPagerNumericButtonsTemplate`. The template renders inside the pager's `<ol>`, so put each
67
+ * control in an `<li>`.
68
+ */
69
+ interface NumericButtonsTemplateContext extends PagerContext {
70
+ readonly $implicit: PagerContext;
71
+ /** The page numbers the default buttons would show, in order (the first and last page included). */
72
+ readonly pages: readonly number[];
44
73
  }
45
74
 
46
75
  declare class PagerNumericButtonsTemplateDirective {
47
76
  readonly templateRef: TemplateRef<NumericButtonsTemplateContext>;
77
+ static ngTemplateContextGuard(_directive: PagerNumericButtonsTemplateDirective, _context: unknown): _context is NumericButtonsTemplateContext;
48
78
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PagerNumericButtonsTemplateDirective, never>;
49
79
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<PagerNumericButtonsTemplateDirective, "ng-template[monaPagerNumericButtonsTemplate]", never, {}, {}, never, never, true, never>;
50
80
  }
51
81
 
52
- interface Page {
53
- page: number;
54
- text: string;
55
- }
56
-
57
82
  interface PageChangeEvent {
58
83
  page: number;
59
84
  skip: number;
@@ -62,12 +87,18 @@ interface PageChangeEvent {
62
87
 
63
88
  type PagerType = "input" | "numeric";
64
89
 
90
+ /** The cancelable payload of the pager's `pageSizeSelect` event. */
65
91
  declare class PageSizeChangeEvent extends PreventableEvent {
66
92
  readonly newPageSize: number;
67
93
  readonly oldPageSize: number;
68
94
  constructor(newPageSize: number, oldPageSize: number);
69
95
  }
70
96
 
97
+ interface PageSizeTemplateContext extends PagerContext {
98
+ /** The page sizes offered, as for the default dropdown. */
99
+ readonly $implicit: readonly number[];
100
+ }
101
+
71
102
  declare const pagerBaseThemeVariants: (props?: ({
72
103
  rounded?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
73
104
  size?: "small" | "medium" | "large" | null | undefined;
@@ -82,83 +113,128 @@ type PagerListVariantProps = VariantProps<typeof pagerListThemeVariants>;
82
113
  type PagerListVariantInputs = VariantInputs<PagerListVariantProps>;
83
114
  type PagerVariantInputs = PagerBaseVariantInputs & PagerInputVariantInputs & PagerListVariantInputs;
84
115
 
116
+ type PagerItem = {
117
+ readonly key: string;
118
+ readonly kind: "page";
119
+ readonly page: number;
120
+ } | {
121
+ readonly direction: "backward" | "forward";
122
+ readonly key: string;
123
+ readonly kind: "jump";
124
+ readonly page: number;
125
+ };
85
126
  declare class PagerComponent implements PagerVariantInputs {
86
127
  #private;
87
128
  private readonly navigationButtonsTemplateList;
88
129
  protected readonly baseClasses: Signal<string>;
130
+ protected readonly compact: Signal<boolean>;
131
+ /** The position of the last item on the current page, or 0 when there are no items. */
132
+ protected readonly end: Signal<number>;
133
+ protected readonly firstNavigationContext: Signal<NavigationButtonsTemplateContext>;
89
134
  protected readonly firstPageNavigationTemplate: Signal<PagerNavigationButtonsTemplateDirective | undefined>;
90
135
  protected readonly hasPages: Signal<boolean>;
91
- protected readonly iconSize: Signal<18 | 20 | 22>;
92
- protected readonly infoClasses: Signal<string>;
93
- protected readonly infoVisible: Signal<boolean>;
94
- protected readonly inputClasses: Signal<string>;
95
- protected readonly inputValue: _angular_core.WritableSignal<number>;
136
+ protected readonly iconSize: Signal<20 | 18 | 22>;
137
+ protected readonly infoClasses: string;
138
+ protected readonly infoContext: Signal<InfoTemplateContext>;
139
+ protected readonly inputClasses: string;
140
+ protected readonly inputValue: _angular_core.WritableSignal<number | null>;
96
141
  protected readonly jumpNextLabel: Signal<string>;
97
142
  protected readonly jumpPreviousLabel: Signal<string>;
143
+ protected readonly lastNavigationContext: Signal<NavigationButtonsTemplateContext>;
98
144
  protected readonly lastPageNavigationTemplate: Signal<PagerNavigationButtonsTemplateDirective | undefined>;
99
- protected readonly listClasses: Signal<string>;
145
+ protected readonly listClasses: string;
146
+ /** Announces page changes made by the user; programmatic changes stay silent. */
147
+ protected readonly liveStatus: _angular_core.WritableSignal<string>;
100
148
  protected readonly messages: Signal<_nanahoshi_mona_ui_i18n.MonaPagerMessages>;
101
- protected readonly nextJumperVisible: Signal<boolean>;
149
+ protected readonly nextNavigationContext: Signal<NavigationButtonsTemplateContext>;
102
150
  protected readonly nextPageNavigationTemplate: Signal<PagerNavigationButtonsTemplateDirective | undefined>;
151
+ protected readonly numericButtonsContext: Signal<NumericButtonsTemplateContext>;
103
152
  protected readonly numericButtonsTemplate: Signal<PagerNumericButtonsTemplateDirective | undefined>;
153
+ /** The current page: the page holding `skip`, clamped to the last page. */
104
154
  protected readonly page: Signal<number>;
105
155
  protected readonly pageCount: Signal<number>;
106
- protected readonly pageInputVisible: _angular_core.WritableSignal<boolean>;
156
+ protected readonly pageInputId: string;
157
+ protected readonly pageInputLabelledBy: string;
158
+ protected readonly pageInputPrefixId: string;
159
+ protected readonly pageInputSuffixId: string;
160
+ protected readonly pageItems: Signal<PagerItem[]>;
107
161
  protected readonly pageList: Signal<number[]>;
108
- protected readonly pageListVisible: _angular_core.WritableSignal<boolean>;
109
- protected readonly pageSizeDropdownData: Signal<number[]>;
162
+ protected readonly pageSizeContext: Signal<PageSizeTemplateContext>;
110
163
  protected readonly pageSizeDropdownList: Signal<DropdownListComponent<number> | undefined>;
164
+ protected readonly pageSizeOptions: Signal<readonly number[]>;
111
165
  protected readonly pageSizeTemplate: Signal<TemplateRef<any> | undefined>;
166
+ /** The page size in use: `pageSize`, or the size the user picked since, as a whole number of at least 1. */
167
+ protected readonly pageSizeValue: Signal<number>;
168
+ protected readonly pagerContext: Signal<PagerContext>;
112
169
  protected readonly pagerInfo: Signal<string>;
113
170
  protected readonly pagerInfoTemplate: Signal<PagerInfoTemplateDirective | undefined>;
114
- protected readonly pagerInfoTemplateContext: Signal<InfoTemplateContext>;
115
- protected readonly pagerPageSize: _angular_core.WritableSignal<number>;
116
- protected readonly pages: Signal<Page[]>;
117
- protected readonly previousJumperVisible: Signal<boolean>;
171
+ protected readonly previousNavigationContext: Signal<NavigationButtonsTemplateContext>;
118
172
  protected readonly previousPageNavigationTemplate: Signal<PagerNavigationButtonsTemplateDirective | undefined>;
173
+ /** `skip` as a whole number of at least 0. */
174
+ protected readonly skipValue: Signal<number>;
175
+ /** The position of the first item on the current page, or 0 when there are no items. */
176
+ protected readonly start: Signal<number>;
177
+ /**
178
+ * @description Accessible name of the pager's navigation landmark. Defaults to the localized "Pagination";
179
+ * name each pager when a page has several.
180
+ */
181
+ readonly ariaLabel: _angular_core.InputSignal<string | null>;
182
+ /**
183
+ * @description Id of the element that names the pager. Takes precedence over {@link ariaLabel}.
184
+ */
185
+ readonly ariaLabelledBy: _angular_core.InputSignal<string>;
119
186
  /**
120
187
  * @description Shows the first and last page navigation buttons.
121
188
  * @default true
122
189
  */
123
- readonly firstLast: _angular_core.InputSignal<boolean>;
190
+ readonly firstLast: _angular_core.InputSignalWithTransform<boolean, unknown>;
124
191
  /**
125
- * @description Enables keyboard navigation on the pager wrapper and its inner controls.
192
+ * @description Enables page shortcuts while a pager button has focus: Page Up and Page Down go to the
193
+ * previous and next page, Home and End to the first and last, and the left and right arrows to the previous
194
+ * and next page (mirrored right to left). The buttons themselves are always ordinary tab stops.
126
195
  * @default true
127
196
  */
128
- readonly navigable: _angular_core.InputSignal<boolean>;
197
+ readonly navigable: _angular_core.InputSignalWithTransform<boolean, unknown>;
129
198
  /**
130
- * @description Emitted when the current page changes.
199
+ * @description Emitted when the user changes the page or the page size, or when the pager corrects a `skip`
200
+ * that is past the last page or not on a page boundary. Setting `skip` or `pageSize` from code to a valid
201
+ * value doesn't emit it.
131
202
  */
132
203
  readonly pageChange: _angular_core.OutputEmitterRef<PageChangeEvent>;
133
204
  /**
134
205
  * @description Shows a numeric input for jumping directly to a page.
135
206
  * @default false
136
207
  */
137
- readonly pageInput: _angular_core.InputSignal<boolean>;
208
+ readonly pageInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
138
209
  /**
139
- * @description Number of items displayed per page.
210
+ * @description Number of items displayed per page; values below 1 count as 1. Supports two-way binding
211
+ * (`[(pageSize)]`): `pageSizeChange` emits the new size after the user changes it, and `pageChange` reports it
212
+ * as `take`.
140
213
  * @default 5
141
214
  */
142
- readonly pageSize: _angular_core.InputSignal<number>;
215
+ readonly pageSize: _angular_core.ModelSignal<number>;
143
216
  /**
144
- * @description Emitted when the page size changes. Cancelable via `preventDefault()` on the event.
217
+ * @description Emitted when the user picks a page size, before it is applied. Call `preventDefault()` on the
218
+ * event to keep the current size.
145
219
  */
146
- readonly pageSizeChange: _angular_core.OutputEmitterRef<PageSizeChangeEvent>;
220
+ readonly pageSizeSelect: _angular_core.OutputEmitterRef<PageSizeChangeEvent>;
147
221
  /**
148
- * @description Page-size options shown in the page-size dropdown. Set to `false` or an empty array to hide the dropdown.
222
+ * @description Page-size options shown in the page-size dropdown. `true` shows the default options; `false`
223
+ * or an empty array hides the dropdown.
149
224
  * @default [5, 10, 20, 50, 100]
150
225
  */
151
- readonly pageSizeValues: _angular_core.InputSignal<boolean | number[]>;
226
+ readonly pageSizeValues: _angular_core.InputSignal<boolean | readonly number[]>;
152
227
  /**
153
228
  * @description Shows the previous and next page navigation buttons.
154
229
  * @default true
155
230
  */
156
- readonly previousNext: _angular_core.InputSignal<boolean>;
231
+ readonly previousNext: _angular_core.InputSignalWithTransform<boolean, unknown>;
157
232
  /**
158
- * @description Collapses sections of the pager as the host element narrows.
233
+ * @description Replaces the page buttons with a page dropdown when the pager is narrower than 480px.
234
+ * Other sections wrap onto a new line instead of being hidden.
159
235
  * @default true
160
236
  */
161
- readonly responsive: _angular_core.InputSignal<boolean>;
237
+ readonly responsive: _angular_core.InputSignalWithTransform<boolean, unknown>;
162
238
  /**
163
239
  * @description Border-radius preset applied to the component.
164
240
  * @default "medium"
@@ -168,22 +244,23 @@ declare class PagerComponent implements PagerVariantInputs {
168
244
  * @description Displays the summary of the current page range and total item count.
169
245
  * @default true
170
246
  */
171
- readonly showInfo: _angular_core.InputSignal<boolean>;
247
+ readonly showInfo: _angular_core.InputSignalWithTransform<boolean, unknown>;
172
248
  /**
173
249
  * @description Size preset controlling the component's dimensions.
174
250
  * @default "medium"
175
251
  */
176
252
  readonly size: _angular_core.InputSignal<"small" | "medium" | "large" | null | undefined>;
177
253
  /**
178
- * @description Number of items to skip before the current page. Determines the current page together with `pageSize`.
254
+ * @description Number of items before the current page. Supports two-way binding. A value past the last page,
255
+ * or between page boundaries, is corrected to the start of the page that holds it, and `pageChange` reports it.
179
256
  * @default 0
180
257
  */
181
- readonly skip: _angular_core.InputSignal<number>;
258
+ readonly skip: _angular_core.ModelSignal<number>;
182
259
  /**
183
260
  * @description Total number of items in the paged collection.
184
261
  * @default 0
185
262
  */
186
- readonly total: _angular_core.InputSignal<number>;
263
+ readonly total: _angular_core.InputSignalWithTransform<number, unknown>;
187
264
  /**
188
265
  * @description Visual mode of the pager: numeric page buttons, or a page-jump input.
189
266
  * @default "numeric"
@@ -195,58 +272,64 @@ declare class PagerComponent implements PagerVariantInputs {
195
272
  */
196
273
  readonly userClasses: _angular_core.InputSignal<string>;
197
274
  /**
198
- * @description Number of numeric page buttons shown at once before collapsing into jump controls.
275
+ * @description Number of page buttons shown between the first and last page before the rest collapse into
276
+ * jump buttons. At least 1.
199
277
  * @default 5
200
278
  */
201
- readonly visiblePages: _angular_core.InputSignal<number>;
279
+ readonly visiblePages: _angular_core.InputSignalWithTransform<number, unknown>;
202
280
  constructor();
281
+ protected changePageSize(value: number | null): void;
282
+ protected commitPageInput(): void;
203
283
  protected formatPageNumber(value: number): string;
204
- protected onJumpNextClick(): void;
205
- protected onJumpPreviousClick(): void;
284
+ /** Goes to a page (clamped to the page range), as a user action: emits `pageChange` and announces the range. */
285
+ protected goToPage(page: number | null): void;
206
286
  protected onKeydown(event: KeyboardEvent): void;
207
- protected onNextPageClick(): void;
208
- protected onPageClick(page: number): void;
209
- protected onPageInputBlur(): void;
210
- protected onPageSizeValueChange(value: number): void;
211
- protected onPreviousPageClick(): void;
287
+ protected onPageInputEnter(event: Event): void;
212
288
  protected pageItemClasses(active: boolean): string;
213
- private activateInnerNavigation;
214
- private focusNextTarget;
215
- private getFocusableTargets;
216
- private handleInnerNavigationKeydown;
217
- private isElementDisabled;
218
- private isElementHidden;
219
- private overrideTabIndex;
220
- private preparePages;
221
- private resolveFocusableTarget;
222
- private restoreManagedFocusTarget;
223
- private restoreManagedFocusTargets;
224
- private setKeyboardPage;
225
- private setPage;
226
- private syncFocusableTabIndexes;
289
+ /**
290
+ * After a user change: announces the new range, and keeps focus in the pager when the focused control was
291
+ * removed or disabled (a jump button that is no longer needed, Next on the last page).
292
+ */
293
+ private afterUserChange;
294
+ /**
295
+ * The page buttons: the first and last page, a window of `visiblePages` pages around the current one, and a
296
+ * jump button for each longer gap. A gap of one page shows that page instead.
297
+ */
298
+ private buildPageItems;
299
+ private createNavigationContext;
300
+ private emitPageChange;
301
+ private findNavigationTemplate;
302
+ private focusedInside;
303
+ private isDisabled;
227
304
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PagerComponent, never>;
228
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<PagerComponent, "mona-pager", never, { "firstLast": { "alias": "firstLast"; "required": false; "isSignal": true; }; "navigable": { "alias": "navigable"; "required": false; "isSignal": true; }; "pageInput": { "alias": "pageInput"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizeValues": { "alias": "pageSizeValues"; "required": false; "isSignal": true; }; "previousNext": { "alias": "previousNext"; "required": false; "isSignal": true; }; "responsive": { "alias": "responsive"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showInfo": { "alias": "showInfo"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "skip": { "alias": "skip"; "required": false; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "userClasses": { "alias": "class"; "required": false; "isSignal": true; }; "visiblePages": { "alias": "visiblePages"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, ["navigationButtonsTemplateList", "numericButtonsTemplate", "pageSizeTemplate", "pagerInfoTemplate"], never, true, never>;
305
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PagerComponent, "mona-pager", never, { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "firstLast": { "alias": "firstLast"; "required": false; "isSignal": true; }; "navigable": { "alias": "navigable"; "required": false; "isSignal": true; }; "pageInput": { "alias": "pageInput"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizeValues": { "alias": "pageSizeValues"; "required": false; "isSignal": true; }; "previousNext": { "alias": "previousNext"; "required": false; "isSignal": true; }; "responsive": { "alias": "responsive"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showInfo": { "alias": "showInfo"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "skip": { "alias": "skip"; "required": false; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "userClasses": { "alias": "class"; "required": false; "isSignal": true; }; "visiblePages": { "alias": "visiblePages"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "pageSize": "pageSizeChange"; "pageSizeSelect": "pageSizeSelect"; "skip": "skipChange"; }, ["navigationButtonsTemplateList", "numericButtonsTemplate", "pageSizeTemplate", "pagerInfoTemplate"], never, true, never>;
229
306
  }
230
307
 
231
308
  declare class PagerPageSizeTemplateDirective {
309
+ static ngTemplateContextGuard(_directive: PagerPageSizeTemplateDirective, _context: unknown): _context is PageSizeTemplateContext;
232
310
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PagerPageSizeTemplateDirective, never>;
233
311
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<PagerPageSizeTemplateDirective, "ng-template[monaPagerPageSizeTemplate]", never, {}, {}, never, never, true, never>;
234
312
  }
235
313
 
236
314
  declare const PAGER_DEFAULT_MESSAGES: {
237
315
  firstPageLabel: string;
316
+ itemsPerPageLabel: string;
238
317
  jumpBackwardLabel: (pages: number) => string;
239
318
  jumpForwardLabel: (pages: number) => string;
240
319
  lastPageLabel: string;
241
320
  nextPageLabel: string;
242
321
  ofText: string;
322
+ pageInputPrefix: (_totalPages: number) => string;
323
+ pageInputSuffix: (totalPages: number) => string;
243
324
  pageLabel: (page: number) => string;
325
+ pageSelectLabel: string;
244
326
  pageSizeLabel: (pageSize: number) => string;
245
327
  pageStatus: (page: number, totalPages: number) => string;
246
328
  pageText: string;
329
+ pagerLabel: string;
247
330
  previousPageLabel: string;
248
331
  rangeStatus: (start: number, end: number, total: number) => string;
249
332
  };
250
333
 
251
334
  export { PAGER_DEFAULT_MESSAGES, PageSizeChangeEvent, PagerComponent, PagerInfoTemplateDirective, PagerNavigationButtonsTemplateDirective, PagerNumericButtonsTemplateDirective, PagerPageSizeTemplateDirective };
252
- export type { PageChangeEvent };
335
+ export type { InfoTemplateContext, NavigationButtonsTemplateContext, NumericButtonsTemplateContext, PageChangeEvent, PageSizeTemplateContext, PagerContext, PagerType };
@@ -1,4 +1,22 @@
1
- import { Predicate, OrderComparator, Selector } from '@mirei/ts-collections';
1
+ import { Selector } from '@mirei/ts-collections';
2
+
3
+ /**
4
+ * @description Options shared by sorting and filtering.
5
+ */
6
+ interface QueryOptions {
7
+ /**
8
+ * @description BCP 47 locale used to compare and lowercase strings. Defaults to the runtime's locale.
9
+ */
10
+ readonly locale?: string;
11
+ }
12
+ /**
13
+ * Compares two field values with one total order, so sorts, group orders and min/max agree:
14
+ * - empty values come first and are equal to each other: null, undefined, NaN, invalid dates, and values
15
+ * with no natural order (objects, arrays, symbols, functions);
16
+ * - then booleans, numbers and bigints (by value), dates (`Date` or luxon `DateTime`, by time),
17
+ * and strings (by the locale, with digits compared by value: "item 2" before "item 10").
18
+ */
19
+ declare function compareValues(left: unknown, right: unknown, options?: QueryOptions): number;
2
20
 
3
21
  type CommonFilterOperators = "eq" | "neq";
4
22
  type NullFilterOperators = "isnull" | "isnotnull";
@@ -17,7 +35,7 @@ type FieldDefinition = {
17
35
  };
18
36
  type CommonFilterDescriptor = FieldDefinition & {
19
37
  operator: CommonFilterOperators;
20
- value: any;
38
+ value: unknown;
21
39
  };
22
40
  type NullFilterDescriptor = FieldDefinition & {
23
41
  operator: NullFilterOperators;
@@ -45,45 +63,58 @@ type DateFilterDescriptor = FieldDefinition & ({
45
63
  } | NullFilterDescriptor);
46
64
  type ArrayFilterDescriptor = FieldDefinition & {
47
65
  operator: ArrayFilterOperators;
48
- value: any[];
66
+ value: readonly unknown[];
49
67
  };
68
+ /** A bound of a range filter. `null` leaves that end open. */
69
+ type RangeFilterBound = number | Date | string | null;
70
+ /** `between` and `notbetween` include both bounds. */
50
71
  type RangeFilterDescriptor = FieldDefinition & {
51
72
  operator: RangeFilterOperators;
52
- value: [number, number];
73
+ value: readonly [from: RangeFilterBound, to: RangeFilterBound];
53
74
  };
54
75
  type FunctionFilterDescriptor = FieldDefinition & {
55
76
  operator: FunctionFilterOperators;
56
- predicate: Predicate<any>;
77
+ /** Receives the value of `field`, not the row. */
78
+ predicate(value: unknown): boolean;
57
79
  };
58
80
  type FilterDescriptor = CommonFilterDescriptor | BooleanFilterDescriptor | NumericFilterDescriptor | StringFilterDescriptor | DateFilterDescriptor | NullFilterDescriptor | EmptyFilterDescriptor | NullOrEmptyFilterDescriptor | ArrayFilterDescriptor | RangeFilterDescriptor | FunctionFilterDescriptor;
59
81
  type FilterLogic = "and" | "or";
82
+ /** An empty `filters` list matches every item, whatever the logic. */
60
83
  interface CompositeFilterDescriptor {
61
- logic: FilterLogic;
62
84
  filters: Array<FilterDescriptor | CompositeFilterDescriptor>;
85
+ logic: FilterLogic;
63
86
  }
64
87
 
65
- interface SortDescriptor<T = any> {
88
+ interface SortDescriptor<TValue = unknown> {
66
89
  dir: SortDirection;
67
90
  field: string;
68
- sort?: OrderComparator<T>;
91
+ /**
92
+ * Compares two values of `field` (not two rows). Return a negative number when `left` comes first
93
+ * in ascending order; `dir: "desc"` reverses the result. Empty values are passed in as they are.
94
+ */
95
+ sort?(left: TValue, right: TValue): number;
69
96
  }
70
97
  type SortDirection = "asc" | "desc";
71
98
 
72
99
  interface IQuery<T> extends Iterable<T> {
73
100
  filter<R>(filter: FilterDescriptor | CompositeFilterDescriptor, fieldSelector?: Selector<T, R>): IQuery<T>;
74
101
  run(): T[];
75
- sort<R>(descriptor: SortDescriptor<T>[], fieldSelector?: Selector<T, R>): IQuery<T>;
102
+ sort<R>(descriptor: readonly SortDescriptor[], fieldSelector?: Selector<T, R>): IQuery<T>;
76
103
  }
77
104
  declare class Query<T> implements IQuery<T> {
78
105
  #private;
79
- private readonly iterable;
80
106
  private constructor();
107
+ /**
108
+ * @description Starts a query over the given items.
109
+ * @param iterable The items to filter and sort.
110
+ * @param options `locale` sets how strings are compared and lowercased; it defaults to the runtime's locale.
111
+ */
112
+ static from<T>(iterable: Iterable<T>, options?: QueryOptions): IQuery<T>;
81
113
  [Symbol.iterator](): Iterator<T>;
82
- static from<T>(iterable: Iterable<T>): IQuery<T>;
83
114
  filter<R>(filter: FilterDescriptor | CompositeFilterDescriptor, fieldSelector?: Selector<T, R>): IQuery<T>;
84
115
  run(): T[];
85
- sort<R>(descriptor: SortDescriptor<T>[], fieldSelector?: Selector<T, R>): IQuery<T>;
116
+ sort<R>(descriptor: readonly SortDescriptor[], fieldSelector?: Selector<T, R>): IQuery<T>;
86
117
  }
87
118
 
88
- export { Query };
89
- export type { ArrayFilterDescriptor, ArrayFilterOperators, BooleanFilterDescriptor, BooleanFilterOperators, CommonFilterDescriptor, CommonFilterOperators, CompositeFilterDescriptor, DateFilterDescriptor, DateFilterOperators, EmptyFilterDescriptor, EmptyFilterOperators, FieldDefinition, FilterDescriptor, FilterLogic, FilterOperators, FunctionFilterDescriptor, FunctionFilterOperators, NullFilterDescriptor, NullFilterOperators, NullOrEmptyFilterDescriptor, NullOrEmptyFilterOperators, NumericFilterDescriptor, NumericFilterOperators, RangeFilterDescriptor, RangeFilterOperators, SortDescriptor, SortDirection, StringFilterDescriptor, StringFilterOperators };
119
+ export { Query, compareValues };
120
+ export type { ArrayFilterDescriptor, ArrayFilterOperators, BooleanFilterDescriptor, BooleanFilterOperators, CommonFilterDescriptor, CommonFilterOperators, CompositeFilterDescriptor, DateFilterDescriptor, DateFilterOperators, EmptyFilterDescriptor, EmptyFilterOperators, FieldDefinition, FilterDescriptor, FilterLogic, FilterOperators, FunctionFilterDescriptor, FunctionFilterOperators, NullFilterDescriptor, NullFilterOperators, NullOrEmptyFilterDescriptor, NullOrEmptyFilterOperators, NumericFilterDescriptor, NumericFilterOperators, QueryOptions, RangeFilterBound, RangeFilterDescriptor, RangeFilterOperators, SortDescriptor, SortDirection, StringFilterDescriptor, StringFilterOperators };