@thalassic/ui 22.16.1 → 22.17.1
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/thalassic-ui.mjs +1463 -594
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +623 -48
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive,
|
|
2
|
+
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, PLATFORM_ID, DestroyRef, numberAttribute, output, viewChild, contentChild, Component, ViewContainerRef, DOCUMENT, afterRenderEffect, linkedSignal, Injectable, Renderer2, ElementRef, makeEnvironmentProviders, TemplateRef, forwardRef, effect, afterNextRender, viewChildren, contentChildren, isDevMode, untracked, provideEnvironmentInitializer } from '@angular/core';
|
|
3
|
+
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
|
|
4
|
+
import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, startOfDay, isSameMonth, format, isSameDay, subMonths, isBefore, isAfter, differenceInCalendarDays, addHours, differenceInMinutes, isSameWeek, addMonths, addWeeks, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setMinutes, setHours, setYear } from 'date-fns';
|
|
5
|
+
import { isPlatformBrowser, NgTemplateOutlet, NgComponentOutlet, LocationStrategy } from '@angular/common';
|
|
3
6
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
7
|
import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
5
8
|
import { takeUntilDestroyed, rxResource, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
6
9
|
import { filter, throwError, map, shareReplay, of, Subscription, takeUntil } from 'rxjs';
|
|
7
10
|
import { Router, ActivatedRoute, RouterLink, NavigationStart, RouterLinkActive } from '@angular/router';
|
|
8
11
|
import { Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
9
|
-
import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, startOfDay, isSameMonth, format, isSameDay, subMonths, isBefore, isAfter, differenceInCalendarDays, addHours, differenceInMinutes, isSameWeek, addMonths, addWeeks, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setMinutes, setHours, setYear } from 'date-fns';
|
|
10
|
-
import { isPlatformBrowser, NgTemplateOutlet, NgComponentOutlet, LocationStrategy } from '@angular/common';
|
|
11
12
|
import { HttpClient } from '@angular/common/http';
|
|
12
13
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
13
14
|
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
14
15
|
import { filter as filter$1 } from 'rxjs/operators';
|
|
15
|
-
import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
16
|
+
import { CdkDialogContainer, DialogRef as DialogRef$1, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
16
17
|
import { Directionality } from '@angular/cdk/bidi';
|
|
17
18
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
|
18
19
|
import { Menu as Menu$1, MenuItem } from '@angular/aria/menu';
|
|
@@ -284,493 +285,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
284
285
|
type: Directive
|
|
285
286
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }] } });
|
|
286
287
|
|
|
287
|
-
// Upper bound for how long to keep a detached pane alive so the panel's
|
|
288
|
-
// `animate.leave` can finish. Disposal happens on `animationend`; the timeout
|
|
289
|
-
// only fires when no exit animation runs (e.g. the `none` motion level).
|
|
290
|
-
const LEAVE_ANIMATION_FALLBACK_MS$1 = 500;
|
|
291
288
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* Shared by every surface that detaches a pane to let the exit animation play
|
|
297
|
-
* (connected overlays, confirm, tooltip).
|
|
289
|
+
* Adds `id` to `element`'s `aria-describedby`, preserving any description the consumer already
|
|
290
|
+
* put there. The attribute is a token list, so an overlay describing an element joins that list
|
|
291
|
+
* rather than replacing it.
|
|
298
292
|
*/
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
293
|
+
const addDescribedBy = (renderer, element, id) => {
|
|
294
|
+
const existing = element.getAttribute('aria-describedby');
|
|
295
|
+
const tokens = existing ? existing.split(' ').filter(Boolean) : [];
|
|
296
|
+
if (tokens.includes(id))
|
|
303
297
|
return;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (settled)
|
|
308
|
-
return;
|
|
309
|
-
settled = true;
|
|
310
|
-
window.clearTimeout(timeoutId);
|
|
311
|
-
paneElement.removeEventListener('animationend', finalize);
|
|
312
|
-
overlayRef.dispose();
|
|
313
|
-
};
|
|
314
|
-
paneElement.addEventListener('animationend', finalize);
|
|
315
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS$1);
|
|
316
|
-
}
|
|
298
|
+
tokens.push(id);
|
|
299
|
+
renderer.setAttribute(element, 'aria-describedby', tokens.join(' '));
|
|
300
|
+
};
|
|
317
301
|
|
|
318
|
-
const
|
|
302
|
+
const DAYS_IN_WEEK = 7;
|
|
319
303
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
* (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
|
|
323
|
-
* positional and dismissal differences between components are expressed through
|
|
324
|
-
* {@link ConnectedOverlayConfig} rather than duplicated per component.
|
|
304
|
+
* Every day shown in a month grid for the month containing `anchor`, starting at the
|
|
305
|
+
* first day of the first week (per `weekStartsOn`).
|
|
325
306
|
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
class OverlayManager {
|
|
330
|
-
_overlay = inject(Overlay);
|
|
331
|
-
_viewContainerRef = inject(ViewContainerRef);
|
|
332
|
-
_destroyRef = inject(DestroyRef);
|
|
333
|
-
_overlayRef = null;
|
|
334
|
-
_config = null;
|
|
335
|
-
_isOpen = signal(false, /* @ts-ignore */
|
|
336
|
-
...(ngDevMode ? [{ debugName: "_isOpen" }] : /* istanbul ignore next */ []));
|
|
337
|
-
// Armed by `ignoreTrailingAuxClick` on open: swallow the first outside
|
|
338
|
-
// `auxclick` so the right-click gesture that opened a context menu doesn't
|
|
339
|
-
// immediately dismiss it. Consumed one-shot (not on a timer) because the user
|
|
340
|
-
// may hold the button arbitrarily long before releasing — the `auxclick`
|
|
341
|
-
// fires on release — so the guard must survive until that first `auxclick`
|
|
342
|
-
// actually arrives. Later outside pointers still dismiss.
|
|
343
|
-
_ignoreTrailingAuxClick = false;
|
|
344
|
-
isOpen = this._isOpen.asReadonly();
|
|
345
|
-
// Dispose the overlay with the host. Registered in a field initializer so no
|
|
346
|
-
// constructor is needed.
|
|
347
|
-
_teardown = this._destroyRef.onDestroy(() => this._dispose());
|
|
348
|
-
open(config) {
|
|
349
|
-
if (this._isOpen())
|
|
350
|
-
return;
|
|
351
|
-
this._config = config;
|
|
352
|
-
if (!this._overlayRef) {
|
|
353
|
-
this._overlayRef = this._overlay.create({
|
|
354
|
-
positionStrategy: this._buildPositionStrategy(config),
|
|
355
|
-
scrollStrategy: config.scrollStrategy === 'close'
|
|
356
|
-
? this._overlay.scrollStrategies.close()
|
|
357
|
-
: this._overlay.scrollStrategies.reposition(),
|
|
358
|
-
hasBackdrop: config.hasBackdrop ?? true,
|
|
359
|
-
backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
|
|
360
|
-
...(config.panelClass != null && { panelClass: config.panelClass }),
|
|
361
|
-
});
|
|
362
|
-
this._wireDismissal(this._overlayRef, config);
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
// Reused ref (`reuse: true`): re-apply the position strategy so a new
|
|
366
|
-
// origin/point takes effect instead of reopening at the previous spot.
|
|
367
|
-
this._overlayRef.updatePositionStrategy(this._buildPositionStrategy(config));
|
|
368
|
-
}
|
|
369
|
-
if (config.minWidth != null) {
|
|
370
|
-
this._overlayRef.updateSize({ minWidth: config.minWidth });
|
|
371
|
-
}
|
|
372
|
-
this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
|
|
373
|
-
this._isOpen.set(true);
|
|
374
|
-
this._ignoreTrailingAuxClick = Boolean(config.ignoreTrailingAuxClick);
|
|
375
|
-
}
|
|
376
|
-
close() {
|
|
377
|
-
if (!this._isOpen())
|
|
378
|
-
return;
|
|
379
|
-
this._isOpen.set(false);
|
|
380
|
-
this._ignoreTrailingAuxClick = false;
|
|
381
|
-
const overlayRef = this._overlayRef;
|
|
382
|
-
const config = this._config;
|
|
383
|
-
if (overlayRef) {
|
|
384
|
-
// Detach (not dispose) so the pane survives while Angular's `animate.leave`
|
|
385
|
-
// plays the panel's exit animation. A reused overlay keeps its ref for the
|
|
386
|
-
// next open; a one-off overlay is disposed once the animation has finished,
|
|
387
|
-
// so the pane is never torn down mid-animation.
|
|
388
|
-
overlayRef.detach();
|
|
389
|
-
const reuse = Boolean(config && config.reuse);
|
|
390
|
-
if (!reuse) {
|
|
391
|
-
this._overlayRef = null;
|
|
392
|
-
disposeAfterLeaveAnimation(overlayRef);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (config && config.onClose)
|
|
396
|
-
config.onClose();
|
|
397
|
-
}
|
|
398
|
-
// Private
|
|
399
|
-
_buildPositionStrategy(config) {
|
|
400
|
-
let strategy = this._overlay
|
|
401
|
-
.position()
|
|
402
|
-
.flexibleConnectedTo(config.origin)
|
|
403
|
-
.withPositions(config.positions);
|
|
404
|
-
if (config.flexibleDimensions === false)
|
|
405
|
-
strategy = strategy.withFlexibleDimensions(false);
|
|
406
|
-
if (config.push === false)
|
|
407
|
-
strategy = strategy.withPush(false);
|
|
408
|
-
return strategy;
|
|
409
|
-
}
|
|
410
|
-
_wireDismissal(overlayRef, config) {
|
|
411
|
-
const hasBackdrop = config.hasBackdrop ?? true;
|
|
412
|
-
if (config.closeOnBackdropClick ?? hasBackdrop) {
|
|
413
|
-
overlayRef
|
|
414
|
-
.backdropClick()
|
|
415
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
416
|
-
.subscribe(() => this.close());
|
|
417
|
-
}
|
|
418
|
-
if (config.closeOnOutsidePointer ?? !hasBackdrop) {
|
|
419
|
-
overlayRef
|
|
420
|
-
.outsidePointerEvents()
|
|
421
|
-
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'), filter(event => {
|
|
422
|
-
// Swallow exactly the first outside `auxclick` after an armed open —
|
|
423
|
-
// the release of the right-click that opened a context menu — then
|
|
424
|
-
// let every later outside pointer dismiss as usual.
|
|
425
|
-
if (this._ignoreTrailingAuxClick && event.type === 'auxclick') {
|
|
426
|
-
this._ignoreTrailingAuxClick = false;
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
return true;
|
|
430
|
-
}))
|
|
431
|
-
.subscribe(() => this.close());
|
|
432
|
-
}
|
|
433
|
-
if (config.closeOnEscape ?? true) {
|
|
434
|
-
overlayRef
|
|
435
|
-
.keydownEvents()
|
|
436
|
-
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
|
|
437
|
-
.subscribe(() => this.close());
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
_dispose() {
|
|
441
|
-
this._overlayRef?.dispose();
|
|
442
|
-
this._overlayRef = null;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Creates an {@link OverlayManager} bound to the current injection context.
|
|
447
|
-
* Call from a component/directive field initializer or constructor.
|
|
307
|
+
* With `weeks` omitted the span is the natural 5–6 weeks that cover the month. Passing a
|
|
308
|
+
* fixed `weeks` count returns exactly that many weeks, so the grid height never reflows
|
|
309
|
+
* between months.
|
|
448
310
|
*/
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
311
|
+
const buildMonthDays = (anchor, weekStartsOn, weeks) => {
|
|
312
|
+
const start = startOfWeek(startOfMonth(anchor), { weekStartsOn });
|
|
313
|
+
const end = weeks === undefined
|
|
314
|
+
? endOfWeek(endOfMonth(anchor), { weekStartsOn })
|
|
315
|
+
: addDays(start, weeks * DAYS_IN_WEEK - 1);
|
|
316
|
+
return eachDayOfInterval({ start, end });
|
|
317
|
+
};
|
|
452
318
|
|
|
453
319
|
/**
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* inputs, the connected overlay lifecycle, roving `aria-activedescendant`
|
|
457
|
-
* navigation, and the keyboard handler. The per-control differences (the value
|
|
458
|
-
* shape, the selected-state check, how the trigger label is built and what a
|
|
459
|
-
* commit does) are expressed through the abstract members below.
|
|
460
|
-
*/
|
|
461
|
-
class AbstractSelect extends ValueFormControl {
|
|
462
|
-
overlay = createOverlayManager();
|
|
463
|
-
triggerElement = viewChild('trigger', /* @ts-ignore */
|
|
464
|
-
...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
|
|
465
|
-
panelTemplate = viewChild('panel', /* @ts-ignore */
|
|
466
|
-
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
467
|
-
/**
|
|
468
|
-
* Consumer template rendered inside each option button in place of the plain
|
|
469
|
-
* label (`<ng-template #option let-context>`). The button itself — and with it
|
|
470
|
-
* the option's ARIA, activation, and hover behavior — stays owned by the
|
|
471
|
-
* control; the template only customizes the visual content.
|
|
472
|
-
*/
|
|
473
|
-
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
474
|
-
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
475
|
-
// Shared inputs (config-independent)
|
|
476
|
-
options = input([], /* @ts-ignore */
|
|
477
|
-
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
478
|
-
optionLabel = input(undefined, /* @ts-ignore */
|
|
479
|
-
...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
480
|
-
optionValue = input(undefined, /* @ts-ignore */
|
|
481
|
-
...(ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
482
|
-
optionDisabled = input(undefined, /* @ts-ignore */
|
|
483
|
-
...(ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
|
|
484
|
-
tabindex = input(0, /* @ts-ignore */
|
|
485
|
-
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
486
|
-
isOpen = this.overlay.isOpen;
|
|
487
|
-
activeIndex = signal(-1, /* @ts-ignore */
|
|
488
|
-
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
489
|
-
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
490
|
-
label: this.optionLabel(),
|
|
491
|
-
value: this.optionValue(),
|
|
492
|
-
disabled: this.optionDisabled(),
|
|
493
|
-
}), /* @ts-ignore */
|
|
494
|
-
...(ngDevMode ? [{ debugName: "normalizedOptions" }] : /* istanbul ignore next */ []));
|
|
495
|
-
/**
|
|
496
|
-
* Options actually shown in the panel and traversed by keyboard navigation. Defaults to the full
|
|
497
|
-
* normalized list; a filtering control (an editable combobox) narrows it via
|
|
498
|
-
* {@link filterVisibleOptions}. `activeIndex` always indexes into this list, never the raw one.
|
|
499
|
-
*/
|
|
500
|
-
visibleOptions = computed(() => this.filterVisibleOptions(this.normalizedOptions()), /* @ts-ignore */
|
|
501
|
-
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
502
|
-
activeDescendantId = computed(() => {
|
|
503
|
-
const index = this.activeIndex();
|
|
504
|
-
if (index < 0)
|
|
505
|
-
return null;
|
|
506
|
-
return this.optionId(index);
|
|
507
|
-
}, /* @ts-ignore */
|
|
508
|
-
...(ngDevMode ? [{ debugName: "activeDescendantId" }] : /* istanbul ignore next */ []));
|
|
509
|
-
hostClasses = computed(() => {
|
|
510
|
-
const array = [this.hostClassBase];
|
|
511
|
-
if (this.isOpen())
|
|
512
|
-
array.push(`${this.hostClassBase}--open`);
|
|
513
|
-
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
514
|
-
if (this.fluid())
|
|
515
|
-
array.push(`${this.CLASS_NAME}--fluid`);
|
|
516
|
-
return array.concat(this.controlClasses());
|
|
517
|
-
}, /* @ts-ignore */
|
|
518
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
519
|
-
get listboxId() {
|
|
520
|
-
return `${this.uniqueId}-listbox`;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Narrows the option list shown in the panel. The listbox controls show every option; an editable
|
|
524
|
-
* combobox overrides this to filter by the typed query.
|
|
525
|
-
*/
|
|
526
|
-
filterVisibleOptions(options) {
|
|
527
|
-
return options;
|
|
528
|
-
}
|
|
529
|
-
/** Hook invoked after the panel has closed, once the trigger has regained focus. */
|
|
530
|
-
onClosed() {
|
|
531
|
-
// No-op by default; an editable combobox overrides this to reconcile its text.
|
|
532
|
-
}
|
|
533
|
-
// Protected methods
|
|
534
|
-
open() {
|
|
535
|
-
const triggerElement = this.triggerElement();
|
|
536
|
-
const panelTemplate = this.panelTemplate();
|
|
537
|
-
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
538
|
-
return;
|
|
539
|
-
this.overlay.open({
|
|
540
|
-
content: panelTemplate,
|
|
541
|
-
origin: triggerElement,
|
|
542
|
-
positions: [
|
|
543
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
544
|
-
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
545
|
-
],
|
|
546
|
-
flexibleDimensions: false,
|
|
547
|
-
push: false,
|
|
548
|
-
panelClass: this.panelClass,
|
|
549
|
-
// The control handles Escape itself via the trigger's keydown handler.
|
|
550
|
-
closeOnEscape: false,
|
|
551
|
-
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
552
|
-
reuse: true,
|
|
553
|
-
onClose: () => {
|
|
554
|
-
this.activeIndex.set(-1);
|
|
555
|
-
const trigger = this.triggerElement();
|
|
556
|
-
if (trigger)
|
|
557
|
-
trigger.nativeElement.focus();
|
|
558
|
-
this.onClosed();
|
|
559
|
-
},
|
|
560
|
-
});
|
|
561
|
-
this.activeIndex.set(this.getInitialActiveIndex());
|
|
562
|
-
}
|
|
563
|
-
close() {
|
|
564
|
-
this.overlay.close();
|
|
565
|
-
}
|
|
566
|
-
toggle() {
|
|
567
|
-
if (this.isOpen()) {
|
|
568
|
-
this.close();
|
|
569
|
-
}
|
|
570
|
-
else {
|
|
571
|
-
this.open();
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
onOptionHover(event, index, disabled) {
|
|
575
|
-
// A touch "enter" is a tap in progress, not a hover; the click that follows
|
|
576
|
-
// commits the option, so the active index has nothing to track.
|
|
577
|
-
if (event.pointerType === 'touch')
|
|
578
|
-
return;
|
|
579
|
-
if (!disabled)
|
|
580
|
-
this.activeIndex.set(index);
|
|
581
|
-
}
|
|
582
|
-
onKeydown(event) {
|
|
583
|
-
if (event.key === 'ArrowDown') {
|
|
584
|
-
event.preventDefault();
|
|
585
|
-
if (this.isOpen()) {
|
|
586
|
-
this.moveActive(1);
|
|
587
|
-
}
|
|
588
|
-
else {
|
|
589
|
-
this.open();
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
else if (event.key === 'ArrowUp') {
|
|
593
|
-
event.preventDefault();
|
|
594
|
-
if (this.isOpen()) {
|
|
595
|
-
this.moveActive(-1);
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
this.open();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
else if (event.key === 'Enter' || event.key === ' ') {
|
|
602
|
-
event.preventDefault();
|
|
603
|
-
if (!this.isOpen()) {
|
|
604
|
-
this.open();
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
const active = this.visibleOptions()[this.activeIndex()];
|
|
608
|
-
if (active && !active.disabled)
|
|
609
|
-
this.commitActiveOption(active);
|
|
610
|
-
}
|
|
611
|
-
else if (event.key === 'Home') {
|
|
612
|
-
if (!this.isOpen())
|
|
613
|
-
return;
|
|
614
|
-
event.preventDefault();
|
|
615
|
-
this.moveActiveToEdge(1);
|
|
616
|
-
}
|
|
617
|
-
else if (event.key === 'End') {
|
|
618
|
-
if (!this.isOpen())
|
|
619
|
-
return;
|
|
620
|
-
event.preventDefault();
|
|
621
|
-
this.moveActiveToEdge(-1);
|
|
622
|
-
}
|
|
623
|
-
else if (event.key === 'Escape') {
|
|
624
|
-
event.preventDefault();
|
|
625
|
-
if (this.isOpen())
|
|
626
|
-
this.close();
|
|
627
|
-
}
|
|
628
|
-
else if (event.key === 'Tab') {
|
|
629
|
-
if (this.isOpen())
|
|
630
|
-
this.close();
|
|
631
|
-
}
|
|
632
|
-
else if ((event.key === 'Delete' || event.key === 'Backspace') &&
|
|
633
|
-
this.clearable() &&
|
|
634
|
-
this.hasValue()) {
|
|
635
|
-
event.preventDefault();
|
|
636
|
-
this.clear();
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
optionId(index) {
|
|
640
|
-
return `${this.uniqueId}-option-${index}`;
|
|
641
|
-
}
|
|
642
|
-
/** Context handed to the consumer's option template for the option at `index`. */
|
|
643
|
-
optionContext(option, index) {
|
|
644
|
-
return {
|
|
645
|
-
$implicit: {
|
|
646
|
-
option: option.source,
|
|
647
|
-
value: option.value,
|
|
648
|
-
label: option.label,
|
|
649
|
-
index,
|
|
650
|
-
selected: this.isOptionSelected(option),
|
|
651
|
-
active: index === this.activeIndex(),
|
|
652
|
-
disabled: option.disabled,
|
|
653
|
-
},
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
moveActive(direction) {
|
|
657
|
-
const options = this.visibleOptions();
|
|
658
|
-
let next = this.activeIndex() + direction;
|
|
659
|
-
while (next >= 0 && next < options.length) {
|
|
660
|
-
if (!options[next].disabled) {
|
|
661
|
-
this.activeIndex.set(next);
|
|
662
|
-
return;
|
|
663
|
-
}
|
|
664
|
-
next += direction;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
// Private methods
|
|
668
|
-
moveActiveToEdge(direction) {
|
|
669
|
-
const options = this.visibleOptions();
|
|
670
|
-
let next = direction === 1 ? 0 : options.length - 1;
|
|
671
|
-
while (next >= 0 && next < options.length) {
|
|
672
|
-
if (!options[next].disabled) {
|
|
673
|
-
this.activeIndex.set(next);
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
next += direction;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
680
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.5", type: AbstractSelect, isStandalone: true, inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0 });
|
|
681
|
-
}
|
|
682
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, decorators: [{
|
|
683
|
-
type: Directive
|
|
684
|
-
}], propDecorators: { triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
685
|
-
|
|
686
|
-
// Form control base classes
|
|
687
|
-
|
|
688
|
-
/** Matches a quoted literal in a `date-fns` format pattern, e.g. the `'h'` in `"HH 'h' mm"`. */
|
|
689
|
-
const QUOTED_LITERAL = /'[^']*'/g;
|
|
690
|
-
/** Day-period tokens (`a`, `b`, `B`) — their presence marks a pattern as 12-hour. */
|
|
691
|
-
const DAY_PERIOD_TOKEN = /[abB]/;
|
|
692
|
-
/**
|
|
693
|
-
* Whether times render on a 12-hour clock. A `'locale'` cycle probes the configured
|
|
694
|
-
* `date-fns` locale's short time pattern for a day-period token; with no locale
|
|
695
|
-
* configured `date-fns` formats as `en-US`, which is 12-hour.
|
|
696
|
-
*/
|
|
697
|
-
const isHour12 = (config) => {
|
|
698
|
-
if (config.hourCycle !== 'locale')
|
|
699
|
-
return config.hourCycle === 12;
|
|
700
|
-
const locale = config.dateFns;
|
|
701
|
-
if (!locale)
|
|
702
|
-
return true;
|
|
703
|
-
return DAY_PERIOD_TOKEN.test(locale.formatLong.time({ width: 'short' }).replace(QUOTED_LITERAL, ''));
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* `date-fns` format options carrying the configured locale, or `undefined` when none is set
|
|
708
|
-
* (so `date-fns` falls back to its built-in `en-US`). Returning `undefined` rather than
|
|
709
|
-
* `{ locale: undefined }` satisfies `exactOptionalPropertyTypes`.
|
|
710
|
-
*/
|
|
711
|
-
const localeFormatOptions = (config) => config.dateFns ? { locale: config.dateFns } : undefined;
|
|
712
|
-
|
|
713
|
-
const DEFAULT_LOCALE_CONFIG = { hourCycle: 'locale' };
|
|
714
|
-
|
|
715
|
-
const LOCALE_CONFIG = new InjectionToken('LOCALE_CONFIG', {
|
|
716
|
-
factory: () => DEFAULT_LOCALE_CONFIG,
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
class QuerySyncDirective {
|
|
720
|
-
_router = inject(Router);
|
|
721
|
-
_route = inject(ActivatedRoute);
|
|
722
|
-
syncToUrl(param, value) {
|
|
723
|
-
void this._router.navigate([], {
|
|
724
|
-
relativeTo: this._route,
|
|
725
|
-
queryParams: { [param]: value },
|
|
726
|
-
queryParamsHandling: 'merge',
|
|
727
|
-
replaceUrl: true,
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
readParam(param) {
|
|
731
|
-
return this._route.snapshot.queryParamMap.get(param);
|
|
732
|
-
}
|
|
733
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
734
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: QuerySyncDirective, isStandalone: true, ngImport: i0 });
|
|
735
|
-
}
|
|
736
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, decorators: [{
|
|
737
|
-
type: Directive
|
|
738
|
-
}] });
|
|
739
|
-
|
|
740
|
-
/**
|
|
741
|
-
* Adds `id` to `element`'s `aria-describedby`, preserving any description the consumer already
|
|
742
|
-
* put there. The attribute is a token list, so an overlay describing an element joins that list
|
|
743
|
-
* rather than replacing it.
|
|
744
|
-
*/
|
|
745
|
-
const addDescribedBy = (renderer, element, id) => {
|
|
746
|
-
const existing = element.getAttribute('aria-describedby');
|
|
747
|
-
const tokens = existing ? existing.split(' ').filter(Boolean) : [];
|
|
748
|
-
if (tokens.includes(id))
|
|
749
|
-
return;
|
|
750
|
-
tokens.push(id);
|
|
751
|
-
renderer.setAttribute(element, 'aria-describedby', tokens.join(' '));
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
const DAYS_IN_WEEK = 7;
|
|
755
|
-
/**
|
|
756
|
-
* Every day shown in a month grid for the month containing `anchor`, starting at the
|
|
757
|
-
* first day of the first week (per `weekStartsOn`).
|
|
758
|
-
*
|
|
759
|
-
* With `weeks` omitted the span is the natural 5–6 weeks that cover the month. Passing a
|
|
760
|
-
* fixed `weeks` count returns exactly that many weeks, so the grid height never reflows
|
|
761
|
-
* between months.
|
|
762
|
-
*/
|
|
763
|
-
const buildMonthDays = (anchor, weekStartsOn, weeks) => {
|
|
764
|
-
const start = startOfWeek(startOfMonth(anchor), { weekStartsOn });
|
|
765
|
-
const end = weeks === undefined
|
|
766
|
-
? endOfWeek(endOfMonth(anchor), { weekStartsOn })
|
|
767
|
-
: addDays(start, weeks * DAYS_IN_WEEK - 1);
|
|
768
|
-
return eachDayOfInterval({ start, end });
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* Block-axis anchoring of an overlay placed beside its origin, read as an arrow alignment along
|
|
773
|
-
* that edge: an overlay pinned by its top edge grows downward, keeping the origin at its start.
|
|
320
|
+
* Block-axis anchoring of an overlay placed beside its origin, read as an arrow alignment along
|
|
321
|
+
* that edge: an overlay pinned by its top edge grows downward, keeping the origin at its start.
|
|
774
322
|
*/
|
|
775
323
|
const OVERLAY_ARROW_BLOCK_ALIGNMENT_MAP = {
|
|
776
324
|
top: 'start',
|
|
@@ -909,6 +457,9 @@ const OVERLAY_POSITION_MAP = {
|
|
|
909
457
|
},
|
|
910
458
|
};
|
|
911
459
|
|
|
460
|
+
/** Every step of the theme radius scale, used to tell a token apart from a raw CSS length. */
|
|
461
|
+
const RADIUS_TOKENS = ['sm', 'md', 'lg', 'xl', '2xl', '3xl'];
|
|
462
|
+
|
|
912
463
|
const buildOverlayPositions = (position, offset) => {
|
|
913
464
|
const preferred = OVERLAY_POSITION_MAP[position];
|
|
914
465
|
const rest = Object.values(OVERLAY_POSITION_MAP).filter(p => p !== preferred);
|
|
@@ -986,11 +537,785 @@ const resolveOverlayArrowPosition = (connectionPair) => {
|
|
|
986
537
|
return null;
|
|
987
538
|
};
|
|
988
539
|
|
|
989
|
-
/**
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
540
|
+
/**
|
|
541
|
+
* Resolves the shapes a `trackBy` input accepts into the function Angular's differs
|
|
542
|
+
* expect: a property key becomes a lookup of that property, an explicit function
|
|
543
|
+
* passes through, and an absent value falls back to tracking by item identity.
|
|
544
|
+
*/
|
|
545
|
+
const resolveTrackBy = (key) => {
|
|
546
|
+
if (key === undefined)
|
|
547
|
+
return (_, item) => item;
|
|
548
|
+
if (typeof key === 'function')
|
|
549
|
+
return key;
|
|
550
|
+
return (_, item) => item[key];
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
/** Reorders Sunday-first weekday labels so the one for `weekStartsOn` comes first. */
|
|
554
|
+
const rotateWeekDays = (weekDays, weekStartsOn) => [
|
|
555
|
+
...weekDays.slice(weekStartsOn),
|
|
556
|
+
...weekDays.slice(0, weekStartsOn),
|
|
557
|
+
];
|
|
558
|
+
|
|
559
|
+
const DEFAULT_VIRTUAL_SCROLL_CONFIG = {
|
|
560
|
+
itemSize: 48,
|
|
561
|
+
minBufferPx: 200,
|
|
562
|
+
maxBufferPx: 400,
|
|
563
|
+
orientation: 'vertical',
|
|
564
|
+
appendOnly: false,
|
|
565
|
+
templateCacheSize: 20,
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
const VIRTUAL_SCROLL_CONFIG = new InjectionToken('VIRTUAL_SCROLL_CONFIG', { factory: () => DEFAULT_VIRTUAL_SCROLL_CONFIG });
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Scroll container that renders only the items intersecting the visible window plus a
|
|
572
|
+
* buffer, keeping the DOM a constant size however long the collection is. Every item
|
|
573
|
+
* occupies the same fixed extent along the scroll axis, declared by `itemSize`.
|
|
574
|
+
*
|
|
575
|
+
* The collection arrives as the `items` input and each item is rendered through a
|
|
576
|
+
* template projected under the `#item` reference:
|
|
577
|
+
*
|
|
578
|
+
* ```html
|
|
579
|
+
* <tls-virtual-scroll [items]="rows()" [itemSize]="48" trackBy="id">
|
|
580
|
+
* <ng-template #item let-row let-index="index" let-count="count">
|
|
581
|
+
* <div class="row" role="listitem" [attr.aria-posinset]="index + 1" [attr.aria-setsize]="count">
|
|
582
|
+
* {{ row.name }}
|
|
583
|
+
* </div>
|
|
584
|
+
* </ng-template>
|
|
585
|
+
* </tls-virtual-scroll>
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* ```scss
|
|
589
|
+
* .row {
|
|
590
|
+
* box-sizing: border-box;
|
|
591
|
+
* height: var(--tls-virtual-scroll-item-size);
|
|
592
|
+
* }
|
|
593
|
+
* ```
|
|
594
|
+
*
|
|
595
|
+
* Because most items are absent from the DOM, assistive technology can no longer
|
|
596
|
+
* derive the collection's size or an item's position from the markup. The template
|
|
597
|
+
* context exposes the true `index` and `count` for exactly this reason; an item
|
|
598
|
+
* carrying a role that belongs to a set should reflect them through `aria-posinset`
|
|
599
|
+
* and `aria-setsize`.
|
|
600
|
+
*
|
|
601
|
+
* Windowing needs a bounded scroll container, so the host must have a resolved extent
|
|
602
|
+
* along the scroll axis — it defaults to filling its parent, which therefore needs a
|
|
603
|
+
* height of its own.
|
|
604
|
+
*
|
|
605
|
+
* The scroll axis follows `orientation`. When it is `horizontal` the roles of the two
|
|
606
|
+
* axes swap: `itemSize` is an item's *width*, so the item template constrains
|
|
607
|
+
* `width: var(--tls-virtual-scroll-item-size)` instead of `height` — and the cross-axis
|
|
608
|
+
* height still has to be resolved, because the absolutely-positioned items cannot
|
|
609
|
+
* drive it.
|
|
610
|
+
*/
|
|
611
|
+
class VirtualScroll {
|
|
612
|
+
// Injections
|
|
613
|
+
_config = inject(VIRTUAL_SCROLL_CONFIG);
|
|
614
|
+
// Inputs
|
|
615
|
+
items = input.required(/* @ts-ignore */
|
|
616
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
617
|
+
/**
|
|
618
|
+
* Extent of a single item along the scroll axis, in pixels. Every offset the container
|
|
619
|
+
* computes assumes it, so an item that renders to a different size drifts out of
|
|
620
|
+
* place. Nothing constrains the item template, so its own styles have to honour the
|
|
621
|
+
* value; it is published on the scroll container as the `--tls-virtual-scroll-item-size`
|
|
622
|
+
* custom property, which an item can read (`height: var(--tls-virtual-scroll-item-size)`)
|
|
623
|
+
* instead of repeating the number.
|
|
624
|
+
*/
|
|
625
|
+
itemSize = input(this._config.itemSize, { ...(ngDevMode ? { debugName: "itemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
626
|
+
/**
|
|
627
|
+
* Buffer kept rendered beyond the visible window, in pixels. When the rendered
|
|
628
|
+
* buffer falls below this minimum, items are rendered up to `maxBufferPx` — which
|
|
629
|
+
* must therefore be at least this value, or the scroll strategy throws. Raising
|
|
630
|
+
* only one of the pair past the other's default breaks that invariant.
|
|
631
|
+
*/
|
|
632
|
+
minBufferPx = input(this._config.minBufferPx, { ...(ngDevMode ? { debugName: "minBufferPx" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
633
|
+
/** Buffer rendered when `minBufferPx` is crossed, in pixels. Must be at least `minBufferPx`. */
|
|
634
|
+
maxBufferPx = input(this._config.maxBufferPx, { ...(ngDevMode ? { debugName: "maxBufferPx" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
635
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
636
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
637
|
+
appendOnly = input(this._config.appendOnly, { ...(ngDevMode ? { debugName: "appendOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
638
|
+
templateCacheSize = input(this._config.templateCacheSize, { ...(ngDevMode ? { debugName: "templateCacheSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
639
|
+
/** Identity of an item, so a changed collection reuses views instead of rebuilding them. */
|
|
640
|
+
trackBy = input(undefined, /* @ts-ignore */
|
|
641
|
+
...(ngDevMode ? [{ debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
642
|
+
/**
|
|
643
|
+
* Role applied to the scroll container rather than the host, so that the items —
|
|
644
|
+
* which the container owns — are described relative to it. Left unset the container
|
|
645
|
+
* carries no role and the items keep whatever semantics their template gives them.
|
|
646
|
+
*/
|
|
647
|
+
viewportRole = input(undefined, /* @ts-ignore */
|
|
648
|
+
...(ngDevMode ? [{ debugName: "viewportRole" }] : /* istanbul ignore next */ []));
|
|
649
|
+
/**
|
|
650
|
+
* Id applied to the scroll container rather than the host, for the same reason as
|
|
651
|
+
* `viewportRole`: a reference to the collection (`aria-controls`, `aria-owns`) has to
|
|
652
|
+
* resolve to the element that owns the items. Deliberately not named `id` — a static
|
|
653
|
+
* `id` attribute would land on the host and the container at once, duplicating the id.
|
|
654
|
+
*/
|
|
655
|
+
viewportId = input(undefined, /* @ts-ignore */
|
|
656
|
+
...(ngDevMode ? [{ debugName: "viewportId" }] : /* istanbul ignore next */ []));
|
|
657
|
+
/**
|
|
658
|
+
* Reflected as `aria-multiselectable` on the scroll container, meaningful when
|
|
659
|
+
* `viewportRole` names a role that supports it (a listbox holding a multiple
|
|
660
|
+
* selection).
|
|
661
|
+
*/
|
|
662
|
+
ariaMultiselectable = input(undefined, /* @ts-ignore */
|
|
663
|
+
...(ngDevMode ? [{ debugName: "ariaMultiselectable" }] : /* istanbul ignore next */ []));
|
|
664
|
+
/**
|
|
665
|
+
* Whether the scroll container is a tab stop. A region that scrolls has to be
|
|
666
|
+
* operable from the keyboard, so it is one by default. Turn it off only when the
|
|
667
|
+
* region already offers that operability another way — items that are themselves
|
|
668
|
+
* focusable, or a widget that drives the container through `scrollToIndex` from a
|
|
669
|
+
* control elsewhere — since a redundant tab stop is its own obstacle.
|
|
670
|
+
*
|
|
671
|
+
* A tab stop should announce what it is: pair it with `viewportRole` and an
|
|
672
|
+
* accessible name (`ariaLabel` / `ariaLabelledby`) so focus does not land on an
|
|
673
|
+
* anonymous container.
|
|
674
|
+
*/
|
|
675
|
+
focusable = input(true, { ...(ngDevMode ? { debugName: "focusable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
676
|
+
/** Accessible name for the scroll container. */
|
|
677
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
678
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
679
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
680
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
681
|
+
ariaDescribedby = input(undefined, /* @ts-ignore */
|
|
682
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
683
|
+
// Outputs
|
|
684
|
+
/** Index of the first item currently rendered, emitted as the window moves. */
|
|
685
|
+
scrolledIndexChange = output();
|
|
686
|
+
// State
|
|
687
|
+
_viewport = viewChild.required(CdkVirtualScrollViewport);
|
|
688
|
+
/**
|
|
689
|
+
* Template rendering a single item, projected as `<ng-template #item>`. It receives
|
|
690
|
+
* the item as `$implicit` alongside the positional context described on the class.
|
|
691
|
+
*/
|
|
692
|
+
itemTemplate = contentChild.required('item');
|
|
693
|
+
// Computed
|
|
694
|
+
resolvedTrackBy = computed(() => resolveTrackBy(this.trackBy()), /* @ts-ignore */
|
|
695
|
+
...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : /* istanbul ignore next */ []));
|
|
696
|
+
// Public methods
|
|
697
|
+
/** Scrolls the item at `index` to the leading edge of the container. */
|
|
698
|
+
scrollToIndex(index, behavior) {
|
|
699
|
+
this._viewport().scrollToIndex(index, behavior);
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Scrolls the least amount that brings the item at `index` fully into view: an item
|
|
703
|
+
* beyond the trailing edge lands on that edge, one before the leading edge lands on
|
|
704
|
+
* it, and an item already fully visible does not move — the behavior of
|
|
705
|
+
* `scrollIntoView({ block: 'nearest' })`, which `scrollToIndex` (always pinning to
|
|
706
|
+
* the leading edge) does not provide.
|
|
707
|
+
*/
|
|
708
|
+
scrollIndexIntoView(index, behavior) {
|
|
709
|
+
const viewport = this._viewport();
|
|
710
|
+
const itemSize = this.itemSize();
|
|
711
|
+
const itemStart = index * itemSize;
|
|
712
|
+
// `start`/`end` name the inline axis (flipping with the layout direction), so the
|
|
713
|
+
// block axis of a vertical container has to be addressed as `top`.
|
|
714
|
+
const horizontal = this.orientation() === 'horizontal';
|
|
715
|
+
const scrollOffset = viewport.measureScrollOffset(horizontal ? 'start' : 'top');
|
|
716
|
+
const viewportSize = viewport.getViewportSize();
|
|
717
|
+
let target;
|
|
718
|
+
if (itemStart < scrollOffset) {
|
|
719
|
+
target = itemStart;
|
|
720
|
+
}
|
|
721
|
+
else if (itemStart + itemSize > scrollOffset + viewportSize) {
|
|
722
|
+
target = itemStart + itemSize - viewportSize;
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const options = horizontal ? { start: target } : { top: target };
|
|
728
|
+
if (behavior !== undefined)
|
|
729
|
+
options.behavior = behavior;
|
|
730
|
+
viewport.scrollTo(options);
|
|
731
|
+
}
|
|
732
|
+
/** Scrolls to an offset given from any edge of the container. */
|
|
733
|
+
scrollTo(options) {
|
|
734
|
+
this._viewport().scrollTo(options);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Re-measures the container. Its size is measured when it is created and whenever the
|
|
738
|
+
* window resizes, so a container revealed inside a panel or a collapsed parent — sized
|
|
739
|
+
* only after that measurement — has to ask for a fresh one.
|
|
740
|
+
*/
|
|
741
|
+
checkViewportSize() {
|
|
742
|
+
this._viewport().checkViewportSize();
|
|
743
|
+
}
|
|
744
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
745
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: VirtualScroll, isStandalone: true, selector: "tls-virtual-scroll", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, minBufferPx: { classPropertyName: "minBufferPx", publicName: "minBufferPx", isSignal: true, isRequired: false, transformFunction: null }, maxBufferPx: { classPropertyName: "maxBufferPx", publicName: "maxBufferPx", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, appendOnly: { classPropertyName: "appendOnly", publicName: "appendOnly", isSignal: true, isRequired: false, transformFunction: null }, templateCacheSize: { classPropertyName: "templateCacheSize", publicName: "templateCacheSize", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, viewportRole: { classPropertyName: "viewportRole", publicName: "viewportRole", isSignal: true, isRequired: false, transformFunction: null }, viewportId: { classPropertyName: "viewportId", publicName: "viewportId", isSignal: true, isRequired: false, transformFunction: null }, ariaMultiselectable: { classPropertyName: "ariaMultiselectable", publicName: "ariaMultiselectable", isSignal: true, isRequired: false, transformFunction: null }, focusable: { classPropertyName: "focusable", publicName: "focusable", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { scrolledIndexChange: "scrolledIndexChange" }, host: { classAttribute: "tls-virtual-scroll" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: "<cdk-virtual-scroll-viewport\n class=\"tls-virtual-scroll__viewport\"\n [style.--tls-virtual-scroll-item-size.px]=\"itemSize()\"\n [itemSize]=\"itemSize()\"\n [minBufferPx]=\"minBufferPx()\"\n [maxBufferPx]=\"maxBufferPx()\"\n [orientation]=\"orientation()\"\n [appendOnly]=\"appendOnly()\"\n [attr.tabindex]=\"focusable() ? 0 : null\"\n [attr.role]=\"viewportRole() ?? null\"\n [attr.id]=\"viewportId() ?? null\"\n [attr.aria-multiselectable]=\"ariaMultiselectable() ?? null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-describedby]=\"ariaDescribedby() ?? null\"\n (scrolledIndexChange)=\"scrolledIndexChange.emit($event)\"\n>\n <ng-container\n *cdkVirtualFor=\"\n let item of items();\n template: itemTemplate();\n trackBy: resolvedTrackBy();\n templateCacheSize: templateCacheSize()\n \"\n />\n</cdk-virtual-scroll-viewport>\n", styles: [":host{--tls-virtual-scroll-height: 100%;height:var(--tls-virtual-scroll-height);display:block}:host .tls-virtual-scroll__viewport{width:100%;height:100%}\n"], dependencies: [{ kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }] });
|
|
746
|
+
}
|
|
747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VirtualScroll, decorators: [{
|
|
748
|
+
type: Component,
|
|
749
|
+
args: [{ selector: 'tls-virtual-scroll', imports: [CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf], host: {
|
|
750
|
+
class: 'tls-virtual-scroll',
|
|
751
|
+
}, template: "<cdk-virtual-scroll-viewport\n class=\"tls-virtual-scroll__viewport\"\n [style.--tls-virtual-scroll-item-size.px]=\"itemSize()\"\n [itemSize]=\"itemSize()\"\n [minBufferPx]=\"minBufferPx()\"\n [maxBufferPx]=\"maxBufferPx()\"\n [orientation]=\"orientation()\"\n [appendOnly]=\"appendOnly()\"\n [attr.tabindex]=\"focusable() ? 0 : null\"\n [attr.role]=\"viewportRole() ?? null\"\n [attr.id]=\"viewportId() ?? null\"\n [attr.aria-multiselectable]=\"ariaMultiselectable() ?? null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-describedby]=\"ariaDescribedby() ?? null\"\n (scrolledIndexChange)=\"scrolledIndexChange.emit($event)\"\n>\n <ng-container\n *cdkVirtualFor=\"\n let item of items();\n template: itemTemplate();\n trackBy: resolvedTrackBy();\n templateCacheSize: templateCacheSize()\n \"\n />\n</cdk-virtual-scroll-viewport>\n", styles: [":host{--tls-virtual-scroll-height: 100%;height:var(--tls-virtual-scroll-height);display:block}:host .tls-virtual-scroll__viewport{width:100%;height:100%}\n"] }]
|
|
752
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], itemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemSize", required: false }] }], minBufferPx: [{ type: i0.Input, args: [{ isSignal: true, alias: "minBufferPx", required: false }] }], maxBufferPx: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxBufferPx", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], appendOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendOnly", required: false }] }], templateCacheSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateCacheSize", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], viewportRole: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportRole", required: false }] }], viewportId: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportId", required: false }] }], ariaMultiselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaMultiselectable", required: false }] }], focusable: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusable", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], scrolledIndexChange: [{ type: i0.Output, args: ["scrolledIndexChange"] }], _viewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['item', { isSignal: true }] }] } });
|
|
753
|
+
|
|
754
|
+
// Upper bound for how long to keep a closing surface alive so its exit
|
|
755
|
+
// (`--leave`) animation can finish before disposal. The `animationend` listener
|
|
756
|
+
// settles early; this fallback covers the case where the event never arrives.
|
|
757
|
+
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Invokes `onDone` once the element's own exit animation has finished, so a
|
|
761
|
+
* closing surface is not torn down while its `--leave` animation is still
|
|
762
|
+
* playing. Fires immediately when no animation runs (e.g. the `none` motion
|
|
763
|
+
* level, where the motion mixin emits nothing) so reduced-motion users don't
|
|
764
|
+
* wait out the fallback timeout.
|
|
765
|
+
*
|
|
766
|
+
* Shared by every container that swaps an `--enter` class for `--leave` and
|
|
767
|
+
* defers disposal until the exit finishes (drawer, dialog).
|
|
768
|
+
*/
|
|
769
|
+
function afterLeaveAnimation(element, onDone) {
|
|
770
|
+
let settled = false;
|
|
771
|
+
const finalize = () => {
|
|
772
|
+
if (settled)
|
|
773
|
+
return;
|
|
774
|
+
settled = true;
|
|
775
|
+
window.clearTimeout(timeoutId);
|
|
776
|
+
element.removeEventListener('animationend', onAnimationEnd);
|
|
777
|
+
onDone();
|
|
778
|
+
};
|
|
779
|
+
// Only the element's own exit animation finalizes; ignore `animationend`
|
|
780
|
+
// bubbling up from animated content inside it.
|
|
781
|
+
const onAnimationEnd = (event) => {
|
|
782
|
+
if (event.target === element)
|
|
783
|
+
finalize();
|
|
784
|
+
};
|
|
785
|
+
element.addEventListener('animationend', onAnimationEnd);
|
|
786
|
+
// Safety net if `animationend` never arrives (e.g. the element is torn down early).
|
|
787
|
+
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
788
|
+
// The `--leave` class applies on the next change detection; on the following
|
|
789
|
+
// frame, finalize at once if no animation is running. When motion is enabled
|
|
790
|
+
// the computed `animationName` is never `none`, so this cannot finalize early.
|
|
791
|
+
requestAnimationFrame(() => {
|
|
792
|
+
if (getComputedStyle(element).animationName === 'none')
|
|
793
|
+
finalize();
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Disposes a detached overlay once the panel's exit animation has finished, so
|
|
799
|
+
* the pane is not torn down while `animate.leave` is still playing. Falls back
|
|
800
|
+
* to a timeout when no animation runs (e.g. the `none` motion level).
|
|
801
|
+
*
|
|
802
|
+
* Shared by every surface that detaches a pane to let the exit animation play
|
|
803
|
+
* (connected overlays, confirm, tooltip).
|
|
804
|
+
*/
|
|
805
|
+
function disposeAfterLeaveAnimation(overlayRef) {
|
|
806
|
+
const paneElement = overlayRef.overlayElement;
|
|
807
|
+
if (!paneElement) {
|
|
808
|
+
overlayRef.dispose();
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
let settled = false;
|
|
812
|
+
const finalize = () => {
|
|
813
|
+
if (settled)
|
|
814
|
+
return;
|
|
815
|
+
settled = true;
|
|
816
|
+
window.clearTimeout(timeoutId);
|
|
817
|
+
paneElement.removeEventListener('animationend', finalize);
|
|
818
|
+
overlayRef.dispose();
|
|
819
|
+
};
|
|
820
|
+
paneElement.addEventListener('animationend', finalize);
|
|
821
|
+
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
|
|
825
|
+
/**
|
|
826
|
+
* Owns the CDK-Overlay lifecycle shared by the library's connected overlay
|
|
827
|
+
* components (popover, menu, select): create/attach, dismissal wiring
|
|
828
|
+
* (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
|
|
829
|
+
* positional and dismissal differences between components are expressed through
|
|
830
|
+
* {@link ConnectedOverlayConfig} rather than duplicated per component.
|
|
831
|
+
*
|
|
832
|
+
* Create one via {@link createOverlayManager} from a component field initializer
|
|
833
|
+
* so it is bound to the host's injection context.
|
|
834
|
+
*/
|
|
835
|
+
class OverlayManager {
|
|
836
|
+
_overlay = inject(Overlay);
|
|
837
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
838
|
+
_destroyRef = inject(DestroyRef);
|
|
839
|
+
_overlayRef = null;
|
|
840
|
+
_config = null;
|
|
841
|
+
_isOpen = signal(false, /* @ts-ignore */
|
|
842
|
+
...(ngDevMode ? [{ debugName: "_isOpen" }] : /* istanbul ignore next */ []));
|
|
843
|
+
// Armed by `ignoreTrailingAuxClick` on open: swallow the first outside
|
|
844
|
+
// `auxclick` so the right-click gesture that opened a context menu doesn't
|
|
845
|
+
// immediately dismiss it. Consumed one-shot (not on a timer) because the user
|
|
846
|
+
// may hold the button arbitrarily long before releasing — the `auxclick`
|
|
847
|
+
// fires on release — so the guard must survive until that first `auxclick`
|
|
848
|
+
// actually arrives. Later outside pointers still dismiss.
|
|
849
|
+
_ignoreTrailingAuxClick = false;
|
|
850
|
+
isOpen = this._isOpen.asReadonly();
|
|
851
|
+
// Dispose the overlay with the host. Registered in a field initializer so no
|
|
852
|
+
// constructor is needed.
|
|
853
|
+
_teardown = this._destroyRef.onDestroy(() => this._dispose());
|
|
854
|
+
open(config) {
|
|
855
|
+
if (this._isOpen())
|
|
856
|
+
return;
|
|
857
|
+
this._config = config;
|
|
858
|
+
if (!this._overlayRef) {
|
|
859
|
+
this._overlayRef = this._overlay.create({
|
|
860
|
+
positionStrategy: this._buildPositionStrategy(config),
|
|
861
|
+
scrollStrategy: config.scrollStrategy === 'close'
|
|
862
|
+
? this._overlay.scrollStrategies.close()
|
|
863
|
+
: this._overlay.scrollStrategies.reposition(),
|
|
864
|
+
hasBackdrop: config.hasBackdrop ?? true,
|
|
865
|
+
backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
|
|
866
|
+
...(config.panelClass != null && { panelClass: config.panelClass }),
|
|
867
|
+
});
|
|
868
|
+
this._wireDismissal(this._overlayRef, config);
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
// Reused ref (`reuse: true`): re-apply the position strategy so a new
|
|
872
|
+
// origin/point takes effect instead of reopening at the previous spot.
|
|
873
|
+
this._overlayRef.updatePositionStrategy(this._buildPositionStrategy(config));
|
|
874
|
+
}
|
|
875
|
+
if (config.minWidth != null) {
|
|
876
|
+
this._overlayRef.updateSize({ minWidth: config.minWidth });
|
|
877
|
+
}
|
|
878
|
+
this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
|
|
879
|
+
this._isOpen.set(true);
|
|
880
|
+
this._ignoreTrailingAuxClick = Boolean(config.ignoreTrailingAuxClick);
|
|
881
|
+
}
|
|
882
|
+
close() {
|
|
883
|
+
if (!this._isOpen())
|
|
884
|
+
return;
|
|
885
|
+
this._isOpen.set(false);
|
|
886
|
+
this._ignoreTrailingAuxClick = false;
|
|
887
|
+
const overlayRef = this._overlayRef;
|
|
888
|
+
const config = this._config;
|
|
889
|
+
if (overlayRef) {
|
|
890
|
+
// Detach (not dispose) so the pane survives while Angular's `animate.leave`
|
|
891
|
+
// plays the panel's exit animation. A reused overlay keeps its ref for the
|
|
892
|
+
// next open; a one-off overlay is disposed once the animation has finished,
|
|
893
|
+
// so the pane is never torn down mid-animation.
|
|
894
|
+
overlayRef.detach();
|
|
895
|
+
const reuse = Boolean(config && config.reuse);
|
|
896
|
+
if (!reuse) {
|
|
897
|
+
this._overlayRef = null;
|
|
898
|
+
disposeAfterLeaveAnimation(overlayRef);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (config && config.onClose)
|
|
902
|
+
config.onClose();
|
|
903
|
+
}
|
|
904
|
+
// Private
|
|
905
|
+
_buildPositionStrategy(config) {
|
|
906
|
+
let strategy = this._overlay
|
|
907
|
+
.position()
|
|
908
|
+
.flexibleConnectedTo(config.origin)
|
|
909
|
+
.withPositions(config.positions);
|
|
910
|
+
if (config.flexibleDimensions === false)
|
|
911
|
+
strategy = strategy.withFlexibleDimensions(false);
|
|
912
|
+
if (config.push === false)
|
|
913
|
+
strategy = strategy.withPush(false);
|
|
914
|
+
return strategy;
|
|
915
|
+
}
|
|
916
|
+
_wireDismissal(overlayRef, config) {
|
|
917
|
+
const hasBackdrop = config.hasBackdrop ?? true;
|
|
918
|
+
if (config.closeOnBackdropClick ?? hasBackdrop) {
|
|
919
|
+
overlayRef
|
|
920
|
+
.backdropClick()
|
|
921
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
922
|
+
.subscribe(() => this.close());
|
|
923
|
+
}
|
|
924
|
+
if (config.closeOnOutsidePointer ?? !hasBackdrop) {
|
|
925
|
+
overlayRef
|
|
926
|
+
.outsidePointerEvents()
|
|
927
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'), filter(event => {
|
|
928
|
+
// Swallow exactly the first outside `auxclick` after an armed open —
|
|
929
|
+
// the release of the right-click that opened a context menu — then
|
|
930
|
+
// let every later outside pointer dismiss as usual.
|
|
931
|
+
if (this._ignoreTrailingAuxClick && event.type === 'auxclick') {
|
|
932
|
+
this._ignoreTrailingAuxClick = false;
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
return true;
|
|
936
|
+
}))
|
|
937
|
+
.subscribe(() => this.close());
|
|
938
|
+
}
|
|
939
|
+
if (config.closeOnEscape ?? true) {
|
|
940
|
+
overlayRef
|
|
941
|
+
.keydownEvents()
|
|
942
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
|
|
943
|
+
.subscribe(() => this.close());
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
_dispose() {
|
|
947
|
+
this._overlayRef?.dispose();
|
|
948
|
+
this._overlayRef = null;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Creates an {@link OverlayManager} bound to the current injection context.
|
|
953
|
+
* Call from a component/directive field initializer or constructor.
|
|
954
|
+
*/
|
|
955
|
+
function createOverlayManager() {
|
|
956
|
+
return new OverlayManager();
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Shared base for the single {@link Select} and {@link MultiSelect} controls.
|
|
961
|
+
* Owns everything the two listbox-combobox controls have in common: the option
|
|
962
|
+
* inputs, the connected overlay lifecycle, roving `aria-activedescendant`
|
|
963
|
+
* navigation, and the keyboard handler. The per-control differences (the value
|
|
964
|
+
* shape, the selected-state check, how the trigger label is built and what a
|
|
965
|
+
* commit does) are expressed through the abstract members below.
|
|
966
|
+
*/
|
|
967
|
+
class AbstractSelect extends ValueFormControl {
|
|
968
|
+
overlay = createOverlayManager();
|
|
969
|
+
_document = inject(DOCUMENT);
|
|
970
|
+
triggerElement = viewChild('trigger', /* @ts-ignore */
|
|
971
|
+
...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
|
|
972
|
+
panelTemplate = viewChild('panel', /* @ts-ignore */
|
|
973
|
+
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
974
|
+
virtualScrollRef = viewChild(VirtualScroll, /* @ts-ignore */
|
|
975
|
+
...(ngDevMode ? [{ debugName: "virtualScrollRef" }] : /* istanbul ignore next */ []));
|
|
976
|
+
/**
|
|
977
|
+
* Whether the panel has already been rendered open, distinguishing the render that
|
|
978
|
+
* opens it from the ones that follow while it stays open.
|
|
979
|
+
*/
|
|
980
|
+
_panelWasOpen = false;
|
|
981
|
+
/**
|
|
982
|
+
* Keeps the active option visible inside the scrolling panel. Focus stays on the
|
|
983
|
+
* trigger and only `aria-activedescendant` moves, so the browser never scrolls the
|
|
984
|
+
* option list on its own — every write of `activeIndex` (keyboard navigation, the
|
|
985
|
+
* initial index on open, a filter narrowing the list) has to be followed by an
|
|
986
|
+
* explicit scroll. Running after render guarantees the option's element exists even
|
|
987
|
+
* when the same change re-rendered the list. `nearest` leaves an already-visible
|
|
988
|
+
* option where it is, so pointer-driven activation never causes a scroll.
|
|
989
|
+
*/
|
|
990
|
+
_scrollActiveOptionIntoView = afterRenderEffect(() => {
|
|
991
|
+
const isOpen = this.isOpen();
|
|
992
|
+
const wasOpen = this._panelWasOpen;
|
|
993
|
+
this._panelWasOpen = isOpen;
|
|
994
|
+
if (!isOpen)
|
|
995
|
+
return;
|
|
996
|
+
const virtualScroll = this.virtualScrollRef();
|
|
997
|
+
// The overlay pane is attached (and re-attached — it is reused across opens)
|
|
998
|
+
// after the panel's view is created, so the viewport's cached measurement is
|
|
999
|
+
// stale until it is re-measured in the first render of an open panel.
|
|
1000
|
+
if (virtualScroll && !wasOpen)
|
|
1001
|
+
virtualScroll.checkViewportSize();
|
|
1002
|
+
const index = this.activeIndex();
|
|
1003
|
+
if (index < 0)
|
|
1004
|
+
return;
|
|
1005
|
+
// The option elements are re-created when the visible list changes, so the scroll
|
|
1006
|
+
// has to re-run then too, not only when the index moves.
|
|
1007
|
+
this.visibleOptions();
|
|
1008
|
+
if (virtualScroll) {
|
|
1009
|
+
// `aria-activedescendant` may only reference a rendered element; scrolling the
|
|
1010
|
+
// index into view keeps it inside the rendered window, and the viewport's render
|
|
1011
|
+
// buffers cover the moment between the index moving and the window following.
|
|
1012
|
+
virtualScroll.scrollIndexIntoView(index);
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const option = this._document.getElementById(this.optionId(index));
|
|
1016
|
+
if (option)
|
|
1017
|
+
option.scrollIntoView({ block: 'nearest' });
|
|
1018
|
+
});
|
|
1019
|
+
/**
|
|
1020
|
+
* Consumer template rendered inside each option button in place of the plain
|
|
1021
|
+
* label (`<ng-template #option let-context>`). The button itself — and with it
|
|
1022
|
+
* the option's ARIA, activation, and hover behavior — stays owned by the
|
|
1023
|
+
* control; the template only customizes the visual content.
|
|
1024
|
+
*/
|
|
1025
|
+
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
1026
|
+
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
1027
|
+
// Shared inputs (config-independent)
|
|
1028
|
+
options = input([], /* @ts-ignore */
|
|
1029
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1030
|
+
optionLabel = input(undefined, /* @ts-ignore */
|
|
1031
|
+
...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
1032
|
+
optionValue = input(undefined, /* @ts-ignore */
|
|
1033
|
+
...(ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
1034
|
+
optionDisabled = input(undefined, /* @ts-ignore */
|
|
1035
|
+
...(ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
|
|
1036
|
+
tabindex = input(0, /* @ts-ignore */
|
|
1037
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
1038
|
+
isOpen = this.overlay.isOpen;
|
|
1039
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
1040
|
+
label: this.optionLabel(),
|
|
1041
|
+
value: this.optionValue(),
|
|
1042
|
+
disabled: this.optionDisabled(),
|
|
1043
|
+
}), /* @ts-ignore */
|
|
1044
|
+
...(ngDevMode ? [{ debugName: "normalizedOptions" }] : /* istanbul ignore next */ []));
|
|
1045
|
+
/**
|
|
1046
|
+
* Options actually shown in the panel and traversed by keyboard navigation. Defaults to the full
|
|
1047
|
+
* normalized list; a filtering control (an editable combobox) narrows it via
|
|
1048
|
+
* {@link filterVisibleOptions}. `activeIndex` always indexes into this list, never the raw one.
|
|
1049
|
+
*/
|
|
1050
|
+
visibleOptions = computed(() => this.filterVisibleOptions(this.normalizedOptions()), /* @ts-ignore */
|
|
1051
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
1052
|
+
/**
|
|
1053
|
+
* Index of the option keyboard navigation rests on, within `visibleOptions`; −1
|
|
1054
|
+
* means none. When the visible list changes under it (the options swapped while the
|
|
1055
|
+
* panel is open), an index that fell out of range snaps to the last enabled option,
|
|
1056
|
+
* so `aria-activedescendant` never references an element that no longer exists.
|
|
1057
|
+
*/
|
|
1058
|
+
activeIndex = linkedSignal({ ...(ngDevMode ? { debugName: "activeIndex" } : /* istanbul ignore next */ {}), source: this.visibleOptions,
|
|
1059
|
+
computation: (options, previous) => {
|
|
1060
|
+
if (previous === undefined)
|
|
1061
|
+
return -1;
|
|
1062
|
+
if (previous.value < options.length)
|
|
1063
|
+
return previous.value;
|
|
1064
|
+
for (let index = options.length - 1; index >= 0; index--) {
|
|
1065
|
+
if (!options[index].disabled)
|
|
1066
|
+
return index;
|
|
1067
|
+
}
|
|
1068
|
+
return -1;
|
|
1069
|
+
} });
|
|
1070
|
+
activeDescendantId = computed(() => {
|
|
1071
|
+
const index = this.activeIndex();
|
|
1072
|
+
if (index < 0)
|
|
1073
|
+
return null;
|
|
1074
|
+
return this.optionId(index);
|
|
1075
|
+
}, /* @ts-ignore */
|
|
1076
|
+
...(ngDevMode ? [{ debugName: "activeDescendantId" }] : /* istanbul ignore next */ []));
|
|
1077
|
+
/**
|
|
1078
|
+
* Height of the virtualized option viewport: sized to the options, capped so the
|
|
1079
|
+
* panel — viewport plus its block padding — never exceeds the panel's max-height.
|
|
1080
|
+
* A short list therefore produces a short panel instead of an empty scroll area.
|
|
1081
|
+
* Bound to the viewport's `--tls-virtual-scroll-height` custom property.
|
|
1082
|
+
*/
|
|
1083
|
+
virtualPanelHeight = computed(() => {
|
|
1084
|
+
const prefix = this.panelCssVariablePrefix;
|
|
1085
|
+
const contentHeight = this.visibleOptions().length * this.virtualScrollItemSize();
|
|
1086
|
+
return `min(${contentHeight}px, calc(var(${prefix}-max-height) - 2 * var(${prefix}-padding-block)))`;
|
|
1087
|
+
}, /* @ts-ignore */
|
|
1088
|
+
...(ngDevMode ? [{ debugName: "virtualPanelHeight" }] : /* istanbul ignore next */ []));
|
|
1089
|
+
hostClasses = computed(() => {
|
|
1090
|
+
const array = [this.hostClassBase];
|
|
1091
|
+
if (this.isOpen())
|
|
1092
|
+
array.push(`${this.hostClassBase}--open`);
|
|
1093
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1094
|
+
if (this.fluid())
|
|
1095
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1096
|
+
return array.concat(this.controlClasses());
|
|
1097
|
+
}, /* @ts-ignore */
|
|
1098
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
1099
|
+
get listboxId() {
|
|
1100
|
+
return `${this.uniqueId}-listbox`;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Narrows the option list shown in the panel. The listbox controls show every option; an editable
|
|
1104
|
+
* combobox overrides this to filter by the typed query.
|
|
1105
|
+
*/
|
|
1106
|
+
filterVisibleOptions(options) {
|
|
1107
|
+
return options;
|
|
1108
|
+
}
|
|
1109
|
+
/** Hook invoked after the panel has closed, once the trigger has regained focus. */
|
|
1110
|
+
onClosed() {
|
|
1111
|
+
// No-op by default; an editable combobox overrides this to reconcile its text.
|
|
1112
|
+
}
|
|
1113
|
+
// Protected methods
|
|
1114
|
+
open() {
|
|
1115
|
+
const triggerElement = this.triggerElement();
|
|
1116
|
+
const panelTemplate = this.panelTemplate();
|
|
1117
|
+
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1118
|
+
return;
|
|
1119
|
+
this.overlay.open({
|
|
1120
|
+
content: panelTemplate,
|
|
1121
|
+
origin: triggerElement,
|
|
1122
|
+
positions: [
|
|
1123
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1124
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1125
|
+
],
|
|
1126
|
+
flexibleDimensions: false,
|
|
1127
|
+
push: false,
|
|
1128
|
+
panelClass: this.panelClass,
|
|
1129
|
+
// The control handles Escape itself via the trigger's keydown handler.
|
|
1130
|
+
closeOnEscape: false,
|
|
1131
|
+
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
1132
|
+
reuse: true,
|
|
1133
|
+
onClose: () => {
|
|
1134
|
+
this.activeIndex.set(-1);
|
|
1135
|
+
const trigger = this.triggerElement();
|
|
1136
|
+
if (trigger)
|
|
1137
|
+
trigger.nativeElement.focus();
|
|
1138
|
+
this.onClosed();
|
|
1139
|
+
},
|
|
1140
|
+
});
|
|
1141
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
1142
|
+
}
|
|
1143
|
+
close() {
|
|
1144
|
+
this.overlay.close();
|
|
1145
|
+
}
|
|
1146
|
+
toggle() {
|
|
1147
|
+
if (this.isOpen()) {
|
|
1148
|
+
this.close();
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
this.open();
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
onOptionHover(event, index, disabled) {
|
|
1155
|
+
// A touch "enter" is a tap in progress, not a hover; the click that follows
|
|
1156
|
+
// commits the option, so the active index has nothing to track.
|
|
1157
|
+
if (event.pointerType === 'touch')
|
|
1158
|
+
return;
|
|
1159
|
+
if (!disabled)
|
|
1160
|
+
this.activeIndex.set(index);
|
|
1161
|
+
}
|
|
1162
|
+
onKeydown(event) {
|
|
1163
|
+
if (event.key === 'ArrowDown') {
|
|
1164
|
+
event.preventDefault();
|
|
1165
|
+
if (this.isOpen()) {
|
|
1166
|
+
this.moveActive(1);
|
|
1167
|
+
}
|
|
1168
|
+
else {
|
|
1169
|
+
this.open();
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
else if (event.key === 'ArrowUp') {
|
|
1173
|
+
event.preventDefault();
|
|
1174
|
+
if (this.isOpen()) {
|
|
1175
|
+
this.moveActive(-1);
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
this.open();
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
else if (event.key === 'Enter' || event.key === ' ') {
|
|
1182
|
+
event.preventDefault();
|
|
1183
|
+
if (!this.isOpen()) {
|
|
1184
|
+
this.open();
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
const active = this.visibleOptions()[this.activeIndex()];
|
|
1188
|
+
if (active && !active.disabled)
|
|
1189
|
+
this.commitActiveOption(active);
|
|
1190
|
+
}
|
|
1191
|
+
else if (event.key === 'Home') {
|
|
1192
|
+
if (!this.isOpen())
|
|
1193
|
+
return;
|
|
1194
|
+
event.preventDefault();
|
|
1195
|
+
this.moveActiveToEdge(1);
|
|
1196
|
+
}
|
|
1197
|
+
else if (event.key === 'End') {
|
|
1198
|
+
if (!this.isOpen())
|
|
1199
|
+
return;
|
|
1200
|
+
event.preventDefault();
|
|
1201
|
+
this.moveActiveToEdge(-1);
|
|
1202
|
+
}
|
|
1203
|
+
else if (event.key === 'Escape') {
|
|
1204
|
+
event.preventDefault();
|
|
1205
|
+
if (this.isOpen())
|
|
1206
|
+
this.close();
|
|
1207
|
+
}
|
|
1208
|
+
else if (event.key === 'Tab') {
|
|
1209
|
+
if (this.isOpen())
|
|
1210
|
+
this.close();
|
|
1211
|
+
}
|
|
1212
|
+
else if ((event.key === 'Delete' || event.key === 'Backspace') &&
|
|
1213
|
+
this.clearable() &&
|
|
1214
|
+
this.hasValue()) {
|
|
1215
|
+
event.preventDefault();
|
|
1216
|
+
this.clear();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
optionId(index) {
|
|
1220
|
+
return `${this.uniqueId}-option-${index}`;
|
|
1221
|
+
}
|
|
1222
|
+
/** Context handed to the consumer's option template for the option at `index`. */
|
|
1223
|
+
optionContext(option, index) {
|
|
1224
|
+
return {
|
|
1225
|
+
$implicit: {
|
|
1226
|
+
option: option.source,
|
|
1227
|
+
value: option.value,
|
|
1228
|
+
label: option.label,
|
|
1229
|
+
index,
|
|
1230
|
+
selected: this.isOptionSelected(option),
|
|
1231
|
+
active: index === this.activeIndex(),
|
|
1232
|
+
disabled: option.disabled,
|
|
1233
|
+
},
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
moveActive(direction) {
|
|
1237
|
+
const options = this.visibleOptions();
|
|
1238
|
+
let next = this.activeIndex() + direction;
|
|
1239
|
+
while (next >= 0 && next < options.length) {
|
|
1240
|
+
if (!options[next].disabled) {
|
|
1241
|
+
this.activeIndex.set(next);
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
next += direction;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
// Private methods
|
|
1248
|
+
moveActiveToEdge(direction) {
|
|
1249
|
+
const options = this.visibleOptions();
|
|
1250
|
+
let next = direction === 1 ? 0 : options.length - 1;
|
|
1251
|
+
while (next >= 0 && next < options.length) {
|
|
1252
|
+
if (!options[next].disabled) {
|
|
1253
|
+
this.activeIndex.set(next);
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
next += direction;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1260
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.0.5", type: AbstractSelect, isStandalone: true, inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "virtualScrollRef", first: true, predicate: VirtualScroll, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0 });
|
|
1261
|
+
}
|
|
1262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, decorators: [{
|
|
1263
|
+
type: Directive
|
|
1264
|
+
}], propDecorators: { triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], virtualScrollRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => VirtualScroll), { isSignal: true }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1265
|
+
|
|
1266
|
+
// Form control base classes
|
|
1267
|
+
|
|
1268
|
+
/** Matches a quoted literal in a `date-fns` format pattern, e.g. the `'h'` in `"HH 'h' mm"`. */
|
|
1269
|
+
const QUOTED_LITERAL = /'[^']*'/g;
|
|
1270
|
+
/** Day-period tokens (`a`, `b`, `B`) — their presence marks a pattern as 12-hour. */
|
|
1271
|
+
const DAY_PERIOD_TOKEN = /[abB]/;
|
|
1272
|
+
/**
|
|
1273
|
+
* Whether times render on a 12-hour clock. A `'locale'` cycle probes the configured
|
|
1274
|
+
* `date-fns` locale's short time pattern for a day-period token; with no locale
|
|
1275
|
+
* configured `date-fns` formats as `en-US`, which is 12-hour.
|
|
1276
|
+
*/
|
|
1277
|
+
const isHour12 = (config) => {
|
|
1278
|
+
if (config.hourCycle !== 'locale')
|
|
1279
|
+
return config.hourCycle === 12;
|
|
1280
|
+
const locale = config.dateFns;
|
|
1281
|
+
if (!locale)
|
|
1282
|
+
return true;
|
|
1283
|
+
return DAY_PERIOD_TOKEN.test(locale.formatLong.time({ width: 'short' }).replace(QUOTED_LITERAL, ''));
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* `date-fns` format options carrying the configured locale, or `undefined` when none is set
|
|
1288
|
+
* (so `date-fns` falls back to its built-in `en-US`). Returning `undefined` rather than
|
|
1289
|
+
* `{ locale: undefined }` satisfies `exactOptionalPropertyTypes`.
|
|
1290
|
+
*/
|
|
1291
|
+
const localeFormatOptions = (config) => config.dateFns ? { locale: config.dateFns } : undefined;
|
|
1292
|
+
|
|
1293
|
+
const DEFAULT_LOCALE_CONFIG = { hourCycle: 'locale' };
|
|
1294
|
+
|
|
1295
|
+
const LOCALE_CONFIG = new InjectionToken('LOCALE_CONFIG', {
|
|
1296
|
+
factory: () => DEFAULT_LOCALE_CONFIG,
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
class QuerySyncDirective {
|
|
1300
|
+
_router = inject(Router);
|
|
1301
|
+
_route = inject(ActivatedRoute);
|
|
1302
|
+
syncToUrl(param, value) {
|
|
1303
|
+
void this._router.navigate([], {
|
|
1304
|
+
relativeTo: this._route,
|
|
1305
|
+
queryParams: { [param]: value },
|
|
1306
|
+
queryParamsHandling: 'merge',
|
|
1307
|
+
replaceUrl: true,
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
readParam(param) {
|
|
1311
|
+
return this._route.snapshot.queryParamMap.get(param);
|
|
1312
|
+
}
|
|
1313
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1314
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: QuerySyncDirective, isStandalone: true, ngImport: i0 });
|
|
1315
|
+
}
|
|
1316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, decorators: [{
|
|
1317
|
+
type: Directive
|
|
1318
|
+
}] });
|
|
994
1319
|
|
|
995
1320
|
/** Attribute a delegated tooltip reads its content from, and matches its items by. */
|
|
996
1321
|
const DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE = 'data-tooltip';
|
|
@@ -1969,6 +2294,10 @@ const DEFAULT_ICONS = {
|
|
|
1969
2294
|
'chevrons-left': svg('<polyline points="11 17 6 12 11 7" /><polyline points="18 17 13 12 18 7" />'),
|
|
1970
2295
|
'chevrons-right': svg('<polyline points="13 17 18 12 13 7" /><polyline points="6 17 11 12 6 7" />'),
|
|
1971
2296
|
close: svg('<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />'),
|
|
2297
|
+
star: svg('<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />'),
|
|
2298
|
+
// The same star, solid. Stroked like the outline version so the two glyphs
|
|
2299
|
+
// share an identical footprint and can be layered over one another.
|
|
2300
|
+
'star-filled': svg('<polygon fill="currentColor" points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />'),
|
|
1972
2301
|
success: svg('<circle cx="12" cy="12" r="10" /><polyline points="8 12 11 15 16 9" />'),
|
|
1973
2302
|
warning: svg('<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />' +
|
|
1974
2303
|
'<line x1="12" y1="9" x2="12" y2="13" /><line x1="12" y1="17" x2="12.01" y2="17" />'),
|
|
@@ -2477,6 +2806,12 @@ const DAYS_PER_WEEK = 7;
|
|
|
2477
2806
|
const MONTH_GRID_ROWS = 6;
|
|
2478
2807
|
/** Default cap on events shown in a month day cell before a "+N more" affordance appears. */
|
|
2479
2808
|
const DEFAULT_MAX_EVENTS_PER_DAY = 3;
|
|
2809
|
+
/**
|
|
2810
|
+
* Dots a day cell shows beneath its number in the dense month layout. Past this many the dots
|
|
2811
|
+
* stop conveying a count and only cost width, so further events go unmarked — the cell's
|
|
2812
|
+
* accessible summary still reports the true total.
|
|
2813
|
+
*/
|
|
2814
|
+
const MAX_DAY_MARKERS = 3;
|
|
2480
2815
|
/** `date-fns` format token for the month/week/day title in the header. */
|
|
2481
2816
|
const MONTH_TITLE_FORMAT = 'MMMM yyyy';
|
|
2482
2817
|
/** `date-fns` format token for a day-of-month number. */
|
|
@@ -2572,6 +2907,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
2572
2907
|
|
|
2573
2908
|
const DEFAULT_CALENDAR_CONFIG = {
|
|
2574
2909
|
view: 'month',
|
|
2910
|
+
views: CALENDAR_VIEW_ORDER,
|
|
2575
2911
|
weekStartsOn: 0,
|
|
2576
2912
|
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
2577
2913
|
hourStart: 0,
|
|
@@ -2585,6 +2921,7 @@ const DEFAULT_CALENDAR_CONFIG = {
|
|
|
2585
2921
|
allDay: 'All day',
|
|
2586
2922
|
noEvents: 'No events',
|
|
2587
2923
|
more: count => `+${count} more`,
|
|
2924
|
+
eventCount: count => (count === 1 ? '1 event' : `${count} events`),
|
|
2588
2925
|
views: {
|
|
2589
2926
|
month: 'Month',
|
|
2590
2927
|
week: 'Week',
|
|
@@ -2745,8 +3082,14 @@ class CalendarMonthView {
|
|
|
2745
3082
|
...(ngDevMode ? [{ debugName: "weekDays" }] : /* istanbul ignore next */ []));
|
|
2746
3083
|
maxEventsPerDay = input.required(/* @ts-ignore */
|
|
2747
3084
|
...(ngDevMode ? [{ debugName: "maxEventsPerDay" }] : /* istanbul ignore next */ []));
|
|
3085
|
+
/** Whether day cells are held to a 1:1 ratio instead of sizing to the events they hold. */
|
|
3086
|
+
squareCells = input(false, /* @ts-ignore */
|
|
3087
|
+
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
2748
3088
|
eventTemplate = input(undefined, /* @ts-ignore */
|
|
2749
3089
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
3090
|
+
/** Replaces what a day cell renders, leaving the cell's own semantics and chrome in place. */
|
|
3091
|
+
dayTemplate = input(undefined, /* @ts-ignore */
|
|
3092
|
+
...(ngDevMode ? [{ debugName: "dayTemplate" }] : /* istanbul ignore next */ []));
|
|
2750
3093
|
/** Accessible name for the grid, announced when focus enters it. */
|
|
2751
3094
|
label = input(undefined, /* @ts-ignore */
|
|
2752
3095
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -2772,9 +3115,13 @@ class CalendarMonthView {
|
|
|
2772
3115
|
const weekDays = days.slice(index, index + DAYS_PER_WEEK);
|
|
2773
3116
|
const segments = assignWeekLanes(weekDays, events);
|
|
2774
3117
|
const hiddenPerColumn = new Array(weekDays.length).fill(0);
|
|
3118
|
+
// Segments already carry each event clipped to the columns it covers, so bucketing them
|
|
3119
|
+
// here costs nothing beyond the walk — far cheaper than re-testing every event per day.
|
|
3120
|
+
const eventsPerColumn = weekDays.map(() => []);
|
|
2775
3121
|
const bars = [];
|
|
2776
3122
|
for (const segment of segments) {
|
|
2777
|
-
|
|
3123
|
+
const beyondLanes = segment.lane >= maxLanes;
|
|
3124
|
+
if (!beyondLanes) {
|
|
2778
3125
|
bars.push({
|
|
2779
3126
|
event: segment.event,
|
|
2780
3127
|
gridColumn: `${segment.startColumn + 1} / span ${segment.endColumn - segment.startColumn + 1}`,
|
|
@@ -2783,19 +3130,32 @@ class CalendarMonthView {
|
|
|
2783
3130
|
continuesAfter: segment.continuesAfter,
|
|
2784
3131
|
});
|
|
2785
3132
|
}
|
|
2786
|
-
|
|
2787
|
-
|
|
3133
|
+
for (let column = segment.startColumn; column <= segment.endColumn; column++) {
|
|
3134
|
+
eventsPerColumn[column].push(segment.event);
|
|
3135
|
+
if (beyondLanes)
|
|
2788
3136
|
hiddenPerColumn[column]++;
|
|
2789
|
-
}
|
|
2790
3137
|
}
|
|
2791
3138
|
}
|
|
2792
|
-
const cells = weekDays.map((date, column) =>
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
3139
|
+
const cells = weekDays.map((date, column) => {
|
|
3140
|
+
// Lane packing orders segments by column and span; a day's own events read chronologically.
|
|
3141
|
+
const dayEvents = eventsPerColumn[column].sort((first, second) => first.start.getTime() - second.start.getTime());
|
|
3142
|
+
const dayNumber = format(date, DAY_NUMBER_FORMAT, this._dateOptions);
|
|
3143
|
+
const inCurrentMonth = isSameMonth(date, activeDate);
|
|
3144
|
+
const isToday = isSameDay(date, now);
|
|
3145
|
+
return {
|
|
3146
|
+
date,
|
|
3147
|
+
dayNumber,
|
|
3148
|
+
inCurrentMonth,
|
|
3149
|
+
isToday,
|
|
3150
|
+
hiddenCount: hiddenPerColumn[column],
|
|
3151
|
+
context: { $implicit: date, dayNumber, inCurrentMonth, isToday, events: dayEvents },
|
|
3152
|
+
eventCount: dayEvents.length,
|
|
3153
|
+
markers: dayEvents.slice(0, MAX_DAY_MARKERS).map(event => ({
|
|
3154
|
+
id: event.id,
|
|
3155
|
+
classes: this._markerClasses(event.color),
|
|
3156
|
+
})),
|
|
3157
|
+
};
|
|
3158
|
+
});
|
|
2799
3159
|
weeks.push({ days: cells, bars });
|
|
2800
3160
|
}
|
|
2801
3161
|
return weeks;
|
|
@@ -2806,18 +3166,32 @@ class CalendarMonthView {
|
|
|
2806
3166
|
moreLabel(count) {
|
|
2807
3167
|
return this._config.labels.more(count);
|
|
2808
3168
|
}
|
|
3169
|
+
/** Localized event-count summary, the only textual form the dense layout's dots have. */
|
|
3170
|
+
eventCountLabel(count) {
|
|
3171
|
+
return this._config.labels.eventCount(count);
|
|
3172
|
+
}
|
|
2809
3173
|
/** Space would scroll the page; consume it and select the focused day instead. */
|
|
2810
3174
|
onDaySpace(event, date) {
|
|
2811
3175
|
event.preventDefault();
|
|
2812
3176
|
this.dateSelect.emit(date);
|
|
2813
3177
|
}
|
|
3178
|
+
// Private methods
|
|
3179
|
+
_markerClasses(eventColor) {
|
|
3180
|
+
const classes = ['tls-calendar-month-view__marker'];
|
|
3181
|
+
if (eventColor)
|
|
3182
|
+
classes.push(`tls-calendar-month-view__marker--${eventColor}`);
|
|
3183
|
+
return classes;
|
|
3184
|
+
}
|
|
2814
3185
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2815
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarMonthView, isStandalone: true, selector: "tls-calendar-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: true, transformFunction: null }, eventTemplate: { classPropertyName: "eventTemplate", publicName: "eventTemplate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelect: "dateSelect", eventSelect: "eventSelect" }, host: { classAttribute: "tls-calendar-month-view" }, ngImport: i0, template: "<div class=\"tls-calendar-month-view__weekdays\" aria-hidden=\"true\">\n @for (weekday of weekdayHeaders(); track weekday) {\n <span class=\"tls-calendar-month-view__weekday\">{{ weekday }}</span>\n }\n</div>\n\n<div\n ngGrid\n class=\"tls-calendar-month-view__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [attr.aria-label]=\"label() ?? null\"\n [style.--tls-calendar-max-lanes]=\"maxEventsPerDay()\"\n>\n @for (week of weeks(); track $index) {\n <div ngGridRow class=\"tls-calendar-month-view__week\">\n @for (cell of week.days; track cell.date.getTime()) {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-calendar-month-view__day\"\n [class.tls-calendar-month-view__day--outside]=\"!cell.inCurrentMonth\"\n [class.tls-calendar-month-view__day--today]=\"cell.isToday\"\n (click)=\"dateSelect.emit(cell.date)\"\n (keydown.enter)=\"dateSelect.emit(cell.date)\"\n (keydown.space)=\"onDaySpace($event, cell.date)\"\n >\n <span class=\"tls-calendar-month-view__day-number\">{{ cell.dayNumber }}</span>\n\n
|
|
3186
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarMonthView, isStandalone: true, selector: "tls-calendar-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: true, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null }, eventTemplate: { classPropertyName: "eventTemplate", publicName: "eventTemplate", isSignal: true, isRequired: false, transformFunction: null }, dayTemplate: { classPropertyName: "dayTemplate", publicName: "dayTemplate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelect: "dateSelect", eventSelect: "eventSelect" }, host: { properties: { "class.tls-calendar-month-view--square": "squareCells()" }, classAttribute: "tls-calendar-month-view" }, ngImport: i0, template: "<div class=\"tls-calendar-month-view__weekdays\" aria-hidden=\"true\">\n @for (weekday of weekdayHeaders(); track weekday) {\n <span class=\"tls-calendar-month-view__weekday\">{{ weekday }}</span>\n }\n</div>\n\n<div\n ngGrid\n class=\"tls-calendar-month-view__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [attr.aria-label]=\"label() ?? null\"\n [style.--tls-calendar-max-lanes]=\"maxEventsPerDay()\"\n>\n @for (week of weeks(); track $index) {\n <div ngGridRow class=\"tls-calendar-month-view__week\">\n @for (cell of week.days; track cell.date.getTime()) {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-calendar-month-view__day\"\n [class.tls-calendar-month-view__day--outside]=\"!cell.inCurrentMonth\"\n [class.tls-calendar-month-view__day--today]=\"cell.isToday\"\n (click)=\"dateSelect.emit(cell.date)\"\n (keydown.enter)=\"dateSelect.emit(cell.date)\"\n (keydown.space)=\"onDaySpace($event, cell.date)\"\n >\n @if (dayTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n <span class=\"tls-calendar-month-view__day-number\">{{ cell.dayNumber }}</span>\n\n <!-- Dots stand in for the event bars in the dense layout, which hides those instead. -->\n @if (cell.eventCount > 0) {\n <span class=\"tls-calendar-month-view__markers\">\n <span class=\"tls-calendar-month-view__markers-label\">\n {{ eventCountLabel(cell.eventCount) }}\n </span>\n\n @for (marker of cell.markers; track marker.id) {\n <span [class]=\"marker.classes\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n\n @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\n }\n }\n </div>\n }\n\n <!-- Event bars span day columns and stack by lane, overlaid on the cells above. -->\n <div class=\"tls-calendar-month-view__bars\">\n @for (bar of week.bars; track bar.event.id) {\n <tls-calendar-event\n view=\"month\"\n class=\"tls-calendar-month-view__bar\"\n [class.tls-calendar-month-view__bar--continues-before]=\"bar.continuesBefore\"\n [class.tls-calendar-month-view__bar--continues-after]=\"bar.continuesAfter\"\n [event]=\"bar.event\"\n [template]=\"eventTemplate()\"\n [style.grid-column]=\"bar.gridColumn\"\n [style.grid-row]=\"bar.gridRow\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n </div>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: Grid, selector: "[ngGrid]", inputs: ["enableSelection", "disabled", "softDisabled", "focusMode", "rowWrap", "colWrap", "multi", "selectionMode", "tabindex"], exportAs: ["ngGrid"] }, { kind: "directive", type: GridRow, selector: "[ngGridRow]", inputs: ["rowIndex"], exportAs: ["ngGridRow"] }, { kind: "directive", type: GridCell, selector: "[ngGridCell]", inputs: ["id", "role", "rowSpan", "colSpan", "rowIndex", "colIndex", "disabled", "selected", "selectable", "tabindex"], outputs: ["selectedChange"], exportAs: ["ngGridCell"] }, { kind: "component", type: CalendarEventItem, selector: "tls-calendar-event", inputs: ["event", "view", "template"], outputs: ["activate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2816
3187
|
}
|
|
2817
3188
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, decorators: [{
|
|
2818
3189
|
type: Component,
|
|
2819
|
-
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem], host: {
|
|
2820
|
-
|
|
3190
|
+
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem, NgTemplateOutlet], host: {
|
|
3191
|
+
class: 'tls-calendar-month-view',
|
|
3192
|
+
'[class.tls-calendar-month-view--square]': 'squareCells()',
|
|
3193
|
+
}, template: "<div class=\"tls-calendar-month-view__weekdays\" aria-hidden=\"true\">\n @for (weekday of weekdayHeaders(); track weekday) {\n <span class=\"tls-calendar-month-view__weekday\">{{ weekday }}</span>\n }\n</div>\n\n<div\n ngGrid\n class=\"tls-calendar-month-view__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [attr.aria-label]=\"label() ?? null\"\n [style.--tls-calendar-max-lanes]=\"maxEventsPerDay()\"\n>\n @for (week of weeks(); track $index) {\n <div ngGridRow class=\"tls-calendar-month-view__week\">\n @for (cell of week.days; track cell.date.getTime()) {\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-calendar-month-view__day\"\n [class.tls-calendar-month-view__day--outside]=\"!cell.inCurrentMonth\"\n [class.tls-calendar-month-view__day--today]=\"cell.isToday\"\n (click)=\"dateSelect.emit(cell.date)\"\n (keydown.enter)=\"dateSelect.emit(cell.date)\"\n (keydown.space)=\"onDaySpace($event, cell.date)\"\n >\n @if (dayTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n <span class=\"tls-calendar-month-view__day-number\">{{ cell.dayNumber }}</span>\n\n <!-- Dots stand in for the event bars in the dense layout, which hides those instead. -->\n @if (cell.eventCount > 0) {\n <span class=\"tls-calendar-month-view__markers\">\n <span class=\"tls-calendar-month-view__markers-label\">\n {{ eventCountLabel(cell.eventCount) }}\n </span>\n\n @for (marker of cell.markers; track marker.id) {\n <span [class]=\"marker.classes\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n\n @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\n }\n }\n </div>\n }\n\n <!-- Event bars span day columns and stack by lane, overlaid on the cells above. -->\n <div class=\"tls-calendar-month-view__bars\">\n @for (bar of week.bars; track bar.event.id) {\n <tls-calendar-event\n view=\"month\"\n class=\"tls-calendar-month-view__bar\"\n [class.tls-calendar-month-view__bar--continues-before]=\"bar.continuesBefore\"\n [class.tls-calendar-month-view__bar--continues-after]=\"bar.continuesAfter\"\n [event]=\"bar.event\"\n [template]=\"eventTemplate()\"\n [style.grid-column]=\"bar.gridColumn\"\n [style.grid-row]=\"bar.gridRow\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n </div>\n </div>\n }\n</div>\n" }]
|
|
3194
|
+
}], propDecorators: { activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }], events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: true }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", required: false }] }], dayTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "dayTemplate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }] } });
|
|
2821
3195
|
|
|
2822
3196
|
const eventEnd = (event) => (event.end ?? event.start).getTime();
|
|
2823
3197
|
/**
|
|
@@ -3024,6 +3398,37 @@ class Calendar {
|
|
|
3024
3398
|
...(ngDevMode ? [{ debugName: "showAllDayRow" }] : /* istanbul ignore next */ []));
|
|
3025
3399
|
maxEventsPerDay = input(this._config.maxEventsPerDay, /* @ts-ignore */
|
|
3026
3400
|
...(ngDevMode ? [{ debugName: "maxEventsPerDay" }] : /* istanbul ignore next */ []));
|
|
3401
|
+
/**
|
|
3402
|
+
* Views the switcher offers, in the order they appear. Narrowing it to one entry hides the
|
|
3403
|
+
* switcher, and the active view is pulled back into the set whenever it falls outside.
|
|
3404
|
+
*/
|
|
3405
|
+
views = input(this._config.views, /* @ts-ignore */
|
|
3406
|
+
...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
|
|
3407
|
+
/** Whether the header renders at all; when false, drive the calendar through its own API. */
|
|
3408
|
+
showHeader = input(true, /* @ts-ignore */
|
|
3409
|
+
...(ngDevMode ? [{ debugName: "showHeader" }] : /* istanbul ignore next */ []));
|
|
3410
|
+
/** Whether the header shows the period title. */
|
|
3411
|
+
showTitle = input(true, /* @ts-ignore */
|
|
3412
|
+
...(ngDevMode ? [{ debugName: "showTitle" }] : /* istanbul ignore next */ []));
|
|
3413
|
+
/** Whether the header shows the previous/today/next controls. */
|
|
3414
|
+
showNavigation = input(true, /* @ts-ignore */
|
|
3415
|
+
...(ngDevMode ? [{ debugName: "showNavigation" }] : /* istanbul ignore next */ []));
|
|
3416
|
+
/** Whether the header shows the view switcher; it is hidden anyway with fewer than two views. */
|
|
3417
|
+
showViewSwitcher = input(true, /* @ts-ignore */
|
|
3418
|
+
...(ngDevMode ? [{ debugName: "showViewSwitcher" }] : /* istanbul ignore next */ []));
|
|
3419
|
+
/**
|
|
3420
|
+
* Density of the layout: `'auto'` lets the rendered width decide, `true` pins the dense layout
|
|
3421
|
+
* on and `false` pins it off. The dense month grid marks each day with a dot per event rather
|
|
3422
|
+
* than laying out event bars, so only `dateSelect` fires there — `eventSelect` has no target.
|
|
3423
|
+
*/
|
|
3424
|
+
compact = input('auto', /* @ts-ignore */
|
|
3425
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
3426
|
+
/**
|
|
3427
|
+
* Whether the month grid holds its day cells to a 1:1 ratio. Off by default, where a cell is
|
|
3428
|
+
* as tall as the events it has to show; on, the grid's height follows from its width alone.
|
|
3429
|
+
*/
|
|
3430
|
+
squareCells = input(false, /* @ts-ignore */
|
|
3431
|
+
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
3027
3432
|
/** Accessible name forwarded to the active view's grid. */
|
|
3028
3433
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
3029
3434
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -3039,18 +3444,33 @@ class Calendar {
|
|
|
3039
3444
|
activeDate = model(new Date(), /* @ts-ignore */
|
|
3040
3445
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
3041
3446
|
labels = this._config.labels;
|
|
3042
|
-
viewOptions = CALENDAR_VIEW_ORDER.map(value => ({ label: this._config.labels.views[value], value }));
|
|
3043
3447
|
eventTemplate = contentChild('eventTemplate', /* @ts-ignore */
|
|
3044
3448
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
3449
|
+
dayTemplate = contentChild('dayTemplate', /* @ts-ignore */
|
|
3450
|
+
...(ngDevMode ? [{ debugName: "dayTemplate" }] : /* istanbul ignore next */ []));
|
|
3045
3451
|
_dateOptions = localeFormatOptions(this._locale);
|
|
3046
3452
|
/** Ticking current time, so the "Today" affordance stays correct across midnight. */
|
|
3047
3453
|
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
3048
3454
|
// Computed
|
|
3049
|
-
hostClasses = computed(() =>
|
|
3050
|
-
'tls-calendar',
|
|
3051
|
-
|
|
3052
|
-
|
|
3455
|
+
hostClasses = computed(() => {
|
|
3456
|
+
const classes = ['tls-calendar', `tls-calendar--${this.view()}`];
|
|
3457
|
+
// Pinned off contributes no class at all, so neither dense rule can match.
|
|
3458
|
+
const compact = this.compact();
|
|
3459
|
+
if (compact === true)
|
|
3460
|
+
classes.push('tls-calendar--compact');
|
|
3461
|
+
if (compact === 'auto')
|
|
3462
|
+
classes.push('tls-calendar--compact-auto');
|
|
3463
|
+
return classes;
|
|
3464
|
+
}, /* @ts-ignore */
|
|
3053
3465
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3466
|
+
viewOptions = computed(() => this.views().map(value => ({ label: this.labels.views[value], value })), /* @ts-ignore */
|
|
3467
|
+
...(ngDevMode ? [{ debugName: "viewOptions" }] : /* istanbul ignore next */ []));
|
|
3468
|
+
/** A lone view has nothing to switch between, so the group is suppressed regardless. */
|
|
3469
|
+
showsViewSwitcher = computed(() => this.showViewSwitcher() && this.views().length > 1, /* @ts-ignore */
|
|
3470
|
+
...(ngDevMode ? [{ debugName: "showsViewSwitcher" }] : /* istanbul ignore next */ []));
|
|
3471
|
+
/** Suppresses the header wrapper once every part it would hold is hidden. */
|
|
3472
|
+
showsHeader = computed(() => this.showHeader() && (this.showNavigation() || this.showTitle() || this.showsViewSwitcher()), /* @ts-ignore */
|
|
3473
|
+
...(ngDevMode ? [{ debugName: "showsHeader" }] : /* istanbul ignore next */ []));
|
|
3054
3474
|
/** Whether the active period already includes today, so "Today" would be a no-op. */
|
|
3055
3475
|
isViewingToday = computed(() => {
|
|
3056
3476
|
const activeDate = this.activeDate();
|
|
@@ -3112,6 +3532,14 @@ class Calendar {
|
|
|
3112
3532
|
constructor() {
|
|
3113
3533
|
// Surface the visible window so consumers can fetch events for it (fires on first render too).
|
|
3114
3534
|
effect(() => this.rangeChange.emit(this.visibleRange()));
|
|
3535
|
+
// An active view outside the offered set would be unreachable once hidden from the
|
|
3536
|
+
// switcher, so it snaps to the first view on offer.
|
|
3537
|
+
effect(() => {
|
|
3538
|
+
const views = this.views();
|
|
3539
|
+
if (views.length === 0 || views.includes(this.view()))
|
|
3540
|
+
return;
|
|
3541
|
+
this.view.set(views[0]);
|
|
3542
|
+
});
|
|
3115
3543
|
}
|
|
3116
3544
|
// Public methods
|
|
3117
3545
|
/** Moves to the next period in the current view's unit. */
|
|
@@ -3157,14 +3585,14 @@ class Calendar {
|
|
|
3157
3585
|
return `${format(start, 'MMM d', this._dateOptions)} – ${format(end, 'MMM d, yyyy', this._dateOptions)}`;
|
|
3158
3586
|
}
|
|
3159
3587
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3160
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: false, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: false, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", isSignal: true, isRequired: false, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { eventSelect: "eventSelect", dateSelect: "dateSelect", rangeChange: "rangeChange", view: "viewChange", activeDate: "activeDateChange" }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "eventTemplate", first: true, predicate: ["eventTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"tls-calendar__header\">\n
|
|
3588
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: false, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: false, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", isSignal: true, isRequired: false, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: false, transformFunction: null }, views: { classPropertyName: "views", publicName: "views", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, showTitle: { classPropertyName: "showTitle", publicName: "showTitle", isSignal: true, isRequired: false, transformFunction: null }, showNavigation: { classPropertyName: "showNavigation", publicName: "showNavigation", isSignal: true, isRequired: false, transformFunction: null }, showViewSwitcher: { classPropertyName: "showViewSwitcher", publicName: "showViewSwitcher", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { eventSelect: "eventSelect", dateSelect: "dateSelect", rangeChange: "rangeChange", view: "viewChange", activeDate: "activeDateChange" }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "eventTemplate", first: true, predicate: ["eventTemplate"], descendants: true, isSignal: true }, { propertyName: "dayTemplate", first: true, predicate: ["dayTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n <tls-calendar-month-view\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n [maxEventsPerDay]=\"maxEventsPerDay()\"\n [squareCells]=\"squareCells()\"\n [eventTemplate]=\"eventTemplate()\"\n [dayTemplate]=\"dayTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('week') {\n <tls-calendar-time-grid\n view=\"week\"\n [days]=\"timeGridDays()\"\n [events]=\"events()\"\n [hourStart]=\"hourStart()\"\n [hourEnd]=\"hourEnd()\"\n [showAllDayRow]=\"showAllDayRow()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('day') {\n <tls-calendar-time-grid\n view=\"day\"\n [days]=\"timeGridDays()\"\n [events]=\"events()\"\n [hourStart]=\"hourStart()\"\n [hourEnd]=\"hourEnd()\"\n [showAllDayRow]=\"showAllDayRow()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('agenda') {\n <tls-calendar-agenda-view\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n}\n", dependencies: [{ kind: "component", type: Button, selector: "tls-button", inputs: ["label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: ToggleGroup, selector: "tls-toggle-group", inputs: ["multiple", "unselectable", "size", "color", "variant", "orientation", "fluid"] }, { kind: "component", type: CalendarMonthView, selector: "tls-calendar-month-view", inputs: ["activeDate", "events", "weekStartsOn", "weekDays", "maxEventsPerDay", "squareCells", "eventTemplate", "dayTemplate", "label"], outputs: ["dateSelect", "eventSelect"] }, { kind: "component", type: CalendarTimeGrid, selector: "tls-calendar-time-grid", inputs: ["days", "events", "view", "hourStart", "hourEnd", "showAllDayRow", "eventTemplate", "label"], outputs: ["dateSelect", "eventSelect"] }, { kind: "component", type: CalendarAgendaView, selector: "tls-calendar-agenda-view", inputs: ["activeDate", "events", "eventTemplate", "label"], outputs: ["dateSelect", "eventSelect"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3161
3589
|
}
|
|
3162
3590
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, decorators: [{
|
|
3163
3591
|
type: Component,
|
|
3164
3592
|
args: [{ selector: 'tls-calendar', imports: [Button, ToggleGroup, CalendarMonthView, CalendarTimeGrid, CalendarAgendaView, Icon], host: {
|
|
3165
3593
|
'[class]': 'hostClasses()',
|
|
3166
|
-
}, template: "<div class=\"tls-calendar__header\">\n
|
|
3167
|
-
}], ctorParameters: () => [], propDecorators: { events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], hourStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStart", required: false }] }], hourEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourEnd", required: false }] }], showAllDayRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllDayRow", required: false }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }, { type: i0.Output, args: ["viewChange"] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: false }] }, { type: i0.Output, args: ["activeDateChange"] }], eventTemplate: [{ type: i0.ContentChild, args: ['eventTemplate', { isSignal: true }] }] } });
|
|
3594
|
+
}, template: "@if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n <tls-calendar-month-view\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n [maxEventsPerDay]=\"maxEventsPerDay()\"\n [squareCells]=\"squareCells()\"\n [eventTemplate]=\"eventTemplate()\"\n [dayTemplate]=\"dayTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('week') {\n <tls-calendar-time-grid\n view=\"week\"\n [days]=\"timeGridDays()\"\n [events]=\"events()\"\n [hourStart]=\"hourStart()\"\n [hourEnd]=\"hourEnd()\"\n [showAllDayRow]=\"showAllDayRow()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('day') {\n <tls-calendar-time-grid\n view=\"day\"\n [days]=\"timeGridDays()\"\n [events]=\"events()\"\n [hourStart]=\"hourStart()\"\n [hourEnd]=\"hourEnd()\"\n [showAllDayRow]=\"showAllDayRow()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n @case ('agenda') {\n <tls-calendar-agenda-view\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [eventTemplate]=\"eventTemplate()\"\n [label]=\"ariaLabel() ?? title()\"\n (dateSelect)=\"dateSelect.emit($event)\"\n (eventSelect)=\"eventSelect.emit($event)\"\n />\n }\n}\n" }]
|
|
3595
|
+
}], ctorParameters: () => [], propDecorators: { events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], hourStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStart", required: false }] }], hourEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourEnd", required: false }] }], showAllDayRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllDayRow", required: false }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: false }] }], views: [{ type: i0.Input, args: [{ isSignal: true, alias: "views", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], showTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTitle", required: false }] }], showNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "showNavigation", required: false }] }], showViewSwitcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "showViewSwitcher", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }, { type: i0.Output, args: ["viewChange"] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: false }] }, { type: i0.Output, args: ["activeDateChange"] }], eventTemplate: [{ type: i0.ContentChild, args: ['eventTemplate', { isSignal: true }] }], dayTemplate: [{ type: i0.ContentChild, args: ['dayTemplate', { isSignal: true }] }] } });
|
|
3168
3596
|
|
|
3169
3597
|
const DEFAULT_CHIP_CONFIG = {
|
|
3170
3598
|
color: 'primary',
|
|
@@ -3736,23 +4164,71 @@ const DIALOG_CONFIG = new InjectionToken('DIALOG_CONFIG', {
|
|
|
3736
4164
|
});
|
|
3737
4165
|
|
|
3738
4166
|
class Dialog extends CdkDialogContainer {
|
|
4167
|
+
// Injections
|
|
3739
4168
|
_tlsConfig = inject(DIALOG_CONFIG);
|
|
3740
|
-
_dialogRef = inject(DialogRef);
|
|
3741
|
-
|
|
4169
|
+
_dialogRef = inject(DialogRef$1);
|
|
4170
|
+
// State
|
|
4171
|
+
_state = signal('enter', /* @ts-ignore */
|
|
4172
|
+
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
4173
|
+
_closing = false;
|
|
4174
|
+
// Computed
|
|
4175
|
+
hostClasses = computed(() => [
|
|
4176
|
+
'tls-dialog',
|
|
4177
|
+
`tls-dialog--${this._tlsConfig.size}`,
|
|
4178
|
+
`tls-dialog--${this._state()}`,
|
|
4179
|
+
], /* @ts-ignore */
|
|
4180
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
4181
|
+
// Accessors
|
|
3742
4182
|
get config() {
|
|
3743
4183
|
return this._tlsConfig;
|
|
3744
4184
|
}
|
|
4185
|
+
// Public methods
|
|
4186
|
+
// Plays the exit animation, then disposes the overlay once it finishes. Routed
|
|
4187
|
+
// through here for every dismissal path (close button, backdrop, Escape)
|
|
4188
|
+
// because the CDK ref's `close()` disposes synchronously, which would skip the exit.
|
|
4189
|
+
animatedClose(result) {
|
|
4190
|
+
if (this._closing)
|
|
4191
|
+
return;
|
|
4192
|
+
this._closing = true;
|
|
4193
|
+
this._state.set('leave');
|
|
4194
|
+
afterLeaveAnimation(this._elementRef.nativeElement, () => this._dialogRef.close(result));
|
|
4195
|
+
}
|
|
4196
|
+
// Protected methods
|
|
3745
4197
|
close() {
|
|
3746
|
-
this.
|
|
4198
|
+
this.animatedClose();
|
|
3747
4199
|
}
|
|
3748
4200
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3749
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Dialog, isStandalone: true, selector: "tls-dialog", host: { properties: { "class": "hostClasses" } }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <tls-button\n class=\"tls-dialog__close\"\n icon\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"config.closeLabel\"\n (click)=\"close()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </tls-button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: Button, selector: "tls-button", inputs: ["label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
4201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Dialog, isStandalone: true, selector: "tls-dialog", host: { properties: { "class": "hostClasses()" } }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <tls-button\n class=\"tls-dialog__close\"\n icon\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"config.closeLabel\"\n (click)=\"close()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </tls-button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: Button, selector: "tls-button", inputs: ["label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3750
4202
|
}
|
|
3751
4203
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, decorators: [{
|
|
3752
4204
|
type: Component,
|
|
3753
|
-
args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet, Button, Icon], host: { '[class]': 'hostClasses' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <tls-button\n class=\"tls-dialog__close\"\n icon\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"config.closeLabel\"\n (click)=\"close()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </tls-button>\n}\n" }]
|
|
4205
|
+
args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet, Button, Icon], host: { '[class]': 'hostClasses()' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <tls-button\n class=\"tls-dialog__close\"\n icon\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"config.closeLabel\"\n (click)=\"close()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </tls-button>\n}\n" }]
|
|
3754
4206
|
}] });
|
|
3755
4207
|
|
|
4208
|
+
/**
|
|
4209
|
+
* Handle to an open dialog. Provided to the dialog's content component (inject it
|
|
4210
|
+
* instead of the CDK `DialogRef`) and returned from {@link DialogService.open}.
|
|
4211
|
+
*
|
|
4212
|
+
* `close` routes through the container so the exit animation plays before the
|
|
4213
|
+
* overlay is disposed, unlike the CDK `DialogRef` which disposes synchronously.
|
|
4214
|
+
*/
|
|
4215
|
+
class DialogRef {
|
|
4216
|
+
_cdkRef;
|
|
4217
|
+
_container;
|
|
4218
|
+
closed;
|
|
4219
|
+
constructor(_cdkRef, _container) {
|
|
4220
|
+
this._cdkRef = _cdkRef;
|
|
4221
|
+
this._container = _container;
|
|
4222
|
+
this.closed = _cdkRef.closed;
|
|
4223
|
+
}
|
|
4224
|
+
get componentInstance() {
|
|
4225
|
+
return this._cdkRef.componentInstance;
|
|
4226
|
+
}
|
|
4227
|
+
close(result) {
|
|
4228
|
+
this._container.animatedClose(result);
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
|
|
3756
4232
|
/**
|
|
3757
4233
|
* Top region of a dialog, holding its title and any supporting text. Keeps its
|
|
3758
4234
|
* padding out of the scrolling body so the title stays put while the content
|
|
@@ -3845,6 +4321,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3845
4321
|
class DialogService {
|
|
3846
4322
|
_dialog = inject(Dialog$1);
|
|
3847
4323
|
_config = inject(DIALOG_CONFIG);
|
|
4324
|
+
// Currently-open dialogs, tracked so `closeAll` can play each exit animation and
|
|
4325
|
+
// so it closes dialogs only (the CDK `Dialog` is shared with `tls-drawer`).
|
|
4326
|
+
_openDialogs = new Set();
|
|
3848
4327
|
open(component, config) {
|
|
3849
4328
|
const resolvedConfig = {
|
|
3850
4329
|
size: config?.size ?? this._config.size,
|
|
@@ -3853,23 +4332,49 @@ class DialogService {
|
|
|
3853
4332
|
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
3854
4333
|
footerAlign: config?.footerAlign ?? this._config.footerAlign,
|
|
3855
4334
|
};
|
|
3856
|
-
|
|
4335
|
+
let dialogRef;
|
|
4336
|
+
const cdkRef = this._dialog.open(component, {
|
|
3857
4337
|
container: {
|
|
3858
4338
|
type: Dialog,
|
|
3859
4339
|
providers: () => [{ provide: DIALOG_CONFIG, useValue: resolvedConfig }],
|
|
3860
4340
|
},
|
|
4341
|
+
// Built against the content injector so the dialog's content can `inject(DialogRef)`
|
|
4342
|
+
// to close itself. The same instance is returned to the caller below.
|
|
4343
|
+
providers: (ref, _cdkConfig, container) => {
|
|
4344
|
+
dialogRef = new DialogRef(ref, container);
|
|
4345
|
+
return [{ provide: DialogRef, useValue: dialogRef }];
|
|
4346
|
+
},
|
|
3861
4347
|
hasBackdrop: true,
|
|
3862
4348
|
backdropClass: 'tls-dialog-backdrop',
|
|
3863
|
-
|
|
4349
|
+
// Suppress CDK's synchronous auto-close so every dismissal routes through
|
|
4350
|
+
// `DialogRef.close`, which plays the exit animation before disposal.
|
|
4351
|
+
disableClose: true,
|
|
3864
4352
|
role: config?.role ?? 'dialog',
|
|
3865
4353
|
ariaLabel: config?.ariaLabel ?? null,
|
|
3866
4354
|
ariaLabelledBy: config?.ariaLabelledBy ?? null,
|
|
3867
4355
|
ariaDescribedBy: config?.ariaDescribedBy ?? null,
|
|
3868
4356
|
data: config?.data,
|
|
3869
4357
|
});
|
|
4358
|
+
const trackedRef = dialogRef;
|
|
4359
|
+
this._openDialogs.add(trackedRef);
|
|
4360
|
+
cdkRef.closed.subscribe(() => this._openDialogs.delete(trackedRef));
|
|
4361
|
+
this._wireDismissal(cdkRef, dialogRef, resolvedConfig);
|
|
4362
|
+
return dialogRef;
|
|
3870
4363
|
}
|
|
3871
4364
|
closeAll() {
|
|
3872
|
-
|
|
4365
|
+
// Iterating a snapshot: `close` is animated, so removal happens later (on
|
|
4366
|
+
// `closed`), but guard against any synchronous mutation regardless.
|
|
4367
|
+
for (const dialogRef of [...this._openDialogs])
|
|
4368
|
+
dialogRef.close();
|
|
4369
|
+
}
|
|
4370
|
+
// Private methods
|
|
4371
|
+
_wireDismissal(cdkRef, dialogRef, config) {
|
|
4372
|
+
if (!config.backdropClose)
|
|
4373
|
+
return;
|
|
4374
|
+
cdkRef.backdropClick.pipe(takeUntil(cdkRef.closed)).subscribe(() => dialogRef.close());
|
|
4375
|
+
cdkRef.keydownEvents
|
|
4376
|
+
.pipe(takeUntil(cdkRef.closed), filter(event => event.key === 'Escape'))
|
|
4377
|
+
.subscribe(() => dialogRef.close());
|
|
3873
4378
|
}
|
|
3874
4379
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3875
4380
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogService, providedIn: 'root' });
|
|
@@ -3922,13 +4427,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3922
4427
|
}, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" }]
|
|
3923
4428
|
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }] } });
|
|
3924
4429
|
|
|
3925
|
-
// Upper bound for how long to keep the drawer alive after a close is requested so
|
|
3926
|
-
// its slide-out (`--leave`) animation can finish before disposal. The `animationend`
|
|
3927
|
-
// listener disposes early; this fallback covers the case where no exit animation
|
|
3928
|
-
// runs (e.g. the `none` motion level, where nothing is emitted).
|
|
3929
|
-
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
3930
4430
|
// Named size tokens, used to tell a preset apart from a custom CSS-length string.
|
|
3931
|
-
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full'];
|
|
4431
|
+
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full', 'auto'];
|
|
3932
4432
|
|
|
3933
4433
|
const DEFAULT_DRAWER_CONFIG = {
|
|
3934
4434
|
side: 'end',
|
|
@@ -3936,6 +4436,7 @@ const DEFAULT_DRAWER_CONFIG = {
|
|
|
3936
4436
|
closeable: true,
|
|
3937
4437
|
backdropClose: true,
|
|
3938
4438
|
rounded: false,
|
|
4439
|
+
grabber: false,
|
|
3939
4440
|
closeLabel: 'Close drawer',
|
|
3940
4441
|
};
|
|
3941
4442
|
|
|
@@ -3946,7 +4447,7 @@ const DRAWER_CONFIG = new InjectionToken('DRAWER_CONFIG', {
|
|
|
3946
4447
|
class Drawer extends CdkDialogContainer {
|
|
3947
4448
|
// Injections
|
|
3948
4449
|
_tlsConfig = inject(DRAWER_CONFIG);
|
|
3949
|
-
_dialogRef = inject(DialogRef);
|
|
4450
|
+
_dialogRef = inject(DialogRef$1);
|
|
3950
4451
|
// State
|
|
3951
4452
|
_state = signal('enter', /* @ts-ignore */
|
|
3952
4453
|
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
@@ -3982,7 +4483,7 @@ class Drawer extends CdkDialogContainer {
|
|
|
3982
4483
|
return;
|
|
3983
4484
|
this._closing = true;
|
|
3984
4485
|
this._state.set('leave');
|
|
3985
|
-
this.
|
|
4486
|
+
afterLeaveAnimation(this._elementRef.nativeElement, () => this._dialogRef.close(result));
|
|
3986
4487
|
}
|
|
3987
4488
|
// Protected methods
|
|
3988
4489
|
close() {
|
|
@@ -3996,46 +4497,15 @@ class Drawer extends CdkDialogContainer {
|
|
|
3996
4497
|
_isNamedSize(size) {
|
|
3997
4498
|
return DRAWER_NAMED_SIZES.includes(size);
|
|
3998
4499
|
}
|
|
3999
|
-
// Invokes `onDone` when the leave animation ends, disposing immediately when no
|
|
4000
|
-
// slide-out actually runs (e.g. the `none` motion level, where the motion mixin
|
|
4001
|
-
// emits nothing) so reduced-motion users don't wait out the fallback timeout.
|
|
4002
|
-
_afterLeaveAnimation(onDone) {
|
|
4003
|
-
const element = this._elementRef.nativeElement;
|
|
4004
|
-
let settled = false;
|
|
4005
|
-
const finalize = () => {
|
|
4006
|
-
if (settled)
|
|
4007
|
-
return;
|
|
4008
|
-
settled = true;
|
|
4009
|
-
window.clearTimeout(timeoutId);
|
|
4010
|
-
element.removeEventListener('animationend', onAnimationEnd);
|
|
4011
|
-
onDone();
|
|
4012
|
-
};
|
|
4013
|
-
// Only the host's own slide-out finalizes; ignore `animationend` bubbling up
|
|
4014
|
-
// from animated content inside the drawer.
|
|
4015
|
-
const onAnimationEnd = (event) => {
|
|
4016
|
-
if (event.target === element)
|
|
4017
|
-
finalize();
|
|
4018
|
-
};
|
|
4019
|
-
element.addEventListener('animationend', onAnimationEnd);
|
|
4020
|
-
// Safety net if `animationend` never arrives (e.g. the pane is torn down early).
|
|
4021
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
4022
|
-
// The `--leave` class applies on the next change detection; on the following
|
|
4023
|
-
// frame, close at once if no animation is running. When motion is enabled the
|
|
4024
|
-
// computed `animationName` is never `none`, so this cannot finalize early.
|
|
4025
|
-
requestAnimationFrame(() => {
|
|
4026
|
-
if (getComputedStyle(element).animationName === 'none')
|
|
4027
|
-
finalize();
|
|
4028
|
-
});
|
|
4029
|
-
}
|
|
4030
4500
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4031
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Drawer, isStandalone: true, selector: "tls-drawer", host: { properties: { "class": "hostClasses()", "style.--tls-drawer-size": "customSize" } }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-drawer__close\" type=\"button\" [attr.aria-label]=\"config.closeLabel\" (click)=\"close()\">\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
4501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Drawer, isStandalone: true, selector: "tls-drawer", host: { properties: { "class": "hostClasses()", "style.--tls-drawer-size": "customSize" } }, usesInheritance: true, ngImport: i0, template: "@if (config.grabber) {\n <div class=\"tls-drawer__grabber\" aria-hidden=\"true\"></div>\n}\n<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-drawer__close\" type=\"button\" [attr.aria-label]=\"config.closeLabel\" (click)=\"close()\">\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
4032
4502
|
}
|
|
4033
4503
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, decorators: [{
|
|
4034
4504
|
type: Component,
|
|
4035
4505
|
args: [{ selector: 'tls-drawer', imports: [CdkPortalOutlet, Icon], host: {
|
|
4036
4506
|
'[class]': 'hostClasses()',
|
|
4037
4507
|
'[style.--tls-drawer-size]': 'customSize',
|
|
4038
|
-
}, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-drawer__close\" type=\"button\" [attr.aria-label]=\"config.closeLabel\" (click)=\"close()\">\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n" }]
|
|
4508
|
+
}, template: "@if (config.grabber) {\n <div class=\"tls-drawer__grabber\" aria-hidden=\"true\"></div>\n}\n<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-drawer__close\" type=\"button\" [attr.aria-label]=\"config.closeLabel\" (click)=\"close()\">\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n" }]
|
|
4039
4509
|
}] });
|
|
4040
4510
|
|
|
4041
4511
|
/**
|
|
@@ -4077,6 +4547,7 @@ class DrawerService {
|
|
|
4077
4547
|
closeable: config?.closeable ?? this._config.closeable,
|
|
4078
4548
|
backdropClose: config?.backdropClose ?? this._config.backdropClose,
|
|
4079
4549
|
rounded: config?.rounded ?? this._config.rounded,
|
|
4550
|
+
grabber: config?.grabber ?? this._config.grabber,
|
|
4080
4551
|
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
4081
4552
|
};
|
|
4082
4553
|
let drawerRef;
|
|
@@ -4478,6 +4949,9 @@ const DEFAULT_AUTOCOMPLETE_CONFIG = {
|
|
|
4478
4949
|
filterMode: 'contains',
|
|
4479
4950
|
emptyMessage: 'No results',
|
|
4480
4951
|
clearLabel: 'Clear',
|
|
4952
|
+
virtualScroll: false,
|
|
4953
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
4954
|
+
virtualScrollItemSize: 39,
|
|
4481
4955
|
};
|
|
4482
4956
|
|
|
4483
4957
|
const AUTOCOMPLETE_CONFIG = new InjectionToken('AUTOCOMPLETE_CONFIG', {
|
|
@@ -4491,6 +4965,7 @@ class Autocomplete extends AbstractSelect {
|
|
|
4491
4965
|
uniqueId = `tls-autocomplete-${Autocomplete._nextUniqueId++}`;
|
|
4492
4966
|
hostClassBase = 'tls-autocomplete';
|
|
4493
4967
|
panelClass = 'tls-autocomplete-panel';
|
|
4968
|
+
panelCssVariablePrefix = '--tls-autocomplete-panel';
|
|
4494
4969
|
value = model(null, /* @ts-ignore */
|
|
4495
4970
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
4496
4971
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -4505,6 +4980,8 @@ class Autocomplete extends AbstractSelect {
|
|
|
4505
4980
|
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
4506
4981
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
4507
4982
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
4983
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4984
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
4508
4985
|
hasValue = computed(() => {
|
|
4509
4986
|
const value = this.value();
|
|
4510
4987
|
return value !== null && value !== undefined;
|
|
@@ -4614,14 +5091,14 @@ class Autocomplete extends AbstractSelect {
|
|
|
4614
5091
|
this.select(option);
|
|
4615
5092
|
}
|
|
4616
5093
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4617
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Autocomplete, isStandalone: true, selector: "tls-autocomplete", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], usesInheritance: true, ngImport: i0, template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
5094
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Autocomplete, isStandalone: true, selector: "tls-autocomplete", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], usesInheritance: true, ngImport: i0, template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
4618
5095
|
}
|
|
4619
5096
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
|
|
4620
5097
|
type: Component,
|
|
4621
|
-
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
5098
|
+
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
4622
5099
|
'[class]': 'hostClasses()',
|
|
4623
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
4624
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }] } });
|
|
5100
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n }\n</ng-template>\n" }]
|
|
5101
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
|
|
4625
5102
|
|
|
4626
5103
|
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
4627
5104
|
|
|
@@ -6082,6 +6559,220 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6082
6559
|
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => RadioButton) }], template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [attr.id]=\"effectiveInputId()\"\n [name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" }]
|
|
6083
6560
|
}], propDecorators: { radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
6084
6561
|
|
|
6562
|
+
const DEFAULT_RATING_CONFIG = {
|
|
6563
|
+
color: 'golden',
|
|
6564
|
+
size: 'md',
|
|
6565
|
+
max: 5,
|
|
6566
|
+
allowHalf: false,
|
|
6567
|
+
allowClear: true,
|
|
6568
|
+
preview: false,
|
|
6569
|
+
labels: {
|
|
6570
|
+
star: value => (value === 1 ? '1 star' : `${value} stars`),
|
|
6571
|
+
},
|
|
6572
|
+
};
|
|
6573
|
+
|
|
6574
|
+
const RATING_CONFIG = new InjectionToken('RATING_CONFIG', {
|
|
6575
|
+
factory: () => DEFAULT_RATING_CONFIG,
|
|
6576
|
+
});
|
|
6577
|
+
|
|
6578
|
+
/**
|
|
6579
|
+
* A star-rating control holding a number of stars, where 0 means unrated. Each
|
|
6580
|
+
* selectable increment (a whole star, or each half when `allowHalf` is on) is a
|
|
6581
|
+
* native radio positioned over its slice of the star row, so the group gets the
|
|
6582
|
+
* radio pattern's focus and arrow-key behaviour natively. The host is the
|
|
6583
|
+
* composite's `radiogroup` container and carries the group-level ARIA.
|
|
6584
|
+
*/
|
|
6585
|
+
class Rating extends ValueFormControl {
|
|
6586
|
+
// Injections
|
|
6587
|
+
_config = inject(RATING_CONFIG);
|
|
6588
|
+
CLASS_NAME = 'tls-rating';
|
|
6589
|
+
// Inputs
|
|
6590
|
+
value = model(0, /* @ts-ignore */
|
|
6591
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6592
|
+
max = input(this._config.max, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6593
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
6594
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
6595
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
6596
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
6597
|
+
/** Offers half-star options: each star becomes two radios, one per half. */
|
|
6598
|
+
allowHalf = input(this._config.allowHalf, { ...(ngDevMode ? { debugName: "allowHalf" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6599
|
+
/** Re-activating the currently selected option resets the value to 0 (unrated). */
|
|
6600
|
+
allowClear = input(this._config.allowClear, { ...(ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6601
|
+
/**
|
|
6602
|
+
* Renders the hover preview's *difference* from the committed value as a
|
|
6603
|
+
* translucent ghost: hovering above the value ghosts only the stars being
|
|
6604
|
+
* added, hovering below ghosts only the part being removed, and the solid
|
|
6605
|
+
* fill always shows the part both agree on.
|
|
6606
|
+
*/
|
|
6607
|
+
preview = input(this._config.preview, { ...(ngDevMode ? { debugName: "preview" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6608
|
+
// State
|
|
6609
|
+
static _counter = 0;
|
|
6610
|
+
/** Groups the radios when the consumer supplies no `name`; unique per instance. */
|
|
6611
|
+
_autoName = `tls-rating-${Rating._counter++}`;
|
|
6612
|
+
/** Option value previewed under the pointer, or null when nothing is hovered. */
|
|
6613
|
+
_hovered = signal(null, /* @ts-ignore */
|
|
6614
|
+
...(ngDevMode ? [{ debugName: "_hovered" }] : /* istanbul ignore next */ []));
|
|
6615
|
+
/** Star currently playing the selection pop animation, or null. */
|
|
6616
|
+
_popped = signal(null, /* @ts-ignore */
|
|
6617
|
+
...(ngDevMode ? [{ debugName: "_popped" }] : /* istanbul ignore next */ []));
|
|
6618
|
+
/** Consumer-provided star slot rendered in place of the built-in star icon. */
|
|
6619
|
+
starTemplate = contentChild('starTemplate', /* @ts-ignore */
|
|
6620
|
+
...(ngDevMode ? [{ debugName: "starTemplate" }] : /* istanbul ignore next */ []));
|
|
6621
|
+
/**
|
|
6622
|
+
* Activating an unchecked radio fires `change` then `click`; a click on the
|
|
6623
|
+
* already-checked one fires `click` alone. This flag marks the `change` so the
|
|
6624
|
+
* trailing `click` is not mistaken for a re-activation that should clear.
|
|
6625
|
+
*/
|
|
6626
|
+
_suppressClear = false;
|
|
6627
|
+
_inputs = viewChildren('radio', /* @ts-ignore */
|
|
6628
|
+
...(ngDevMode ? [{ debugName: "_inputs" }] : /* istanbul ignore next */ []));
|
|
6629
|
+
// Computed
|
|
6630
|
+
hostClasses = computed(() => {
|
|
6631
|
+
const className = this.CLASS_NAME;
|
|
6632
|
+
const array = [`${className}--${this.size()}`, `${className}--${this.color()}`];
|
|
6633
|
+
return array.concat(this.controlClasses());
|
|
6634
|
+
}, /* @ts-ignore */
|
|
6635
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
6636
|
+
stars = computed(() => Array.from({ length: Math.max(0, Math.floor(this.max())) }, (_, index) => index + 1), /* @ts-ignore */
|
|
6637
|
+
...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
6638
|
+
radioName = computed(() => this.name() || this._autoName, /* @ts-ignore */
|
|
6639
|
+
...(ngDevMode ? [{ debugName: "radioName" }] : /* istanbul ignore next */ []));
|
|
6640
|
+
/**
|
|
6641
|
+
* Hovered option that should actually drive the preview: none while the
|
|
6642
|
+
* control is non-interactive, so a readonly/disabled flip mid-hover cannot
|
|
6643
|
+
* leave a stale preview on screen.
|
|
6644
|
+
*/
|
|
6645
|
+
_previewedOption = computed(() => this.notInteractive() ? null : this._hovered(), /* @ts-ignore */
|
|
6646
|
+
...(ngDevMode ? [{ debugName: "_previewedOption" }] : /* istanbul ignore next */ []));
|
|
6647
|
+
// Protected methods
|
|
6648
|
+
/**
|
|
6649
|
+
* Solidly filled share of the given star, 0–100. Reads the hovered preview
|
|
6650
|
+
* when one is active, the committed value otherwise; a fractional value fills
|
|
6651
|
+
* its star partially, so a non-interactive rating can display an average like
|
|
6652
|
+
* 4.3. In ghost mode the solid fill shows only the part the committed value
|
|
6653
|
+
* and the hovered one agree on — the delta belongs to the ghost layer.
|
|
6654
|
+
*/
|
|
6655
|
+
fillPercent(star) {
|
|
6656
|
+
const hovered = this._previewedOption();
|
|
6657
|
+
const value = this.value();
|
|
6658
|
+
let display;
|
|
6659
|
+
if (hovered === null)
|
|
6660
|
+
display = value;
|
|
6661
|
+
else if (this.preview())
|
|
6662
|
+
display = Math.min(value, hovered);
|
|
6663
|
+
else
|
|
6664
|
+
display = hovered;
|
|
6665
|
+
return this._starShare(display, star);
|
|
6666
|
+
}
|
|
6667
|
+
/**
|
|
6668
|
+
* Ghost-layer share of the given star, 0–100: reaches whichever of the
|
|
6669
|
+
* committed and hovered values is larger, so the part peeking out from under
|
|
6670
|
+
* the solid fill is exactly their difference — the stars a click would add,
|
|
6671
|
+
* or the part it would remove.
|
|
6672
|
+
*/
|
|
6673
|
+
ghostPercent(star) {
|
|
6674
|
+
const hovered = this._previewedOption();
|
|
6675
|
+
if (hovered === null)
|
|
6676
|
+
return 0;
|
|
6677
|
+
return this._starShare(Math.max(this.value(), hovered), star);
|
|
6678
|
+
}
|
|
6679
|
+
starLabel(option) {
|
|
6680
|
+
return this._config.labels.star(option);
|
|
6681
|
+
}
|
|
6682
|
+
/** Whether the displayed value (hover preview first, else committed) fills the star only partially. */
|
|
6683
|
+
isHalf(star) {
|
|
6684
|
+
const share = this._starShare(this._previewedOption() ?? this.value(), star);
|
|
6685
|
+
return share > 0 && share < 100;
|
|
6686
|
+
}
|
|
6687
|
+
onChange(option) {
|
|
6688
|
+
// A radio has no native readonly, so a readonly (or disabled-but-still-
|
|
6689
|
+
// reachable) rating reverts the native check instead of committing it.
|
|
6690
|
+
if (this.notInteractive()) {
|
|
6691
|
+
this._syncNativeChecked();
|
|
6692
|
+
return;
|
|
6693
|
+
}
|
|
6694
|
+
this._suppressClear = true;
|
|
6695
|
+
this.value.set(option);
|
|
6696
|
+
this._pop(option);
|
|
6697
|
+
}
|
|
6698
|
+
isPopped(star) {
|
|
6699
|
+
return this._popped() === star;
|
|
6700
|
+
}
|
|
6701
|
+
onPopAnimationEnd(star) {
|
|
6702
|
+
if (this._popped() === star)
|
|
6703
|
+
this._popped.set(null);
|
|
6704
|
+
}
|
|
6705
|
+
onClick(option) {
|
|
6706
|
+
if (this.notInteractive())
|
|
6707
|
+
return;
|
|
6708
|
+
if (this._suppressClear) {
|
|
6709
|
+
this._suppressClear = false;
|
|
6710
|
+
return;
|
|
6711
|
+
}
|
|
6712
|
+
if (this.allowClear() && this.value() === option)
|
|
6713
|
+
this.value.set(0);
|
|
6714
|
+
}
|
|
6715
|
+
onPointerDown() {
|
|
6716
|
+
// A stale flag from an earlier keyboard arrow change would swallow the next
|
|
6717
|
+
// pointer click's clearing; a fresh pointer interaction starts clean.
|
|
6718
|
+
this._suppressClear = false;
|
|
6719
|
+
}
|
|
6720
|
+
onPointerEnter(option) {
|
|
6721
|
+
if (this.notInteractive())
|
|
6722
|
+
return;
|
|
6723
|
+
this._hovered.set(option);
|
|
6724
|
+
}
|
|
6725
|
+
onPointerLeave() {
|
|
6726
|
+
this._hovered.set(null);
|
|
6727
|
+
}
|
|
6728
|
+
// Private methods
|
|
6729
|
+
_starShare(display, star) {
|
|
6730
|
+
return Math.min(Math.max(display - (star - 1), 0), 1) * 100;
|
|
6731
|
+
}
|
|
6732
|
+
/**
|
|
6733
|
+
* Plays the selection pop on the star containing the committed option. When
|
|
6734
|
+
* that star is already popping (e.g. its other half was just selected), the
|
|
6735
|
+
* class is dropped for a frame and re-applied, so the animation restarts.
|
|
6736
|
+
*/
|
|
6737
|
+
_pop(option) {
|
|
6738
|
+
const star = Math.ceil(option);
|
|
6739
|
+
if (this._popped() === star) {
|
|
6740
|
+
this._popped.set(null);
|
|
6741
|
+
requestAnimationFrame(() => this._popped.set(star));
|
|
6742
|
+
return;
|
|
6743
|
+
}
|
|
6744
|
+
this._popped.set(star);
|
|
6745
|
+
}
|
|
6746
|
+
/**
|
|
6747
|
+
* Restores every radio's native checked state from the model. Needed after a
|
|
6748
|
+
* reverted change: the browser has already moved the native check to the
|
|
6749
|
+
* activated radio, and the unchanged `checked` bindings won't move it back.
|
|
6750
|
+
*/
|
|
6751
|
+
_syncNativeChecked() {
|
|
6752
|
+
for (const inputRef of this._inputs()) {
|
|
6753
|
+
const element = inputRef.nativeElement;
|
|
6754
|
+
element.checked = Number(element.value) === this.value();
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Rating, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6758
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Rating, isStandalone: true, selector: "tls-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, allowHalf: { classPropertyName: "allowHalf", publicName: "allowHalf", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, preview: { classPropertyName: "preview", publicName: "preview", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "pointerleave": "onPointerLeave()" }, properties: { "class": "hostClasses()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null", "attr.aria-required": "required() ? 'true' : null", "attr.aria-readonly": "readonly() ? 'true' : null", "attr.aria-busy": "pending() ? 'true' : null" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Rating) }], queries: [{ propertyName: "starTemplate", first: true, predicate: ["starTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_inputs", predicate: ["radio"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (star of stars(); track star) {\n <span\n class=\"tls-rating-star\"\n [class.tls-rating-star--pop]=\"isPopped(star)\"\n (animationend)=\"onPopAnimationEnd(star)\"\n >\n <!-- Purely visual: the radios carry the accessible names and state. -->\n <span class=\"tls-rating-icons\" aria-hidden=\"true\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: false, preview: false }\"\n />\n @if (preview()) {\n <!-- Sits under the solid fill, so only the delta between the committed\n and hovered values peeks out as a ghost. -->\n <span class=\"tls-rating-fill tls-rating-fill--ghost\" [style.width.%]=\"ghostPercent(star)\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: true, preview: true }\"\n />\n </span>\n }\n <span class=\"tls-rating-fill\" [style.width.%]=\"fillPercent(star)\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: true, preview: false }\"\n />\n </span>\n </span>\n @if (allowHalf()) {\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--start\"\n [name]=\"radioName()\"\n [value]=\"star - 0.5\"\n [checked]=\"value() === star - 0.5\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star - 0.5)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star - 0.5)\"\n (change)=\"onChange(star - 0.5)\"\n (click)=\"onClick(star - 0.5)\"\n (blur)=\"touched.set(true)\"\n />\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--end\"\n [name]=\"radioName()\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star)\"\n (change)=\"onChange(star)\"\n (click)=\"onClick(star)\"\n (blur)=\"touched.set(true)\"\n />\n } @else {\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--whole\"\n [name]=\"radioName()\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star)\"\n (change)=\"onChange(star)\"\n (click)=\"onClick(star)\"\n (blur)=\"touched.set(true)\"\n />\n }\n </span>\n}\n\n<!-- One star layer's content: the consumer-provided star slot when present, the\n built-in star icon otherwise. Every layer (empty, ghost, solid fill) renders\n through this fragment so a custom star applies to all of them. -->\n<ng-template #starContent let-star let-filled=\"filled\" let-preview=\"preview\">\n <span class=\"tls-rating-icon\">\n @if (starTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: star,\n filled: filled,\n preview: preview,\n half: isHalf(star),\n }\"\n />\n } @else {\n <tls-icon [name]=\"filled ? 'star-filled' : 'star'\" />\n }\n </span>\n</ng-template>\n", styles: [":host{--tls-rating-gap: var(--spacing-1);display:inline-flex;align-items:center;gap:var(--tls-rating-gap)}\n"], dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
6759
|
+
}
|
|
6760
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Rating, decorators: [{
|
|
6761
|
+
type: Component,
|
|
6762
|
+
args: [{ selector: 'tls-rating', imports: [Icon, NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Rating) }], host: {
|
|
6763
|
+
role: 'radiogroup',
|
|
6764
|
+
'[class]': 'hostClasses()',
|
|
6765
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
6766
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
6767
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
6768
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
6769
|
+
'[attr.aria-required]': "required() ? 'true' : null",
|
|
6770
|
+
'[attr.aria-readonly]': "readonly() ? 'true' : null",
|
|
6771
|
+
'[attr.aria-busy]': "pending() ? 'true' : null",
|
|
6772
|
+
'(pointerleave)': 'onPointerLeave()',
|
|
6773
|
+
}, template: "@for (star of stars(); track star) {\n <span\n class=\"tls-rating-star\"\n [class.tls-rating-star--pop]=\"isPopped(star)\"\n (animationend)=\"onPopAnimationEnd(star)\"\n >\n <!-- Purely visual: the radios carry the accessible names and state. -->\n <span class=\"tls-rating-icons\" aria-hidden=\"true\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: false, preview: false }\"\n />\n @if (preview()) {\n <!-- Sits under the solid fill, so only the delta between the committed\n and hovered values peeks out as a ghost. -->\n <span class=\"tls-rating-fill tls-rating-fill--ghost\" [style.width.%]=\"ghostPercent(star)\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: true, preview: true }\"\n />\n </span>\n }\n <span class=\"tls-rating-fill\" [style.width.%]=\"fillPercent(star)\">\n <ng-container\n [ngTemplateOutlet]=\"starContent\"\n [ngTemplateOutletContext]=\"{ $implicit: star, filled: true, preview: false }\"\n />\n </span>\n </span>\n @if (allowHalf()) {\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--start\"\n [name]=\"radioName()\"\n [value]=\"star - 0.5\"\n [checked]=\"value() === star - 0.5\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star - 0.5)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star - 0.5)\"\n (change)=\"onChange(star - 0.5)\"\n (click)=\"onClick(star - 0.5)\"\n (blur)=\"touched.set(true)\"\n />\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--end\"\n [name]=\"radioName()\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star)\"\n (change)=\"onChange(star)\"\n (click)=\"onClick(star)\"\n (blur)=\"touched.set(true)\"\n />\n } @else {\n <input\n #radio\n type=\"radio\"\n class=\"tls-rating-input tls-rating-input--whole\"\n [name]=\"radioName()\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"starLabel(star)\"\n (pointerdown)=\"onPointerDown()\"\n (pointerenter)=\"onPointerEnter(star)\"\n (change)=\"onChange(star)\"\n (click)=\"onClick(star)\"\n (blur)=\"touched.set(true)\"\n />\n }\n </span>\n}\n\n<!-- One star layer's content: the consumer-provided star slot when present, the\n built-in star icon otherwise. Every layer (empty, ghost, solid fill) renders\n through this fragment so a custom star applies to all of them. -->\n<ng-template #starContent let-star let-filled=\"filled\" let-preview=\"preview\">\n <span class=\"tls-rating-icon\">\n @if (starTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: star,\n filled: filled,\n preview: preview,\n half: isHalf(star),\n }\"\n />\n } @else {\n <tls-icon [name]=\"filled ? 'star-filled' : 'star'\" />\n }\n </span>\n</ng-template>\n", styles: [":host{--tls-rating-gap: var(--spacing-1);display:inline-flex;align-items:center;gap:var(--tls-rating-gap)}\n"] }]
|
|
6774
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], allowHalf: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowHalf", required: false }] }], allowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClear", required: false }] }], preview: [{ type: i0.Input, args: [{ isSignal: true, alias: "preview", required: false }] }], starTemplate: [{ type: i0.ContentChild, args: ['starTemplate', { isSignal: true }] }], _inputs: [{ type: i0.ViewChildren, args: ['radio', { isSignal: true }] }] } });
|
|
6775
|
+
|
|
6085
6776
|
const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
6086
6777
|
size: 'md',
|
|
6087
6778
|
placeholder: '',
|
|
@@ -6090,6 +6781,9 @@ const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
|
6090
6781
|
maxLabels: 2,
|
|
6091
6782
|
clearLabel: 'Clear',
|
|
6092
6783
|
selectedCountLabel: count => `${count} selected`,
|
|
6784
|
+
virtualScroll: false,
|
|
6785
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
6786
|
+
virtualScrollItemSize: 39,
|
|
6093
6787
|
};
|
|
6094
6788
|
|
|
6095
6789
|
const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
|
|
@@ -6103,6 +6797,7 @@ class MultiSelect extends AbstractSelect {
|
|
|
6103
6797
|
uniqueId = `tls-multi-select-${MultiSelect._nextUniqueId++}`;
|
|
6104
6798
|
hostClassBase = 'tls-multi-select';
|
|
6105
6799
|
panelClass = 'tls-multi-select-panel';
|
|
6800
|
+
panelCssVariablePrefix = '--tls-multi-select-panel';
|
|
6106
6801
|
value = model([], /* @ts-ignore */
|
|
6107
6802
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6108
6803
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -6115,6 +6810,8 @@ class MultiSelect extends AbstractSelect {
|
|
|
6115
6810
|
...(ngDevMode ? [{ debugName: "maxLabels" }] : /* istanbul ignore next */ []));
|
|
6116
6811
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
6117
6812
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
6813
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6814
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6118
6815
|
hasValue = computed(() => this.value().length > 0, /* @ts-ignore */
|
|
6119
6816
|
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
6120
6817
|
selectedValues = computed(() => new Set(this.value()), /* @ts-ignore */
|
|
@@ -6161,14 +6858,14 @@ class MultiSelect extends AbstractSelect {
|
|
|
6161
6858
|
this.toggleOption(option);
|
|
6162
6859
|
}
|
|
6163
6860
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6164
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
6861
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-multi-select__panel tls-multi-select__panel--virtual\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [ariaMultiselectable]=\"true\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
6165
6862
|
}
|
|
6166
6863
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
6167
6864
|
type: Component,
|
|
6168
|
-
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
6865
|
+
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
6169
6866
|
'[class]': 'hostClasses()',
|
|
6170
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
6171
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }] } });
|
|
6867
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-multi-select__panel tls-multi-select__panel--virtual\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [ariaMultiselectable]=\"true\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n }\n </ul>\n }\n</ng-template>\n" }]
|
|
6868
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
|
|
6172
6869
|
|
|
6173
6870
|
const DEFAULT_SELECT_CONFIG = {
|
|
6174
6871
|
size: 'md',
|
|
@@ -6176,6 +6873,9 @@ const DEFAULT_SELECT_CONFIG = {
|
|
|
6176
6873
|
fluid: false,
|
|
6177
6874
|
clearable: false,
|
|
6178
6875
|
clearLabel: 'Clear',
|
|
6876
|
+
virtualScroll: false,
|
|
6877
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
6878
|
+
virtualScrollItemSize: 39,
|
|
6179
6879
|
};
|
|
6180
6880
|
|
|
6181
6881
|
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
@@ -6189,6 +6889,7 @@ class Select extends AbstractSelect {
|
|
|
6189
6889
|
uniqueId = `tls-select-${Select._nextUniqueId++}`;
|
|
6190
6890
|
hostClassBase = 'tls-select';
|
|
6191
6891
|
panelClass = 'tls-select-panel';
|
|
6892
|
+
panelCssVariablePrefix = '--tls-select-panel';
|
|
6192
6893
|
value = model(null, /* @ts-ignore */
|
|
6193
6894
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6194
6895
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -6199,6 +6900,8 @@ class Select extends AbstractSelect {
|
|
|
6199
6900
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6200
6901
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
6201
6902
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
6903
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6904
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6202
6905
|
hasValue = computed(() => {
|
|
6203
6906
|
const value = this.value();
|
|
6204
6907
|
return value !== null && value !== undefined && value !== '';
|
|
@@ -6238,14 +6941,14 @@ class Select extends AbstractSelect {
|
|
|
6238
6941
|
this.select(option);
|
|
6239
6942
|
}
|
|
6240
6943
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6241
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
6944
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-select__panel tls-select__panel--virtual\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
6242
6945
|
}
|
|
6243
6946
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
6244
6947
|
type: Component,
|
|
6245
|
-
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
6948
|
+
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
6246
6949
|
'[class]': 'hostClasses()',
|
|
6247
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <
|
|
6248
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }] } });
|
|
6950
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-select__panel tls-select__panel--virtual\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n }\n </ul>\n }\n</ng-template>\n" }]
|
|
6951
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
|
|
6249
6952
|
|
|
6250
6953
|
const DEFAULT_SLIDER_CONFIG = {
|
|
6251
6954
|
color: 'primary',
|
|
@@ -7465,11 +8168,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7465
8168
|
}]
|
|
7466
8169
|
}], ctorParameters: () => [], propDecorators: { tlsPaginationQuerySync: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsPaginationQuerySync", required: false }] }] } });
|
|
7467
8170
|
|
|
8171
|
+
const DEFAULT_PROGRESS_CONFIG = {
|
|
8172
|
+
max: 100,
|
|
8173
|
+
color: 'primary',
|
|
8174
|
+
size: 'md',
|
|
8175
|
+
activeSegmentScale: 2,
|
|
8176
|
+
};
|
|
8177
|
+
|
|
8178
|
+
const PROGRESS_CONFIG = new InjectionToken('PROGRESS_CONFIG', {
|
|
8179
|
+
factory: () => DEFAULT_PROGRESS_CONFIG,
|
|
8180
|
+
});
|
|
8181
|
+
|
|
8182
|
+
/**
|
|
8183
|
+
* A read-only linear progress indicator. Renders one continuous bar by
|
|
8184
|
+
* default; `segments` splits the track into that many discrete pills that fill
|
|
8185
|
+
* in order as the value advances — the idiom for step-based flows ("step 2 of
|
|
8186
|
+
* 6"). The host carries the `progressbar` role and the value ARIA.
|
|
8187
|
+
*/
|
|
8188
|
+
class Progress {
|
|
8189
|
+
// Injections
|
|
8190
|
+
_config = inject(PROGRESS_CONFIG);
|
|
8191
|
+
// Inputs
|
|
8192
|
+
value = input(0, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8193
|
+
max = input(this._config.max, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8194
|
+
/**
|
|
8195
|
+
* Splits the track into this many equal segments, filled one after another
|
|
8196
|
+
* as the value grows, the segment at the boundary partially. `null` renders
|
|
8197
|
+
* one continuous bar.
|
|
8198
|
+
*/
|
|
8199
|
+
segments = input(null, /* @ts-ignore */
|
|
8200
|
+
...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
8201
|
+
/**
|
|
8202
|
+
* Segment rendered wider than the rest, marking the step in progress: a
|
|
8203
|
+
* zero-based index, or `'latest'` to follow the frontmost segment the value
|
|
8204
|
+
* has reached. `null` keeps every segment the same width. Only meaningful
|
|
8205
|
+
* with `segments`.
|
|
8206
|
+
*/
|
|
8207
|
+
activeSegment = input(null, /* @ts-ignore */
|
|
8208
|
+
...(ngDevMode ? [{ debugName: "activeSegment" }] : /* istanbul ignore next */ []));
|
|
8209
|
+
/** Width of the active segment relative to the others (a flex-grow ratio). */
|
|
8210
|
+
activeSegmentScale = input(this._config.activeSegmentScale, { ...(ngDevMode ? { debugName: "activeSegmentScale" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8211
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
8212
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
8213
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
8214
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
8215
|
+
/** Accessible name for the progressbar. */
|
|
8216
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
8217
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
8218
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
8219
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
8220
|
+
// Computed
|
|
8221
|
+
hostClasses = computed(() => {
|
|
8222
|
+
const className = 'tls-progress';
|
|
8223
|
+
const array = [className];
|
|
8224
|
+
array.push(`${className}--${this.color()}`);
|
|
8225
|
+
array.push(`${className}--${this.size()}`);
|
|
8226
|
+
return array;
|
|
8227
|
+
}, /* @ts-ignore */
|
|
8228
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
8229
|
+
/** Value clamped into [0, max]; the number exposed through ARIA. */
|
|
8230
|
+
clampedValue = computed(() => Math.min(Math.max(this.value(), 0), this.max()), /* @ts-ignore */
|
|
8231
|
+
...(ngDevMode ? [{ debugName: "clampedValue" }] : /* istanbul ignore next */ []));
|
|
8232
|
+
/** Filled share of the whole track, 0–1. */
|
|
8233
|
+
_fraction = computed(() => {
|
|
8234
|
+
const max = this.max();
|
|
8235
|
+
if (max <= 0)
|
|
8236
|
+
return 0;
|
|
8237
|
+
return this.clampedValue() / max;
|
|
8238
|
+
}, /* @ts-ignore */
|
|
8239
|
+
...(ngDevMode ? [{ debugName: "_fraction" }] : /* istanbul ignore next */ []));
|
|
8240
|
+
/**
|
|
8241
|
+
* Per-segment fill percentages, 0–100. A continuous bar is a single
|
|
8242
|
+
* segment, so one loop renders both looks; in segmented mode the overall
|
|
8243
|
+
* fraction is distributed across the segments in order, so each is full,
|
|
8244
|
+
* empty, or — at the boundary — partial.
|
|
8245
|
+
*/
|
|
8246
|
+
segmentFills = computed(() => {
|
|
8247
|
+
const segments = this.segments();
|
|
8248
|
+
const fraction = this._fraction();
|
|
8249
|
+
if (segments === null || segments < 2)
|
|
8250
|
+
return [fraction * 100];
|
|
8251
|
+
const count = Math.floor(segments);
|
|
8252
|
+
return Array.from({ length: count }, (_, index) => Math.min(Math.max(fraction * count - index, 0), 1) * 100);
|
|
8253
|
+
}, /* @ts-ignore */
|
|
8254
|
+
...(ngDevMode ? [{ debugName: "segmentFills" }] : /* istanbul ignore next */ []));
|
|
8255
|
+
/**
|
|
8256
|
+
* Index of the emphasized segment, or `null` when none: the clamped
|
|
8257
|
+
* consumer-picked index, or — for `'latest'` — the frontmost segment the
|
|
8258
|
+
* value has reached (the first one when nothing is filled yet).
|
|
8259
|
+
*/
|
|
8260
|
+
activeIndex = computed(() => {
|
|
8261
|
+
const activeSegment = this.activeSegment();
|
|
8262
|
+
if (activeSegment === null)
|
|
8263
|
+
return null;
|
|
8264
|
+
const count = this.segmentFills().length;
|
|
8265
|
+
if (count < 2)
|
|
8266
|
+
return null;
|
|
8267
|
+
const index = activeSegment === 'latest'
|
|
8268
|
+
? Math.ceil(this._fraction() * count) - 1
|
|
8269
|
+
: Math.floor(activeSegment);
|
|
8270
|
+
return Math.min(Math.max(index, 0), count - 1);
|
|
8271
|
+
}, /* @ts-ignore */
|
|
8272
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
8273
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Progress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8274
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Progress, isStandalone: true, selector: "tls-progress", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: false, transformFunction: null }, activeSegment: { classPropertyName: "activeSegment", publicName: "activeSegment", isSignal: true, isRequired: false, transformFunction: null }, activeSegmentScale: { classPropertyName: "activeSegmentScale", publicName: "activeSegmentScale", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar", "aria-valuemin": "0" }, properties: { "class": "hostClasses()", "attr.aria-valuemax": "max()", "attr.aria-valuenow": "clampedValue()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "ariaLabelledby() ?? null" } }, ngImport: i0, template: "@for (segmentFill of segmentFills(); track $index) {\n <div\n class=\"tls-progress-segment\"\n [style.flex-grow]=\"$index === activeIndex() ? activeSegmentScale() : null\"\n >\n <div class=\"tls-progress-fill\" [style.inline-size.%]=\"segmentFill\"></div>\n </div>\n}\n", styles: [":host{--tls-progress-gap: var(--spacing-2);display:flex;align-items:center;gap:var(--tls-progress-gap)}\n"] });
|
|
8275
|
+
}
|
|
8276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Progress, decorators: [{
|
|
8277
|
+
type: Component,
|
|
8278
|
+
args: [{ selector: 'tls-progress', imports: [], host: {
|
|
8279
|
+
role: 'progressbar',
|
|
8280
|
+
'[class]': 'hostClasses()',
|
|
8281
|
+
'aria-valuemin': '0',
|
|
8282
|
+
'[attr.aria-valuemax]': 'max()',
|
|
8283
|
+
'[attr.aria-valuenow]': 'clampedValue()',
|
|
8284
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
8285
|
+
'[attr.aria-labelledby]': 'ariaLabelledby() ?? null',
|
|
8286
|
+
}, template: "@for (segmentFill of segmentFills(); track $index) {\n <div\n class=\"tls-progress-segment\"\n [style.flex-grow]=\"$index === activeIndex() ? activeSegmentScale() : null\"\n >\n <div class=\"tls-progress-fill\" [style.inline-size.%]=\"segmentFill\"></div>\n </div>\n}\n", styles: [":host{--tls-progress-gap: var(--spacing-2);display:flex;align-items:center;gap:var(--tls-progress-gap)}\n"] }]
|
|
8287
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: false }] }], activeSegment: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeSegment", required: false }] }], activeSegmentScale: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeSegmentScale", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }] } });
|
|
8288
|
+
|
|
7468
8289
|
const DEFAULT_SKELETON_CONFIG = {
|
|
7469
8290
|
size: null,
|
|
7470
8291
|
width: null,
|
|
7471
8292
|
height: null,
|
|
7472
|
-
radius:
|
|
8293
|
+
radius: 'md',
|
|
7473
8294
|
duration: 2500,
|
|
7474
8295
|
rounded: false,
|
|
7475
8296
|
animate: true,
|
|
@@ -7480,7 +8301,9 @@ const SKELETON_CONFIG = new InjectionToken('SKELETON_CONFIG', {
|
|
|
7480
8301
|
});
|
|
7481
8302
|
|
|
7482
8303
|
class Skeleton {
|
|
8304
|
+
// Injections
|
|
7483
8305
|
_config = inject(SKELETON_CONFIG);
|
|
8306
|
+
// Inputs
|
|
7484
8307
|
size = input(this._config.size, /* @ts-ignore */
|
|
7485
8308
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
7486
8309
|
width = input(this._config.width, /* @ts-ignore */
|
|
@@ -7493,6 +8316,7 @@ class Skeleton {
|
|
|
7493
8316
|
...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
7494
8317
|
rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7495
8318
|
animate = input(this._config.animate, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
8319
|
+
// Computed
|
|
7496
8320
|
hostClasses = computed(() => {
|
|
7497
8321
|
const className = 'tls-skeleton';
|
|
7498
8322
|
const array = [className];
|
|
@@ -7506,23 +8330,29 @@ class Skeleton {
|
|
|
7506
8330
|
const size = this.size();
|
|
7507
8331
|
const width = this.width() ?? size;
|
|
7508
8332
|
const height = this.height() ?? size;
|
|
7509
|
-
const rounded = this.rounded();
|
|
7510
|
-
const radius = this.radius();
|
|
7511
8333
|
return {
|
|
7512
|
-
'--tls-skeleton-width': this.
|
|
7513
|
-
'--tls-skeleton-height': this.
|
|
7514
|
-
'--tls-skeleton-radius': rounded ? '50%' :
|
|
8334
|
+
'--tls-skeleton-width': this._resolveDimension(width),
|
|
8335
|
+
'--tls-skeleton-height': this._resolveDimension(height),
|
|
8336
|
+
'--tls-skeleton-radius': this.rounded() ? '50%' : this._resolveRadius(this.radius()),
|
|
7515
8337
|
'--tls-skeleton-duration': `${this.duration()}ms`,
|
|
7516
8338
|
};
|
|
7517
8339
|
}, /* @ts-ignore */
|
|
7518
8340
|
...(ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []));
|
|
7519
|
-
|
|
8341
|
+
// Private methods
|
|
8342
|
+
_resolveDimension(value) {
|
|
7520
8343
|
if (value === null)
|
|
7521
8344
|
return '100%';
|
|
7522
8345
|
if (typeof value === 'string')
|
|
7523
8346
|
return value;
|
|
7524
8347
|
return `${value}px`;
|
|
7525
8348
|
}
|
|
8349
|
+
_resolveRadius(value) {
|
|
8350
|
+
if (typeof value === 'number')
|
|
8351
|
+
return `${value}px`;
|
|
8352
|
+
if (RADIUS_TOKENS.some(token => token === value))
|
|
8353
|
+
return `var(--radius-${value})`;
|
|
8354
|
+
return value;
|
|
8355
|
+
}
|
|
7526
8356
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Skeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7527
8357
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Skeleton, isStandalone: true, selector: "tls-skeleton", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "hostClasses()", "style": "hostStyles()" } }, ngImport: i0, template: '', isInline: true });
|
|
7528
8358
|
}
|
|
@@ -7927,9 +8757,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7927
8757
|
const DEFAULT_STEP_CONFIG = {
|
|
7928
8758
|
color: 'primary',
|
|
7929
8759
|
};
|
|
8760
|
+
const DEFAULT_STEPPER_LABELS = {
|
|
8761
|
+
completed: 'Completed',
|
|
8762
|
+
invalid: 'Invalid',
|
|
8763
|
+
};
|
|
7930
8764
|
const DEFAULT_STEPPER_CONFIG = {
|
|
7931
8765
|
orientation: 'horizontal',
|
|
8766
|
+
labelPosition: 'end',
|
|
7932
8767
|
linear: false,
|
|
8768
|
+
labels: DEFAULT_STEPPER_LABELS,
|
|
7933
8769
|
step: DEFAULT_STEP_CONFIG,
|
|
7934
8770
|
};
|
|
7935
8771
|
|
|
@@ -7954,6 +8790,12 @@ class Step {
|
|
|
7954
8790
|
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
7955
8791
|
disabled = input(false, /* @ts-ignore */
|
|
7956
8792
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
8793
|
+
/**
|
|
8794
|
+
* Marks the step's content as invalid: its header takes the danger hue and
|
|
8795
|
+
* assistive technology hears the invalid state. Drive it from the step's
|
|
8796
|
+
* form validity to surface errors in the navigation.
|
|
8797
|
+
*/
|
|
8798
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7957
8799
|
hostClasses = computed(() => {
|
|
7958
8800
|
const className = 'tls-step';
|
|
7959
8801
|
const array = [className];
|
|
@@ -7965,17 +8807,19 @@ class Step {
|
|
|
7965
8807
|
}, /* @ts-ignore */
|
|
7966
8808
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
7967
8809
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7968
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Step, isStandalone: true, selector: "tls-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.TabPanel, inputs: ["value", "value"] }], ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
8810
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Step, isStandalone: true, selector: "tls-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.TabPanel, inputs: ["value", "value"] }], ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
7969
8811
|
}
|
|
7970
8812
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, decorators: [{
|
|
7971
8813
|
type: Component,
|
|
7972
8814
|
args: [{ selector: 'tls-step', imports: [], hostDirectives: [{ directive: TabPanel, inputs: ['value'] }], host: {
|
|
7973
8815
|
'[class]': 'hostClasses()',
|
|
7974
8816
|
}, template: "<ng-content></ng-content>\n" }]
|
|
7975
|
-
}], propDecorators: { iconTemplateRef: [{ type: i0.ContentChild, args: ['stepIcon', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
8817
|
+
}], propDecorators: { iconTemplateRef: [{ type: i0.ContentChild, args: ['stepIcon', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }] } });
|
|
7976
8818
|
|
|
7977
8819
|
class Stepper {
|
|
7978
8820
|
_config = inject(STEPPER_CONFIG);
|
|
8821
|
+
/** Visually hidden state texts appended to a step's accessible name. */
|
|
8822
|
+
labels = this._config.labels;
|
|
7979
8823
|
steps = contentChildren(Step, /* @ts-ignore */
|
|
7980
8824
|
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
7981
8825
|
completedTemplateRef = contentChild('completedTemplate', /* @ts-ignore */
|
|
@@ -7986,6 +8830,8 @@ class Stepper {
|
|
|
7986
8830
|
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
7987
8831
|
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
7988
8832
|
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
8833
|
+
labelPosition = input(this._config.labelPosition, /* @ts-ignore */
|
|
8834
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
7989
8835
|
completed = input(false, /* @ts-ignore */
|
|
7990
8836
|
...(ngDevMode ? [{ debugName: "completed" }] : /* istanbul ignore next */ []));
|
|
7991
8837
|
linear = input(this._config.linear, /* @ts-ignore */
|
|
@@ -8000,6 +8846,7 @@ class Stepper {
|
|
|
8000
8846
|
const className = 'tls-stepper';
|
|
8001
8847
|
const array = [className];
|
|
8002
8848
|
array.push(`${className}--${this.orientation()}`);
|
|
8849
|
+
array.push(`${className}--label-${this.labelPosition()}`);
|
|
8003
8850
|
if (this.completed())
|
|
8004
8851
|
array.push(`${className}--completed`);
|
|
8005
8852
|
return array;
|
|
@@ -8016,14 +8863,14 @@ class Stepper {
|
|
|
8016
8863
|
this.stepSelect.emit({ index, value });
|
|
8017
8864
|
}
|
|
8018
8865
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8019
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.Tabs }], ngImport: i0, template: "<ul\n class=\"tls-stepper-header\"\n ngTabList\n [orientation]=\"orientation()\"\n [wrap]=\"false\"\n [softDisabled]=\"false\"\n [selectedTab]=\"active()\"\n (selectedTabChange)=\"onSelectedTabChange($event)\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-
|
|
8866
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.Tabs }], ngImport: i0, template: "<ul\n class=\"tls-stepper-header\"\n ngTabList\n [orientation]=\"orientation()\"\n [wrap]=\"false\"\n [softDisabled]=\"false\"\n [selectedTab]=\"active()\"\n (selectedTabChange)=\"onSelectedTabChange($event)\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n @let isCompleted = activeIndex() > index || completed();\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header__item--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"ariaTab.selected()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--invalid]=\"step.invalid()\"\n [class.tls-stepper-header__item--completed]=\"isCompleted\">\n <button\n #ariaTab=\"ngTab\"\n ngTab\n class=\"tls-stepper-header-button\"\n type=\"button\"\n [value]=\"step.value()\"\n [disabled]=\"step.disabled() || (linear() && index > activeIndex() + 1)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n\n @if (step.invalid()) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.invalid }}</span>\n } @else if (isCompleted) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.completed }}</span>\n }\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TabList, selector: "[ngTabList]", inputs: ["orientation", "wrap", "softDisabled", "focusMode", "selectionMode", "selectedTab", "disabled"], outputs: ["selectedTabChange"], exportAs: ["ngTabList"] }, { kind: "directive", type: Tab$1, selector: "[ngTab]", inputs: ["id", "disabled", "value"], exportAs: ["ngTab"] }] });
|
|
8020
8867
|
}
|
|
8021
8868
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, decorators: [{
|
|
8022
8869
|
type: Component,
|
|
8023
8870
|
args: [{ selector: 'tls-stepper', imports: [NgTemplateOutlet, TabList, Tab$1], hostDirectives: [Tabs$1], host: {
|
|
8024
8871
|
'[class]': 'hostClasses()',
|
|
8025
|
-
}, template: "<ul\n class=\"tls-stepper-header\"\n ngTabList\n [orientation]=\"orientation()\"\n [wrap]=\"false\"\n [softDisabled]=\"false\"\n [selectedTab]=\"active()\"\n (selectedTabChange)=\"onSelectedTabChange($event)\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-
|
|
8026
|
-
}], propDecorators: { steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Step), { isSignal: true }] }], completedTemplateRef: [{ type: i0.ContentChild, args: ['completedTemplate', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }, { type: i0.Output, args: ["activeChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }] } });
|
|
8872
|
+
}, template: "<ul\n class=\"tls-stepper-header\"\n ngTabList\n [orientation]=\"orientation()\"\n [wrap]=\"false\"\n [softDisabled]=\"false\"\n [selectedTab]=\"active()\"\n (selectedTabChange)=\"onSelectedTabChange($event)\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n @let isCompleted = activeIndex() > index || completed();\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header__item--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"ariaTab.selected()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--invalid]=\"step.invalid()\"\n [class.tls-stepper-header__item--completed]=\"isCompleted\">\n <button\n #ariaTab=\"ngTab\"\n ngTab\n class=\"tls-stepper-header-button\"\n type=\"button\"\n [value]=\"step.value()\"\n [disabled]=\"step.disabled() || (linear() && index > activeIndex() + 1)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n\n @if (step.invalid()) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.invalid }}</span>\n } @else if (isCompleted) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.completed }}</span>\n }\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n" }]
|
|
8873
|
+
}], propDecorators: { steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Step), { isSignal: true }] }], completedTemplateRef: [{ type: i0.ContentChild, args: ['completedTemplate', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }, { type: i0.Output, args: ["activeChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }] } });
|
|
8027
8874
|
|
|
8028
8875
|
const DEFAULT_TAB_NAV_CONFIG = {
|
|
8029
8876
|
variant: 'flat',
|
|
@@ -8187,6 +9034,12 @@ class Table {
|
|
|
8187
9034
|
striped = input(this._config.striped, { ...(ngDevMode ? { debugName: "striped" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
8188
9035
|
trackBy = input(/* @ts-ignore */
|
|
8189
9036
|
...(ngDevMode ? [undefined, { debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
9037
|
+
/**
|
|
9038
|
+
* Bounds the table's height, in pixels. When set, the host becomes the scroll
|
|
9039
|
+
* container for the rows and the header row sticks to its top edge while they
|
|
9040
|
+
* scroll. Left unset the table grows with its content and nothing scrolls.
|
|
9041
|
+
*/
|
|
9042
|
+
maxHeight = input(undefined, { ...(ngDevMode ? { debugName: "maxHeight" } : /* istanbul ignore next */ {}), transform: value => value === undefined || value === null ? undefined : numberAttribute(value) });
|
|
8190
9043
|
/** Accessible name for the table, forwarded to the inner `<table>` element. */
|
|
8191
9044
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
8192
9045
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -8222,15 +9075,10 @@ class Table {
|
|
|
8222
9075
|
return filtered;
|
|
8223
9076
|
}, []), /* @ts-ignore */
|
|
8224
9077
|
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
8225
|
-
resolvedTrackBy = computed(() =>
|
|
8226
|
-
const trackBy = this.trackBy();
|
|
8227
|
-
if (trackBy === undefined)
|
|
8228
|
-
return (_, row) => row;
|
|
8229
|
-
if (typeof trackBy === 'string')
|
|
8230
|
-
return (_, row) => row[trackBy];
|
|
8231
|
-
return trackBy;
|
|
8232
|
-
}, /* @ts-ignore */
|
|
9078
|
+
resolvedTrackBy = computed(() => resolveTrackBy(this.trackBy()), /* @ts-ignore */
|
|
8233
9079
|
...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : /* istanbul ignore next */ []));
|
|
9080
|
+
scrollable = computed(() => this.maxHeight() !== undefined, /* @ts-ignore */
|
|
9081
|
+
...(ngDevMode ? [{ debugName: "scrollable" }] : /* istanbul ignore next */ []));
|
|
8234
9082
|
classes = computed(() => {
|
|
8235
9083
|
const className = 'tls-table';
|
|
8236
9084
|
const array = [className];
|
|
@@ -8270,7 +9118,7 @@ class Table {
|
|
|
8270
9118
|
return definition;
|
|
8271
9119
|
}
|
|
8272
9120
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8273
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Table, isStandalone: true, selector: "tls-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, columnDefinitions: { classPropertyName: "columnDefinitions", publicName: "columnDefinitions", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "tableColumns", predicate: TableColumn, isSignal: true }], ngImport: i0, template: "<table\n cdk-table\n [class]=\"classes()\"\n [dataSource]=\"dataSource\"\n [trackBy]=\"resolvedTrackBy()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout", "recycleRows"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "directive", type: CdkHeaderRowDef, selector: "[cdkHeaderRowDef]", inputs: ["cdkHeaderRowDef", "cdkHeaderRowDefSticky"] }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "directive", type: CdkRowDef, selector: "[cdkRowDef]", inputs: ["cdkRowDefColumns", "cdkRowDefWhen"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
9121
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Table, isStandalone: true, selector: "tls-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, columnDefinitions: { classPropertyName: "columnDefinitions", publicName: "columnDefinitions", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tls-table-container--scrollable": "scrollable()", "style.max-height.px": "maxHeight() ?? null" }, classAttribute: "tls-table-container" }, queries: [{ propertyName: "tableColumns", predicate: TableColumn, isSignal: true }], ngImport: i0, template: "<table\n cdk-table\n [class]=\"classes()\"\n [dataSource]=\"dataSource\"\n [trackBy]=\"resolvedTrackBy()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns(); sticky: scrollable()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}:host.tls-table-container--scrollable{overflow-y:auto;overscroll-behavior:contain}\n"], dependencies: [{ kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout", "recycleRows"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "directive", type: CdkHeaderRowDef, selector: "[cdkHeaderRowDef]", inputs: ["cdkHeaderRowDef", "cdkHeaderRowDefSticky"] }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "directive", type: CdkRowDef, selector: "[cdkRowDef]", inputs: ["cdkRowDefColumns", "cdkRowDefWhen"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
8274
9122
|
}
|
|
8275
9123
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Table, decorators: [{
|
|
8276
9124
|
type: Component,
|
|
@@ -8286,8 +9134,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
8286
9134
|
CdkRow,
|
|
8287
9135
|
CdkRowDef,
|
|
8288
9136
|
NgTemplateOutlet,
|
|
8289
|
-
], host: {
|
|
8290
|
-
|
|
9137
|
+
], host: {
|
|
9138
|
+
class: 'tls-table-container',
|
|
9139
|
+
'[class.tls-table-container--scrollable]': 'scrollable()',
|
|
9140
|
+
'[style.max-height.px]': 'maxHeight() ?? null',
|
|
9141
|
+
}, template: "<table\n cdk-table\n [class]=\"classes()\"\n [dataSource]=\"dataSource\"\n [trackBy]=\"resolvedTrackBy()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns(); sticky: scrollable()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}:host.tls-table-container--scrollable{overflow-y:auto;overscroll-behavior:contain}\n"] }]
|
|
9142
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], columnDefinitions: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnDefinitions", required: false }] }], hideHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideHeader", required: false }] }], striped: [{ type: i0.Input, args: [{ isSignal: true, alias: "striped", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], tableColumns: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TableColumn), { isSignal: true }] }] } });
|
|
8291
9143
|
|
|
8292
9144
|
// A declarative content holder: the host element itself is never rendered. `tls-tabs`
|
|
8293
9145
|
// reads the captured content/header templates and renders them inside its own
|
|
@@ -9064,10 +9916,20 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9064
9916
|
provide: POPOVER_CONFIG,
|
|
9065
9917
|
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, components.popover),
|
|
9066
9918
|
},
|
|
9919
|
+
{
|
|
9920
|
+
provide: PROGRESS_CONFIG,
|
|
9921
|
+
useValue: deepMerge(DEFAULT_PROGRESS_CONFIG, components.progress),
|
|
9922
|
+
},
|
|
9067
9923
|
{
|
|
9068
9924
|
provide: RADIO_BUTTON_CONFIG,
|
|
9069
9925
|
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, components.radioButton),
|
|
9070
9926
|
},
|
|
9927
|
+
{
|
|
9928
|
+
provide: RATING_CONFIG,
|
|
9929
|
+
// `labels` is a deep-partial override; deepMerge merges it recursively, but its
|
|
9930
|
+
// `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
9931
|
+
useValue: deepMerge(DEFAULT_RATING_CONFIG, components.rating),
|
|
9932
|
+
},
|
|
9071
9933
|
{
|
|
9072
9934
|
provide: SELECT_CONFIG,
|
|
9073
9935
|
useValue: deepMerge(DEFAULT_SELECT_CONFIG, components.select),
|
|
@@ -9086,6 +9948,9 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9086
9948
|
},
|
|
9087
9949
|
{
|
|
9088
9950
|
provide: STEPPER_CONFIG,
|
|
9951
|
+
// `labels` and `step` are deep-partial overrides; deepMerge merges them
|
|
9952
|
+
// recursively, but its `Partial<T>` signature only models a shallow
|
|
9953
|
+
// partial, so cast to it.
|
|
9089
9954
|
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, components.stepper),
|
|
9090
9955
|
},
|
|
9091
9956
|
{
|
|
@@ -9120,6 +9985,10 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9120
9985
|
provide: TOOLTIP_CONFIG,
|
|
9121
9986
|
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, components.tooltip),
|
|
9122
9987
|
},
|
|
9988
|
+
{
|
|
9989
|
+
provide: VIRTUAL_SCROLL_CONFIG,
|
|
9990
|
+
useValue: deepMerge(DEFAULT_VIRTUAL_SCROLL_CONFIG, components.virtualScroll),
|
|
9991
|
+
},
|
|
9123
9992
|
]);
|
|
9124
9993
|
};
|
|
9125
9994
|
|
|
@@ -9127,5 +9996,5 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9127
9996
|
* Generated bundle index. Do not edit.
|
|
9128
9997
|
*/
|
|
9129
9998
|
|
|
9130
|
-
export { ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, AUTOCOMPLETE_CONFIG, ActivityHeatmap, Alert, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, HIGHLIGHT_CONFIG, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, ValueFormControl, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, provideThalassicIcons, provideThalassicUIConfig, resolveActivityLevel };
|
|
9999
|
+
export { ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, AUTOCOMPLETE_CONFIG, ActivityHeatmap, Alert, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_PROGRESS_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_RATING_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEPPER_LABELS, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DEFAULT_VIRTUAL_SCROLL_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogRef, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, HIGHLIGHT_CONFIG, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, PROGRESS_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, Progress, RADIO_BUTTON_CONFIG, RATING_CONFIG, RadioButton, Rating, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, VIRTUAL_SCROLL_CONFIG, ValueFormControl, VirtualScroll, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, provideThalassicIcons, provideThalassicUIConfig, resolveActivityLevel };
|
|
9131
10000
|
//# sourceMappingURL=thalassic-ui.mjs.map
|