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,71 +1,68 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { MnCollectionState } from 'mn-angular-lib/collection';
|
|
5
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { AfterViewChecked, AfterViewInit, DoCheck, EventEmitter, OnDestroy, Signal } from "@angular/core";
|
|
3
|
+
import { MnCollectionState } from "mn-angular-lib/collection";
|
|
6
4
|
/**
|
|
7
5
|
* Configuration for a single tab item.
|
|
8
6
|
*/
|
|
9
|
-
type MnTabItem = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
export type MnTabItem = {
|
|
8
|
+
/** Translation key or label text for the tab. */
|
|
9
|
+
label: string;
|
|
10
|
+
/**
|
|
11
|
+
* Stable value this tab is written as in the URL while the tab bar mirrors
|
|
12
|
+
* its selection there (see {@link MnTabDataSource.urlParam}).
|
|
13
|
+
*
|
|
14
|
+
* Defaults to a slug of the last segment of {@link label}
|
|
15
|
+
* (`matches.hub.tab.entrants` → `entrants`, `members.tabMembers` →
|
|
16
|
+
* `tab-members`). Set it when that slug is not the URL you want to hand out,
|
|
17
|
+
* or when the label key may be renamed — a shared link is only as stable as
|
|
18
|
+
* the value in it.
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/** Callback invoked when this tab becomes active. */
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
/** Callback invoked when this tab is deactivated. */
|
|
24
|
+
onDeactivate?: () => void;
|
|
25
|
+
/** Optional notification count shown as a badge on the tab. Accepts a plain number or a Signal<number>. Hidden when 0 or absent. */
|
|
26
|
+
badge?: number | Signal<number>;
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
31
29
|
* Data source configuration for the mn-tab component.
|
|
32
30
|
*/
|
|
33
|
-
type MnTabDataSource = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
31
|
+
export type MnTabDataSource = {
|
|
32
|
+
/** List of tab items to display. */
|
|
33
|
+
items: MnTabItem[];
|
|
34
|
+
/** Index of the tab that should be active by default. */
|
|
35
|
+
defaultActive: number;
|
|
36
|
+
/**
|
|
37
|
+
* Lifecycle state of the tab set. When {@link MnCollectionState.LOADING} the tab
|
|
38
|
+
* bar renders a loading skeleton; any other state renders the real tabs.
|
|
39
|
+
*/
|
|
40
|
+
state?: MnCollectionState;
|
|
41
|
+
/**
|
|
42
|
+
* Number of placeholder tabs to render while {@link state} is LOADING.
|
|
43
|
+
* Defaults to the number of known `items`, falling back to 3 when no items are
|
|
44
|
+
* known yet. Set this only when the real tabs are not yet known at load time
|
|
45
|
+
* (e.g. tabs that depend on data being fetched) to predict the final count.
|
|
46
|
+
*/
|
|
47
|
+
skeletonCount?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Query parameter the active tab is mirrored in, so a reload or a shared
|
|
50
|
+
* link lands on the tab the user was looking at. Defaults to `'tab'`; pass
|
|
51
|
+
* `false` to keep this tab bar out of the URL.
|
|
52
|
+
*
|
|
53
|
+
* Each tab bar that can be on screen at the same time as another needs its
|
|
54
|
+
* own parameter name — two bars sharing one name fight over it. Turn it off
|
|
55
|
+
* for a tab bar whose selection is not worth sharing, such as one inside a
|
|
56
|
+
* modal, which would otherwise write to the URL of the page behind it.
|
|
57
|
+
*
|
|
58
|
+
* Only user selections are written, so a page nobody has clicked a tab on
|
|
59
|
+
* keeps a clean URL and falls back to {@link defaultActive}. Restoring a tab
|
|
60
|
+
* from the URL runs that tab's {@link MnTabItem.onClick} and emits
|
|
61
|
+
* `activeChange`, so a consumer tracking the active tab itself hears about
|
|
62
|
+
* the restored one.
|
|
63
|
+
*/
|
|
64
|
+
urlParam?: string | false;
|
|
67
65
|
};
|
|
68
|
-
|
|
69
66
|
/**
|
|
70
67
|
* Tab component that renders a horizontal tab bar.
|
|
71
68
|
* Supports translation keys for labels via MnTranslatePipe.
|
|
@@ -74,279 +71,291 @@ type MnTabDataSource = {
|
|
|
74
71
|
* a back button or a shared link lands on the same tab; see
|
|
75
72
|
* {@link MnTabDataSource.urlParam} to rename that parameter or switch it off.
|
|
76
73
|
*/
|
|
77
|
-
declare class MnTabComponent implements DoCheck, AfterViewInit, AfterViewChecked, OnDestroy {
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
-
|
|
74
|
+
export declare class MnTabComponent implements DoCheck, AfterViewInit, AfterViewChecked, OnDestroy {
|
|
75
|
+
/**
|
|
76
|
+
* Router the active tab is written to. Optional: a tab bar used outside a
|
|
77
|
+
* routed application still works, it just has no URL to mirror into.
|
|
78
|
+
*/
|
|
79
|
+
private readonly router;
|
|
80
|
+
/** Route the tab value is read back from; absent for the same reason as {@link router}. */
|
|
81
|
+
private readonly route;
|
|
82
|
+
/**
|
|
83
|
+
* Marks the view whenever {@link currentActive} moves. The selection changes from three
|
|
84
|
+
* places Angular does not notice under OnPush: the query-parameter subscription, the
|
|
85
|
+
* {@link ngDoCheck} re-resolve, and a stale item being dropped — only a click arrives
|
|
86
|
+
* through a listener that dirties the view by itself.
|
|
87
|
+
*/
|
|
88
|
+
private readonly cdr;
|
|
89
|
+
/** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
|
|
90
|
+
private readonly queryParamsSub?;
|
|
91
|
+
/**
|
|
92
|
+
* URL keys of the current items, memoised on the items array so a slug is
|
|
93
|
+
* computed once per tab set rather than on every change-detection pass.
|
|
94
|
+
*/
|
|
95
|
+
private urlKeyCache?;
|
|
96
|
+
/** URL key of {@link currentActive}, so a rebuilt tab set can be recognised as the same tab. */
|
|
97
|
+
private currentKey?;
|
|
98
|
+
/**
|
|
99
|
+
* Key of a selection whose URL write has not landed yet. Navigation is
|
|
100
|
+
* asynchronous, so a consumer that rebuilds its tabs in response to the click
|
|
101
|
+
* can be resolved against a URL that still names the previous tab; until the
|
|
102
|
+
* write completes, this is the truth about what the user picked.
|
|
103
|
+
*/
|
|
104
|
+
private pendingKey?;
|
|
105
|
+
/** Set on destroy so a deferred restore can't announce a tab nobody is showing. */
|
|
106
|
+
private destroyed;
|
|
107
|
+
/** The horizontally-scrolling wrapper the edge fade is painted onto. */
|
|
108
|
+
private scrollContainer?;
|
|
109
|
+
/** The tab row; queried for the active tab so the indicator can measure it. */
|
|
110
|
+
private tabList?;
|
|
111
|
+
/** The shared underline that slides to the active tab. */
|
|
112
|
+
private indicator?;
|
|
113
|
+
/** Pending indicator remeasure, cancelled on destroy so a post-destroy frame can't read a detached ref. */
|
|
114
|
+
private indicatorFrame?;
|
|
115
|
+
/**
|
|
116
|
+
* True while a click-initiated slide is animating. The active tab's
|
|
117
|
+
* `font-bold` widens the row, which fires {@link resizeObserver}; without
|
|
118
|
+
* this guard the observer's snap ({@link updateIndicator} with `animate:
|
|
119
|
+
* false`) would land the indicator at its target the same frame the slide
|
|
120
|
+
* starts, so the transition never paints. Set synchronously in
|
|
121
|
+
* {@link setActive} — before the frame runs — so the guard doesn't depend on
|
|
122
|
+
* rAF-vs-ResizeObserver callback ordering.
|
|
123
|
+
*/
|
|
124
|
+
private sliding;
|
|
125
|
+
/** Clears {@link sliding} after the slide finishes; re-armed per click, cancelled on destroy. */
|
|
126
|
+
private slidingTimer?;
|
|
127
|
+
/** Slide duration in ms; matches the indicator's `duration-300` transition. */
|
|
128
|
+
private static readonly SLIDE_MS;
|
|
129
|
+
/** How far the fade reaches in from each overflowing edge. */
|
|
130
|
+
private static readonly FADE;
|
|
131
|
+
/** Data source containing tab items and default active index. */
|
|
132
|
+
dataSource: MnTabDataSource;
|
|
133
|
+
/**
|
|
134
|
+
* Whether to enable horizontal scrolling when items overflow.
|
|
135
|
+
* When true, tabs scroll horizontally instead of overflowing their container.
|
|
136
|
+
*
|
|
137
|
+
* Defaults to `true`: the tab bar never wraps (`flex-nowrap`), so without
|
|
138
|
+
* scrolling an overflowing bar would clip its last tabs or push the page width
|
|
139
|
+
* on narrow screens. When the tabs already fit, `overflow-x-auto` is a no-op,
|
|
140
|
+
* so this default only ever changes behaviour for the overflow case it fixes.
|
|
141
|
+
*/
|
|
142
|
+
scrollable: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether tabs should stretch to fill the available width.
|
|
145
|
+
* Defaults to false, so tabs only take as much space as their content.
|
|
146
|
+
*/
|
|
147
|
+
justified: boolean;
|
|
148
|
+
/** Icons rendered by the template. */
|
|
149
|
+
protected readonly icons: Record<"ChevronLeft" | "ChevronRight", import("@lucide/angular").LucideIconData>;
|
|
150
|
+
/**
|
|
151
|
+
* Whether tabs are scrolled out of view past the start edge, which shows the start chevron.
|
|
152
|
+
* A signal, so a write from the scroll handler or the resize observer marks the view by itself.
|
|
153
|
+
*/
|
|
154
|
+
readonly canScrollStart: import("@angular/core").WritableSignal<boolean>;
|
|
155
|
+
/** Whether tabs are hidden past the end edge, which shows the end chevron. */
|
|
156
|
+
readonly canScrollEnd: import("@angular/core").WritableSignal<boolean>;
|
|
157
|
+
/** Emits the newly activated tab item whenever the active tab changes. */
|
|
158
|
+
activeChange: EventEmitter<MnTabItem>;
|
|
159
|
+
/** The currently active tab item. */
|
|
160
|
+
currentActive?: MnTabItem;
|
|
161
|
+
/** Watches the wrapper and the tab row so the fade re-evaluates on width or content changes. */
|
|
162
|
+
private resizeObserver?;
|
|
163
|
+
/**
|
|
164
|
+
* Whether the tab bar is loading and should render skeleton tabs, from
|
|
165
|
+
* {@link MnTabDataSource.state}.
|
|
166
|
+
*/
|
|
167
|
+
get isLoadingState(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Index array sizing the loading skeleton: `skeletonCount` when provided,
|
|
170
|
+
* otherwise the number of known items, falling back to a default when none.
|
|
171
|
+
*/
|
|
172
|
+
get skeletonTabs(): number[];
|
|
173
|
+
constructor();
|
|
174
|
+
/**
|
|
175
|
+
* Re-resolves the active tab on every change-detection pass.
|
|
176
|
+
*
|
|
177
|
+
* The data source is often populated or rebuilt asynchronously (tabs that
|
|
178
|
+
* depend on fetched data or permissions). Resolving the active tab only once
|
|
179
|
+
* at init would leave {@link currentActive} pointing at a stale item — the
|
|
180
|
+
* tab bar would then highlight nothing and swallow the first click — so the
|
|
181
|
+
* selection is kept in sync with whatever the data source currently holds.
|
|
182
|
+
*/
|
|
183
|
+
ngDoCheck(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Starts watching the scroll wrapper so the edge fade stays honest. A scroll
|
|
186
|
+
* moves the fade to whichever side now hides tabs; a resize (viewport change)
|
|
187
|
+
* or a change to the tab row's width (tabs added, relabelled, skeleton →
|
|
188
|
+
* loaded) re-checks whether either edge overflows at all.
|
|
189
|
+
*/
|
|
190
|
+
ngAfterViewInit(): void;
|
|
191
|
+
/** Wrapper geometry (`scrollWidth:clientWidth`) at the last fade evaluation. */
|
|
192
|
+
private lastFadeGeometry;
|
|
193
|
+
/**
|
|
194
|
+
* Re-evaluates the edge fade when the wrapper's scrollable extent changes without its box
|
|
195
|
+
* changing. {@link resizeObserver} only sees border-box changes, and the tab row is a
|
|
196
|
+
* block-level flex container that keeps its parent's width while its tabs overflow inside it,
|
|
197
|
+
* so tabs that arrive after init (permission-gated tabs, badge counts, skeleton → loaded) grow
|
|
198
|
+
* `scrollWidth` without firing it; until a resize or scroll the fade stayed off. Two property
|
|
199
|
+
* reads per pass; the repaint only runs when they moved.
|
|
200
|
+
*/
|
|
201
|
+
ngAfterViewChecked(): void;
|
|
202
|
+
ngOnDestroy(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Paints a fade over whichever edge has tabs scrolled out of view — a soft
|
|
205
|
+
* dissolve that reads as "more this way", the affordance a hidden scrollbar
|
|
206
|
+
* otherwise costs us. Uses a mask (content → transparent) rather than a
|
|
207
|
+
* background-coloured overlay, so it needs no knowledge of the theme.
|
|
208
|
+
*
|
|
209
|
+
* The fade alone only reads as "more" when it dissolves a tab cut off
|
|
210
|
+
* mid-label. When a tab boundary lands exactly on the edge it merely softens
|
|
211
|
+
* a complete label and the hidden tabs go unnoticed, so the same overflow
|
|
212
|
+
* also shows a chevron in the faded strip ({@link canScrollStart},
|
|
213
|
+
* {@link canScrollEnd}).
|
|
214
|
+
*/
|
|
215
|
+
updateEdgeFades(): void;
|
|
216
|
+
/**
|
|
217
|
+
* Scrolls the bar by most of its visible width towards one edge, from a chevron press. The
|
|
218
|
+
* scroll event that follows moves the fade and hides the chevron whose edge has been reached.
|
|
219
|
+
* Jumps instead of gliding for a user who asked for reduced motion.
|
|
220
|
+
* @param direction - -1 towards the start, 1 towards the end.
|
|
221
|
+
*/
|
|
222
|
+
scrollTabs(direction: -1 | 1): void;
|
|
223
|
+
/**
|
|
224
|
+
* Sets the given tab item as active, invoking deactivate/activate callbacks,
|
|
225
|
+
* and records the selection in the URL so it survives a reload or a share.
|
|
226
|
+
* @param item - The tab item to activate.
|
|
227
|
+
*/
|
|
228
|
+
setActive(item: MnTabItem): void;
|
|
229
|
+
/**
|
|
230
|
+
* Whether a tab is the bar's single Tab stop: the active tab, or the first tab while none is
|
|
231
|
+
* active yet. Every other tab is reached with the arrow keys, so Tab leaves the bar in one press.
|
|
232
|
+
* @param item - The tab to check.
|
|
233
|
+
* @returns True for the one tab that keeps `tabindex="0"`.
|
|
234
|
+
*/
|
|
235
|
+
isTabStop(item: MnTabItem): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Keyboard handling on a tab. Left and Right move to the previous or next tab and wrap at the
|
|
238
|
+
* ends, Home and End jump to the first and last; the tab moved to is activated at once
|
|
239
|
+
* (automatic activation) and receives focus. Enter and Space activate the focused tab, handled
|
|
240
|
+
* on keydown so Space does not scroll the page first. Other keys are left alone.
|
|
241
|
+
* @param event - The keydown on a tab.
|
|
242
|
+
* @param item - The tab the key was pressed on.
|
|
243
|
+
*/
|
|
244
|
+
onTabKeydown(event: KeyboardEvent, item: MnTabItem): void;
|
|
245
|
+
/**
|
|
246
|
+
* Moves focus to the tab at `index` and scrolls it into view inside a scrollable bar. Focusing
|
|
247
|
+
* works before change detection has moved `tabindex="0"` onto it, because a script may focus an
|
|
248
|
+
* element with `tabindex="-1"`.
|
|
249
|
+
* @param index - Position of the tab in the data source's items.
|
|
250
|
+
*/
|
|
251
|
+
private focusTab;
|
|
252
|
+
/**
|
|
253
|
+
* Moves the selection to `item` and tells the consumer about it: the
|
|
254
|
+
* deactivate/activate/emit sequence a click produces, shared by the click
|
|
255
|
+
* path and the URL-driven ones (deep link, back button), which owe the
|
|
256
|
+
* consumer the same notifications.
|
|
257
|
+
* @param item - The tab item to activate.
|
|
258
|
+
*/
|
|
259
|
+
private activate;
|
|
260
|
+
/**
|
|
261
|
+
* Marks a click-driven slide as in progress and schedules the guard to lift
|
|
262
|
+
* once the transition has finished. A timeout (not `transitionend`) so the
|
|
263
|
+
* flag still clears under `motion-reduce`, where no transition event fires.
|
|
264
|
+
*/
|
|
265
|
+
private beginSlide;
|
|
266
|
+
/**
|
|
267
|
+
* Moves the shared underline to the active tab. When `animate` is false the
|
|
268
|
+
* move is snapped (no slide) by disabling the transition for one reflow —
|
|
269
|
+
* used on init, async selection and resize, where a slide would read as jank.
|
|
270
|
+
* @param animate - Whether the move should slide (true) or snap (false).
|
|
271
|
+
*/
|
|
272
|
+
private updateIndicator;
|
|
273
|
+
/**
|
|
274
|
+
* Scrolls the strip so the active tab is fully in view, clear of the 2rem edge the fade and
|
|
275
|
+
* the scroll chevron cover. Only keyboard focus used to scroll, so a deep link to a tab past
|
|
276
|
+
* the fold ("?tab=results" on a phone) opened with the strip at its start and the selected
|
|
277
|
+
* tab out of sight. Sets scrollLeft on the strip itself rather than calling scrollIntoView,
|
|
278
|
+
* which would scroll the page too.
|
|
279
|
+
* @param active - The selected tab element.
|
|
280
|
+
*/
|
|
281
|
+
private revealActiveTab;
|
|
282
|
+
/**
|
|
283
|
+
* Remeasures the indicator on the next animation frame, so the read happens
|
|
284
|
+
* after layout reflects the latest active-tab classes. Coalesces bursts and
|
|
285
|
+
* is cancellable on destroy.
|
|
286
|
+
* @param animate - Whether the resulting move should slide.
|
|
287
|
+
*/
|
|
288
|
+
private scheduleIndicator;
|
|
289
|
+
/**
|
|
290
|
+
* Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
|
|
291
|
+
* @param item - The tab item whose badge to resolve.
|
|
292
|
+
*/
|
|
293
|
+
getBadge(item: MnTabItem): number | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Ensures {@link currentActive} references a tab that still exists in the data
|
|
296
|
+
* source, preferring the tab named in the URL and falling back to the
|
|
297
|
+
* configured default tab when the current selection is missing or stale
|
|
298
|
+
* (e.g. after the items array is replaced).
|
|
299
|
+
*/
|
|
300
|
+
private syncActiveTab;
|
|
301
|
+
/**
|
|
302
|
+
* Records `item` as the selection, remembering its URL key so the same tab is
|
|
303
|
+
* recognised after the consumer rebuilds the items array.
|
|
304
|
+
* @param item - The newly selected tab.
|
|
305
|
+
*/
|
|
306
|
+
private select;
|
|
307
|
+
/**
|
|
308
|
+
* Runs the restored tab's callbacks a change-detection pass later, unless the
|
|
309
|
+
* selection moved on in the meantime (a click, or another tab set arriving).
|
|
310
|
+
* @param item - The tab restored from the URL.
|
|
311
|
+
*/
|
|
312
|
+
private announceRestored;
|
|
313
|
+
/**
|
|
314
|
+
* Activates the tab a URL value names, when it is not the tab already on
|
|
315
|
+
* screen. Values naming no known tab are ignored: another tab bar on the page
|
|
316
|
+
* may own that parameter, and a stale link should leave the default standing.
|
|
317
|
+
* @param key - The value read from the query parameter, if any.
|
|
318
|
+
*/
|
|
319
|
+
private activateUrlKey;
|
|
320
|
+
/**
|
|
321
|
+
* The query parameter this tab bar mirrors into, or undefined when there is
|
|
322
|
+
* nothing to mirror into (no router) or the consumer switched it off.
|
|
323
|
+
*/
|
|
324
|
+
private urlParam;
|
|
325
|
+
/**
|
|
326
|
+
* The tab the current URL asks for, if it names one of `items`.
|
|
327
|
+
* @param items - The tab set to resolve the URL value against.
|
|
328
|
+
*/
|
|
329
|
+
private itemFromUrl;
|
|
330
|
+
/**
|
|
331
|
+
* Records the active tab in the query string, replacing the current history
|
|
332
|
+
* entry: switching tabs is not a navigation to walk back through, and back
|
|
333
|
+
* should leave the page rather than retrace its tabs.
|
|
334
|
+
* @param item - The tab that just became active.
|
|
335
|
+
*/
|
|
336
|
+
private writeUrl;
|
|
337
|
+
/**
|
|
338
|
+
* The URL key of every tab, in item order: the item's `id`, else a slug of
|
|
339
|
+
* its label. Repeats are numbered so each tab still round-trips through the
|
|
340
|
+
* URL; give such tabs an explicit `id` to choose the value yourself.
|
|
341
|
+
* @param items - The tab set to key.
|
|
342
|
+
*/
|
|
343
|
+
private urlKeys;
|
|
344
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnTabComponent, never>;
|
|
345
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnTabComponent, "mn-tab", never, {
|
|
346
|
+
"dataSource": {
|
|
347
|
+
"alias": "dataSource";
|
|
348
|
+
"required": false;
|
|
349
|
+
};
|
|
350
|
+
"scrollable": {
|
|
351
|
+
"alias": "scrollable";
|
|
352
|
+
"required": false;
|
|
353
|
+
};
|
|
354
|
+
"justified": {
|
|
355
|
+
"alias": "justified";
|
|
356
|
+
"required": false;
|
|
357
|
+
};
|
|
358
|
+
}, {
|
|
359
|
+
"activeChange": "activeChange";
|
|
360
|
+
}, never, never, true, never>;
|
|
361
|
+
}
|