mn-angular-lib 2.0.34 → 2.0.35
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/mn-angular-lib-alert.mjs +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
loadMore: () => Promise<void>;
|
|
14
|
-
reset?: () => void;
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, TemplateRef } from "@angular/core";
|
|
3
|
+
import { LucideIconData } from "@lucide/angular";
|
|
4
|
+
import { BehaviorSubject } from "rxjs";
|
|
5
|
+
import { MnLanguageService } from "mn-angular-lib/core";
|
|
6
|
+
import { MnActionIcon, MnDropdownAction, MnDropdownActionColor, MnMultiSelectOption, MnSelectOption } from "mn-angular-lib/forms";
|
|
7
|
+
import { MnSkeletonProps } from "mn-angular-lib/button";
|
|
8
|
+
import { MnBottomSheet } from "mn-angular-lib/bottom-sheet";
|
|
9
|
+
export type PaginationStrategy = {
|
|
10
|
+
hasMoreRows: boolean;
|
|
11
|
+
loadMore: () => Promise<void>;
|
|
12
|
+
reset?: () => void;
|
|
15
13
|
};
|
|
16
|
-
type CursorPaginationStrategy = {
|
|
17
|
-
|
|
14
|
+
export type CursorPaginationStrategy = {
|
|
15
|
+
endCursor?: string;
|
|
18
16
|
} & PaginationStrategy;
|
|
19
|
-
type OffsetPaginationStrategy = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
export type OffsetPaginationStrategy = {
|
|
18
|
+
currentPage: number;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
totalItems?: number;
|
|
23
21
|
} & PaginationStrategy;
|
|
24
22
|
/**
|
|
25
23
|
* Lifecycle state of a collection's data, driving which chrome the component
|
|
@@ -30,37 +28,37 @@ type OffsetPaginationStrategy = {
|
|
|
30
28
|
* to `ERROR` (or `RETRIEVED`) must also emit on `dataRows` (e.g. `dataRows.next([])`)
|
|
31
29
|
* so the component runs change detection and re-reads the new state.
|
|
32
30
|
*/
|
|
33
|
-
declare enum MnCollectionState {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
export declare enum MnCollectionState {
|
|
32
|
+
/** Data is being (re)loaded; skeleton placeholders are shown. */
|
|
33
|
+
LOADING = "LOADING",
|
|
34
|
+
/** Data has loaded (possibly empty); rows or the empty state are shown. */
|
|
35
|
+
RETRIEVED = "RETRIEVED",
|
|
36
|
+
/** Loading failed; the error placeholder is shown. */
|
|
37
|
+
ERROR = "ERROR"
|
|
40
38
|
}
|
|
41
|
-
type PaginationMode = 'none' | 'load-more' | 'paginated' | 'client-side-pagination' | 'infinite-scroll';
|
|
42
|
-
type MnCollectionLabels = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
export type PaginationMode = 'none' | 'load-more' | 'paginated' | 'client-side-pagination' | 'infinite-scroll';
|
|
40
|
+
export type MnCollectionLabels = {
|
|
41
|
+
loadMore?: string;
|
|
42
|
+
/** Translation key for the "Load more" button label. */
|
|
43
|
+
loadMoreKey?: string;
|
|
44
|
+
rowsPerPage?: string;
|
|
45
|
+
/** Translation key for the "Rows per page" label. */
|
|
46
|
+
rowsPerPageKey?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Page position readout, shown on narrow viewports where the item range does
|
|
49
|
+
* not fit. Supports the `{{current}}` and `{{total}}` placeholders.
|
|
50
|
+
* Defaults to `Page {{current}} of {{total}}`.
|
|
51
|
+
*/
|
|
52
|
+
pageIndicator?: string;
|
|
53
|
+
/** Translation key for the page position readout. */
|
|
54
|
+
pageIndicatorKey?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Item range readout. Supports the `{{start}}`, `{{end}}` and `{{total}}`
|
|
57
|
+
* placeholders. Defaults to `{{start}}–{{end}} of {{total}}`.
|
|
58
|
+
*/
|
|
59
|
+
itemRange?: string;
|
|
60
|
+
/** Translation key for the item range readout. */
|
|
61
|
+
itemRangeKey?: string;
|
|
64
62
|
};
|
|
65
63
|
/**
|
|
66
64
|
* Chrome shared by every MnLib collection component (table, list, grid):
|
|
@@ -70,159 +68,158 @@ type MnCollectionLabels = {
|
|
|
70
68
|
* {@link import('../mn-grid').GridDataSource}) extend this with their own
|
|
71
69
|
* rendering contract (columns / item template / card template).
|
|
72
70
|
*/
|
|
73
|
-
type MnCollectionDataSource<T> = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
71
|
+
export type MnCollectionDataSource<T> = {
|
|
72
|
+
dataRows: BehaviorSubject<T[]>;
|
|
73
|
+
getID: (row: T) => string;
|
|
74
|
+
emptyMessage: string;
|
|
75
|
+
/** Translation key for the empty message. When set, the component resolves it via MnLanguageService. */
|
|
76
|
+
emptyMessageKey?: string;
|
|
77
|
+
emptyTemplate?: TemplateRef<unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Icon rendered above {@link emptyMessage} in the default empty state. Pass any
|
|
80
|
+
* lucide icon's static `.icon` data (e.g. `LucideSearchX.icon`). Defaults to an
|
|
81
|
+
* inbox icon when omitted; set to `null` to render the message with no icon.
|
|
82
|
+
* Ignored when {@link emptyTemplate} is provided.
|
|
83
|
+
*/
|
|
84
|
+
emptyIcon?: LucideIconData | null;
|
|
85
|
+
/**
|
|
86
|
+
* Lifecycle state of the data, controlling loading / error / empty rendering.
|
|
87
|
+
* Defaults to {@link MnCollectionState.RETRIEVED} when not set.
|
|
88
|
+
*/
|
|
89
|
+
state?: MnCollectionState;
|
|
90
|
+
/** Number of placeholder rows rendered while data is loading. Defaults to 5. */
|
|
91
|
+
skeletonRowCount?: number;
|
|
92
|
+
/** Message shown in the error placeholder when {@link state} is ERROR. */
|
|
93
|
+
errorMessage?: string;
|
|
94
|
+
/** Translation key for {@link errorMessage}; resolved via MnLanguageService. */
|
|
95
|
+
errorMessageKey?: string;
|
|
96
|
+
/** Custom template rendered in place of the default error placeholder. */
|
|
97
|
+
errorTemplate?: TemplateRef<unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to show the search box in the toolbar. When omitted, search auto-enables once
|
|
100
|
+
* the collection holds at least {@link searchThreshold} rows *and* a way to search exists
|
|
101
|
+
* ({@link isInSearch} or {@link onServerSearch}) — the same rule mn-select and
|
|
102
|
+
* mn-multi-select apply to their option lists, so long collections stay filterable
|
|
103
|
+
* without every call site opting in. Set explicitly to force it on or off.
|
|
104
|
+
*/
|
|
105
|
+
canSearch?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Number of rows at which the search box auto-enables (default: 8). Ignored when
|
|
108
|
+
* {@link canSearch} is set explicitly. Server-paginated sources count {@link totalItems}.
|
|
109
|
+
*/
|
|
110
|
+
searchThreshold?: number;
|
|
111
|
+
searchPlaceholder?: string;
|
|
112
|
+
/** Translation key for the search placeholder. When set, the component resolves it via MnLanguageService. */
|
|
113
|
+
searchPlaceholderKey?: string;
|
|
114
|
+
isInSearch?: (row: T, searchValue: string) => boolean;
|
|
115
|
+
searchForAdditionalItems?: (searchValue: string) => Promise<T[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Callback invoked when the user types in the search box (server-side search).
|
|
118
|
+
* When provided, the component skips client-side filtering and delegates to the consumer.
|
|
119
|
+
*/
|
|
120
|
+
onServerSearch?: (searchValue: string) => void;
|
|
121
|
+
paginationMode?: PaginationMode;
|
|
122
|
+
paginationStrategy?: PaginationStrategy;
|
|
123
|
+
loadAdditionalRows?: () => Promise<T[]>;
|
|
124
|
+
/** Number of items per page when paginationMode is 'paginated'. Defaults to 10. */
|
|
125
|
+
pageSize?: number;
|
|
126
|
+
/** Options for the page-size selector dropdown. Defaults to [5, 10, 25, 50]. */
|
|
127
|
+
pageSizeOptions?: number[];
|
|
128
|
+
/**
|
|
129
|
+
* The largest page mn-table's phone "Load more" may ask a `paginated` (server-side) consumer
|
|
130
|
+
* for. Each tap grows the page by the size it started at, up to this cap; past it the pager
|
|
131
|
+
* comes back. Defaults to 100, a common server limit. Client-side pagination has no cap.
|
|
132
|
+
*/
|
|
133
|
+
maxPageSize?: number;
|
|
134
|
+
/** Callback invoked when the user changes the page size via the dropdown. */
|
|
135
|
+
onPageSizeChange?: (newSize: number) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Total number of items on the server.
|
|
138
|
+
* When set, pagination and infinite-scroll use this instead of filteredItems.length.
|
|
139
|
+
*/
|
|
140
|
+
totalItems?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Callback invoked when the user navigates to a different page.
|
|
143
|
+
* When provided, the component delegates pagination to the consumer (server-side).
|
|
144
|
+
*/
|
|
145
|
+
onPageChange?: (page: number) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Callback invoked when the user scrolls to the bottom in infinite-scroll mode.
|
|
148
|
+
* When provided, the component delegates loading more rows to the consumer (server-side).
|
|
149
|
+
*/
|
|
150
|
+
onLoadMore?: () => void;
|
|
151
|
+
labels?: MnCollectionLabels;
|
|
154
152
|
};
|
|
155
153
|
/**
|
|
156
154
|
* Adds row/item selection to {@link MnCollectionDataSource}. Used by components
|
|
157
155
|
* that support selection (table, list); grid intentionally omits it.
|
|
158
156
|
*/
|
|
159
|
-
type MnSelectableCollectionDataSource<T> = MnCollectionDataSource<T> & {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
157
|
+
export type MnSelectableCollectionDataSource<T> = MnCollectionDataSource<T> & {
|
|
158
|
+
selectionMode?: 'none' | 'single' | 'multi';
|
|
159
|
+
selectedRows?: BehaviorSubject<T[]>;
|
|
160
|
+
/** IDs to pre-select when the component initializes. */
|
|
161
|
+
initialSelectedIds?: string[];
|
|
162
|
+
/**
|
|
163
|
+
* Rows behind {@link initialSelectedIds}, for collections whose rows are paged in
|
|
164
|
+
* from a server. The component can only recognise a selected row once it has been
|
|
165
|
+
* loaded, so on page 1 of a server-paginated table it knows the *ids* that are
|
|
166
|
+
* selected but not what they are called — which is exactly what
|
|
167
|
+
* {@link selectionSummary} needs to render. Supplying the rows here fills that
|
|
168
|
+
* gap. Unnecessary when every row is client-side: the ids resolve against
|
|
169
|
+
* `dataRows` on their own.
|
|
170
|
+
*/
|
|
171
|
+
initialSelectedRows?: T[];
|
|
172
|
+
/**
|
|
173
|
+
* Renders an always-visible summary of the current selection above the
|
|
174
|
+
* collection: a count and one removable tag per selected row.
|
|
175
|
+
*
|
|
176
|
+
* It exists because a selection and a paginated list answer different questions.
|
|
177
|
+
* The list is for *finding* rows and is therefore filtered, searched and paged;
|
|
178
|
+
* the selection is the answer the user is assembling, and hiding it on page 40
|
|
179
|
+
* makes people re-pick rows they already had. The summary never pages, filters or
|
|
180
|
+
* sorts — it always shows the whole selection.
|
|
181
|
+
*/
|
|
182
|
+
selectionSummary?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Label for a row inside {@link selectionSummary}. Defaults to the first column
|
|
185
|
+
* that renders a plain string, falling back to the row's id.
|
|
186
|
+
*/
|
|
187
|
+
selectionLabel?: (row: T) => string;
|
|
188
|
+
/**
|
|
189
|
+
* How many tags {@link selectionSummary} shows before collapsing the rest behind
|
|
190
|
+
* a "+N more" control. Defaults to 8.
|
|
191
|
+
*
|
|
192
|
+
* A summary exists to be taken in at a glance, so it must not grow without bound:
|
|
193
|
+
* left uncapped, selecting a few hundred rows turns the header into the page and
|
|
194
|
+
* pushes the table — the thing being worked in — off screen entirely. The count in
|
|
195
|
+
* the heading always states the true total, so collapsing hides tags, never
|
|
196
|
+
* information.
|
|
197
|
+
*/
|
|
198
|
+
selectionSummaryLimit?: number;
|
|
199
|
+
/** Labels for the {@link selectionSummary} chrome. */
|
|
200
|
+
selectionSummaryLabels?: {
|
|
201
|
+
/** Heading, supporting a `{{count}}` placeholder. Defaults to `Selected ({{count}})`. */
|
|
202
|
+
title?: string;
|
|
203
|
+
/** Translation key for {@link title}. */
|
|
204
|
+
titleKey?: string;
|
|
205
|
+
/** Label for the clear-everything action. Defaults to `Clear all`. */
|
|
206
|
+
clearAll?: string;
|
|
207
|
+
/** Translation key for {@link clearAll}. */
|
|
208
|
+
clearAllKey?: string;
|
|
209
|
+
/** Accessible label for a tag's remove button, supporting `{{label}}`. */
|
|
210
|
+
remove?: string;
|
|
211
|
+
/** Translation key for {@link remove}. */
|
|
212
|
+
removeKey?: string;
|
|
213
|
+
/** Expand action, supporting a `{{count}}` placeholder. Defaults to `+{{count}} more`. */
|
|
214
|
+
showMore?: string;
|
|
215
|
+
/** Translation key for {@link showMore}. */
|
|
216
|
+
showMoreKey?: string;
|
|
217
|
+
/** Collapse action. Defaults to `Show less`. */
|
|
218
|
+
showLess?: string;
|
|
219
|
+
/** Translation key for {@link showLess}. */
|
|
220
|
+
showLessKey?: string;
|
|
221
|
+
};
|
|
224
222
|
};
|
|
225
|
-
|
|
226
223
|
/**
|
|
227
224
|
* Shared chrome for MnLib collection components (table, list, grid):
|
|
228
225
|
* data subscription, client/server search, every pagination mode, load-more,
|
|
@@ -236,280 +233,285 @@ type MnSelectableCollectionDataSource<T> = MnCollectionDataSource<T> & {
|
|
|
236
233
|
* Init runs in a fixed order (see {@link ngOnInit}); subclasses hook in via the
|
|
237
234
|
* `protected` template methods rather than overriding `ngOnInit`.
|
|
238
235
|
*/
|
|
239
|
-
declare abstract class MnCollectionBase<T, DS extends MnCollectionDataSource<T>> implements OnInit, OnDestroy, DoCheck {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
236
|
+
export declare abstract class MnCollectionBase<T, DS extends MnCollectionDataSource<T>> implements OnInit, OnDestroy, DoCheck {
|
|
237
|
+
dataSource: DS;
|
|
238
|
+
/** Row count at which the search box auto-enables when `canSearch` is unset. */
|
|
239
|
+
private static readonly DEFAULT_SEARCH_THRESHOLD;
|
|
240
|
+
filteredItems: T[];
|
|
241
|
+
paginatedItems: T[];
|
|
242
|
+
searchValue: string;
|
|
243
|
+
loadingMoreRows: boolean;
|
|
244
|
+
/** Fallback empty-state icon used when a data source doesn't set `emptyIcon`. */
|
|
245
|
+
protected readonly defaultEmptyIcon: import("@lucide/angular").LucideIconData;
|
|
246
|
+
currentPage: number;
|
|
247
|
+
pageSize: number;
|
|
248
|
+
/**
|
|
249
|
+
* Measured pixel height of the body container, applied as a `min-height` floor
|
|
250
|
+
* while a server reload is in flight so the container can't collapse when the
|
|
251
|
+
* data rows are swapped for skeletons. Released in {@link ngDoCheck} the moment
|
|
252
|
+
* the loading state clears. `0` means no lock.
|
|
253
|
+
*/
|
|
254
|
+
lockedMinHeight: number;
|
|
255
|
+
/**
|
|
256
|
+
* Measured pixel height of one full page, applied as a persistent `min-height` floor
|
|
257
|
+
* while paginated so a short page (the last page, or after a row is removed/filtered)
|
|
258
|
+
* can't collapse the body and jump the layout below it. Blank space fills the remaindernpm
|
|
259
|
+
* at the bottom. Captured once a full page is actually on screen; `0` means unmeasured.
|
|
260
|
+
* Distinct from the transient {@link lockedMinHeight} reload lock — both combine in
|
|
261
|
+
* {@link bodyMinHeight} via `Math.max`.
|
|
262
|
+
*/
|
|
263
|
+
fullPageHeight: number;
|
|
264
|
+
/** Write-once guard so {@link fullPageHeight} is measured once per pageSize. */
|
|
265
|
+
private pageHeightMeasured;
|
|
266
|
+
protected readonly cdr: ChangeDetectorRef;
|
|
267
|
+
protected readonly lang: MnLanguageService;
|
|
268
|
+
/** Prefix used in validation error messages, e.g. `MnList`. Overridden by subclasses. */
|
|
269
|
+
protected readonly componentName: string;
|
|
270
|
+
private dataSubscription?;
|
|
271
|
+
private searchSubject;
|
|
272
|
+
private searchSubscription?;
|
|
273
|
+
private langSubscription?;
|
|
274
|
+
/** Tracks the previous toolbar template reference for change detection. */
|
|
275
|
+
private previousToolbarTemplate?;
|
|
276
|
+
constructor();
|
|
277
|
+
/**
|
|
278
|
+
* Single source of truth for the data lifecycle: the explicit
|
|
279
|
+
* {@link MnCollectionDataSource.state}, defaulting to RETRIEVED when unset.
|
|
280
|
+
* Every internal loading check routes through this.
|
|
281
|
+
*/
|
|
282
|
+
get collectionState(): MnCollectionState;
|
|
283
|
+
/** Whether the collection is currently loading (skeleton placeholders shown). */
|
|
284
|
+
get isLoadingState(): boolean;
|
|
285
|
+
/** Accessible name for the loading placeholder, and the text the status region announces. */
|
|
286
|
+
get loadingLabel(): string;
|
|
287
|
+
/** Whether loading failed (the error placeholder is shown instead of rows/empty). */
|
|
288
|
+
get isErrorState(): boolean;
|
|
289
|
+
/** Whether the component delegates search to the consumer (server-side). */
|
|
290
|
+
get isServerSearched(): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Whether the search box is shown: the explicit `canSearch` when set, otherwise
|
|
293
|
+
* auto-enabled once the row count reaches `searchThreshold` and the source can actually
|
|
294
|
+
* search (a client predicate or a server callback — a box that filters nothing is noise).
|
|
295
|
+
* A non-empty term keeps the box even when the (server-)filtered result drops below the
|
|
296
|
+
* threshold, so the user can always clear what they typed.
|
|
297
|
+
*/
|
|
298
|
+
get isSearchable(): boolean;
|
|
299
|
+
get isPaginated(): boolean;
|
|
300
|
+
/** Whether the component delegates pagination to the consumer (server-side). */
|
|
301
|
+
get isServerPaginated(): boolean;
|
|
302
|
+
get showLoadMore(): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* The measured full-page {@link fullPageHeight} floor, but only while it should apply:
|
|
305
|
+
* paginated, not loading, with rows present. Keeps a short page from collapsing the body.
|
|
306
|
+
*/
|
|
307
|
+
get reservedPageHeight(): number;
|
|
308
|
+
/**
|
|
309
|
+
* `min-height` (px) applied to the body: the larger of the transient reload lock and the
|
|
310
|
+
* persistent full-page floor, so neither can shrink the body below the other. `null` clears it.
|
|
311
|
+
*/
|
|
312
|
+
get bodyMinHeight(): number | null;
|
|
313
|
+
/** Total number of items, accounting for server-side pagination. */
|
|
314
|
+
get totalItemCount(): number;
|
|
315
|
+
get totalPages(): number;
|
|
316
|
+
get resolvedPageSizeOptions(): number[];
|
|
317
|
+
/** Page-size options formatted for mn-select. */
|
|
318
|
+
get pageSizeSelectOptions(): MnSelectOption<number>[];
|
|
319
|
+
get visiblePages(): number[];
|
|
320
|
+
/**
|
|
321
|
+
* Body container wrapping the skeleton/data swap region, used to measure its
|
|
322
|
+
* height for {@link lockBodyHeight}. Implemented by each component with a
|
|
323
|
+
* `@ViewChild('collectionBody')` so the template reference resolves there.
|
|
324
|
+
*/
|
|
325
|
+
protected abstract collectionBody?: ElementRef<HTMLElement>;
|
|
326
|
+
/** The toolbar template whose identity is watched in change detection. */
|
|
327
|
+
protected abstract get trackedToolbarTemplate(): TemplateRef<unknown> | undefined;
|
|
328
|
+
get skeletonRows(): number[];
|
|
329
|
+
ngOnInit(): void;
|
|
330
|
+
ngDoCheck(): void;
|
|
331
|
+
ngOnDestroy(): void;
|
|
332
|
+
onSearch(searchString: string): void;
|
|
333
|
+
goToPage(page: number): void;
|
|
334
|
+
onPageSizeChange(newSize: number): void;
|
|
335
|
+
loadMoreRows(): void;
|
|
336
|
+
isTemplateRef(value: unknown): value is TemplateRef<unknown>;
|
|
337
|
+
trackByID: (_index: number, item: T) => string;
|
|
338
|
+
/** Applies search/sort/filtering and pagination to the current rows. */
|
|
339
|
+
protected abstract applyFilter(searchForItems: boolean): void;
|
|
340
|
+
/** Runs after pageSize is set but before the first {@link applyFilter}. */
|
|
341
|
+
protected beforeInitialFilter(): void;
|
|
342
|
+
/**
|
|
343
|
+
* Runs after a fresh batch of rows has been filtered in, for work that needs the
|
|
344
|
+
* rows to exist. Subclasses override to react to data arriving late; call `super`
|
|
345
|
+
* to keep the default (currently nothing).
|
|
346
|
+
*/
|
|
347
|
+
protected onRowsChanged(): void;
|
|
348
|
+
/**
|
|
349
|
+
* Resolves a label three ways, in order: the consumer's explicit key, a
|
|
350
|
+
* conventional `mnCollection.*` key when the app defines one, and finally a
|
|
351
|
+
* readable English default.
|
|
352
|
+
*
|
|
353
|
+
* The middle step is what makes the components translatable out of the box: an
|
|
354
|
+
* app that adds the `mnCollection` namespace to its locale files gets every
|
|
355
|
+
* table, list and grid translated at once, with no per-call-site wiring across
|
|
356
|
+
* dozens of data sources. An app that does not keeps today's English text rather
|
|
357
|
+
* than leaking raw keys into the UI.
|
|
358
|
+
*
|
|
359
|
+
* @param consumerKey The data source's own translation key, if it set one.
|
|
360
|
+
* @param defaultKey The conventional key this label falls back to.
|
|
361
|
+
* @param fallback The English text used when neither key resolves.
|
|
362
|
+
* @param params Optional interpolation values.
|
|
363
|
+
* @returns The resolved label.
|
|
364
|
+
*/
|
|
365
|
+
protected resolveLabel(consumerKey: string | undefined, defaultKey: string, fallback: string, params?: Record<string, string | number>): string;
|
|
366
|
+
/**
|
|
367
|
+
* Resolves translation keys to display strings via {@link MnLanguageService}.
|
|
368
|
+
* Subclasses override to resolve their own keys; call `super` to keep these.
|
|
369
|
+
*/
|
|
370
|
+
protected resolveTranslationKeys(): void;
|
|
371
|
+
/**
|
|
372
|
+
* Captures the body container's current height into {@link lockedMinHeight} so it
|
|
373
|
+
* holds while a server reload swaps the data rows for skeletons. Must be called
|
|
374
|
+
* while the old rows are still rendered (before delegating to the consumer), and
|
|
375
|
+
* only locks when rows are present — the first load has nothing to preserve.
|
|
376
|
+
*/
|
|
377
|
+
protected lockBodyHeight(): void;
|
|
378
|
+
/**
|
|
379
|
+
* Drops the cached {@link fullPageHeight} floor so it is re-measured on the next full page.
|
|
380
|
+
* Must run whenever the page size changes (the old floor is for a different row count).
|
|
381
|
+
*/
|
|
382
|
+
protected invalidatePageHeight(): void;
|
|
383
|
+
protected applyPagination(): void;
|
|
384
|
+
/** Client-side search filtering shared by list and grid. */
|
|
385
|
+
protected applySearchFilter(items: T[]): T[];
|
|
386
|
+
protected processLoadedRows(rows: T[]): void;
|
|
387
|
+
/**
|
|
388
|
+
* Reports every misconfigured pagination setting and repairs it in place.
|
|
389
|
+
*
|
|
390
|
+
* This deliberately does **not** throw. It runs first in {@link ngOnInit}, and a
|
|
391
|
+
* throw there aborts the rest of init — the data subscription is never made and
|
|
392
|
+
* {@link applyFilter} never runs, so the component renders a permanently empty
|
|
393
|
+
* body that only "heals" once some later interaction happens to call
|
|
394
|
+
* {@link applyFilter}. That failure mode reads as "the table is broken" rather
|
|
395
|
+
* than "the data source is misconfigured", and inside a modal the thrown error
|
|
396
|
+
* is easy to miss entirely. Logging loudly and degrading to the nearest working
|
|
397
|
+
* mode keeps the misconfiguration visible while still rendering the rows.
|
|
398
|
+
*/
|
|
399
|
+
protected normalizeDataSource(): void;
|
|
400
|
+
/**
|
|
401
|
+
* Logs a data-source configuration problem, prefixed with the component name.
|
|
402
|
+
* @param message What is wrong and how it was compensated for.
|
|
403
|
+
*/
|
|
404
|
+
private reportConfigError;
|
|
405
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnCollectionBase<any, any>, never>;
|
|
406
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnCollectionBase<any, any>, never, never, {
|
|
407
|
+
"dataSource": {
|
|
408
|
+
"alias": "dataSource";
|
|
409
|
+
"required": false;
|
|
410
|
+
};
|
|
411
|
+
}, {}, never, never, true, never>;
|
|
410
412
|
}
|
|
411
|
-
|
|
412
413
|
/**
|
|
413
414
|
* Extends {@link MnCollectionBase} with single/multi row selection, shared by
|
|
414
415
|
* components that support it (table, list). Grid extends the plain base instead.
|
|
415
416
|
*/
|
|
416
|
-
declare abstract class MnSelectableCollectionBase<T, DS extends MnSelectableCollectionDataSource<T>> extends MnCollectionBase<T, DS> {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
417
|
+
export declare abstract class MnSelectableCollectionBase<T, DS extends MnSelectableCollectionDataSource<T>> extends MnCollectionBase<T, DS> {
|
|
418
|
+
selectionChange: EventEmitter<T[]>;
|
|
419
|
+
selectedIds: Set<string>;
|
|
420
|
+
/** Whether the summary is currently showing every tag rather than the first few. */
|
|
421
|
+
selectionSummaryExpanded: boolean;
|
|
422
|
+
get allSelected(): boolean;
|
|
423
|
+
/**
|
|
424
|
+
* The row behind every selected id, kept so the selection survives the rows
|
|
425
|
+
* themselves going away.
|
|
426
|
+
*
|
|
427
|
+
* {@link selectedIds} alone is enough to tick a checkbox, because that only ever
|
|
428
|
+
* asks about a row already on screen. The summary asks the opposite question —
|
|
429
|
+
* "what is selected, including what isn't on this page?" — and a server-paginated
|
|
430
|
+
* collection has long since discarded those rows. Rows are captured as they are
|
|
431
|
+
* selected and backfilled from {@link MnSelectableCollectionDataSource.initialSelectedRows}
|
|
432
|
+
* and from each batch that loads.
|
|
433
|
+
*/
|
|
434
|
+
protected selectedRowsById: Map<string, T>;
|
|
435
|
+
/**
|
|
436
|
+
* Whether a seeded initial selection still has to be announced, because none of
|
|
437
|
+
* its ids matched a loaded row yet. See {@link beforeInitialFilter}.
|
|
438
|
+
*/
|
|
439
|
+
private pendingInitialEmit;
|
|
440
|
+
/**
|
|
441
|
+
* Every selected row, in selection order, for the summary. Ids whose row was
|
|
442
|
+
* never seen are skipped rather than rendered as a bare id.
|
|
443
|
+
*/
|
|
444
|
+
get selectedSummaryRows(): T[];
|
|
445
|
+
/** Whether the selection summary should render. */
|
|
446
|
+
get showSelectionSummary(): boolean;
|
|
447
|
+
/** How many tags to show before collapsing the remainder. */
|
|
448
|
+
get selectionSummaryLimit(): number;
|
|
449
|
+
/**
|
|
450
|
+
* Tag count the summary collapses at when the data source names no limit.
|
|
451
|
+
*
|
|
452
|
+
* Subclasses that know their own width narrow this: the same eight tags that
|
|
453
|
+
* read as a compact header on a wide table become seven stacked lines in a phone
|
|
454
|
+
* sheet, pushing the rows they describe off screen. Overridden by
|
|
455
|
+
* {@link MnCollectionDataSource.selectionSummaryLimit}.
|
|
456
|
+
*/
|
|
457
|
+
protected get defaultSelectionSummaryLimit(): number;
|
|
458
|
+
/**
|
|
459
|
+
* The tags to render: the first {@link selectionSummaryLimit} rows, or all of them
|
|
460
|
+
* once expanded. Keeps a large selection from turning the header into the page.
|
|
461
|
+
*/
|
|
462
|
+
get visibleSelectionRows(): T[];
|
|
463
|
+
/** How many selected rows are collapsed out of view; 0 when all are shown. */
|
|
464
|
+
get hiddenSelectionCount(): number;
|
|
465
|
+
/** Expands or re-collapses the summary's tag list. */
|
|
466
|
+
toggleSelectionSummary(): void;
|
|
467
|
+
/**
|
|
468
|
+
* The label for a row in the summary: the consumer's {@link
|
|
469
|
+
* MnSelectableCollectionDataSource.selectionLabel}, else the first column that
|
|
470
|
+
* renders a plain string, else the row's id.
|
|
471
|
+
* @param row The selected row.
|
|
472
|
+
* @returns The text to show on the row's tag.
|
|
473
|
+
*/
|
|
474
|
+
selectionLabelFor(row: T): string;
|
|
475
|
+
/** Removes one row from the selection, from its tag in the summary. */
|
|
476
|
+
removeSelection(row: T): void;
|
|
477
|
+
get hasSelection(): boolean;
|
|
478
|
+
get isMultiSelect(): boolean;
|
|
479
|
+
isSelected(item: T): boolean;
|
|
480
|
+
/** Clears the whole selection, from the summary's clear-all action. */
|
|
481
|
+
clearSelection(): void;
|
|
482
|
+
toggle(item: T): void;
|
|
483
|
+
toggleAll(): void;
|
|
484
|
+
/**
|
|
485
|
+
* Fallback label used when the data source declares no `selectionLabel`.
|
|
486
|
+
* Subclasses that know how to render a row as text (a table knows its columns)
|
|
487
|
+
* override this; the base has nothing to go on.
|
|
488
|
+
* @returns The label, or null when none can be derived.
|
|
489
|
+
*/
|
|
490
|
+
protected defaultSelectionLabel(_row: T): string | null;
|
|
491
|
+
/** Seeds selection from `initialSelectedIds` before the first filter pass. */
|
|
492
|
+
protected beforeInitialFilter(): void;
|
|
493
|
+
/** Announces a deferred initial selection as soon as its rows are loaded. */
|
|
494
|
+
protected onRowsChanged(): void;
|
|
495
|
+
protected emitSelection(): void;
|
|
496
|
+
/** Records the row object for every loaded row that is currently selected. */
|
|
497
|
+
private captureSelectedRows;
|
|
498
|
+
/** The currently loaded rows whose id is selected. */
|
|
499
|
+
private resolveSelectedRows;
|
|
500
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnSelectableCollectionBase<any, any>, never>;
|
|
501
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnSelectableCollectionBase<any, any>, never, never, {}, {
|
|
502
|
+
"selectionChange": "selectionChange";
|
|
503
|
+
}, never, never, true, never>;
|
|
501
504
|
}
|
|
502
|
-
|
|
503
505
|
/** One position in the page-number strip. */
|
|
504
|
-
type MnPageSlot = {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
506
|
+
export type MnPageSlot = {
|
|
507
|
+
/** Page to jump to, or `null` for an ellipsis gap. */
|
|
508
|
+
page: number | null;
|
|
509
|
+
/**
|
|
510
|
+
* True for the first/last page anchors and the gaps beside them. These are
|
|
511
|
+
* hidden below `md`, where the readout states the total and « » already jump
|
|
512
|
+
* to either end — the strip would otherwise wrap.
|
|
513
|
+
*/
|
|
514
|
+
anchor: boolean;
|
|
513
515
|
};
|
|
514
516
|
/**
|
|
515
517
|
* Presentational pagination footer shared by every MnLib collection component
|
|
@@ -518,137 +520,189 @@ type MnPageSlot = {
|
|
|
518
520
|
* (via {@link import('./mn-collection-base.directive').MnCollectionBase}) and
|
|
519
521
|
* reacts to the outputs.
|
|
520
522
|
*/
|
|
521
|
-
declare class MnCollectionPagination {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
523
|
+
export declare class MnCollectionPagination {
|
|
524
|
+
private readonly lang;
|
|
525
|
+
/** Prefix for the page-size select's id, keeping it unique per host. */
|
|
526
|
+
idPrefix: string;
|
|
527
|
+
isPaginated: boolean;
|
|
528
|
+
isServerPaginated: boolean;
|
|
529
|
+
showLoadMore: boolean;
|
|
530
|
+
loadingMoreRows: boolean;
|
|
531
|
+
currentPage: number;
|
|
532
|
+
pageSize: number;
|
|
533
|
+
totalPages: number;
|
|
534
|
+
totalItemCount: number;
|
|
535
|
+
visiblePages: number[];
|
|
536
|
+
pageSizeSelectOptions: MnSelectOption<number>[];
|
|
537
|
+
labels?: MnCollectionLabels;
|
|
538
|
+
loadMore: EventEmitter<void>;
|
|
539
|
+
pageChange: EventEmitter<number>;
|
|
540
|
+
pageSizeChange: EventEmitter<number>;
|
|
541
|
+
get showPagination(): boolean;
|
|
542
|
+
/** First item number on the current page, 1-based. Zero when there is no data. */
|
|
543
|
+
get rangeStart(): number;
|
|
544
|
+
/** Last item number on the current page, clamped to the total. */
|
|
545
|
+
get rangeEnd(): number;
|
|
546
|
+
/**
|
|
547
|
+
* {@link visiblePages} anchored with the first and last page, so the total page
|
|
548
|
+
* count is on screen at md+ without consulting the readout.
|
|
549
|
+
*
|
|
550
|
+
* e.g. page 5 of 50 → `1 … 4 5 6 … 50`
|
|
551
|
+
*/
|
|
552
|
+
get pageSlots(): MnPageSlot[];
|
|
553
|
+
/** e.g. `Page 5 of 50`. */
|
|
554
|
+
get pageIndicatorLabel(): string;
|
|
555
|
+
/** e.g. `41–50 of 250`. */
|
|
556
|
+
get itemRangeLabel(): string;
|
|
557
|
+
/** "Items per page" label beside the page-size selector. */
|
|
558
|
+
get rowsPerPageLabel(): string;
|
|
559
|
+
/**
|
|
560
|
+
* Substitutes `{{name}}` placeholders, matching the interpolation syntax used
|
|
561
|
+
* by MnLanguageService so the same translation strings work either way.
|
|
562
|
+
*/
|
|
563
|
+
private fill;
|
|
564
|
+
/** Label for the load-more button. */
|
|
565
|
+
get loadMoreLabel(): string;
|
|
566
|
+
/** Accessible label for the first-page control. */
|
|
567
|
+
get firstPageLabel(): string;
|
|
568
|
+
/** Accessible label for the previous-page control. */
|
|
569
|
+
get previousPageLabel(): string;
|
|
570
|
+
/** Accessible label for the next-page control. */
|
|
571
|
+
get nextPageLabel(): string;
|
|
572
|
+
/** Accessible label for the last-page control. */
|
|
573
|
+
get lastPageLabel(): string;
|
|
574
|
+
/**
|
|
575
|
+
* Wrapper classes for one slot in the page strip, shrinking it in two steps as
|
|
576
|
+
* the footer narrows. Container queries, so the measurement is the footer's own
|
|
577
|
+
* width — the same strip is wide on a page and cramped in a modal.
|
|
578
|
+
*
|
|
579
|
+
* The first/last anchors and their gaps drop below 640px, where « and » already
|
|
580
|
+
* jump to either end. Below 380px every number drops, the current one included:
|
|
581
|
+
* the strip would otherwise wrap onto a second line and push the footer over the
|
|
582
|
+
* table, and the "Page 3 of 9" readout beside it already says where the user is.
|
|
583
|
+
* A lone current number would read as a page count ("1" beside "Page 1 of 2").
|
|
584
|
+
* The arrows survive both steps, so navigation never depends on a number.
|
|
585
|
+
*/
|
|
586
|
+
slotVisibility(slot: MnPageSlot): string;
|
|
587
|
+
/**
|
|
588
|
+
* Accessible label for a page-number button.
|
|
589
|
+
* @param page The page the button jumps to.
|
|
590
|
+
* @returns The label, naming the page.
|
|
591
|
+
*/
|
|
592
|
+
pageLabel(page: number): string;
|
|
593
|
+
/**
|
|
594
|
+
* Resolves a label three ways, in order: the consumer's explicit text, the
|
|
595
|
+
* conventional `mnCollection.*` key when the app defines one, and finally a
|
|
596
|
+
* readable English default.
|
|
597
|
+
*
|
|
598
|
+
* Mirrors `MnCollectionBase.resolveLabel`; this component is presentational and
|
|
599
|
+
* does not extend that base, but its chrome must be just as translatable — the
|
|
600
|
+
* page-size label and the item-range readout are on screen for every paged
|
|
601
|
+
* collection in the app.
|
|
602
|
+
*
|
|
603
|
+
* @param explicit The label the host passed in, if any.
|
|
604
|
+
* @param key The conventional translation key to try.
|
|
605
|
+
* @param fallback The English text used when neither resolves.
|
|
606
|
+
* @returns The resolved label.
|
|
607
|
+
*/
|
|
608
|
+
private label;
|
|
609
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnCollectionPagination, never>;
|
|
610
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnCollectionPagination, "mn-collection-pagination", never, {
|
|
611
|
+
"idPrefix": {
|
|
612
|
+
"alias": "idPrefix";
|
|
613
|
+
"required": false;
|
|
614
|
+
};
|
|
615
|
+
"isPaginated": {
|
|
616
|
+
"alias": "isPaginated";
|
|
617
|
+
"required": false;
|
|
618
|
+
};
|
|
619
|
+
"isServerPaginated": {
|
|
620
|
+
"alias": "isServerPaginated";
|
|
621
|
+
"required": false;
|
|
622
|
+
};
|
|
623
|
+
"showLoadMore": {
|
|
624
|
+
"alias": "showLoadMore";
|
|
625
|
+
"required": false;
|
|
626
|
+
};
|
|
627
|
+
"loadingMoreRows": {
|
|
628
|
+
"alias": "loadingMoreRows";
|
|
629
|
+
"required": false;
|
|
630
|
+
};
|
|
631
|
+
"currentPage": {
|
|
632
|
+
"alias": "currentPage";
|
|
633
|
+
"required": false;
|
|
634
|
+
};
|
|
635
|
+
"pageSize": {
|
|
636
|
+
"alias": "pageSize";
|
|
637
|
+
"required": false;
|
|
638
|
+
};
|
|
639
|
+
"totalPages": {
|
|
640
|
+
"alias": "totalPages";
|
|
641
|
+
"required": false;
|
|
642
|
+
};
|
|
643
|
+
"totalItemCount": {
|
|
644
|
+
"alias": "totalItemCount";
|
|
645
|
+
"required": false;
|
|
646
|
+
};
|
|
647
|
+
"visiblePages": {
|
|
648
|
+
"alias": "visiblePages";
|
|
649
|
+
"required": false;
|
|
650
|
+
};
|
|
651
|
+
"pageSizeSelectOptions": {
|
|
652
|
+
"alias": "pageSizeSelectOptions";
|
|
653
|
+
"required": false;
|
|
654
|
+
};
|
|
655
|
+
"labels": {
|
|
656
|
+
"alias": "labels";
|
|
657
|
+
"required": false;
|
|
658
|
+
};
|
|
659
|
+
}, {
|
|
660
|
+
"loadMore": "loadMore";
|
|
661
|
+
"pageChange": "pageChange";
|
|
662
|
+
"pageSizeChange": "pageSizeChange";
|
|
663
|
+
}, never, never, true, never>;
|
|
609
664
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
NONE = "NONE"
|
|
665
|
+
export declare enum ColumnSortType {
|
|
666
|
+
ALPHABETICAL = "ALPHABETICAL",
|
|
667
|
+
NUMERICAL = "NUMERICAL",
|
|
668
|
+
DATE = "DATE",
|
|
669
|
+
NONE = "NONE"
|
|
616
670
|
}
|
|
617
|
-
type SortState = {
|
|
618
|
-
|
|
619
|
-
|
|
671
|
+
export type SortState = {
|
|
672
|
+
columnKey: string;
|
|
673
|
+
direction: 'asc' | 'desc';
|
|
620
674
|
};
|
|
621
|
-
type TableAppearance = {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
675
|
+
export type TableAppearance = {
|
|
676
|
+
striped?: boolean;
|
|
677
|
+
/** Hover wash on clickable rows (on by default); rows that do nothing on click never get one. */
|
|
678
|
+
hover?: boolean;
|
|
679
|
+
compact?: boolean;
|
|
680
|
+
bordered?: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* How column widths are computed. Defaults to `stable`.
|
|
683
|
+
*
|
|
684
|
+
* - `stable` (default): the best of both. The first render with rows on screen
|
|
685
|
+
* uses the browser's automatic layout, so each column is sized in proportion to
|
|
686
|
+
* its real content; those measured widths are then pinned and the table switches
|
|
687
|
+
* to a fixed layout. Columns therefore keep sensible, content-derived
|
|
688
|
+
* proportions **and** stop moving when the rows change underneath — a new page,
|
|
689
|
+
* a filter or a search cannot resize them. Widths are re-measured only when the
|
|
690
|
+
* table itself is resized (or a {@link ColumnBase.hiddenBelow} column appears or
|
|
691
|
+
* disappears), never when the rows change. Content that no longer fits is
|
|
692
|
+
* truncated with an ellipsis and exposed as a `title` tooltip.
|
|
693
|
+
* - `auto`: the plain browser layout. Every column is re-sized to its widest cell
|
|
694
|
+
* on every change, so the columns shift on each new page, filter and search.
|
|
695
|
+
* Use it for a static table, or when a cell must never be truncated.
|
|
696
|
+
* - `fixed`: widths are **data-independent**. Nothing is measured — not the cell
|
|
697
|
+
* content, and not the header text either. Each column is either its declared
|
|
698
|
+
* {@link ColumnBase.width} or an even share of whatever is left over:
|
|
699
|
+
* `(table width − Σ declared widths) ÷ number of undeclared visible columns`.
|
|
700
|
+
* Only worth choosing over `stable` when every column declares a `width`, or
|
|
701
|
+
* when a deliberate even split is what you want: with widths undeclared, a
|
|
702
|
+
* two-character status column is handed exactly as much room as a long
|
|
703
|
+
* description.
|
|
704
|
+
*/
|
|
705
|
+
layout?: 'auto' | 'fixed' | 'stable';
|
|
652
706
|
};
|
|
653
707
|
/**
|
|
654
708
|
* The control rendered for a column filter, and the shape of the value it produces:
|
|
@@ -657,24 +711,24 @@ type TableAppearance = {
|
|
|
657
711
|
* - `multi-select` → `string[]` (OR semantics across the chosen values)
|
|
658
712
|
* - `boolean` → `boolean` (tri-state: any / true / false)
|
|
659
713
|
*/
|
|
660
|
-
type ColumnFilterType = 'text' | 'select' | 'multi-select' | 'boolean';
|
|
661
|
-
type ColumnFilterOption = {
|
|
662
|
-
|
|
663
|
-
|
|
714
|
+
export type ColumnFilterType = 'text' | 'select' | 'multi-select' | 'boolean';
|
|
715
|
+
export type ColumnFilterOption = {
|
|
716
|
+
label: string;
|
|
717
|
+
value: string;
|
|
664
718
|
};
|
|
665
719
|
/** Every value shape a column filter can hold, discriminated by {@link ColumnFilterType}. */
|
|
666
|
-
type ColumnFilterValue = string | string[] | boolean;
|
|
720
|
+
export type ColumnFilterValue = string | string[] | boolean;
|
|
667
721
|
/** Map of column key to its current filter value. */
|
|
668
|
-
type ColumnFilterState = Record<string, ColumnFilterValue | undefined>;
|
|
722
|
+
export type ColumnFilterState = Record<string, ColumnFilterValue | undefined>;
|
|
669
723
|
/**
|
|
670
724
|
* One active column filter, as handed to
|
|
671
725
|
* {@link TableDataSource.onColumnFilterChange}. Only columns whose filter is
|
|
672
726
|
* actually set are included, so the array maps straight onto query params.
|
|
673
727
|
*/
|
|
674
|
-
type MnColumnFilter = {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
728
|
+
export type MnColumnFilter = {
|
|
729
|
+
key: string;
|
|
730
|
+
type: ColumnFilterType;
|
|
731
|
+
value: ColumnFilterValue;
|
|
678
732
|
};
|
|
679
733
|
/**
|
|
680
734
|
* Customizes the loading-skeleton placeholder rendered in a column's cells.
|
|
@@ -682,7 +736,7 @@ type MnColumnFilter = {
|
|
|
682
736
|
* `TemplateRef` for a fully custom placeholder. When omitted, a text-shaped
|
|
683
737
|
* skeleton at 75% width is used (matching the previous default).
|
|
684
738
|
*/
|
|
685
|
-
type ColumnSkeleton = Partial<MnSkeletonProps> | TemplateRef<unknown>;
|
|
739
|
+
export type ColumnSkeleton = Partial<MnSkeletonProps> | TemplateRef<unknown>;
|
|
686
740
|
/**
|
|
687
741
|
* A presentation value that is either fixed for the whole column or derived per row.
|
|
688
742
|
*
|
|
@@ -693,53 +747,53 @@ type ColumnSkeleton = Partial<MnSkeletonProps> | TemplateRef<unknown>;
|
|
|
693
747
|
*
|
|
694
748
|
* Resolved on every change detection, so the accessor must be cheap and side-effect free.
|
|
695
749
|
*/
|
|
696
|
-
type MnRowValue<T, V> = V | ((row: T) => V);
|
|
750
|
+
export type MnRowValue<T, V> = V | ((row: T) => V);
|
|
697
751
|
/**
|
|
698
752
|
* A per-row command rendered in an actions column (see {@link ColumnBase.actions}).
|
|
699
753
|
* Unlike a cell it carries no display value — choosing it invokes {@link run} with the
|
|
700
754
|
* row. The table renders actions inline as buttons; below 640px they move into the sheet a
|
|
701
755
|
* tap on the row opens (a ⋯ menu inside a modal).
|
|
702
756
|
*/
|
|
703
|
-
type MnTableRowAction<T> = {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
757
|
+
export type MnTableRowAction<T> = {
|
|
758
|
+
/** Visible label. Falls back to `labelKey`'s resolved text when omitted. */
|
|
759
|
+
label?: MnRowValue<T, string>;
|
|
760
|
+
/** Translation key for the label, resolved via MnLanguageService and kept updated on locale change. */
|
|
761
|
+
labelKey?: MnRowValue<T, string>;
|
|
762
|
+
/**
|
|
763
|
+
* Optional leading icon: a template (an `<mn-icon>`, a bespoke `<svg>`, …), or lucide
|
|
764
|
+
* icon data such as `LucidePencil.icon`, which the table renders itself. The data form
|
|
765
|
+
* lets an action be declared without an `<ng-template>` stub and a `@ViewChild` per
|
|
766
|
+
* glyph, which is what makes shared action factories practical.
|
|
767
|
+
*/
|
|
768
|
+
icon?: MnRowValue<T, MnActionIcon>;
|
|
769
|
+
/** Invoked with the row when the action is chosen. */
|
|
770
|
+
run: (row: T) => void;
|
|
771
|
+
/**
|
|
772
|
+
* Predicate deciding whether the action is hidden for a given row. A hidden action is
|
|
773
|
+
* dropped entirely for that row (not shown, not counted). When every action is hidden
|
|
774
|
+
* for a row its cell is left empty — no buttons and no ⋯ menu. Use this for "row 1 has
|
|
775
|
+
* actions, row 2 doesn't", or per-permission actions (e.g. only admins can delete).
|
|
776
|
+
*/
|
|
777
|
+
hidden?: (row: T) => boolean;
|
|
778
|
+
/**
|
|
779
|
+
* When the action is {@link hidden} for a row, keep its place among the inline buttons as
|
|
780
|
+
* an invisible slot instead of dropping it, so the actions after it stay in the same column
|
|
781
|
+
* on every row (a delete never slides under another row's icon). It is still not shown,
|
|
782
|
+
* not focusable, not announced and not in the ⋯ menu. Leave it off for actions that stand
|
|
783
|
+
* in for each other (activate/deactivate), where a reserved slot would be a permanent gap.
|
|
784
|
+
*/
|
|
785
|
+
keepSlot?: boolean;
|
|
786
|
+
/** Predicate deciding whether the action is disabled (shown but non-interactive) for a row. */
|
|
787
|
+
disabled?: (row: T) => boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Tints the action's button and its ⋯-menu item. Defaults to `'primary'` (or
|
|
790
|
+
* `'danger'` when {@link danger} is set), matching the built-in look. Whatever colour
|
|
791
|
+
* an action shows inline is carried into the collapsed bottom-sheet item too.
|
|
792
|
+
*/
|
|
793
|
+
color?: MnRowValue<T, MnDropdownActionColor>;
|
|
794
|
+
/** Renders the action in a destructive style (e.g. "Delete"). Shorthand for
|
|
795
|
+
* `color: 'danger'`. */
|
|
796
|
+
danger?: boolean;
|
|
743
797
|
};
|
|
744
798
|
/**
|
|
745
799
|
* Where a column goes once the table is narrower than 640px and renders each row as a
|
|
@@ -751,77 +805,77 @@ type MnTableRowAction<T> = {
|
|
|
751
805
|
* - `'sheet'` — only in the bottom sheet a tap on the row opens;
|
|
752
806
|
* - `'hidden'` — nowhere on a phone.
|
|
753
807
|
*/
|
|
754
|
-
type MnColumnMobileSlot = 'leading' | 'title' | 'meta' | 'trailing' | 'sheet' | 'hidden';
|
|
808
|
+
export type MnColumnMobileSlot = 'leading' | 'title' | 'meta' | 'trailing' | 'sheet' | 'hidden';
|
|
755
809
|
/** Everything about a column that is independent of filtering. */
|
|
756
|
-
type ColumnBase<T> = {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
810
|
+
export type ColumnBase<T> = {
|
|
811
|
+
key: string;
|
|
812
|
+
header: string | TemplateRef<unknown>;
|
|
813
|
+
/** Translation key for the column header. When set, mn-table resolves it via MnLanguageService and keeps it updated on locale change. */
|
|
814
|
+
headerKey?: string;
|
|
815
|
+
/**
|
|
816
|
+
* How a data cell is rendered — a string accessor or a `TemplateRef`. Optional only
|
|
817
|
+
* because an {@link actions} column renders commands instead of a value; every value
|
|
818
|
+
* column must set it.
|
|
819
|
+
*/
|
|
820
|
+
cell?: ((row: T) => string) | TemplateRef<unknown>;
|
|
821
|
+
/**
|
|
822
|
+
* Turns this column into an actions column: per-row command buttons rendered inline.
|
|
823
|
+
* Below 640px, where rows are composed instead of gridded, the actions move into the
|
|
824
|
+
* bottom sheet a tap on the row opens (into a ⋯ menu inside a modal, where a second
|
|
825
|
+
* sheet would stack). When set, {@link cell} is ignored.
|
|
826
|
+
*/
|
|
827
|
+
actions?: MnTableRowAction<T>[];
|
|
828
|
+
/**
|
|
829
|
+
* How each inline action button is presented on a wide table:
|
|
830
|
+
* - `'both'` (default) — icon (when provided) followed by the label;
|
|
831
|
+
* - `'icon'` — icon only; the label becomes the button's accessible name and hover
|
|
832
|
+
* tooltip. An action without an icon falls back to showing its label so it is never
|
|
833
|
+
* blank;
|
|
834
|
+
* - `'label'` — text only, no icon.
|
|
835
|
+
*
|
|
836
|
+
* The collapsed ⋯ menu always lists full labels regardless of this setting, so
|
|
837
|
+
* `'icon'` still reads clearly once the actions move into the bottom sheet on mobile.
|
|
838
|
+
*/
|
|
839
|
+
actionsInline?: 'icon' | 'label' | 'both';
|
|
840
|
+
/** Alternative cell renderer shown below the given breakpoint. When set, `cell` is hidden below this breakpoint and `cellSm` is shown instead. */
|
|
841
|
+
cellSm?: {
|
|
842
|
+
below: 'sm' | 'md' | 'lg';
|
|
843
|
+
cell: ((row: T) => string) | TemplateRef<unknown>;
|
|
844
|
+
};
|
|
845
|
+
sortType?: ColumnSortType;
|
|
846
|
+
getRawValueToSort?: (row: T) => unknown;
|
|
847
|
+
width?: string;
|
|
848
|
+
align?: 'left' | 'center' | 'right';
|
|
849
|
+
hiddenBelow?: 'sm' | 'md' | 'lg';
|
|
850
|
+
/**
|
|
851
|
+
* Overrides the slot this column gets below 640px. Leave it unset: the table derives the
|
|
852
|
+
* slots from the config it already has (which columns a phone shows, {@link hiddenBelow},
|
|
853
|
+
* {@link width}, {@link sortType}, {@link align}). Set it only where that guess is wrong —
|
|
854
|
+
* a date that comes first but is not the row's name, an image that should not be text.
|
|
855
|
+
*/
|
|
856
|
+
mobile?: MnColumnMobileSlot;
|
|
857
|
+
/**
|
|
858
|
+
* Whether this row has no value for the column. Below 640px an empty value is left off the
|
|
859
|
+
* composed row and the detail sheet, label included. A string cell needs nothing: a blank or
|
|
860
|
+
* lone-dash value is caught already. Set it on a template cell, whose markup the table cannot
|
|
861
|
+
* read, when that template draws a placeholder ("-") for "nothing".
|
|
862
|
+
*/
|
|
863
|
+
isEmpty?: (row: T) => boolean;
|
|
864
|
+
/** Customizes the loading-skeleton placeholder shown in this column's cells while data loads. */
|
|
865
|
+
skeleton?: ColumnSkeleton;
|
|
812
866
|
};
|
|
813
867
|
/** Filter presentation props shared by every filterable column. */
|
|
814
868
|
type ColumnFilterCommon = {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
869
|
+
/** Whether this column supports per-column filtering. */
|
|
870
|
+
filterable: true;
|
|
871
|
+
/** Placeholder text for the filter input. For `select`, it also labels the "no filter" option. */
|
|
872
|
+
filterPlaceholder?: string;
|
|
873
|
+
/** Translation key for the filter placeholder. When set, mn-table resolves it via MnLanguageService. */
|
|
874
|
+
filterPlaceholderKey?: string;
|
|
875
|
+
/** Whether the filter input is disabled. */
|
|
876
|
+
filterDisabled?: boolean;
|
|
877
|
+
/** Autocomplete attribute for the filter input. */
|
|
878
|
+
filterAutocomplete?: string;
|
|
825
879
|
};
|
|
826
880
|
/**
|
|
827
881
|
* The filter half of a {@link ColumnDefinition}, discriminated on `filterType` so
|
|
@@ -833,127 +887,126 @@ type ColumnFilterCommon = {
|
|
|
833
887
|
* across all columns — without narrowing first.
|
|
834
888
|
*/
|
|
835
889
|
type ColumnFilterConfig<T> = (ColumnFilterCommon & {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
890
|
+
filterType?: 'text';
|
|
891
|
+
filterOptions?: never;
|
|
892
|
+
/** Custom predicate. Receives the row and the trimmed text the user typed. */
|
|
893
|
+
filterFn?: (row: T, filterValue: string) => boolean;
|
|
840
894
|
}) | (ColumnFilterCommon & {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
895
|
+
filterType: 'select';
|
|
896
|
+
filterOptions: ColumnFilterOption[];
|
|
897
|
+
/** Custom predicate. Receives the row and the selected option value. */
|
|
898
|
+
filterFn?: (row: T, filterValue: string) => boolean;
|
|
845
899
|
}) | (ColumnFilterCommon & {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
900
|
+
filterType: 'multi-select';
|
|
901
|
+
filterOptions: ColumnFilterOption[];
|
|
902
|
+
/** Custom predicate. Receives the row and every selected option value. */
|
|
903
|
+
filterFn?: (row: T, filterValue: string[]) => boolean;
|
|
850
904
|
}) | (ColumnFilterCommon & {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
905
|
+
filterType: 'boolean';
|
|
906
|
+
filterOptions?: never;
|
|
907
|
+
/** Custom predicate. Receives the row and the chosen true/false state. */
|
|
908
|
+
filterFn?: (row: T, filterValue: boolean) => boolean;
|
|
855
909
|
}) | {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
910
|
+
filterable?: false;
|
|
911
|
+
filterType?: never;
|
|
912
|
+
filterOptions?: never;
|
|
913
|
+
filterFn?: never;
|
|
914
|
+
filterPlaceholder?: string;
|
|
915
|
+
filterPlaceholderKey?: string;
|
|
916
|
+
filterDisabled?: never;
|
|
917
|
+
filterAutocomplete?: never;
|
|
864
918
|
};
|
|
865
|
-
type ColumnDefinition<T> = ColumnBase<T> & ColumnFilterConfig<T>;
|
|
866
|
-
type TableDataSource<T> = MnSelectableCollectionDataSource<T> & {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
919
|
+
export type ColumnDefinition<T> = ColumnBase<T> & ColumnFilterConfig<T>;
|
|
920
|
+
export type TableDataSource<T> = MnSelectableCollectionDataSource<T> & {
|
|
921
|
+
/** Accessible name of the scrollable table region; without it the `mnCollection.dataTable` convention key is used. */
|
|
922
|
+
ariaLabel?: string;
|
|
923
|
+
columns: ColumnDefinition<T>[];
|
|
924
|
+
defaultSort?: SortState;
|
|
925
|
+
onRowClick?: (row: T) => void;
|
|
926
|
+
appearance?: TableAppearance;
|
|
927
|
+
/** Template rendered on the left side of the toolbar (before the search field). */
|
|
928
|
+
toolbarLeftTemplate?: TemplateRef<unknown>;
|
|
929
|
+
/** Template rendered on the right side of the toolbar (after the search field). */
|
|
930
|
+
toolbarRightTemplate?: TemplateRef<unknown>;
|
|
931
|
+
/**
|
|
932
|
+
* Label for the toggle button that opens the stacked filter panel on small
|
|
933
|
+
* screens (below 640px). Defaults to "Filters".
|
|
934
|
+
*/
|
|
935
|
+
filtersLabel?: string;
|
|
936
|
+
/** Translation key for {@link filtersLabel}. Resolved via MnLanguageService. */
|
|
937
|
+
filtersLabelKey?: string;
|
|
938
|
+
/**
|
|
939
|
+
* Label for the action that resets every column filter in the small-screen
|
|
940
|
+
* panel. Defaults to "Clear all".
|
|
941
|
+
*/
|
|
942
|
+
clearFiltersLabel?: string;
|
|
943
|
+
/** Translation key for {@link clearFiltersLabel}. Resolved via MnLanguageService. */
|
|
944
|
+
clearFiltersLabelKey?: string;
|
|
945
|
+
/** Labels for the range / boolean filter controls. */
|
|
946
|
+
filterLabels?: MnTableFilterLabels;
|
|
947
|
+
/**
|
|
948
|
+
* Callback invoked when a column filter changes (server-side filtering).
|
|
949
|
+
* When provided, mn-table skips client-side column filtering entirely and
|
|
950
|
+
* delegates to the consumer, exactly as {@link MnCollectionDataSource.onServerSearch}
|
|
951
|
+
* does for search: the table resets to page 1 and hands over every active filter.
|
|
952
|
+
*
|
|
953
|
+
* Required whenever filterable columns are combined with
|
|
954
|
+
* `paginationMode: 'paginated'` — client-side filtering would otherwise only
|
|
955
|
+
* filter the page the server already returned, while the paginator kept
|
|
956
|
+
* reporting the unfiltered `totalItems`.
|
|
957
|
+
*
|
|
958
|
+
* Text filters are debounced (300ms); every other filter type fires immediately.
|
|
959
|
+
*/
|
|
960
|
+
onColumnFilterChange?: (filters: MnColumnFilter[]) => void;
|
|
907
961
|
};
|
|
908
962
|
/**
|
|
909
963
|
* User-facing labels for the filter controls that need more than a placeholder.
|
|
910
964
|
* Each has a `*Key` counterpart resolved via MnLanguageService on init and on
|
|
911
965
|
* every locale change.
|
|
912
966
|
*/
|
|
913
|
-
type MnTableFilterLabels = {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
967
|
+
export type MnTableFilterLabels = {
|
|
968
|
+
/** Unset option of a boolean filter. Defaults to "Any". */
|
|
969
|
+
any?: string;
|
|
970
|
+
anyKey?: string;
|
|
971
|
+
/** True option of a boolean filter. Defaults to "Yes". */
|
|
972
|
+
yes?: string;
|
|
973
|
+
yesKey?: string;
|
|
974
|
+
/** False option of a boolean filter. Defaults to "No". */
|
|
975
|
+
no?: string;
|
|
976
|
+
noKey?: string;
|
|
977
|
+
/**
|
|
978
|
+
* Summary a multi-select filter collapses to from the second selection onwards.
|
|
979
|
+
* The `{count}` token is replaced with how many are selected. Defaults to
|
|
980
|
+
* `{count} selected`. A column header has room for about one value, so listing
|
|
981
|
+
* them all would overflow the cell the moment a second one is picked.
|
|
982
|
+
*/
|
|
983
|
+
selected?: string;
|
|
984
|
+
/** Translation key for {@link selected}. */
|
|
985
|
+
selectedKey?: string;
|
|
932
986
|
};
|
|
933
987
|
/** @deprecated Use {@link MnCollectionLabels}. */
|
|
934
|
-
type TableLabels = MnCollectionLabels;
|
|
935
|
-
|
|
988
|
+
export type TableLabels = MnCollectionLabels;
|
|
936
989
|
/**
|
|
937
990
|
* Which column fills which slot of a row once the table is narrower than 640px and renders
|
|
938
991
|
* composed rows instead of a grid. Every value column lands in exactly one place: a slot on the
|
|
939
992
|
* row, the {@link sheet}, or nowhere when its `mobile` is `'hidden'`.
|
|
940
993
|
*/
|
|
941
|
-
type MnTableRowLayout<T> = {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
994
|
+
export type MnTableRowLayout<T> = {
|
|
995
|
+
/** A small block before the title (a rank, a thumbnail). */
|
|
996
|
+
leading?: ColumnDefinition<T>;
|
|
997
|
+
/** The row's name, up to two lines. */
|
|
998
|
+
title?: ColumnDefinition<T>;
|
|
999
|
+
/** The value at the right edge — the number or date compared down the list. */
|
|
1000
|
+
trailing?: ColumnDefinition<T>;
|
|
1001
|
+
/** The second line under the title. */
|
|
1002
|
+
meta: ColumnDefinition<T>[];
|
|
1003
|
+
/** Value columns only shown in the bottom sheet, in column order. */
|
|
1004
|
+
sheet: ColumnDefinition<T>[];
|
|
1005
|
+
/** Columns carrying row actions; they go to the sheet (or a ⋯ menu inside a modal). */
|
|
1006
|
+
actions: ColumnDefinition<T>[];
|
|
954
1007
|
};
|
|
955
1008
|
/** How many derived columns the second line takes before the rest goes to the sheet. */
|
|
956
|
-
declare const ROW_META_LIMIT = 2;
|
|
1009
|
+
export declare const ROW_META_LIMIT = 2;
|
|
957
1010
|
/**
|
|
958
1011
|
* Derives the phone layout of a row from the column config the app already has, so a table
|
|
959
1012
|
* needs nothing new to read well on a phone. In order:
|
|
@@ -972,577 +1025,578 @@ declare const ROW_META_LIMIT = 2;
|
|
|
972
1025
|
* @param columns The table's columns, in declaration order.
|
|
973
1026
|
* @returns The layout.
|
|
974
1027
|
*/
|
|
975
|
-
declare function resolveRowLayout<T>(columns: ColumnDefinition<T>[]): MnTableRowLayout<T>;
|
|
976
|
-
|
|
1028
|
+
export declare function resolveRowLayout<T>(columns: ColumnDefinition<T>[]): MnTableRowLayout<T>;
|
|
977
1029
|
/** What tapping a composed row does: select it, run the consumer's handler, open the sheet, or nothing. */
|
|
978
|
-
type MnTableRowTap = 'select' | 'click' | 'detail' | 'none';
|
|
979
|
-
declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDataSource<T>> {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1030
|
+
export type MnTableRowTap = 'select' | 'click' | 'detail' | 'none';
|
|
1031
|
+
export declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDataSource<T>> {
|
|
1032
|
+
/** Lucide icons the template renders. */
|
|
1033
|
+
protected readonly icons: Record<"ArrowDown" | "ArrowUp" | "ChevronRight" | "Ellipsis" | "Funnel" | "X", import("@lucide/angular").LucideIconData>;
|
|
1034
|
+
sortChange: EventEmitter<SortState | null>;
|
|
1035
|
+
rowClick: EventEmitter<T>;
|
|
1036
|
+
currentSort: SortState | null;
|
|
1037
|
+
/** Per-column filter values keyed by column key. */
|
|
1038
|
+
columnFilters: ColumnFilterState;
|
|
1039
|
+
/** Viewport width (px) below which the inline filter row collapses into a panel. */
|
|
1040
|
+
private static readonly FILTER_COLLAPSE_WIDTH;
|
|
1041
|
+
/**
|
|
1042
|
+
* True when the viewport is narrow enough that the per-column filter inputs no
|
|
1043
|
+
* longer fit under their headers; the inline row is then replaced by a toggle
|
|
1044
|
+
* button and a stacked filter panel.
|
|
1045
|
+
*/
|
|
1046
|
+
protected filtersCollapsed: boolean;
|
|
1047
|
+
/** Whether the small-screen filter bottom sheet is currently open. */
|
|
1048
|
+
protected filtersPanelOpen: boolean;
|
|
1049
|
+
/** Small-screen filter sheet, held so the close button can play its exit. */
|
|
1050
|
+
protected filtersSheet?: MnBottomSheet;
|
|
1051
|
+
/**
|
|
1052
|
+
* Whether this table renders inside an mn modal. There it never opens its own detail sheet:
|
|
1053
|
+
* on a phone the modal already is a sheet, and a second one stacks two drawers on one screen.
|
|
1054
|
+
* Actions stay reachable through a ⋯ menu on the row instead.
|
|
1055
|
+
*/
|
|
1056
|
+
private readonly inModal;
|
|
1057
|
+
/** For scheduling focus once the detail sheet has rendered. */
|
|
1058
|
+
private readonly injector;
|
|
1059
|
+
/**
|
|
1060
|
+
* The injector the filter sheet renders its fields with. The field template is declared
|
|
1061
|
+
* outside the sheet, so on its own it injects from there and its selects would open a second
|
|
1062
|
+
* sheet on top; this one says they are already in a sheet.
|
|
1063
|
+
*/
|
|
1064
|
+
protected readonly inSheetInjector: import("@angular/core").DestroyableInjector;
|
|
1065
|
+
/** The row whose detail sheet is open, or null when none is. */
|
|
1066
|
+
protected detailRow: T | null;
|
|
1067
|
+
/** The control that opened the detail sheet, which gets focus back when it closes. */
|
|
1068
|
+
private detailTrigger;
|
|
1069
|
+
/** Detail sheet, held so an action can play its exit before running. */
|
|
1070
|
+
protected detailSheet?: MnBottomSheet;
|
|
1071
|
+
/** The sheet's heading, focused on open so the sheet is announced and Escape reaches it. */
|
|
1072
|
+
protected detailHeading?: ElementRef<HTMLElement>;
|
|
1073
|
+
/** The last derived row layout and the column config it was derived from. */
|
|
1074
|
+
private layoutCache?;
|
|
1075
|
+
/** Counts tables on the page, so each sort radio group gets a name of its own. */
|
|
1076
|
+
private static instanceCount;
|
|
1077
|
+
/** The `name` that ties this table's sort radios into one group. */
|
|
1078
|
+
protected readonly sortGroupName: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Whether rows render as composed lines instead of a grid. The same 640px container width
|
|
1081
|
+
* at which the filter row already collapses: below it neither the filter inputs nor the
|
|
1082
|
+
* columns have room, so both give way at once.
|
|
1083
|
+
*/
|
|
1084
|
+
get rowMode(): boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Which column goes where on a composed row, derived from the column config (see
|
|
1087
|
+
* {@link resolveRowLayout}). Recomputed only when the columns, or a setting the rule reads,
|
|
1088
|
+
* change — a consumer adding a permission-gated column later is picked up.
|
|
1089
|
+
*/
|
|
1090
|
+
get rowLayout(): MnTableRowLayout<T>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Every value column the detail sheet lists under its heading: all of them except the two
|
|
1093
|
+
* the heading itself shows (title and trailing), so the sheet is the whole record.
|
|
1094
|
+
*/
|
|
1095
|
+
get detailColumns(): ColumnDefinition<T>[];
|
|
1096
|
+
/** Whether any of the row's action columns has a visible action for it. */
|
|
1097
|
+
rowHasAnyActions(row: T): boolean;
|
|
1098
|
+
/**
|
|
1099
|
+
* Whether a row has anything its composed line does not show: a column only the sheet
|
|
1100
|
+
* lists, or an action. Never inside a modal, where the table opens no sheet.
|
|
1101
|
+
*/
|
|
1102
|
+
rowHasDetail(row: T): boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* What a tap on a composed row does, in order of precedence: select it (a selection table),
|
|
1105
|
+
* run the consumer's row handler as on a wide table, open the detail sheet, or nothing.
|
|
1106
|
+
*/
|
|
1107
|
+
rowTap(row: T): MnTableRowTap;
|
|
1108
|
+
/**
|
|
1109
|
+
* Whether a row needs its own ⋯ button for the sheet, because a tap already does something
|
|
1110
|
+
* else. A row that opens the consumer's own detail (`onRowClick`) gets one only for actions:
|
|
1111
|
+
* a sheet with nothing but the same record next to that detail was two views of one row.
|
|
1112
|
+
*/
|
|
1113
|
+
showsRowMore(row: T): boolean;
|
|
1114
|
+
/** Whether a row shows its actions as a ⋯ menu: inside a modal, where there is no sheet. */
|
|
1115
|
+
showsRowMenu(row: T): boolean;
|
|
1116
|
+
/** Handles a tap on a composed row's main area. */
|
|
1117
|
+
onRowTap(row: T, event: Event): void;
|
|
1118
|
+
/**
|
|
1119
|
+
* Opens the detail sheet for a row and moves focus to its heading.
|
|
1120
|
+
* @param row The row.
|
|
1121
|
+
* @param trigger The control that opened it, which gets focus back on close.
|
|
1122
|
+
*/
|
|
1123
|
+
openDetail(row: T, trigger?: HTMLElement | null): void;
|
|
1124
|
+
/** Plays the detail sheet's exit, then unmounts it. */
|
|
1125
|
+
closeDetail(): Promise<void>;
|
|
1126
|
+
/** Clears the detail sheet once it is gone and returns focus to the control that opened it. */
|
|
1127
|
+
onDetailDismissed(): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Runs an action from the detail sheet. The sheet closes first, so an action that opens a
|
|
1130
|
+
* modal or navigates does not do so underneath it.
|
|
1131
|
+
*/
|
|
1132
|
+
runDetailAction(action: MnTableRowAction<T>, row: T): Promise<void>;
|
|
1133
|
+
/**
|
|
1134
|
+
* The text a composed row shows for a string column: the full cell. Not `cellSm` — that is the
|
|
1135
|
+
* short form an app wrote for a squeezed grid column (an e-mail cut to ten characters, a status
|
|
1136
|
+
* reduced to an icon), and a composed row has the room the grid column lacked.
|
|
1137
|
+
*/
|
|
1138
|
+
rowCellText(column: ColumnDefinition<T>, row: T): string;
|
|
1139
|
+
/** The template a composed row renders for a column; null for a string column. */
|
|
1140
|
+
rowCellTemplate(column: ColumnDefinition<T>): TemplateRef<unknown> | null;
|
|
1141
|
+
/**
|
|
1142
|
+
* Whether a cell is empty for this row: what the column's `isEmpty` says, else for a string
|
|
1143
|
+
* cell blank or the lone dash an app writes for "nothing". Such a value is left off the
|
|
1144
|
+
* composed row and the detail sheet ("Beschrijving: -" said nothing). A template cell without
|
|
1145
|
+
* `isEmpty` is never judged empty — its markup is the app's.
|
|
1146
|
+
*/
|
|
1147
|
+
rowValueEmpty(column: ColumnDefinition<T>, row: T): boolean;
|
|
1148
|
+
/** The second-line columns that have something to show for this row. */
|
|
1149
|
+
rowMeta(row: T): ColumnDefinition<T>[];
|
|
1150
|
+
/**
|
|
1151
|
+
* The column name a composed row shows beside a second-line or right-side value: with no
|
|
1152
|
+
* header row, "Lid", "1-12-2023" or "535" alone does not say what it is. Empty for a template
|
|
1153
|
+
* cell — a badge or an icon carries its own meaning, and its markup is the app's.
|
|
1154
|
+
*/
|
|
1155
|
+
rowSlotLabel(column: ColumnDefinition<T>): string;
|
|
1156
|
+
/** A row's name as text, for accessible names: its title cell, else the selection label. */
|
|
1157
|
+
rowLabel(row: T): string;
|
|
1158
|
+
/** Accessible name of a row's ⋯ button. */
|
|
1159
|
+
rowDetailsLabel(row: T): string;
|
|
1160
|
+
/** Columns a person can sort by, offered in the filter sheet once the header row is gone. */
|
|
1161
|
+
get sortableColumns(): ColumnDefinition<T>[];
|
|
1162
|
+
/**
|
|
1163
|
+
* Whether the toolbar shows the filter button: below 640px, when there is a filter to set or
|
|
1164
|
+
* a sort to choose — the header row that held both is gone there. Not over an empty or
|
|
1165
|
+
* one-row list, where there is nothing to narrow or order, unless a filter or sort is
|
|
1166
|
+
* already set (then the button is how to undo it).
|
|
1167
|
+
*/
|
|
1168
|
+
get showsFilterButton(): boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* Whether the search field shows: as always on a wide table, but below 640px not over an empty
|
|
1171
|
+
* or one-row list (there is nothing to find), unless a search is already typed or rows are
|
|
1172
|
+
* still loading.
|
|
1173
|
+
*/
|
|
1174
|
+
get showsSearch(): boolean;
|
|
1175
|
+
/**
|
|
1176
|
+
* Whether the pagination strip shows. Below 640px not for a single page: "Page 1 of 1" under
|
|
1177
|
+
* an empty or short list is chrome with nothing to do. Above it the strip stays as it was.
|
|
1178
|
+
*/
|
|
1179
|
+
get showsPagination(): boolean;
|
|
1180
|
+
/**
|
|
1181
|
+
* Whether a paginated table offers "Load more" instead of the pager: below 640px, on the first
|
|
1182
|
+
* page, while rows remain and the next size stays within {@link MnCollectionDataSource.maxPageSize}.
|
|
1183
|
+
* A tap grows the page instead of appending the next one, so a consumer that reloads after an
|
|
1184
|
+
* edit or a delete gets the whole visible list back rather than one page under stale rows.
|
|
1185
|
+
*/
|
|
1186
|
+
get showsPhoneLoadMore(): boolean;
|
|
1187
|
+
/**
|
|
1188
|
+
* How many rows the phone list shows. A server-side consumer's rows, not the size asked for:
|
|
1189
|
+
* a consumer that answers an older, bigger request last shows more than {@link pageSize}.
|
|
1190
|
+
*/
|
|
1191
|
+
private get phoneShownCount();
|
|
1192
|
+
/** How far the phone list has grown, as "10 of 48". */
|
|
1193
|
+
get phoneLoadedLabel(): string;
|
|
1194
|
+
/** The phone "Load more" button's label: the consumer's, the app's convention key, or English. */
|
|
1195
|
+
get phoneLoadMoreLabel(): string;
|
|
1196
|
+
/** A grown phone list has no pager to hold steady, so it keeps no full-page height floor. */
|
|
1197
|
+
get reservedPageHeight(): number;
|
|
1198
|
+
/**
|
|
1199
|
+
* Grows the phone list by one step: a client-side table shows more of the rows it holds, a
|
|
1200
|
+
* server-side one asks its consumer for a bigger first page. The rows on screen stay there
|
|
1201
|
+
* while that loads ({@link phoneLoadingMore}); skeletons would throw the reader back to the top.
|
|
1202
|
+
*/
|
|
1203
|
+
loadMorePhoneRows(): void;
|
|
1204
|
+
/**
|
|
1205
|
+
* The page size the next "Load more" asks for: one step more than the rows shown, capped for a
|
|
1206
|
+
* server.
|
|
1207
|
+
* @returns The next size; equal to the rows shown when the cap is reached.
|
|
1208
|
+
*/
|
|
1209
|
+
private nextPhonePageSize;
|
|
1210
|
+
/** Fresh rows answer a "Load more": the button stops spinning. */
|
|
1211
|
+
protected onRowsChanged(): void;
|
|
1212
|
+
/** A failed "Load more" shows the error, not a button that spins forever. */
|
|
1213
|
+
ngDoCheck(): void;
|
|
1214
|
+
/** How many column filters are set, shown as a count on the filter button. */
|
|
1215
|
+
get activeFilterCount(): number;
|
|
1216
|
+
/**
|
|
1217
|
+
* Title of the small-screen sheet and its button: "Filters" when there is something to filter,
|
|
1218
|
+
* "Sort by" when the sheet only holds the sort choice — a funnel over a sheet with no filter in
|
|
1219
|
+
* it promises something the sheet does not have.
|
|
1220
|
+
*/
|
|
1221
|
+
get filterSheetLabel(): string;
|
|
1222
|
+
/** Accessible name of the icon-only filter button, with the active count when there is one. */
|
|
1223
|
+
get filtersButtonAriaLabel(): string;
|
|
1224
|
+
/** Label of the sort select in the filter sheet. */
|
|
1225
|
+
get sortByLabel(): string;
|
|
1226
|
+
/** The sort select's "no sort" option. */
|
|
1227
|
+
get sortDefaultLabel(): string;
|
|
1228
|
+
/** The current sort direction in words, shown on the chosen column's direction button. */
|
|
1229
|
+
get sortDirectionLabel(): string;
|
|
1230
|
+
/** Accessible name of the direction button: what it shows and that a press flips it. */
|
|
1231
|
+
get sortDirectionButtonLabel(): string;
|
|
1232
|
+
/** Flips the current sort between ascending and descending. */
|
|
1233
|
+
toggleSortDirection(): void;
|
|
1234
|
+
/**
|
|
1235
|
+
* Sorts by a column chosen in the filter sheet, exactly as a header click would. A newly
|
|
1236
|
+
* chosen column starts ascending; re-choosing the current one keeps its direction.
|
|
1237
|
+
* @param columnKey The column, or empty for the default order.
|
|
1238
|
+
*/
|
|
1239
|
+
onSortColumn(columnKey: string): void;
|
|
1240
|
+
/**
|
|
1241
|
+
* Flips the direction of the current sort from the sheet's switch.
|
|
1242
|
+
* @param direction The value the switch emitted.
|
|
1243
|
+
*/
|
|
1244
|
+
onSortDirection(direction: string): void;
|
|
1245
|
+
/** Sets the sort, tells the consumer and re-sorts, as a header click does. */
|
|
1246
|
+
private applySort;
|
|
1247
|
+
protected readonly componentName = "MnTable";
|
|
1248
|
+
protected get trackedToolbarTemplate(): TemplateRef<unknown> | undefined;
|
|
1249
|
+
protected collectionBody?: ElementRef<HTMLElement>;
|
|
1250
|
+
/** Debounces server-side text filters so typing doesn't fire a request per keystroke. */
|
|
1251
|
+
private readonly filterDebounce;
|
|
1252
|
+
/**
|
|
1253
|
+
* Most rows shown per page on mobile (< md). A **cap**, not an override: a data
|
|
1254
|
+
* source asking for fewer rows keeps its own size. Raising a small page size on
|
|
1255
|
+
* a phone is the opposite of what it is for — it pushes the paginator below the
|
|
1256
|
+
* fold, which is most damaging inside a modal, where the sheet is already short
|
|
1257
|
+
* and its footer is pinned over the bottom of the table.
|
|
1258
|
+
*/
|
|
1259
|
+
private static readonly MOBILE_PAGE_SIZE;
|
|
1260
|
+
/** {@link MnCollectionDataSource.maxPageSize} when the consumer sets none. */
|
|
1261
|
+
private static readonly DEFAULT_MAX_PAGE_SIZE;
|
|
1262
|
+
/** Rows one phone "Load more" tap adds: the page size before the first tap; 0 while not grown. */
|
|
1263
|
+
private phoneLoadStep;
|
|
1264
|
+
/** Whether a phone "Load more" refetch is in flight: rows stay up and the button spins. */
|
|
1265
|
+
protected phoneLoadingMore: boolean;
|
|
1266
|
+
/**
|
|
1267
|
+
* The component's own element, measured for every responsive decision. Typed via
|
|
1268
|
+
* the annotation, not `inject(ElementRef<HTMLElement>)` — that form is a generic
|
|
1269
|
+
* call on the token and leaves `nativeElement` untyped.
|
|
1270
|
+
*/
|
|
1271
|
+
private readonly host;
|
|
1272
|
+
/** Whether the consumer owns filtering (server-side), mirroring {@link isServerSearched}. */
|
|
1273
|
+
get isServerFiltered(): boolean;
|
|
1274
|
+
/** Every column filter that is actually set, in column order. */
|
|
1275
|
+
get activeColumnFilters(): MnColumnFilter[];
|
|
1276
|
+
/** Whether at least one column filter is active. */
|
|
1277
|
+
get hasActiveFilters(): boolean;
|
|
1278
|
+
/**
|
|
1279
|
+
* Updates a column filter value and either re-filters locally or hands the
|
|
1280
|
+
* active filters to the consumer. Server-side text filters are debounced;
|
|
1281
|
+
* every other type commits immediately.
|
|
1282
|
+
*/
|
|
1283
|
+
onColumnFilter(column: ColumnDefinition<T>, value: ColumnFilterValue): void;
|
|
1284
|
+
/** Updates a tri-state boolean filter from its select ('' = any). */
|
|
1285
|
+
onBooleanFilter(column: ColumnDefinition<T>, raw: string): void;
|
|
1286
|
+
/** The effective filter type of a column, defaulting to text. */
|
|
1287
|
+
filterTypeOf(column: ColumnDefinition<T>): ColumnFilterType;
|
|
1288
|
+
/** Whether a specific column's filter currently narrows the rows. */
|
|
1289
|
+
isColumnFilterActive(column: ColumnDefinition<T>): boolean;
|
|
1290
|
+
/** Filter options formatted for mn-multi-select for a given column. */
|
|
1291
|
+
getFilterMultiSelectOptions(column: ColumnDefinition<T>): MnMultiSelectOption<string>[];
|
|
1292
|
+
/** Label for the small-screen filters toggle button. */
|
|
1293
|
+
get filtersButtonLabel(): string;
|
|
1294
|
+
/**
|
|
1295
|
+
* Summary a multi-select filter collapses to once more than one option is picked.
|
|
1296
|
+
* Resolved with the `{count}` token intact for mn-multi-select to fill in.
|
|
1297
|
+
*/
|
|
1298
|
+
get filterSelectedLabel(): string;
|
|
1299
|
+
/** Current text/select filter value for a column. */
|
|
1300
|
+
textFilterValue(column: ColumnDefinition<T>): string;
|
|
1301
|
+
/** Current multi-select filter value for a column. */
|
|
1302
|
+
multiFilterValue(column: ColumnDefinition<T>): string[];
|
|
1303
|
+
/** Current boolean filter value for a column, as the select's string value. */
|
|
1304
|
+
booleanFilterValue(column: ColumnDefinition<T>): string;
|
|
1305
|
+
/** Resets every column filter and re-applies (or re-requests) filtering. */
|
|
1306
|
+
clearAllFilters(): void;
|
|
1307
|
+
/** Whether any column has filtering enabled. */
|
|
1308
|
+
get hasColumnFilters(): boolean;
|
|
1309
|
+
/** Label for the "clear all filters" action in the small-screen panel. */
|
|
1310
|
+
get clearFiltersButtonLabel(): string;
|
|
1311
|
+
/** Accessible label for the filter sheet's close button. */
|
|
1312
|
+
get filtersCloseLabel(): string;
|
|
1313
|
+
/** Heading for the selection summary, with the count filled in. */
|
|
1314
|
+
get selectionSummaryTitle(): string;
|
|
1315
|
+
/** Label for the summary's clear-everything action. */
|
|
1316
|
+
get selectionClearAllLabel(): string;
|
|
1317
|
+
/** Opens the small-screen filter bottom sheet. */
|
|
1318
|
+
openFiltersPanel(): void;
|
|
1319
|
+
/** Plays the sheet's slide-down exit, then unmounts it. */
|
|
1320
|
+
closeFiltersPanel(): Promise<void>;
|
|
1321
|
+
private readonly baseTableClasses;
|
|
1322
|
+
/**
|
|
1323
|
+
* Column widths measured from the automatic layout and pinned, keyed by column
|
|
1324
|
+
* key, for `stable`. Empty until the first render that has real rows on screen,
|
|
1325
|
+
* and cleared whenever the table is resized so the next render re-measures.
|
|
1326
|
+
*/
|
|
1327
|
+
private pinnedWidths;
|
|
1328
|
+
/** Sets sort/filter state seeded from the data source before the first filter pass. */
|
|
1329
|
+
protected beforeInitialFilter(): void;
|
|
1330
|
+
/**
|
|
1331
|
+
* Whether {@link pinColumnWidths} has run. Tracked separately from
|
|
1332
|
+
* {@link pinnedWidths} being non-empty, because the widest column is deliberately
|
|
1333
|
+
* left unpinned and a table with a single flexible column therefore pins nothing.
|
|
1334
|
+
*/
|
|
1335
|
+
private widthsPinned;
|
|
1336
|
+
/**
|
|
1337
|
+
* Recomputes whether the inline filter row should collapse into the panel.
|
|
1338
|
+
* Closes the panel when returning to the wide layout so reopened state never
|
|
1339
|
+
* leaks across the breakpoint. Marks for check only when the layout flips.
|
|
1340
|
+
*/
|
|
1341
|
+
private updateFilterLayout;
|
|
1342
|
+
sort(column: ColumnDefinition<T>): void;
|
|
1343
|
+
/**
|
|
1344
|
+
* Whether clicking a row does anything: a data-source `onRowClick`, a bound `(rowClick)`,
|
|
1345
|
+
* or row selection. Only then does a row get the hover wash and the pointer, so a plain
|
|
1346
|
+
* list does not look like one that opens something. `appearance.hover: false` still turns
|
|
1347
|
+
* the wash off on a clickable table.
|
|
1348
|
+
*/
|
|
1349
|
+
get rowsClickable(): boolean;
|
|
1350
|
+
onRowClick(row: T): void;
|
|
1351
|
+
/**
|
|
1352
|
+
* Resolves the skeleton placeholder config for a column's cells.
|
|
1353
|
+
* Falls back to a text-shaped bar at 75% width (the previous default); any
|
|
1354
|
+
* fields the column provides override that default.
|
|
1355
|
+
*/
|
|
1356
|
+
getColumnSkeletonData(column: ColumnDefinition<T>): Partial<MnSkeletonProps>;
|
|
1357
|
+
getSortIcon(column: ColumnDefinition<T>): string;
|
|
1358
|
+
/**
|
|
1359
|
+
* Accessible name for a column's inline filter control: the header text, or the column key when
|
|
1360
|
+
* the header is a template.
|
|
1361
|
+
* @param column - The filtered column.
|
|
1362
|
+
*/
|
|
1363
|
+
filterLabel(column: ColumnDefinition<T>): string;
|
|
1364
|
+
/**
|
|
1365
|
+
* A string column's header text. `headerKey` is translated here, at render time, rather than
|
|
1366
|
+
* only in `resolveTranslationKeys`: that runs on init and on a locale change, so a column a
|
|
1367
|
+
* consumer adds afterwards (a permission-gated actions or image column) kept an empty header,
|
|
1368
|
+
* which a screen reader announces as a nameless column.
|
|
1369
|
+
* @param column - The column whose header is shown.
|
|
1370
|
+
* @returns The translated key when the column has one, otherwise its literal header, or an
|
|
1371
|
+
* empty string for a template header (rendered through its own outlet instead).
|
|
1372
|
+
*/
|
|
1373
|
+
headerText(column: ColumnDefinition<T>): string;
|
|
1374
|
+
isSortable(column: ColumnDefinition<T>): boolean;
|
|
1375
|
+
constructor();
|
|
1376
|
+
/**
|
|
1377
|
+
* Classes for the `<table>` element. `table-fixed` is added once column widths
|
|
1378
|
+
* are no longer allowed to follow the content: always for the `fixed` layout, and
|
|
1379
|
+
* for `stable` from the moment its widths have been measured and pinned.
|
|
1380
|
+
*/
|
|
1381
|
+
get tableClasses(): string;
|
|
1382
|
+
/** Page size to use at/above the `md` breakpoint (consumer's pageSize, or the user's selection). */
|
|
1383
|
+
private desktopPageSize;
|
|
1384
|
+
/** Label for the summary's expand/collapse control. */
|
|
1385
|
+
get selectionSummaryToggleLabel(): string;
|
|
1386
|
+
/** Placeholder and accessible name for the search box. */
|
|
1387
|
+
get searchPlaceholderLabel(): string;
|
|
1388
|
+
/** Screen-reader-only header text of the selection column, so that column is never nameless. */
|
|
1389
|
+
get selectionColumnLabel(): string;
|
|
1390
|
+
/** Accessible name for the scrollable table region. */
|
|
1391
|
+
get tableRegionLabel(): string;
|
|
1392
|
+
/**
|
|
1393
|
+
* Fewer tags once the table is narrow. A tag holding a person's full name takes
|
|
1394
|
+
* a whole line at phone width, so the eight that read as a compact header on a
|
|
1395
|
+
* wide table become eight stacked lines in a modal sheet — the summary then
|
|
1396
|
+
* occupies more of the screen than the rows it is summarising.
|
|
1397
|
+
*
|
|
1398
|
+
* Reuses {@link filtersCollapsed} rather than measuring again: it is already
|
|
1399
|
+
* maintained on every resize and means exactly "this table is under 640px".
|
|
1400
|
+
* The heading still states the true total, so the hidden tags cost no information.
|
|
1401
|
+
*/
|
|
1402
|
+
protected get defaultSelectionSummaryLimit(): number;
|
|
1403
|
+
/** Tracks the desktop page size when the user picks one (selector only shows at >= md). */
|
|
1404
|
+
onPageSizeChange(newSize: number): void;
|
|
1405
|
+
/** The effective column-width strategy, defaulting to `stable`. */
|
|
1406
|
+
get layoutMode(): 'auto' | 'fixed' | 'stable';
|
|
1407
|
+
/**
|
|
1408
|
+
* Whether column widths have stopped following the cell content — `fixed` always,
|
|
1409
|
+
* `stable` once {@link pinColumnWidths} has captured them. Drives `table-fixed`
|
|
1410
|
+
* and the cell truncation together, so a cell is never clipped while the column
|
|
1411
|
+
* it sits in could still have grown to fit it.
|
|
1412
|
+
*/
|
|
1413
|
+
get widthsArePinned(): boolean;
|
|
1414
|
+
/** Any / Yes / No options for a boolean column filter. */
|
|
1415
|
+
getBooleanFilterOptions(column: ColumnDefinition<T>): MnSelectOption<string>[];
|
|
1416
|
+
/**
|
|
1417
|
+
* The width to render for a column: the consumer's own declared width always
|
|
1418
|
+
* wins, then a width pinned by the `stable` layout, otherwise none.
|
|
1419
|
+
* @param column The column being rendered.
|
|
1420
|
+
* @returns A CSS width, or `null` to leave it to the layout algorithm.
|
|
1421
|
+
*/
|
|
1422
|
+
columnWidth(column: ColumnDefinition<T>): string | null;
|
|
1423
|
+
/**
|
|
1424
|
+
* The `title` tooltip for a cell, so text truncated by a pinned column stays
|
|
1425
|
+
* readable. Only string cells have text to expose; template cells render their
|
|
1426
|
+
* own markup and are left alone.
|
|
1427
|
+
* @param column The column being rendered.
|
|
1428
|
+
* @param row The row being rendered.
|
|
1429
|
+
* @returns The full cell text, or `null` when there is nothing to expose.
|
|
1430
|
+
*/
|
|
1431
|
+
cellTitle(column: ColumnDefinition<T>, row: T): string | null;
|
|
1432
|
+
/**
|
|
1433
|
+
* Falls back to the first column that renders a plain string, which is almost
|
|
1434
|
+
* always the name-like column a person would use to identify the row. Template
|
|
1435
|
+
* columns are skipped: they render markup this cannot flatten to a tag label.
|
|
1436
|
+
* @param row The selected row.
|
|
1437
|
+
* @returns The label, or null when every column renders a template.
|
|
1438
|
+
*/
|
|
1439
|
+
protected defaultSelectionLabel(row: T): string | null;
|
|
1440
|
+
/**
|
|
1441
|
+
* Resolves table-specific translation keys (column headers/filters) plus the
|
|
1442
|
+
* shared keys handled by the base.
|
|
1443
|
+
*/
|
|
1444
|
+
protected resolveTranslationKeys(): void;
|
|
1445
|
+
protected applyFilter(searchForItems: boolean): void;
|
|
1446
|
+
/**
|
|
1447
|
+
* Re-evaluate on a window resize too. The ResizeObserver covers every change to
|
|
1448
|
+
* the table's own box, but {@link isMobileViewport} reads the window, which can
|
|
1449
|
+
* change without the table's width following it (a fixed-width table, a modal
|
|
1450
|
+
* pinned to a max width).
|
|
1451
|
+
*/
|
|
1452
|
+
protected onWindowResize(): void;
|
|
1453
|
+
/** Re-evaluate responsive page size and filter layout when the table is resized. */
|
|
1454
|
+
private onHostResize;
|
|
1455
|
+
/**
|
|
1456
|
+
* Captures the current, automatically-derived width of every visible column and
|
|
1457
|
+
* pins it, which flips the table to `table-fixed` on the next render.
|
|
1458
|
+
*
|
|
1459
|
+
* Runs only with real rows on screen: measuring the loading skeletons would pin
|
|
1460
|
+
* the placeholder bars' widths rather than the data's. Hidden columns
|
|
1461
|
+
* ({@link ColumnBase.hiddenBelow}) measure 0 and are skipped, so they are free to
|
|
1462
|
+
* size themselves if a resize later reveals them.
|
|
1463
|
+
*
|
|
1464
|
+
* The **widest** column is measured but deliberately left unpinned, so it absorbs
|
|
1465
|
+
* whatever space the pinned ones leave over. Pinning every column instead makes the
|
|
1466
|
+
* widths sum to slightly more than the container — `border-collapse` shares borders
|
|
1467
|
+
* between neighbours, so rounding each cell's measured width over-counts them — and
|
|
1468
|
+
* the table then overflows into a spurious horizontal scrollbar. Leaving one column
|
|
1469
|
+
* elastic also means a later resize squeezes the widest column first instead of
|
|
1470
|
+
* clipping every column equally.
|
|
1471
|
+
*/
|
|
1472
|
+
private pinColumnWidths;
|
|
1473
|
+
/**
|
|
1474
|
+
* Drops the pinned widths so the next render with rows re-measures them. Called
|
|
1475
|
+
* when the table is resized: the old pixel widths were shares of a box that no
|
|
1476
|
+
* longer exists, and a resize is also what makes `hiddenBelow` columns come and
|
|
1477
|
+
* go, changing which columns need a share at all.
|
|
1478
|
+
*/
|
|
1479
|
+
private unpinColumnWidths;
|
|
1480
|
+
getCellValue(column: ColumnDefinition<T>, row: T): string;
|
|
1481
|
+
/** Returns the small-screen cell value for a column with cellSm defined. */
|
|
1482
|
+
getCellSmValue(column: ColumnDefinition<T>, row: T): string;
|
|
1483
|
+
/** The actions visible for a given row — those whose `hidden(row)` is not true. Shared by the wide table's buttons, the detail sheet and a modal's ⋯ menu. */
|
|
1484
|
+
visibleRowActions(column: ColumnDefinition<T>, row: T): MnTableRowAction<T>[];
|
|
1485
|
+
/**
|
|
1486
|
+
* The inline buttons for a row, in column order: every visible action, plus a placeholder
|
|
1487
|
+
* where a hidden action has {@link MnTableRowAction.keepSlot} so the buttons after it keep
|
|
1488
|
+
* their column. The ⋯ menu and the collapse rule still read {@link visibleRowActions}.
|
|
1489
|
+
*/
|
|
1490
|
+
inlineRowActions(column: ColumnDefinition<T>, row: T): {
|
|
1491
|
+
action: MnTableRowAction<T>;
|
|
1492
|
+
placeholder: boolean;
|
|
1493
|
+
}[];
|
|
1494
|
+
/** Whether a row has any visible actions at all; when false its cell is left empty. */
|
|
1495
|
+
hasRowActions(column: ColumnDefinition<T>, row: T): boolean;
|
|
1496
|
+
/**
|
|
1497
|
+
* Resolves a {@link MnRowValue}: either the fixed value, or the accessor applied to
|
|
1498
|
+
* the row. Every per-row presentation field goes through here so the fixed and derived
|
|
1499
|
+
* forms can never drift apart.
|
|
1500
|
+
*/
|
|
1501
|
+
private resolveRowValue;
|
|
1502
|
+
/** The resolved label for an inline action button (translation key wins once resolved). */
|
|
1503
|
+
rowActionLabel(action: MnTableRowAction<T>, row: T): string;
|
|
1504
|
+
/** The resolved leading icon for an action on a given row, if it has one. */
|
|
1505
|
+
rowActionIcon(action: MnTableRowAction<T>, row: T): MnActionIcon | undefined;
|
|
1506
|
+
/** Whether an inline action button should render its icon. */
|
|
1507
|
+
showActionIcon(column: ColumnDefinition<T>, action: MnTableRowAction<T>, row: T): boolean;
|
|
1508
|
+
/**
|
|
1509
|
+
* Whether an inline action button should render its text label. In `'icon'` mode the
|
|
1510
|
+
* label is hidden — unless the action has no icon, in which case it is shown anyway so
|
|
1511
|
+
* the button is never blank.
|
|
1512
|
+
*/
|
|
1513
|
+
showActionLabel(column: ColumnDefinition<T>, action: MnTableRowAction<T>, row: T): boolean;
|
|
1514
|
+
/** Whether an action is disabled for the given row. */
|
|
1515
|
+
isRowActionDisabled(action: MnTableRowAction<T>, row: T): boolean;
|
|
1516
|
+
/**
|
|
1517
|
+
* The effective colour for an action, used identically by the inline button and the
|
|
1518
|
+
* collapsed ⋯-menu item so the two never diverge: an explicit `color`, else `'danger'`
|
|
1519
|
+
* for a destructive action, else the default `'primary'`.
|
|
1520
|
+
*/
|
|
1521
|
+
rowActionColor(action: MnTableRowAction<T>, row: T): MnDropdownActionColor;
|
|
1522
|
+
/** Invokes an action for a row. */
|
|
1523
|
+
runRowAction(action: MnTableRowAction<T>, row: T): void;
|
|
1524
|
+
/** A stable, unique element id for a row's actions dropdown (aria wiring). */
|
|
1525
|
+
actionsDropdownId(column: ColumnDefinition<T>, row: T): string;
|
|
1526
|
+
/** Maps a row's visible actions to mn-dropdown commands, binding the row into each. */
|
|
1527
|
+
rowDropdownActions(column: ColumnDefinition<T>, row: T): MnDropdownAction[];
|
|
1528
|
+
trackByKey: (_index: number, column: ColumnDefinition<T>) => string;
|
|
1529
|
+
/** True when the table is narrower than the filter-collapse breakpoint. */
|
|
1530
|
+
private isFilterViewport;
|
|
1531
|
+
/**
|
|
1532
|
+
* True when the **window** is below the `md` (768px) breakpoint.
|
|
1533
|
+
*
|
|
1534
|
+
* Deliberately viewport-based, unlike {@link isFilterViewport}: the forced
|
|
1535
|
+
* mobile page size exists to keep a phone screen scrollable, and it is paired
|
|
1536
|
+
* with the rows-per-page selector that mn-collection-pagination hides at the
|
|
1537
|
+
* same viewport breakpoint. Measuring the table's own width instead would let
|
|
1538
|
+
* the two disagree — a 700px table on a desktop would be pinned to the mobile
|
|
1539
|
+
* row count while still offering the selector that overrides it.
|
|
1540
|
+
*/
|
|
1541
|
+
private isMobileViewport;
|
|
1542
|
+
/**
|
|
1543
|
+
* The table's own rendered width, which every responsive decision is made
|
|
1544
|
+
* against — the same width the `@container` queries in the template use, so
|
|
1545
|
+
* the TS and CSS halves of the responsive layout can never disagree.
|
|
1546
|
+
*
|
|
1547
|
+
* Falls back to the window width before the host has been laid out (and in
|
|
1548
|
+
* SSR), which is the closest available approximation at that point.
|
|
1549
|
+
* @returns The width in CSS pixels.
|
|
1550
|
+
*/
|
|
1551
|
+
private measuredWidth;
|
|
1552
|
+
/**
|
|
1553
|
+
* Applies the breakpoint-appropriate page size: capped at {@link MOBILE_PAGE_SIZE}
|
|
1554
|
+
* below `md`, the desktop size at/above it. When the size actually changes, client-side tables
|
|
1555
|
+
* re-slice locally and server-side tables ask the consumer to refetch, so the
|
|
1556
|
+
* rendered rows update in every pagination mode (used at init and on window resize).
|
|
1557
|
+
*/
|
|
1558
|
+
private applyResponsivePageSize;
|
|
1559
|
+
get totalColumnCount(): number;
|
|
1560
|
+
/**
|
|
1561
|
+
* Hands the active filters to the consumer. Locks the body height first so the
|
|
1562
|
+
* skeleton swap during the refetch can't collapse the layout, matching
|
|
1563
|
+
* {@link goToPage} and {@link onSearch}.
|
|
1564
|
+
*/
|
|
1565
|
+
private emitServerFilters;
|
|
1566
|
+
/** Resets every filterable column to its type's empty value. */
|
|
1567
|
+
private seedFilterValues;
|
|
1568
|
+
/**
|
|
1569
|
+
* Resolves the selection-summary labels from their translation keys. Resolved
|
|
1570
|
+
* without params so the `{{count}}` / `{{label}}` placeholders survive for the
|
|
1571
|
+
* getters to fill in per render.
|
|
1572
|
+
*/
|
|
1573
|
+
private resolveSelectionSummaryKeys;
|
|
1574
|
+
/** Resolves the range / boolean filter control labels from their translation keys. */
|
|
1575
|
+
private resolveFilterLabelKeys;
|
|
1576
|
+
private applySorting;
|
|
1577
|
+
/**
|
|
1578
|
+
* What an unfiltered select column reads: the column's own placeholder, else "All". It is both
|
|
1579
|
+
* the first option and the select's placeholder, because mn-select shows its placeholder for an
|
|
1580
|
+
* empty value (right for a form field, which must stay invalid until chosen), so without it an
|
|
1581
|
+
* unfiltered column read the select's generic "Select..." instead of "All".
|
|
1582
|
+
* @param column The filtered column.
|
|
1583
|
+
* @returns The label.
|
|
1584
|
+
*/
|
|
1585
|
+
filterAllLabel(column: ColumnDefinition<T>): string;
|
|
1586
|
+
/** Filter options formatted for mn-select for a given column. */
|
|
1587
|
+
getFilterSelectOptions(column: ColumnDefinition<T>): MnSelectOption<string>[];
|
|
1588
|
+
/**
|
|
1589
|
+
* Accessible label for a tag's remove button.
|
|
1590
|
+
* @param row The row the tag stands for.
|
|
1591
|
+
* @returns The label, naming the row so screen readers announce which one goes.
|
|
1592
|
+
*/
|
|
1593
|
+
selectionRemoveLabel(row: T): string;
|
|
1594
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnTable<any>, never>;
|
|
1595
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnTable<any>, "mn-table", never, {}, {
|
|
1596
|
+
"sortChange": "sortChange";
|
|
1597
|
+
"rowClick": "rowClick";
|
|
1598
|
+
}, never, never, true, never>;
|
|
1544
1599
|
}
|
|
1545
|
-
|
|
1546
1600
|
/**
|
|
1547
1601
|
* Pure helpers backing mn-table's per-column filters: the empty value and
|
|
1548
1602
|
* "is it set?" test for each filter type, and the default client-side predicate
|
|
@@ -1551,20 +1605,20 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
|
|
|
1551
1605
|
* Kept free of Angular so the filter semantics can be unit-tested directly.
|
|
1552
1606
|
*/
|
|
1553
1607
|
/** The reset/unset value for a filter type. */
|
|
1554
|
-
declare function emptyFilterValue(type: ColumnFilterType): ColumnFilterValue;
|
|
1608
|
+
export declare function emptyFilterValue(type: ColumnFilterType): ColumnFilterValue;
|
|
1555
1609
|
/**
|
|
1556
1610
|
* Whether a filter value should actually narrow the rows. Empty strings and
|
|
1557
1611
|
* empty arrays are inactive; `false` on a boolean filter is active (it means
|
|
1558
1612
|
* "show only the false rows"), which is why a plain truthiness check is not
|
|
1559
1613
|
* enough.
|
|
1560
1614
|
*/
|
|
1561
|
-
declare function isFilterValueActive(value: ColumnFilterValue | undefined): boolean;
|
|
1615
|
+
export declare function isFilterValueActive(value: ColumnFilterValue | undefined): boolean;
|
|
1562
1616
|
/**
|
|
1563
1617
|
* The value a filter compares against for a row: the column's
|
|
1564
1618
|
* `getRawValueToSort` when present (the only option for template cells, which
|
|
1565
1619
|
* have no string to read), otherwise the rendered cell string.
|
|
1566
1620
|
*/
|
|
1567
|
-
declare function resolveFilterableValue<T>(column: ColumnDefinition<T>, row: T): unknown;
|
|
1621
|
+
export declare function resolveFilterableValue<T>(column: ColumnDefinition<T>, row: T): unknown;
|
|
1568
1622
|
/**
|
|
1569
1623
|
* The default predicate for a filter type, used when the column supplies no
|
|
1570
1624
|
* `filterFn`. Semantics per type:
|
|
@@ -1573,7 +1627,7 @@ declare function resolveFilterableValue<T>(column: ColumnDefinition<T>, row: T):
|
|
|
1573
1627
|
* - `multi-select` — equality against any selected value (OR)
|
|
1574
1628
|
* - `boolean` — truthiness of the raw value equals the chosen state
|
|
1575
1629
|
*/
|
|
1576
|
-
declare function defaultFilterPredicate(type: ColumnFilterType, raw: unknown, value: ColumnFilterValue): boolean;
|
|
1630
|
+
export declare function defaultFilterPredicate(type: ColumnFilterType, raw: unknown, value: ColumnFilterValue): boolean;
|
|
1577
1631
|
/**
|
|
1578
1632
|
* Whether a row passes a column's active filter — the column's own `filterFn`
|
|
1579
1633
|
* when it has one, otherwise {@link defaultFilterPredicate}.
|
|
@@ -1583,8 +1637,7 @@ declare function defaultFilterPredicate(type: ColumnFilterType, raw: unknown, va
|
|
|
1583
1637
|
* is widened once here. Consumers keep the precise per-type signature where they
|
|
1584
1638
|
* declare the column, which is where it matters.
|
|
1585
1639
|
*/
|
|
1586
|
-
declare function matchesColumnFilter<T>(column: ColumnDefinition<T>, row: T, value: ColumnFilterValue): boolean;
|
|
1587
|
-
|
|
1640
|
+
export declare function matchesColumnFilter<T>(column: ColumnDefinition<T>, row: T, value: ColumnFilterValue): boolean;
|
|
1588
1641
|
/**
|
|
1589
1642
|
* Attribute directive that applies responsive-hiding classes to table cells/headers.
|
|
1590
1643
|
* Hides the element by default and shows it as `table-cell` at the specified breakpoint.
|
|
@@ -1601,143 +1654,155 @@ declare function matchesColumnFilter<T>(column: ColumnDefinition<T>, row: T, val
|
|
|
1601
1654
|
*
|
|
1602
1655
|
* Usage: `<td [mnHiddenBelow]="column.hiddenBelow">`
|
|
1603
1656
|
*/
|
|
1604
|
-
declare class MnHiddenBelowDirective implements OnChanges {
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1657
|
+
export declare class MnHiddenBelowDirective implements OnChanges {
|
|
1658
|
+
/** The breakpoint below which the element is hidden. */
|
|
1659
|
+
mnHiddenBelow: 'sm' | 'md' | 'lg' | undefined;
|
|
1660
|
+
private readonly el;
|
|
1661
|
+
private readonly renderer;
|
|
1662
|
+
private appliedClasses;
|
|
1663
|
+
/**
|
|
1664
|
+
* Static mapping of breakpoints to their full Tailwind class names, so Tailwind
|
|
1665
|
+
* can detect them at build time.
|
|
1666
|
+
*
|
|
1667
|
+
* These are **container** widths, deliberately lower than the viewport
|
|
1668
|
+
* breakpoints they are named after. A table almost never gets the whole window:
|
|
1669
|
+
* a page table sits inside a docked sidebar plus page padding, which on a
|
|
1670
|
+
* 1280px screen leaves it under 900px. Reusing 1024px for `lg` would demand a
|
|
1671
|
+
* ~1400px window before an `lg` column ever appeared — hiding columns on the
|
|
1672
|
+
* most ordinary laptop. These values instead express how much room the column
|
|
1673
|
+
* itself needs, which is what a container query should measure.
|
|
1674
|
+
*/
|
|
1675
|
+
private readonly classMap;
|
|
1676
|
+
ngOnChanges(): void;
|
|
1677
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnHiddenBelowDirective, never>;
|
|
1678
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnHiddenBelowDirective, "[mnHiddenBelow]", never, {
|
|
1679
|
+
"mnHiddenBelow": {
|
|
1680
|
+
"alias": "mnHiddenBelow";
|
|
1681
|
+
"required": false;
|
|
1682
|
+
};
|
|
1683
|
+
}, {}, never, never, true, never>;
|
|
1626
1684
|
}
|
|
1627
|
-
|
|
1628
1685
|
/**
|
|
1629
1686
|
* Attribute directive that hides an element below the given breakpoint and shows it at/above.
|
|
1630
1687
|
* Uses `hidden` + `{bp}:inline` so the element is invisible on small screens.
|
|
1631
1688
|
*
|
|
1632
1689
|
* Usage: `<span [mnShowAbove]="'sm'">`
|
|
1633
1690
|
*/
|
|
1634
|
-
declare class MnShowAboveDirective implements OnChanges {
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1691
|
+
export declare class MnShowAboveDirective implements OnChanges {
|
|
1692
|
+
/** The breakpoint at/above which the element becomes visible. */
|
|
1693
|
+
mnShowAbove: 'sm' | 'md' | 'lg' | undefined;
|
|
1694
|
+
private readonly el;
|
|
1695
|
+
private readonly renderer;
|
|
1696
|
+
private appliedClasses;
|
|
1697
|
+
/** Static mapping of breakpoints to their full Tailwind class names. */
|
|
1698
|
+
private readonly classMap;
|
|
1699
|
+
ngOnChanges(): void;
|
|
1700
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnShowAboveDirective, never>;
|
|
1701
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnShowAboveDirective, "[mnShowAbove]", never, {
|
|
1702
|
+
"mnShowAbove": {
|
|
1703
|
+
"alias": "mnShowAbove";
|
|
1704
|
+
"required": false;
|
|
1705
|
+
};
|
|
1706
|
+
}, {}, never, never, true, never>;
|
|
1645
1707
|
}
|
|
1646
|
-
|
|
1647
1708
|
/**
|
|
1648
1709
|
* Attribute directive that shows an element below the given breakpoint and hides it at/above.
|
|
1649
1710
|
* Uses `inline` by default + `{bp}:hidden` so the element is only visible on small screens.
|
|
1650
1711
|
*
|
|
1651
1712
|
* Usage: `<span [mnShowBelow]="'sm'">`
|
|
1652
1713
|
*/
|
|
1653
|
-
declare class MnShowBelowDirective implements OnChanges {
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1714
|
+
export declare class MnShowBelowDirective implements OnChanges {
|
|
1715
|
+
/** The breakpoint below which the element is visible. */
|
|
1716
|
+
mnShowBelow: 'sm' | 'md' | 'lg' | undefined;
|
|
1717
|
+
private readonly el;
|
|
1718
|
+
private readonly renderer;
|
|
1719
|
+
private appliedClasses;
|
|
1720
|
+
/** Static mapping of breakpoints to their full Tailwind class names. */
|
|
1721
|
+
private readonly classMap;
|
|
1722
|
+
ngOnChanges(): void;
|
|
1723
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnShowBelowDirective, never>;
|
|
1724
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnShowBelowDirective, "[mnShowBelow]", never, {
|
|
1725
|
+
"mnShowBelow": {
|
|
1726
|
+
"alias": "mnShowBelow";
|
|
1727
|
+
"required": false;
|
|
1728
|
+
};
|
|
1729
|
+
}, {}, never, never, true, never>;
|
|
1664
1730
|
}
|
|
1665
|
-
|
|
1666
1731
|
/**
|
|
1667
1732
|
* Customizes the loading-skeleton placeholder rendered for each list item.
|
|
1668
1733
|
* Either a set of skeleton lines (each a partial {@link MnSkeletonProps}) stacked
|
|
1669
1734
|
* vertically, or a `TemplateRef` for a fully custom placeholder. When omitted,
|
|
1670
1735
|
* two text-shaped lines (75% and 50% width) are used, matching the previous default.
|
|
1671
1736
|
*/
|
|
1672
|
-
type ListSkeleton = {
|
|
1673
|
-
|
|
1737
|
+
export type ListSkeleton = {
|
|
1738
|
+
lines: Partial<MnSkeletonProps>[];
|
|
1674
1739
|
} | TemplateRef<unknown>;
|
|
1675
|
-
type ListAppearance = {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1740
|
+
export type ListAppearance = {
|
|
1741
|
+
/** Show a divider between items. Defaults to true. */
|
|
1742
|
+
dividers?: boolean;
|
|
1743
|
+
/** Highlight a clickable item on hover. Defaults to true; items that do nothing on click never get it. */
|
|
1744
|
+
hover?: boolean;
|
|
1745
|
+
/** Use compact (smaller) padding. */
|
|
1746
|
+
compact?: boolean;
|
|
1747
|
+
/** Show a border around the list. */
|
|
1748
|
+
bordered?: boolean;
|
|
1684
1749
|
};
|
|
1685
|
-
type ListDataSource<T> = MnSelectableCollectionDataSource<T> & {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1750
|
+
export type ListDataSource<T> = MnSelectableCollectionDataSource<T> & {
|
|
1751
|
+
/** Template used to render each list item. Receives the item as `$implicit` and `data`. */
|
|
1752
|
+
itemTemplate: TemplateRef<unknown>;
|
|
1753
|
+
/** Customizes the loading-skeleton placeholder shown for each item while data loads. */
|
|
1754
|
+
skeleton?: ListSkeleton;
|
|
1755
|
+
onItemClick?: (item: T) => void;
|
|
1756
|
+
appearance?: ListAppearance;
|
|
1757
|
+
/** Template rendered on the left of the toolbar, before the search field. */
|
|
1758
|
+
toolbarLeftTemplate?: TemplateRef<unknown>;
|
|
1759
|
+
/** Template rendered on the right of the toolbar, after the search field. */
|
|
1760
|
+
toolbarRightTemplate?: TemplateRef<unknown>;
|
|
1761
|
+
/**
|
|
1762
|
+
* @deprecated Use {@link toolbarRightTemplate}, which names the slot it fills.
|
|
1763
|
+
* Still honoured, and still rendered on the right, so existing callers keep
|
|
1764
|
+
* working unchanged.
|
|
1765
|
+
*/
|
|
1766
|
+
toolbarTemplate?: TemplateRef<unknown>;
|
|
1702
1767
|
};
|
|
1703
1768
|
/** @deprecated Use {@link MnCollectionLabels}. */
|
|
1704
|
-
type ListLabels = MnCollectionLabels;
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1769
|
+
export type ListLabels = MnCollectionLabels;
|
|
1770
|
+
export declare class MnList<T = unknown> extends MnSelectableCollectionBase<T, ListDataSource<T>> {
|
|
1771
|
+
itemClick: EventEmitter<T>;
|
|
1772
|
+
protected readonly componentName = "MnList";
|
|
1773
|
+
/** Skeleton lines rendered for each placeholder item, falling back to the default two-bar layout. */
|
|
1774
|
+
get skeletonLines(): Partial<MnSkeletonProps>[];
|
|
1775
|
+
/**
|
|
1776
|
+
* Whether clicking an item does anything: a data-source `onItemClick` or a bound
|
|
1777
|
+
* `(itemClick)`. Only then does an item get the hover wash and the pointer.
|
|
1778
|
+
*/
|
|
1779
|
+
get itemsClickable(): boolean;
|
|
1780
|
+
onItemClick(item: T): void;
|
|
1781
|
+
/**
|
|
1782
|
+
* Keyboard activation of a clickable item: Enter and Space open it, as they would a button.
|
|
1783
|
+
* Handled on keydown so Space does not scroll the page first, and only when the item itself has
|
|
1784
|
+
* focus, so a checkbox or button inside the item keeps its own keys.
|
|
1785
|
+
* @param event - The keydown on the item.
|
|
1786
|
+
* @param item - The item the key was pressed on.
|
|
1787
|
+
*/
|
|
1788
|
+
onItemKeydown(event: KeyboardEvent, item: T): void;
|
|
1789
|
+
/**
|
|
1790
|
+
* The toolbar template the base class watches for identity changes. Prefers the
|
|
1791
|
+
* left slot, then the right, then the deprecated `toolbarTemplate`, so a list
|
|
1792
|
+
* using any single slot still re-renders when that template is swapped.
|
|
1793
|
+
*/
|
|
1794
|
+
protected get trackedToolbarTemplate(): TemplateRef<unknown> | undefined;
|
|
1795
|
+
protected collectionBody?: ElementRef<HTMLElement>;
|
|
1796
|
+
protected applyFilter(searchForItems: boolean): void;
|
|
1797
|
+
/** Accessible name for the scrollable list region. */
|
|
1798
|
+
get listRegionLabel(): string;
|
|
1799
|
+
/** Label on the header checkbox that selects or clears every visible row. */
|
|
1800
|
+
get selectAllLabel(): string;
|
|
1801
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnList<any>, never>;
|
|
1802
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnList<any>, "mn-list", never, {}, {
|
|
1803
|
+
"itemClick": "itemClick";
|
|
1804
|
+
}, never, never, true, never>;
|
|
1739
1805
|
}
|
|
1740
|
-
|
|
1741
1806
|
/**
|
|
1742
1807
|
* Controls the responsive card layout. Provide **either** `cols` (explicit column
|
|
1743
1808
|
* counts per breakpoint) **or** `minCardWidth` (CSS `auto-fit`/`minmax`); when
|
|
@@ -1745,27 +1810,27 @@ declare class MnList<T = unknown> extends MnSelectableCollectionBase<T, ListData
|
|
|
1745
1810
|
*
|
|
1746
1811
|
* Breakpoints match Tailwind defaults: sm 640px, md 768px, lg 1024px, xl 1280px.
|
|
1747
1812
|
*/
|
|
1748
|
-
type GridLayout = {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1813
|
+
export type GridLayout = {
|
|
1814
|
+
/**
|
|
1815
|
+
* Explicit column count per breakpoint. Each falls back to the next-smaller one.
|
|
1816
|
+
* Counts are clamped to 1–12, the range Tailwind's `grid-cols-*` utilities cover.
|
|
1817
|
+
*/
|
|
1818
|
+
cols?: {
|
|
1819
|
+
base?: number;
|
|
1820
|
+
sm?: number;
|
|
1821
|
+
md?: number;
|
|
1822
|
+
lg?: number;
|
|
1823
|
+
xl?: number;
|
|
1824
|
+
};
|
|
1825
|
+
/** Minimum card width, e.g. '18rem'. Enables auto-fit layout; ignores `cols`. */
|
|
1826
|
+
minCardWidth?: string;
|
|
1827
|
+
/** Gap between cards. Defaults to '1rem'. */
|
|
1828
|
+
gap?: string;
|
|
1829
|
+
/**
|
|
1830
|
+
* Caps the number of cards shown (preview mode, e.g. "first 3"). Intended for
|
|
1831
|
+
* `paginationMode: 'none'`; it slices the visible set and the pager stays hidden.
|
|
1832
|
+
*/
|
|
1833
|
+
maxItems?: number;
|
|
1769
1834
|
};
|
|
1770
1835
|
/**
|
|
1771
1836
|
* Customizes the loading-skeleton placeholder rendered for each card while data
|
|
@@ -1773,8 +1838,8 @@ type GridLayout = {
|
|
|
1773
1838
|
* useful form), or a set of stacked skeleton lines. When omitted, a default card
|
|
1774
1839
|
* placeholder (image block + two text bars) is rendered.
|
|
1775
1840
|
*/
|
|
1776
|
-
type GridSkeleton = TemplateRef<unknown> | {
|
|
1777
|
-
|
|
1841
|
+
export type GridSkeleton = TemplateRef<unknown> | {
|
|
1842
|
+
lines: Partial<MnSkeletonProps>[];
|
|
1778
1843
|
};
|
|
1779
1844
|
/**
|
|
1780
1845
|
* Configures an {@link import('./mn-grid.component').MnGrid}.
|
|
@@ -1785,26 +1850,25 @@ type GridSkeleton = TemplateRef<unknown> | {
|
|
|
1785
1850
|
* unwrapped — it fully controls its own layout — while the text variant gets the
|
|
1786
1851
|
* grid's default centered placeholder.
|
|
1787
1852
|
*/
|
|
1788
|
-
type GridDataSource<T> = MnCollectionDataSource<T> & {
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1853
|
+
export type GridDataSource<T> = MnCollectionDataSource<T> & {
|
|
1854
|
+
/** Template used to render each card. Receives the item as `$implicit` and `data`. */
|
|
1855
|
+
cardTemplate: TemplateRef<unknown>;
|
|
1856
|
+
/** Customizes the loading-skeleton card shown while data loads. */
|
|
1857
|
+
skeleton?: GridSkeleton;
|
|
1858
|
+
/** Responsive layout configuration. */
|
|
1859
|
+
layout?: GridLayout;
|
|
1860
|
+
onItemClick?: (item: T) => void;
|
|
1861
|
+
/** Template rendered on the left of the toolbar, before the search field. */
|
|
1862
|
+
toolbarLeftTemplate?: TemplateRef<unknown>;
|
|
1863
|
+
/** Template rendered on the right of the toolbar, after the search field. */
|
|
1864
|
+
toolbarRightTemplate?: TemplateRef<unknown>;
|
|
1865
|
+
/**
|
|
1866
|
+
* @deprecated Use {@link toolbarRightTemplate}, which names the slot it fills.
|
|
1867
|
+
* Still honoured, and still rendered on the right, so existing callers keep
|
|
1868
|
+
* working unchanged.
|
|
1869
|
+
*/
|
|
1870
|
+
toolbarTemplate?: TemplateRef<unknown>;
|
|
1806
1871
|
};
|
|
1807
|
-
|
|
1808
1872
|
/**
|
|
1809
1873
|
* Responsive card-grid component. Shares the collection chrome (search, every
|
|
1810
1874
|
* pagination mode, loading skeleton, empty state, toolbar, i18n) with
|
|
@@ -1812,49 +1876,49 @@ type GridDataSource<T> = MnCollectionDataSource<T> & {
|
|
|
1812
1876
|
* via {@link MnCollectionBase}, and lays items out as cards instead of rows.
|
|
1813
1877
|
* Selection is intentionally not supported.
|
|
1814
1878
|
*/
|
|
1815
|
-
declare class MnGrid<T = unknown> extends MnCollectionBase<T, GridDataSource<T>> {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1879
|
+
export declare class MnGrid<T = unknown> extends MnCollectionBase<T, GridDataSource<T>> {
|
|
1880
|
+
itemClick: EventEmitter<T>;
|
|
1881
|
+
protected readonly componentName = "MnGrid";
|
|
1882
|
+
/** Whether the grid uses auto-fit (minCardWidth) instead of explicit columns. */
|
|
1883
|
+
get isAutoLayout(): boolean;
|
|
1884
|
+
/**
|
|
1885
|
+
* Classes for the card container: `grid` plus one column utility per
|
|
1886
|
+
* breakpoint the consumer configured. Omitted for the auto-fit layout, whose
|
|
1887
|
+
* columns come from {@link autoTemplateColumns} instead.
|
|
1888
|
+
*/
|
|
1889
|
+
get gridClasses(): string;
|
|
1890
|
+
/** Gap between cards. */
|
|
1891
|
+
get gridGap(): string;
|
|
1892
|
+
/**
|
|
1893
|
+
* Inline `grid-template-columns` for the auto-fit layout, or null when explicit
|
|
1894
|
+
* `cols` are used (the utilities in {@link gridClasses} then own the columns).
|
|
1895
|
+
* `minCardWidth` is a free-form CSS length, so it can only be expressed inline.
|
|
1896
|
+
*/
|
|
1897
|
+
get autoTemplateColumns(): string | null;
|
|
1898
|
+
/** Skeleton lines for the default/lines placeholder; null when a custom template is used. */
|
|
1899
|
+
get skeletonLines(): Partial<MnSkeletonProps>[];
|
|
1900
|
+
/**
|
|
1901
|
+
* The toolbar template the base class watches for identity changes. Prefers the
|
|
1902
|
+
* left slot, then the right, then the deprecated `toolbarTemplate`, so a grid
|
|
1903
|
+
* using any single slot still re-renders when that template is swapped.
|
|
1904
|
+
*/
|
|
1905
|
+
protected get trackedToolbarTemplate(): TemplateRef<unknown> | undefined;
|
|
1906
|
+
protected collectionBody?: ElementRef<HTMLElement>;
|
|
1907
|
+
onItemClick(item: T): void;
|
|
1908
|
+
/**
|
|
1909
|
+
* Keyboard activation of a clickable item: Enter and Space open it, as they would a button.
|
|
1910
|
+
* Handled on keydown so Space does not scroll the page first, and only when the item itself has
|
|
1911
|
+
* focus, so a checkbox or button inside the item keeps its own keys.
|
|
1912
|
+
* @param event - The keydown on the item.
|
|
1913
|
+
* @param item - The item the key was pressed on.
|
|
1914
|
+
*/
|
|
1915
|
+
onItemKeydown(event: KeyboardEvent, item: T): void;
|
|
1916
|
+
protected applyFilter(searchForItems: boolean): void;
|
|
1917
|
+
/** Accessible name for the scrollable grid region. */
|
|
1918
|
+
get gridRegionLabel(): string;
|
|
1919
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnGrid<any>, never>;
|
|
1920
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnGrid<any>, "mn-grid", never, {}, {
|
|
1921
|
+
"itemClick": "itemClick";
|
|
1922
|
+
}, never, never, true, never>;
|
|
1857
1923
|
}
|
|
1858
|
-
|
|
1859
|
-
export { ColumnSortType, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnGrid, MnHiddenBelowDirective, MnList, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnTable, ROW_META_LIMIT, defaultFilterPredicate, emptyFilterValue, isFilterValueActive, matchesColumnFilter, resolveFilterableValue, resolveRowLayout };
|
|
1860
|
-
export type { ColumnBase, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnFilterValue, ColumnSkeleton, CursorPaginationStrategy, GridDataSource, GridLayout, GridSkeleton, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnCollectionDataSource, MnCollectionLabels, MnColumnFilter, MnColumnMobileSlot, MnPageSlot, MnRowValue, MnSelectableCollectionDataSource, MnTableFilterLabels, MnTableRowAction, MnTableRowLayout, MnTableRowTap, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, SortState, TableAppearance, TableDataSource, TableLabels };
|
|
1924
|
+
export {};
|