@nanahoshi/mona-ui 0.24.7 → 0.24.8

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 (67) hide show
  1. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  2. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  3. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
  4. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs} +2 -2
  5. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs → nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs} +4 -4
  6. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs → nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs} +2 -2
  7. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs} +4 -4
  8. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs} +8 -8
  9. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  10. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +40 -3
  11. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
  12. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
  13. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
  14. package/fesm2022/nanahoshi-mona-ui-internal.mjs +28 -2
  15. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
  16. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -71
  17. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +25 -3
  18. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +29 -3
  19. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +29 -3
  20. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +36 -3
  21. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +25 -3
  22. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +29 -3
  23. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +25 -3
  24. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +25 -3
  25. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +29 -3
  26. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +45 -3
  27. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +25 -3
  28. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +25 -3
  29. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +25 -3
  30. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
  31. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
  32. package/i18n/catalogs/en-US.messages.json +28 -6
  33. package/locales/ar-sa/ar-sa.messages.json +25 -3
  34. package/locales/de-de/de-de.messages.json +25 -3
  35. package/locales/es-es/es-es.messages.json +25 -3
  36. package/locales/fr-fr/fr-fr.messages.json +25 -3
  37. package/locales/id-id/id-id.messages.json +25 -3
  38. package/locales/it-it/it-it.messages.json +25 -3
  39. package/locales/ja-jp/ja-jp.messages.json +25 -3
  40. package/locales/ko-kr/ko-kr.messages.json +25 -3
  41. package/locales/pt-br/pt-br.messages.json +25 -3
  42. package/locales/ru-ru/ru-ru.messages.json +25 -3
  43. package/locales/tr-tr/tr-tr.messages.json +25 -3
  44. package/locales/zh-cn/zh-cn.messages.json +25 -3
  45. package/locales/zh-tw/zh-tw.messages.json +25 -3
  46. package/package.json +1 -1
  47. package/types/nanahoshi-mona-ui-i18n.d.ts +50 -0
  48. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
  49. package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
  50. package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
  51. package/types/nanahoshi-mona-ui-internal.d.ts +10 -2
  52. package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
  53. package/types/nanahoshi-mona-ui-list-view.d.ts +112 -21
  54. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +22 -0
  55. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +22 -0
  56. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +22 -0
  57. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +22 -0
  58. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +22 -0
  59. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +22 -0
  60. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +22 -0
  61. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +22 -0
  62. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +22 -0
  63. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +22 -0
  64. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +22 -0
  65. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +22 -0
  66. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +22 -0
  67. package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
@@ -1,11 +1,12 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, input, output, effect, untracked, afterRenderEffect, Optional, SkipSelf, Component, model, afterNextRender } from '@angular/core';
3
+ import { Directive, input, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, output, booleanAttribute, effect, untracked, Component, model } from '@angular/core';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { ListService, ListComponent, ListHeaderTemplateDirective, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
5
+ import { ImmutableList } from '@mirei/ts-collections';
6
+ import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
7
+ import { ListService, LIST_DEFAULT_MESSAGES, ListComponent, ListHeaderTemplateDirective, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, LIST_VIEW_HOST_LIST_SERVICE } from '@nanahoshi/mona-ui/internal/list';
6
8
  import { PagerComponent } from '@nanahoshi/mona-ui/pager';
7
- import { ImmutableSet } from '@mirei/ts-collections';
8
- import { fromEvent, filter } from 'rxjs';
9
+ import { Subject, fromEvent, filter } from 'rxjs';
9
10
  import { twMerge } from 'tailwind-merge';
10
11
  import { cva } from 'class-variance-authority';
11
12
 
@@ -20,6 +21,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
20
21
  }]
21
22
  }] });
22
23
 
24
+ /**
25
+ * Template for the header of each group. The group's value is the template's implicit value (`let-group`); see
26
+ * `ListViewGroupHeaderTemplateContext`. The context isn't type-checked, so templates written against the value's own
27
+ * type keep compiling.
28
+ */
23
29
  class ListViewGroupHeaderTemplateDirective {
24
30
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewGroupHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
25
31
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListViewGroupHeaderTemplateDirective, isStandalone: true, selector: "ng-template[monaListViewGroupHeaderTemplate]", ngImport: i0 }); }
@@ -42,16 +48,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
42
48
  }]
43
49
  }] });
44
50
 
