@nanahoshi/mona-ui 0.24.7 → 0.24.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
- package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +339 -101
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +10 -10
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +44 -3
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +465 -23
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -71
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -3
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -3
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +40 -3
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -3
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -3
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +49 -3
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +29 -3
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
- package/fesm2022/nanahoshi-mona-ui-window.mjs +591 -310
- package/i18n/catalogs/en-US.messages.json +32 -6
- package/locales/ar-sa/ar-sa.messages.json +29 -3
- package/locales/de-de/de-de.messages.json +29 -3
- package/locales/es-es/es-es.messages.json +29 -3
- package/locales/fr-fr/fr-fr.messages.json +29 -3
- package/locales/id-id/id-id.messages.json +29 -3
- package/locales/it-it/it-it.messages.json +29 -3
- package/locales/ja-jp/ja-jp.messages.json +29 -3
- package/locales/ko-kr/ko-kr.messages.json +29 -3
- package/locales/pt-br/pt-br.messages.json +29 -3
- package/locales/ru-ru/ru-ru.messages.json +29 -3
- package/locales/tr-tr/tr-tr.messages.json +29 -3
- package/locales/zh-cn/zh-cn.messages.json +29 -3
- package/locales/zh-tw/zh-tw.messages.json +29 -3
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
- package/types/nanahoshi-mona-ui-button.d.ts +20 -3
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
- package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
- package/types/nanahoshi-mona-ui-i18n.d.ts +69 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
- package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
- package/types/nanahoshi-mona-ui-internal.d.ts +128 -16
- package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
- package/types/nanahoshi-mona-ui-list-view.d.ts +112 -21
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +26 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +26 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
- package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
- package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
- package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
- package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
- package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
- package/types/nanahoshi-mona-ui-window.d.ts +103 -14
|
@@ -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,
|
|
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 {
|
|
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 {
|
|
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: "
|
|
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
|
-
#
|
|
92
|
-
#scrollSubscription;
|
|
116
|
+
#atBottom;
|
|
93
117
|
constructor() {
|
|
94
118
|
this.#destroyRef = inject(DestroyRef);
|
|
95
|
-
this.#hostElementRef = inject(
|
|
96
|
-
this.#
|
|
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().
|
|
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
|
-
|
|
122
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
236
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
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: (
|
|
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]=\"
|
|
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: (
|
|
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
|
-
|
|
299
|
-
|
|
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
|
|
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
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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: {
|
|
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
|
-
|
|
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
|
-
|
|
291
|
+
transferFromList: (list) => `نقل من ${list}`,
|
|
292
|
+
transferTo: "نقل إلى القائمة الأخرى",
|
|
293
|
+
transferToList: (list) => `نقل إلى ${list}`
|
|
282
294
|
},
|
|
283
295
|
multiSelect: {
|
|
284
296
|
clear: "مسح",
|
|
@@ -289,6 +301,7 @@ const AR_SA_MESSAGES = {
|
|
|
289
301
|
close: "إغلاق",
|
|
290
302
|
error: "خطأ",
|
|
291
303
|
info: "معلومات",
|
|
304
|
+
region: "الإشعارات",
|
|
292
305
|
success: "نجاح",
|
|
293
306
|
warning: "تحذير"
|
|
294
307
|
},
|
|
@@ -346,6 +359,7 @@ const AR_SA_MESSAGES = {
|
|
|
346
359
|
},
|
|
347
360
|
splitButton: {
|
|
348
361
|
menuButtonAriaLabel: "عرض خيارات القائمة",
|
|
362
|
+
menuButtonWithText: (text) => `مزيد من خيارات ${text}`,
|
|
349
363
|
splitButton: (text) => (text ? `${text}، زر تقسيم` : "زر تقسيم")
|
|
350
364
|
},
|
|
351
365
|
splitter: {
|
|
@@ -389,13 +403,24 @@ const AR_SA_MESSAGES = {
|
|
|
389
403
|
collapse: "طي",
|
|
390
404
|
expand: "توسيع",
|
|
391
405
|
filter: "تصفية:",
|
|
392
|
-
|
|
406
|
+
filterLabel: (tree) => `تصفية: ${tree}`,
|
|
407
|
+
filterTree: "تصفية طريقة عرض الشجرة",
|
|
408
|
+
loadError: (node) => `تعذّر تحميل عناصر ${node}`,
|
|
409
|
+
loadingNode: (node) => `جارٍ تحميل ${node}`,
|
|
410
|
+
movedAfter: (node, target) => `تم نقل ${node} بعد ${target}`,
|
|
411
|
+
movedBefore: (node, target) => `تم نقل ${node} قبل ${target}`,
|
|
412
|
+
movedInto: (node, target) => `تم نقل ${node} إلى داخل ${target}`,
|
|
413
|
+
noData: "لا توجد بيانات",
|
|
414
|
+
noMatches: "لا توجد عناصر مطابقة",
|
|
415
|
+
results: (count) => `عدد النتائج: ${localizeNumber(count)}`,
|
|
416
|
+
retryLoading: (node) => `إعادة محاولة تحميل ${node}`
|
|
393
417
|
},
|
|
394
418
|
window: {
|
|
395
419
|
close: "إغلاق",
|
|
396
420
|
closeWindow: "إغلاق النافذة",
|
|
397
421
|
maximize: "تكبير",
|
|
398
422
|
minimize: "تصغير",
|
|
423
|
+
moveOrResizeWindow: "نقل النافذة أو تغيير حجمها. استخدم مفاتيح الأسهم للتحريك، أو Ctrl مع مفاتيح الأسهم لتغيير الحجم.",
|
|
399
424
|
moveWindow: "نقل النافذة. استخدم مفاتيح الأسهم للتحريك.",
|
|
400
425
|
resizeBottom: "تغيير حجم النافذة من الأسفل. استخدم مفاتيح الأسهم لتغيير الحجم.",
|
|
401
426
|
resizeBottomLeft: "تغيير حجم النافذة من الزاوية السفلية اليسرى. استخدم مفاتيح الأسهم لتغيير الحجم.",
|
|
@@ -405,6 +430,7 @@ const AR_SA_MESSAGES = {
|
|
|
405
430
|
resizeTop: "تغيير حجم النافذة من الأعلى. استخدم مفاتيح الأسهم لتغيير الحجم.",
|
|
406
431
|
resizeTopLeft: "تغيير حجم النافذة من الزاوية العلوية اليسرى. استخدم مفاتيح الأسهم لتغيير الحجم.",
|
|
407
432
|
resizeTopRight: "تغيير حجم النافذة من الزاوية العلوية اليمنى. استخدم مفاتيح الأسهم لتغيير الحجم.",
|
|
433
|
+
resizeWindow: "تغيير حجم النافذة. استخدم Ctrl مع مفاتيح الأسهم لتغيير الحجم.",
|
|
408
434
|
restore: "استعادة"
|
|
409
435
|
}
|
|
410
436
|
};
|