51
+ /**
52
+ * Template for each item of a list view. The data item is the template's implicit value (`let-item`). Bind the list
53
+ * view's items to `monaListViewItemTemplateOf` to type it; without it, the item is `any` in templates.
54
+ */
55
+ // `any` by default: a template without `monaListViewItemTemplateOf` keeps an untyped item, as before the guard existed.
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
57
  class ListViewItemTemplateDirective {
58
+ constructor() {
59
+ /**
60
+ * @description The list view's items, used only to type the template's item. Optional.
61
+ * @default null
62
+ */
63
+ this.monaListViewItemTemplateOf = input(null, /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "monaListViewItemTemplateOf" }] : /* istanbul ignore next */ []));
65
+ }
66
+ static ngTemplateContextGuard(_directive, _context) {
67
+ return true;
68
+ }
46
69
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
47
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListViewItemTemplateDirective, isStandalone: true, selector: "ng-template[monaListViewItemTemplate]", ngImport: i0 }); }
70
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListViewItemTemplateDirective, isStandalone: true, selector: "ng-template[monaListViewItemTemplate]", inputs: { monaListViewItemTemplateOf: { classPropertyName: "monaListViewItemTemplateOf", publicName: "monaListViewItemTemplateOf", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
48
71
  }
49
72
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewItemTemplateDirective, decorators: [{
50
73
  type: Directive,
51
74
  args: [{
52
75
  selector: "ng-template[monaListViewItemTemplate]"
53
76
  }]
54
- }] });
77
+ }], propDecorators: { monaListViewItemTemplateOf: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaListViewItemTemplateOf", required: false }] }] } });
55
78
 
56
79
  class ListViewNoDataTemplateDirective {
57
80
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewNoDataTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -85,20 +108,16 @@ const listViewBaseThemeVariants = cva(`
85
108
  }
86
109
  });
87
110
 
111
+ /** How close to the end (in pixels) counts as scrolled to the bottom. */
112
+ const SCROLL_BOTTOM_THRESHOLD = 3;
88
113
  class ListViewComponent {
89
114
  #destroyRef;
90
115
  #hostElementRef;
91
- #scrollBottomEnabled;
92
- #scrollSubscription;
116
+ #atBottom;
93
117
  constructor() {
94
118
  this.#destroyRef = inject(DestroyRef);
95
- this.#hostElementRef = inject((ElementRef));
96
- this.#scrollBottomEnabled = computed(() => {
97
- const pageableOptions = this.listService.pageableOptions();
98
- return !pageableOptions.enabled;
99
- }, /* @ts-ignore */
100
- ...(ngDevMode ? [{ debugName: "#scrollBottomEnabled" }] : /* istanbul ignore next */ []));
101
- this.#scrollSubscription = null;
119
+ this.#hostElementRef = inject(ElementRef);
120
+ this.#atBottom = false;
102
121
  this.baseClasses = computed(() => {
103
122
  const rounded = this.rounded();
104
123
  const size = this.size();
@@ -110,7 +129,7 @@ class ListViewComponent {
110
129
  this.footerTemplate = contentChild(ListViewFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
111
130
  this.groupHeaderTemplate = contentChild(ListViewGroupHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
112
131
  this.headerTemplate = contentChild(ListViewHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
113
- this.itemCount = computed(() => this.listItems().size(), /* @ts-ignore */
132
+ this.itemCount = computed(() => this.listItems().length, /* @ts-ignore */
114
133
  ...(ngDevMode ? [{ debugName: "itemCount" }] : /* istanbul ignore next */ []));
115
134
  this.itemTemplate = contentChild(ListViewItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
116
135
  this.listHeight = computed(() => {
@@ -118,10 +137,8 @@ class ListViewComponent {
118
137
  return typeof height === "number" ? `${height}px` : height;
119
138
  }, /* @ts-ignore */
120
139
  ...(ngDevMode ? [{ debugName: "listHeight" }] : /* istanbul ignore next */ []));
121
- this.listItems = computed(() => {
122
- const items = this.items();
123
- return ImmutableSet.create(items);
124
- }, /* @ts-ignore */
140
+ /** The items as given: a list, so equal items (two `"a"` strings) are both shown. */
141
+ this.listItems = computed(() => ImmutableList.create(this.items()), /* @ts-ignore */
125
142
  ...(ngDevMode ? [{ debugName: "listItems" }] : /* istanbul ignore next */ []));
126
143
  this.listMaxHeight = computed(() => {
127
144
  const maxHeight = this.maxHeight();
@@ -133,26 +150,66 @@ class ListViewComponent {
133
150
  return typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
134
151
  }, /* @ts-ignore */
135
152
  ...(ngDevMode ? [{ debugName: "listMaxWidth" }] : /* istanbul ignore next */ []));
153
+ /**
154
+ * A list you can select from is a `listbox`; one that only shows items is a `list`.
155
+ */
156
+ this.listRole = computed(() => this.listService.selectableOptions().enabled ? "listbox" : "list", /* @ts-ignore */
157
+ ...(ngDevMode ? [{ debugName: "listRole" }] : /* istanbul ignore next */ []));
136
158
  this.listService = inject(ListService);
137
159
  this.listWidth = computed(() => {
138
160
  const width = this.width();
139
161
  return typeof width === "number" ? `${width}px` : width;
140
162
  }, /* @ts-ignore */
141
163
  ...(ngDevMode ? [{ debugName: "listWidth" }] : /* istanbul ignore next */ []));
164
+ this.messages = inject(MonaI18nService).componentMessages("list", LIST_DEFAULT_MESSAGES);
142
165
  this.noDataTemplate = contentChild(ListViewNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
143
- this.viewItems = computed(() => this.listItems(), /* @ts-ignore */
144
- ...(ngDevMode ? [{ debugName: "viewItems" }] : /* istanbul ignore next */ []));
166
+ /** The pager's name: the given one, else one built from the list's name, else the pager's own default. */
167
+ this.pagerLabel = computed(() => {
168
+ const pagerAriaLabel = this.pagerAriaLabel();
169
+ if (pagerAriaLabel) {
170
+ return pagerAriaLabel;
171
+ }
172
+ const ariaLabel = this.ariaLabel();
173
+ return ariaLabel ? this.messages().pagerLabel(ariaLabel) : null;
174
+ }, /* @ts-ignore */
175
+ ...(ngDevMode ? [{ debugName: "pagerLabel" }] : /* istanbul ignore next */ []));
176
+ /** Polite status text: loading, or the empty state. */
177
+ this.statusText = computed(() => {
178
+ if (this.loading()) {
179
+ return this.messages().loading;
180
+ }
181
+ return this.itemCount() === 0 ? this.messages().noData : "";
182
+ }, /* @ts-ignore */
183
+ ...(ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []));
145
184
  /**
146
185
  * @description Accessible name for the list view's `listbox` element. Describe what the list represents.
147
186
  * @default ""
148
187
  */
149
188
  this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
150
189
  /**
151
- * @description Sets the height of the list view.
190
+ * @description Id of the element that names the list view's list, as an alternative to `aria-label`.
191
+ * @default ""
192
+ */
193
+ this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
194
+ /**
195
+ * @description Property name or predicate that marks an item as disabled. Disabled items can't be selected,
196
+ * activated or reached by typeahead.
197
+ * @default ""
198
+ */
199
+ this.disabledBy = input("", /* @ts-ignore */
200
+ ...(ngDevMode ? [{ debugName: "disabledBy" }] : /* istanbul ignore next */ []));
201
+ /**
202
+ * @description Sets the height of the list view. With virtual scrolling, the viewport takes this height, so a
203
+ * percentage needs a parent with a height; `""` sizes the viewport to its items instead.
152
204
  * @default 100%
153
205
  */
154
206
  this.height = input("100%", /* @ts-ignore */
155
207
  ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
208
+ /**
209
+ * @description Emitted with the data item when the user activates an enabled item by clicking it or pressing
210
+ * Enter on it. Fires whether or not the list view is selectable.
211
+ */
212
+ this.itemActivate = output();
156
213
  /**
157
214
  * @description Collection of items to render.
158
215
  * @default []
@@ -183,6 +240,11 @@ class ListViewComponent {
183
240
  */
184
241
  this.listStyle = input({}, /* @ts-ignore */
185
242
  ...(ngDevMode ? [{ debugName: "listStyle" }] : /* istanbul ignore next */ []));
243
+ /**
244
+ * @description Marks the list as loading: it gets `aria-busy` and a polite "Loading" status.
245
+ * @default false
246
+ */
247
+ this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
186
248
  /**
187
249
  * @description Sets the maximum height of the list.
188
250
  * @default ""
@@ -195,6 +257,18 @@ class ListViewComponent {
195
257
  */
196
258
  this.maxWidth = input("", /* @ts-ignore */
197
259
  ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
260
+ /**
261
+ * Page-size picks from the pager, forwarded to `ListViewPageableDirective`.
262
+ * @internal
263
+ */
264
+ this.pageSizeSelect$ = new Subject();
265
+ /**
266
+ * @description Accessible name of the pager. Defaults to "{name} pagination" from the list view's `aria-label`,
267
+ * so two paged list views on a page have different landmarks.
268
+ * @default ""
269
+ */
270
+ this.pagerAriaLabel = input("", /* @ts-ignore */
271
+ ...(ngDevMode ? [{ debugName: "pagerAriaLabel" }] : /* istanbul ignore next */ []));
198
272
  /**
199
273
  * @description Border-radius preset applied to the component.
200
274
  * @default medium
@@ -202,7 +276,8 @@ class ListViewComponent {
202
276
  this.rounded = input("medium", /* @ts-ignore */
203
277
  ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
204
278
  /**
205
- * @description Emitted when the list is scrolled to the bottom.
279
+ * @description Emitted once each time the list is scrolled to its end, when the list view isn't paged. Scrolling
280
+ * away and back emits again, as does reaching the new end after more items are added.
206
281
  */
207
282
  this.scrollBottom = output();
208
283
  /**
@@ -228,60 +303,68 @@ class ListViewComponent {
228
303
  */
229
304
  this.width = input("100%", /* @ts-ignore */
230
305
  ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
306
+ // Arrow keys, Home/End and typeahead work without the navigable directive, which can still change or turn
307
+ // them off. Without them only one item could be reached from the keyboard.
308
+ this.listService.setNavigableOptions({ enabled: true, mode: "select", wrap: false });
231
309
  effect(() => {
232
310
  const textField = this.textField();
233
311
  untracked(() => this.listService.setTextField(textField ?? ""));
234
312
  });
235
- afterRenderEffect({
236
- read: () => this.setScrollBottomEvent()
313
+ effect(() => {
314
+ const disabledBy = this.disabledBy();
315
+ untracked(() => this.listService.setDisabledBy(disabledBy ?? ""));
237
316
  });
317
+ this.setScrollBottomEvent();
318
+ }
319
+ onItemActivate(item) {
320
+ this.itemActivate.emit(item.data);
238
321
  }
239
322
  onPageChange(event) {
240
323
  this.listService.pageState.update(s => ({ ...s, page: event.page, skip: event.skip, take: event.take }));
241
324
  }
242
- setScrollBottomEvent() {
243
- let element;
244
- const virtualScrollEnabled = this.listService.virtualScrollOptions().enabled;
245
- if (virtualScrollEnabled) {
246
- element = this.#hostElementRef.nativeElement.querySelector(".cdk-virtual-scroll-viewport");
247
- }
248
- else {
249
- element = this.#hostElementRef.nativeElement.querySelector("mona-list > ul");
250
- }
251
- this.#scrollSubscription?.unsubscribe();
252
- if (!element) {
253
- return;
325
+ onPageSizeSelect(event) {
326
+ this.pageSizeSelect$.next(event);
327
+ }
328
+ /** Whether the scrolled element is this list view's own list or viewport, not a nested list view or template. */
329
+ isListScroll(target) {
330
+ if (!(target instanceof HTMLElement) ||
331
+ target.closest("mona-list-view") !== this.#hostElementRef.nativeElement) {
332
+ return false;
254
333
  }
255
- this.#scrollSubscription = fromEvent(element, "scroll")
256
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(event => {
257
- if (!this.#scrollBottomEnabled()) {
258
- return false;
259
- }
334
+ return target.matches("cdk-virtual-scroll-viewport") || target.matches("mona-list > ul");
335
+ }
336
+ /**
337
+ * Scroll events don't bubble, so the host listens in the capture phase. That covers the list and the virtual
338
+ * viewport whenever they are rendered, including ones created after the first render.
339
+ */
340
+ setScrollBottomEvent() {
341
+ const host = this.#hostElementRef.nativeElement;
342
+ fromEvent(host, "scroll", { capture: true })
343
+ .pipe(takeUntilDestroyed(this.#destroyRef), filter(event => this.isListScroll(event.target)), filter(event => {
260
344
  const target = event.target;
261
- return Math.abs(target.scrollHeight - target.scrollTop - target.clientHeight) < 3.0;
345
+ const atBottom = target.scrollHeight - target.scrollTop - target.clientHeight < SCROLL_BOTTOM_THRESHOLD;
346
+ const arrived = atBottom && !this.#atBottom;
347
+ this.#atBottom = atBottom;
348
+ return arrived && !this.listService.pageableOptions().enabled;
262
349
  }))
263
350
  .subscribe(event => this.scrollBottom.emit(event));
264
351
  }
265
352
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
266
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListViewComponent, isStandalone: true, selector: "mona-list-view", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, listClass: { classPropertyName: "listClass", publicName: "listClass", isSignal: true, isRequired: false, transformFunction: null }, listItemClass: { classPropertyName: "listItemClass", publicName: "listItemClass", isSignal: true, isRequired: false, transformFunction: null }, listItemStyle: { classPropertyName: "listItemStyle", publicName: "listItemStyle", isSignal: true, isRequired: false, transformFunction: null }, listStyle: { classPropertyName: "listStyle", publicName: "listStyle", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scrollBottom: "scrollBottom" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "-1" } }, providers: [
353
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListViewComponent, isStandalone: true, selector: "mona-list-view", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, disabledBy: { classPropertyName: "disabledBy", publicName: "disabledBy", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, listClass: { classPropertyName: "listClass", publicName: "listClass", isSignal: true, isRequired: false, transformFunction: null }, listItemClass: { classPropertyName: "listItemClass", publicName: "listItemClass", isSignal: true, isRequired: false, transformFunction: null }, listItemStyle: { classPropertyName: "listItemStyle", publicName: "listItemStyle", isSignal: true, isRequired: false, transformFunction: null }, listStyle: { classPropertyName: "listStyle", publicName: "listStyle", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, pagerAriaLabel: { classPropertyName: "pagerAriaLabel", publicName: "pagerAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemActivate: "itemActivate", scrollBottom: "scrollBottom" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "-1", "attr.aria-label": "null", "attr.aria-labelledby": "null" } }, providers: [
267
354
  {
355
+ // Each list view has its own service, unless the component whose template it is in shares one on purpose.
268
356
  provide: ListService,
269
- useFactory: (parentListService) => {
270
- return parentListService ?? new ListService();
271
- },
272
- deps: [[new Optional(), new SkipSelf(), ListService]]
357
+ useFactory: () => inject(LIST_VIEW_HOST_LIST_SERVICE, { optional: true, skipSelf: true }) ?? new ListService()
273
358
  }
274
- ], queries: [{ propertyName: "footerTemplate", first: true, predicate: ListViewFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ListViewGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListViewHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListViewItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListViewNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<mona-list\n [ariaLabel]=\"ariaLabel()\"\n [data]=\"viewItems()\"\n [height]=\"listHeight()\"\n [focusOnMount]=\"false\"\n [width]=\"listWidth()\"\n [maxHeight]=\"listMaxHeight()\"\n [maxWidth]=\"listMaxWidth()\"\n [listItemClass]=\"listItemClass()\"\n [listItemStyle]=\"listItemStyle()\"\n [listClass]=\"listClass()\"\n [listStyle]=\"listStyle()\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-groupHeader>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: groupHeader }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n</mona-list>\n\n@let pageableOptions = listService.pageableOptions();\n@if (pageableOptions.enabled && !listService.virtualScrollOptions().enabled && viewItems().length > 0) {\n @let pageState = listService.pageState();\n <mona-pager\n [firstLast]=\"pageableOptions.firstLast\"\n [pageSizeValues]=\"pageableOptions.pageSizeValues\"\n [visiblePages]=\"pageableOptions.visiblePages\"\n [total]=\"itemCount()\"\n [skip]=\"pageState.skip\"\n [responsive]=\"false\"\n [rounded]=\"rounded()\"\n [pageSize]=\"pageState.take\"\n [previousNext]=\"pageableOptions.previousNext\"\n [showInfo]=\"pageableOptions.showInfo\"\n [size]=\"size()\"\n (pageChange)=\"onPageChange($event)\"\n class=\"border-b-0 border-x-0 rounded-t-none\"></mona-pager>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PagerComponent, selector: "mona-pager", inputs: ["aria-label", "aria-labelledby", "firstLast", "navigable", "pageInput", "pageSize", "pageSizeValues", "previousNext", "responsive", "rounded", "showInfo", "size", "skip", "total", "type", "class", "visiblePages"], outputs: ["pageChange", "pageSizeChange", "pageSizeSelect", "skipChange"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemSelect"] }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }] }); }
359
+ ], queries: [{ propertyName: "footerTemplate", first: true, predicate: ListViewFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ListViewGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListViewHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListViewItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListViewNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<mona-list\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [busy]=\"loading()\"\n [listRole]=\"listRole()\"\n [data]=\"listItems()\"\n [height]=\"listHeight()\"\n [focusOnMount]=\"false\"\n [width]=\"listWidth()\"\n [maxHeight]=\"listMaxHeight()\"\n [maxWidth]=\"listMaxWidth()\"\n [listItemClass]=\"listItemClass()\"\n [listItemStyle]=\"listItemStyle()\"\n [listClass]=\"listClass()\"\n [listStyle]=\"listStyle()\"\n (itemActivate)=\"onItemActivate($event)\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-groupHeader>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: groupHeader }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n</mona-list>\n\n@let pageableOptions = listService.pageableOptions();\n@if (pageableOptions.enabled && !listService.virtualScrollOptions().enabled && itemCount() > 0) {\n @let pageState = listService.pageState();\n <mona-pager\n [firstLast]=\"pageableOptions.firstLast\"\n [pageSizeValues]=\"pageableOptions.pageSizeValues\"\n [visiblePages]=\"pageableOptions.visiblePages\"\n [total]=\"itemCount()\"\n [skip]=\"pageState.skip\"\n [responsive]=\"false\"\n [rounded]=\"rounded()\"\n [pageSize]=\"pageState.take\"\n [previousNext]=\"pageableOptions.previousNext\"\n [showInfo]=\"pageableOptions.showInfo\"\n [type]=\"pageableOptions.type\"\n [size]=\"size()\"\n [aria-label]=\"pagerLabel()\"\n (pageChange)=\"onPageChange($event)\"\n (pageSizeSelect)=\"onPageSizeSelect($event)\"\n class=\"border-b-0 border-x-0 rounded-t-none\"></mona-pager>\n}\n<div role=\"status\" class=\"sr-only\">{{ statusText() }}</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PagerComponent, selector: "mona-pager", inputs: ["aria-label", "aria-labelledby", "firstLast", "navigable", "pageInput", "pageSize", "pageSizeValues", "previousNext", "responsive", "rounded", "showInfo", "size", "skip", "total", "type", "class", "visiblePages"], outputs: ["pageChange", "pageSizeChange", "pageSizeSelect", "skipChange"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "ariaLabelledBy", "busy", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listRole", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemActivate", "itemSelect"] }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }] }); }
275
360
  }
276
361
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewComponent, decorators: [{
277
362
  type: Component,
278
363
  args: [{ selector: "mona-list-view", providers: [
279
364
  {
365
+ // Each list view has its own service, unless the component whose template it is in shares one on purpose.
280
366
  provide: ListService,
281
- useFactory: (parentListService) => {
282
- return parentListService ?? new ListService();
283
- },
284
- deps: [[new Optional(), new SkipSelf(), ListService]]
367
+ useFactory: () => inject(LIST_VIEW_HOST_LIST_SERVICE, { optional: true, skipSelf: true }) ?? new ListService()
285
368
  }
286
369
  ], imports: [
287
370
  NgTemplateOutlet,
@@ -294,9 +377,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
294
377
  ListNoDataTemplateDirective
295
378
  ], host: {
296
379
  "[class]": "baseClasses()",
297
- "[attr.tabindex]": "-1"
298
- }, template: "<mona-list\n [ariaLabel]=\"ariaLabel()\"\n [data]=\"viewItems()\"\n [height]=\"listHeight()\"\n [focusOnMount]=\"false\"\n [width]=\"listWidth()\"\n [maxHeight]=\"listMaxHeight()\"\n [maxWidth]=\"listMaxWidth()\"\n [listItemClass]=\"listItemClass()\"\n [listItemStyle]=\"listItemStyle()\"\n [listClass]=\"listClass()\"\n [listStyle]=\"listStyle()\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-groupHeader>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: groupHeader }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n</mona-list>\n\n@let pageableOptions = listService.pageableOptions();\n@if (pageableOptions.enabled && !listService.virtualScrollOptions().enabled && viewItems().length > 0) {\n @let pageState = listService.pageState();\n <mona-pager\n [firstLast]=\"pageableOptions.firstLast\"\n [pageSizeValues]=\"pageableOptions.pageSizeValues\"\n [visiblePages]=\"pageableOptions.visiblePages\"\n [total]=\"itemCount()\"\n [skip]=\"pageState.skip\"\n [responsive]=\"false\"\n [rounded]=\"rounded()\"\n [pageSize]=\"pageState.take\"\n [previousNext]=\"pageableOptions.previousNext\"\n [showInfo]=\"pageableOptions.showInfo\"\n [size]=\"size()\"\n (pageChange)=\"onPageChange($event)\"\n class=\"border-b-0 border-x-0 rounded-t-none\"></mona-pager>\n}\n" }]
299
- }], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], listClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listClass", required: false }] }], listItemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemClass", required: false }] }], listItemStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemStyle", required: false }] }], listStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listStyle", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], scrollBottom: [{ type: i0.Output, args: ["scrollBottom"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
380
+ "[attr.tabindex]": "-1",
381
+ // The name belongs to the list inside; the host has no role to carry it.
382
+ "[attr.aria-label]": "null",
383
+ "[attr.aria-labelledby]": "null"
384
+ }, template: "<mona-list\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [busy]=\"loading()\"\n [listRole]=\"listRole()\"\n [data]=\"listItems()\"\n [height]=\"listHeight()\"\n [focusOnMount]=\"false\"\n [width]=\"listWidth()\"\n [maxHeight]=\"listMaxHeight()\"\n [maxWidth]=\"listMaxWidth()\"\n [listItemClass]=\"listItemClass()\"\n [listItemStyle]=\"listItemStyle()\"\n [listClass]=\"listClass()\"\n [listStyle]=\"listStyle()\"\n (itemActivate)=\"onItemActivate($event)\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-groupHeader>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: groupHeader }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </ng-template>\n }\n</mona-list>\n\n@let pageableOptions = listService.pageableOptions();\n@if (pageableOptions.enabled && !listService.virtualScrollOptions().enabled && itemCount() > 0) {\n @let pageState = listService.pageState();\n <mona-pager\n [firstLast]=\"pageableOptions.firstLast\"\n [pageSizeValues]=\"pageableOptions.pageSizeValues\"\n [visiblePages]=\"pageableOptions.visiblePages\"\n [total]=\"itemCount()\"\n [skip]=\"pageState.skip\"\n [responsive]=\"false\"\n [rounded]=\"rounded()\"\n [pageSize]=\"pageState.take\"\n [previousNext]=\"pageableOptions.previousNext\"\n [showInfo]=\"pageableOptions.showInfo\"\n [type]=\"pageableOptions.type\"\n [size]=\"size()\"\n [aria-label]=\"pagerLabel()\"\n (pageChange)=\"onPageChange($event)\"\n (pageSizeSelect)=\"onPageSizeSelect($event)\"\n class=\"border-b-0 border-x-0 rounded-t-none\"></mona-pager>\n}\n<div role=\"status\" class=\"sr-only\">{{ statusText() }}</div>\n" }]
385
+ }], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListViewNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], disabledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledBy", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], itemActivate: [{ type: i0.Output, args: ["itemActivate"] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], listClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listClass", required: false }] }], listItemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemClass", required: false }] }], listItemStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemStyle", required: false }] }], listStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listStyle", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], pagerAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagerAriaLabel", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], scrollBottom: [{ type: i0.Output, args: ["scrollBottom"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
300
386
 
301
387
  class ListViewGroupableDirective {
302
388
  #defaultOptions;
@@ -399,12 +485,33 @@ class ListViewPageableDirective {
399
485
  */
400
486
  this.page = model(1, /* @ts-ignore */
401
487
  ...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
488
+ /**
489
+ * @description Items per page. Supports two-way binding via `[(pageSize)]`: it updates when the user picks a size
490
+ * in the pager. While unset, the options' `pageSize` applies. A new size keeps the first item of the current
491
+ * page in view.
492
+ * @default undefined
493
+ */
494
+ this.pageSize = model(undefined, /* @ts-ignore */
495
+ ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
496
+ /**
497
+ * @description Emitted when the user picks a page size, before it is applied. Call `preventDefault()` on the
498
+ * event to keep the current size.
499
+ */
500
+ this.pageSizeSelect = output();
402
501
  effect(() => {
403
502
  const options = this.options();
404
503
  untracked(() => {
405
504
  const mergedOptions = options === "" ? this.#defaultOptions : { ...this.#defaultOptions, ...options };
406
505
  this.#listService.setPageableOptions(mergedOptions);
407
- this.#listService.pageState.update(s => ({ ...s, take: mergedOptions.pageSize }));
506
+ this.setTake(this.pageSize() ?? mergedOptions.pageSize);
507
+ });
508
+ });
509
+ effect(() => {
510
+ const pageSize = this.pageSize();
511
+ untracked(() => {
512
+ if (pageSize != null) {
513
+ this.setTake(pageSize);
514
+ }
408
515
  });
409
516
  });
410
517
  effect(() => {
@@ -423,22 +530,42 @@ class ListViewPageableDirective {
423
530
  if (this.page() !== pageState.page) {
424
531
  this.page.set(pageState.page);
425
532
  }
533
+ // Report sizes the user picked; an unset size stays unset while the options' size applies.
534
+ const pageSize = this.pageSize();
535
+ const optionsSize = this.#listService.pageableOptions().pageSize;
536
+ if (pageSize !== pageState.take && (pageSize != null || pageState.take !== optionsSize)) {
537
+ this.pageSize.set(pageState.take);
538
+ }
426
539
  });
427
540
  });
541
+ inject(ListViewComponent)
542
+ .pageSizeSelect$.pipe(takeUntilDestroyed(inject(DestroyRef)))
543
+ .subscribe(event => {
544
+ this.pageSizeSelect.emit(event);
545
+ });
546
+ }
547
+ /** Applies a page size, keeping the first item of the current page in view. */
548
+ setTake(take) {
549
+ const size = Math.max(1, Math.floor(take) || 1);
550
+ const pageState = this.#listService.pageState();
551
+ if (pageState.take === size) {
552
+ return;
553
+ }
554
+ const page = Math.floor(pageState.skip / size) + 1;
555
+ this.#listService.pageState.set({ page, skip: (page - 1) * size, take: size });
428
556
  }
429
557
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewPageableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
430
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListViewPageableDirective, isStandalone: true, selector: "mona-list-view[monaListViewPageable]", inputs: { options: { classPropertyName: "options", publicName: "monaListViewPageable", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange" }, ngImport: i0 }); }
558
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListViewPageableDirective, isStandalone: true, selector: "mona-list-view[monaListViewPageable]", inputs: { options: { classPropertyName: "options", publicName: "monaListViewPageable", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange", pageSize: "pageSizeChange", pageSizeSelect: "pageSizeSelect" }, ngImport: i0 }); }
431
559
  }
432
560
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewPageableDirective, decorators: [{
433
561
  type: Directive,
434
562
  args: [{
435
563
  selector: "mona-list-view[monaListViewPageable]"
436
564
  }]
437
- }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaListViewPageable", required: false }] }], page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }, { type: i0.Output, args: ["pageChange"] }] } });
565
+ }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaListViewPageable", required: false }] }], page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }, { type: i0.Output, args: ["pageChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], pageSizeSelect: [{ type: i0.Output, args: ["pageSizeSelect"] }] } });
438
566
 
439
567
  class ListViewSelectableDirective {
440
568
  #defaultOptions;
441
- #destroyRef;
442
569
  #listService;
443
570
  constructor() {
444
571
  this.#defaultOptions = {
@@ -446,14 +573,13 @@ class ListViewSelectableDirective {
446
573
  enabled: true,
447
574
  toggleable: false
448
575
  };
449
- this.#destroyRef = inject(DestroyRef);
450
576
  this.#listService = inject(ListService);
451
- this.selectedKeysChange = output();
452
577
  this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaListViewSelectable" });
453
578
  this.selectBy = input("", /* @ts-ignore */
454
579
  ...(ngDevMode ? [{ debugName: "selectBy" }] : /* istanbul ignore next */ []));
455
580
  this.selectedKeys = input([], /* @ts-ignore */
456
581
  ...(ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []));
582
+ this.selectedKeysChange = output();
457
583
  effect(() => {
458
584
  const selectBy = this.selectBy();
459
585
  untracked(() => {
@@ -480,13 +606,9 @@ class ListViewSelectableDirective {
480
606
  }
481
607
  });
482
608
  });
483
- afterNextRender({
484
- read: () => {
485
- this.#listService.selectedKeysChange$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(keys => {
486
- this.selectedKeysChange.emit(keys);
487
- });
488
- }
489
- });
609
+ this.#listService.selectedKeysChange$
610
+ .pipe(takeUntilDestroyed())
611
+ .subscribe(keys => this.selectedKeysChange.emit(keys));
490
612
  }
491
613
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListViewSelectableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
492
614
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListViewSelectableDirective, isStandalone: true, selector: "mona-list-view[monaListViewSelectable]", inputs: { options: { classPropertyName: "options", publicName: "monaListViewSelectable", isSignal: true, isRequired: false, transformFunction: null }, selectBy: { classPropertyName: "selectBy", publicName: "selectBy", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedKeysChange: "selectedKeysChange" }, ngImport: i0 }); }
@@ -496,7 +618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
496
618
  args: [{
497
619
  selector: "mona-list-view[monaListViewSelectable]"
498
620
  }]
499
- }], ctorParameters: () => [], propDecorators: { selectedKeysChange: [{ type: i0.Output, args: ["selectedKeysChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaListViewSelectable", required: false }] }], selectBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectBy", required: false }] }], selectedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedKeys", required: false }] }] } });
621
+ }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaListViewSelectable", required: false }] }], selectBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectBy", required: false }] }], selectedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedKeys", required: false }] }], selectedKeysChange: [{ type: i0.Output, args: ["selectedKeysChange"] }] } });
500
622
 
501
623
  class ListViewVirtualScrollDirective {
502
624
  #listService;
@@ -268,17 +268,29 @@ const AR_SA_MESSAGES = {
268
268
  },
269
269
  list: {
270
270
  filterList: "تصفية القائمة",
271
- noData: "لا توجد بيانات"
271
+ loading: "جارٍ التحميل",
272
+ noData: "لا توجد بيانات",
273
+ pagerLabel: (list) => `ترقيم صفحات ${list}`
272
274
  },
273
275
  listBox: {
274
276
  clearSelection: "إلغاء التحديد",
277
+ itemsMoved: (position, total) => `تم النقل إلى الموضع ${localizeNumber(position)} من ${localizeNumber(total)}`,
278
+ itemsRemoved: (count) => `عدد العناصر التي تمت إزالتها: ${localizeNumber(count)}`,
279
+ itemsTransferred: (count, list) => `عدد العناصر المنقولة إلى ${list}: ${localizeNumber(count)}`,
280
+ itemsTransferredToOtherList: (count) => `عدد العناصر المنقولة إلى القائمة الأخرى: ${localizeNumber(count)}`,
275
281
  moveDown: "تحريك لأسفل",
276
282
  moveUp: "تحريك لأعلى",
277
283
  remove: "إزالة",
284
+ selectionCleared: "تم إلغاء التحديد",
285
+ toolbarLabel: (list) => `إجراءات ${list}`,
278
286
  transferAllFrom: "نقل الكل من القائمة الأخرى",
287
+ transferAllFromList: (list) => `نقل الكل من ${list}`,
279
288
  transferAllTo: "نقل الكل إلى القائمة الأخرى",
289
+ transferAllToList: (list) => `نقل الكل إلى ${list}`,
280
290
  transferFrom: "نقل من القائمة الأخرى",
281
- transferTo: "نقل إلى القائمة الأخرى"
291
+ transferFromList: (list) => `نقل من ${list}`,
292
+ transferTo: "نقل إلى القائمة الأخرى",
293
+ transferToList: (list) => `نقل إلى ${list}`
282
294
  },
283
295
  multiSelect: {
284
296
  clear: "مسح",
@@ -389,7 +401,17 @@ const AR_SA_MESSAGES = {
389
401
  collapse: "طي",
390
402
  expand: "توسيع",
391
403
  filter: "تصفية:",
392
- filterTree: "تصفية طريقة عرض الشجرة"
404
+ filterLabel: (tree) => `تصفية: ${tree}`,
405
+ filterTree: "تصفية طريقة عرض الشجرة",
406
+ loadError: (node) => `تعذّر تحميل عناصر ${node}`,
407
+ loadingNode: (node) => `جارٍ تحميل ${node}`,
408
+ movedAfter: (node, target) => `تم نقل ${node} بعد ${target}`,
409
+ movedBefore: (node, target) => `تم نقل ${node} قبل ${target}`,
410
+ movedInto: (node, target) => `تم نقل ${node} إلى داخل ${target}`,
411
+ noData: "لا توجد بيانات",
412
+ noMatches: "لا توجد عناصر مطابقة",
413
+ results: (count) => `عدد النتائج: ${localizeNumber(count)}`,
414
+ retryLoading: (node) => `إعادة محاولة تحميل ${node}`
393
415
  },
394
416
  window: {
395
417
  close: "إغلاق",
@@ -264,17 +264,33 @@ const DE_DE_MESSAGES = {
264
264
  },
265
265
  list: {
266
266
  filterList: "Liste filtern",
267
- noData: "Keine Daten"
267
+ loading: "Wird geladen",
268
+ noData: "Keine Daten",
269
+ pagerLabel: (list) => `Seitennavigation für ${list}`
268
270
  },
269
271
  listBox: {
270
272
  clearSelection: "Auswahl aufheben",
273
+ itemsMoved: (position, total) => `An Position ${localizeNumber(position)} von ${localizeNumber(total)} verschoben`,
274
+ itemsRemoved: (count) => count === 1 ? `${localizeNumber(count)} Element entfernt` : `${localizeNumber(count)} Elemente entfernt`,
275
+ itemsTransferred: (count, list) => count === 1
276
+ ? `${localizeNumber(count)} Element in ${list} übertragen`
277
+ : `${localizeNumber(count)} Elemente in ${list} übertragen`,
278
+ itemsTransferredToOtherList: (count) => count === 1
279
+ ? `${localizeNumber(count)} Element in die andere Liste übertragen`
280
+ : `${localizeNumber(count)} Elemente in die andere Liste übertragen`,
271
281
  moveDown: "Nach unten verschieben",
272
282
  moveUp: "Nach oben verschieben",
273
283
  remove: "Entfernen",
284
+ selectionCleared: "Auswahl aufgehoben",
285
+ toolbarLabel: (list) => `Aktionen für ${list}`,
274
286
  transferAllFrom: "Alle aus der anderen Liste übertragen",
287
+ transferAllFromList: (list) => `Alle aus ${list} übertragen`,
275
288
  transferAllTo: "Alle in die andere Liste übertragen",
289
+ transferAllToList: (list) => `Alle in ${list} übertragen`,
276
290
  transferFrom: "Aus der anderen Liste übertragen",
277
- transferTo: "In die andere Liste übertragen"
291
+ transferFromList: (list) => `Aus ${list} übertragen`,
292
+ transferTo: "In die andere Liste übertragen",
293
+ transferToList: (list) => `In ${list} übertragen`
278
294
  },
279
295
  multiSelect: {
280
296
  clear: "Leeren",
@@ -389,7 +405,17 @@ const DE_DE_MESSAGES = {
389
405
  collapse: "Einklappen",
390
406
  expand: "Erweitern",
391
407
  filter: "Filtern",
392
- filterTree: "Baum filtern"
408
+ filterLabel: (tree) => `${tree} filtern`,
409
+ filterTree: "Baum filtern",
410
+ loadError: (node) => `Die Elemente in ${node} konnten nicht geladen werden`,
411
+ loadingNode: (node) => `${node} wird geladen`,
412
+ movedAfter: (node, target) => `${node} nach ${target} verschoben`,
413
+ movedBefore: (node, target) => `${node} vor ${target} verschoben`,
414
+ movedInto: (node, target) => `${node} in ${target} verschoben`,
415
+ noData: "Keine Daten",
416
+ noMatches: "Keine passenden Elemente",
417
+ results: (count) => count === 1 ? `${localizeNumber(count)} Ergebnis` : `${localizeNumber(count)} Ergebnisse`,
418
+ retryLoading: (node) => `${node} erneut laden`
393
419
  },
394
420
  window: {
395
421
  close: "Schließen",