@thalassic/ui 22.16.0 → 22.17.0
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 +1472 -602
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +629 -50
|
@@ -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',
|
|
@@ -983,14 +531,788 @@ const resolveOverlayArrowPosition = (connectionPair) => {
|
|
|
983
531
|
alignment: OVERLAY_ARROW_BLOCK_ALIGNMENT_MAP[overlayY],
|
|
984
532
|
};
|
|
985
533
|
}
|
|
986
|
-
return null;
|
|
987
|
-
};
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
534
|
+
return null;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Resolves the shapes a `trackBy` input accepts into the function Angular's differs
|
|
539
|
+
* expect: a property key becomes a lookup of that property, an explicit function
|
|
540
|
+
* passes through, and an absent value falls back to tracking by item identity.
|
|
541
|
+
*/
|
|
542
|
+
const resolveTrackBy = (key) => {
|
|
543
|
+
if (key === undefined)
|
|
544
|
+
return (_, item) => item;
|
|
545
|
+
if (typeof key === 'function')
|
|
546
|
+
return key;
|
|
547
|
+
return (_, item) => item[key];
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/** Reorders Sunday-first weekday labels so the one for `weekStartsOn` comes first. */
|
|
551
|
+
const rotateWeekDays = (weekDays, weekStartsOn) => [
|
|
552
|
+
...weekDays.slice(weekStartsOn),
|
|
553
|
+
...weekDays.slice(0, weekStartsOn),
|
|
554
|
+
];
|
|
555
|
+
|
|
556
|
+
const DEFAULT_VIRTUAL_SCROLL_CONFIG = {
|
|
557
|
+
itemSize: 48,
|
|
558
|
+
minBufferPx: 200,
|
|
559
|
+
maxBufferPx: 400,
|
|
560
|
+
orientation: 'vertical',
|
|
561
|
+
appendOnly: false,
|
|
562
|
+
templateCacheSize: 20,
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
const VIRTUAL_SCROLL_CONFIG = new InjectionToken('VIRTUAL_SCROLL_CONFIG', { factory: () => DEFAULT_VIRTUAL_SCROLL_CONFIG });
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Scroll container that renders only the items intersecting the visible window plus a
|
|
569
|
+
* buffer, keeping the DOM a constant size however long the collection is. Every item
|
|
570
|
+
* occupies the same fixed extent along the scroll axis, declared by `itemSize`.
|
|
571
|
+
*
|
|
572
|
+
* The collection arrives as the `items` input and each item is rendered through a
|
|
573
|
+
* template projected under the `#item` reference:
|
|
574
|
+
*
|
|
575
|
+
* ```html
|
|
576
|
+
* <tls-virtual-scroll [items]="rows()" [itemSize]="48" trackBy="id">
|
|
577
|
+
* <ng-template #item let-row let-index="index" let-count="count">
|
|
578
|
+
* <div class="row" role="listitem" [attr.aria-posinset]="index + 1" [attr.aria-setsize]="count">
|
|
579
|
+
* {{ row.name }}
|
|
580
|
+
* </div>
|
|
581
|
+
* </ng-template>
|
|
582
|
+
* </tls-virtual-scroll>
|
|
583
|
+
* ```
|
|
584
|
+
*
|
|
585
|
+
* ```scss
|
|
586
|
+
* .row {
|
|
587
|
+
* box-sizing: border-box;
|
|
588
|
+
* height: var(--tls-virtual-scroll-item-size);
|
|
589
|
+
* }
|
|
590
|
+
* ```
|
|
591
|
+
*
|
|
592
|
+
* Because most items are absent from the DOM, assistive technology can no longer
|
|
593
|
+
* derive the collection's size or an item's position from the markup. The template
|
|
594
|
+
* context exposes the true `index` and `count` for exactly this reason; an item
|
|
595
|
+
* carrying a role that belongs to a set should reflect them through `aria-posinset`
|
|
596
|
+
* and `aria-setsize`.
|
|
597
|
+
*
|
|
598
|
+
* Windowing needs a bounded scroll container, so the host must have a resolved extent
|
|
599
|
+
* along the scroll axis — it defaults to filling its parent, which therefore needs a
|
|
600
|
+
* height of its own.
|
|
601
|
+
*
|
|
602
|
+
* The scroll axis follows `orientation`. When it is `horizontal` the roles of the two
|
|
603
|
+
* axes swap: `itemSize` is an item's *width*, so the item template constrains
|
|
604
|
+
* `width: var(--tls-virtual-scroll-item-size)` instead of `height` — and the cross-axis
|
|
605
|
+
* height still has to be resolved, because the absolutely-positioned items cannot
|
|
606
|
+
* drive it.
|
|
607
|
+
*/
|
|
608
|
+
class VirtualScroll {
|
|
609
|
+
// Injections
|
|
610
|
+
_config = inject(VIRTUAL_SCROLL_CONFIG);
|
|
611
|
+
// Inputs
|
|
612
|
+
items = input.required(/* @ts-ignore */
|
|
613
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
614
|
+
/**
|
|
615
|
+
* Extent of a single item along the scroll axis, in pixels. Every offset the container
|
|
616
|
+
* computes assumes it, so an item that renders to a different size drifts out of
|
|
617
|
+
* place. Nothing constrains the item template, so its own styles have to honour the
|
|
618
|
+
* value; it is published on the scroll container as the `--tls-virtual-scroll-item-size`
|
|
619
|
+
* custom property, which an item can read (`height: var(--tls-virtual-scroll-item-size)`)
|
|
620
|
+
* instead of repeating the number.
|
|
621
|
+
*/
|
|
622
|
+
itemSize = input(this._config.itemSize, { ...(ngDevMode ? { debugName: "itemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
623
|
+
/**
|
|
624
|
+
* Buffer kept rendered beyond the visible window, in pixels. When the rendered
|
|
625
|
+
* buffer falls below this minimum, items are rendered up to `maxBufferPx` — which
|
|
626
|
+
* must therefore be at least this value, or the scroll strategy throws. Raising
|
|
627
|
+
* only one of the pair past the other's default breaks that invariant.
|
|
628
|
+
*/
|
|
629
|
+
minBufferPx = input(this._config.minBufferPx, { ...(ngDevMode ? { debugName: "minBufferPx" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
630
|
+
/** Buffer rendered when `minBufferPx` is crossed, in pixels. Must be at least `minBufferPx`. */
|
|
631
|
+
maxBufferPx = input(this._config.maxBufferPx, { ...(ngDevMode ? { debugName: "maxBufferPx" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
632
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
633
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
634
|
+
appendOnly = input(this._config.appendOnly, { ...(ngDevMode ? { debugName: "appendOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
635
|
+
templateCacheSize = input(this._config.templateCacheSize, { ...(ngDevMode ? { debugName: "templateCacheSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
636
|
+
/** Identity of an item, so a changed collection reuses views instead of rebuilding them. */
|
|
637
|
+
trackBy = input(undefined, /* @ts-ignore */
|
|
638
|
+
...(ngDevMode ? [{ debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
639
|
+
/**
|
|
640
|
+
* Role applied to the scroll container rather than the host, so that the items —
|
|
641
|
+
* which the container owns — are described relative to it. Left unset the container
|
|
642
|
+
* carries no role and the items keep whatever semantics their template gives them.
|
|
643
|
+
*/
|
|
644
|
+
viewportRole = input(undefined, /* @ts-ignore */
|
|
645
|
+
...(ngDevMode ? [{ debugName: "viewportRole" }] : /* istanbul ignore next */ []));
|
|
646
|
+
/**
|
|
647
|
+
* Id applied to the scroll container rather than the host, for the same reason as
|
|
648
|
+
* `viewportRole`: a reference to the collection (`aria-controls`, `aria-owns`) has to
|
|
649
|
+
* resolve to the element that owns the items. Deliberately not named `id` — a static
|
|
650
|
+
* `id` attribute would land on the host and the container at once, duplicating the id.
|
|
651
|
+
*/
|
|
652
|
+
viewportId = input(undefined, /* @ts-ignore */
|
|
653
|
+
...(ngDevMode ? [{ debugName: "viewportId" }] : /* istanbul ignore next */ []));
|
|
654
|
+
/**
|
|
655
|
+
* Reflected as `aria-multiselectable` on the scroll container, meaningful when
|
|
656
|
+
* `viewportRole` names a role that supports it (a listbox holding a multiple
|
|
657
|
+
* selection).
|
|
658
|
+
*/
|
|
659
|
+
ariaMultiselectable = input(undefined, /* @ts-ignore */
|
|
660
|
+
...(ngDevMode ? [{ debugName: "ariaMultiselectable" }] : /* istanbul ignore next */ []));
|
|
661
|
+
/**
|
|
662
|
+
* Whether the scroll container is a tab stop. A region that scrolls has to be
|
|
663
|
+
* operable from the keyboard, so it is one by default. Turn it off only when the
|
|
664
|
+
* region already offers that operability another way — items that are themselves
|
|
665
|
+
* focusable, or a widget that drives the container through `scrollToIndex` from a
|
|
666
|
+
* control elsewhere — since a redundant tab stop is its own obstacle.
|
|
667
|
+
*
|
|
668
|
+
* A tab stop should announce what it is: pair it with `viewportRole` and an
|
|
669
|
+
* accessible name (`ariaLabel` / `ariaLabelledby`) so focus does not land on an
|
|
670
|
+
* anonymous container.
|
|
671
|
+
*/
|
|
672
|
+
focusable = input(true, { ...(ngDevMode ? { debugName: "focusable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
673
|
+
/** Accessible name for the scroll container. */
|
|
674
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
675
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
676
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
677
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
678
|
+
ariaDescribedby = input(undefined, /* @ts-ignore */
|
|
679
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
680
|
+
// Outputs
|
|
681
|
+
/** Index of the first item currently rendered, emitted as the window moves. */
|
|
682
|
+
scrolledIndexChange = output();
|
|
683
|
+
// State
|
|
684
|
+
_viewport = viewChild.required(CdkVirtualScrollViewport);
|
|
685
|
+
/**
|
|
686
|
+
* Template rendering a single item, projected as `<ng-template #item>`. It receives
|
|
687
|
+
* the item as `$implicit` alongside the positional context described on the class.
|
|
688
|
+
*/
|
|
689
|
+
itemTemplate = contentChild.required('item');
|
|
690
|
+
// Computed
|
|
691
|
+
resolvedTrackBy = computed(() => resolveTrackBy(this.trackBy()), /* @ts-ignore */
|
|
692
|
+
...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : /* istanbul ignore next */ []));
|
|
693
|
+
// Public methods
|
|
694
|
+
/** Scrolls the item at `index` to the leading edge of the container. */
|
|
695
|
+
scrollToIndex(index, behavior) {
|
|
696
|
+
this._viewport().scrollToIndex(index, behavior);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Scrolls the least amount that brings the item at `index` fully into view: an item
|
|
700
|
+
* beyond the trailing edge lands on that edge, one before the leading edge lands on
|
|
701
|
+
* it, and an item already fully visible does not move — the behavior of
|
|
702
|
+
* `scrollIntoView({ block: 'nearest' })`, which `scrollToIndex` (always pinning to
|
|
703
|
+
* the leading edge) does not provide.
|
|
704
|
+
*/
|
|
705
|
+
scrollIndexIntoView(index, behavior) {
|
|
706
|
+
const viewport = this._viewport();
|
|
707
|
+
const itemSize = this.itemSize();
|
|
708
|
+
const itemStart = index * itemSize;
|
|
709
|
+
// `start`/`end` name the inline axis (flipping with the layout direction), so the
|
|
710
|
+
// block axis of a vertical container has to be addressed as `top`.
|
|
711
|
+
const horizontal = this.orientation() === 'horizontal';
|
|
712
|
+
const scrollOffset = viewport.measureScrollOffset(horizontal ? 'start' : 'top');
|
|
713
|
+
const viewportSize = viewport.getViewportSize();
|
|
714
|
+
let target;
|
|
715
|
+
if (itemStart < scrollOffset) {
|
|
716
|
+
target = itemStart;
|
|
717
|
+
}
|
|
718
|
+
else if (itemStart + itemSize > scrollOffset + viewportSize) {
|
|
719
|
+
target = itemStart + itemSize - viewportSize;
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const options = horizontal ? { start: target } : { top: target };
|
|
725
|
+
if (behavior !== undefined)
|
|
726
|
+
options.behavior = behavior;
|
|
727
|
+
viewport.scrollTo(options);
|
|
728
|
+
}
|
|
729
|
+
/** Scrolls to an offset given from any edge of the container. */
|
|
730
|
+
scrollTo(options) {
|
|
731
|
+
this._viewport().scrollTo(options);
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Re-measures the container. Its size is measured when it is created and whenever the
|
|
735
|
+
* window resizes, so a container revealed inside a panel or a collapsed parent — sized
|
|
736
|
+
* only after that measurement — has to ask for a fresh one.
|
|
737
|
+
*/
|
|
738
|
+
checkViewportSize() {
|
|
739
|
+
this._viewport().checkViewportSize();
|
|
740
|
+
}
|
|
741
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
742
|
+
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"] }] });
|
|
743
|
+
}
|
|
744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: VirtualScroll, decorators: [{
|
|
745
|
+
type: Component,
|
|
746
|
+
args: [{ selector: 'tls-virtual-scroll', imports: [CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf], host: {
|
|
747
|
+
class: 'tls-virtual-scroll',
|
|
748
|
+
}, 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"] }]
|
|
749
|
+
}], 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 }] }] } });
|
|
750
|
+
|
|
751
|
+
// Upper bound for how long to keep a closing surface alive so its exit
|
|
752
|
+
// (`--leave`) animation can finish before disposal. The `animationend` listener
|
|
753
|
+
// settles early; this fallback covers the case where the event never arrives.
|
|
754
|
+
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Invokes `onDone` once the element's own exit animation has finished, so a
|
|
758
|
+
* closing surface is not torn down while its `--leave` animation is still
|
|
759
|
+
* playing. Fires immediately when no animation runs (e.g. the `none` motion
|
|
760
|
+
* level, where the motion mixin emits nothing) so reduced-motion users don't
|
|
761
|
+
* wait out the fallback timeout.
|
|
762
|
+
*
|
|
763
|
+
* Shared by every container that swaps an `--enter` class for `--leave` and
|
|
764
|
+
* defers disposal until the exit finishes (drawer, dialog).
|
|
765
|
+
*/
|
|
766
|
+
function afterLeaveAnimation(element, onDone) {
|
|
767
|
+
let settled = false;
|
|
768
|
+
const finalize = () => {
|
|
769
|
+
if (settled)
|
|
770
|
+
return;
|
|
771
|
+
settled = true;
|
|
772
|
+
window.clearTimeout(timeoutId);
|
|
773
|
+
element.removeEventListener('animationend', onAnimationEnd);
|
|
774
|
+
onDone();
|
|
775
|
+
};
|
|
776
|
+
// Only the element's own exit animation finalizes; ignore `animationend`
|
|
777
|
+
// bubbling up from animated content inside it.
|
|
778
|
+
const onAnimationEnd = (event) => {
|
|
779
|
+
if (event.target === element)
|
|
780
|
+
finalize();
|
|
781
|
+
};
|
|
782
|
+
element.addEventListener('animationend', onAnimationEnd);
|
|
783
|
+
// Safety net if `animationend` never arrives (e.g. the element is torn down early).
|
|
784
|
+
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
785
|
+
// The `--leave` class applies on the next change detection; on the following
|
|
786
|
+
// frame, finalize at once if no animation is running. When motion is enabled
|
|
787
|
+
// the computed `animationName` is never `none`, so this cannot finalize early.
|
|
788
|
+
requestAnimationFrame(() => {
|
|
789
|
+
if (getComputedStyle(element).animationName === 'none')
|
|
790
|
+
finalize();
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Disposes a detached overlay once the panel's exit animation has finished, so
|
|
796
|
+
* the pane is not torn down while `animate.leave` is still playing. Falls back
|
|
797
|
+
* to a timeout when no animation runs (e.g. the `none` motion level).
|
|
798
|
+
*
|
|
799
|
+
* Shared by every surface that detaches a pane to let the exit animation play
|
|
800
|
+
* (connected overlays, confirm, tooltip).
|
|
801
|
+
*/
|
|
802
|
+
function disposeAfterLeaveAnimation(overlayRef) {
|
|
803
|
+
const paneElement = overlayRef.overlayElement;
|
|
804
|
+
if (!paneElement) {
|
|
805
|
+
overlayRef.dispose();
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
let settled = false;
|
|
809
|
+
const finalize = () => {
|
|
810
|
+
if (settled)
|
|
811
|
+
return;
|
|
812
|
+
settled = true;
|
|
813
|
+
window.clearTimeout(timeoutId);
|
|
814
|
+
paneElement.removeEventListener('animationend', finalize);
|
|
815
|
+
overlayRef.dispose();
|
|
816
|
+
};
|
|
817
|
+
paneElement.addEventListener('animationend', finalize);
|
|
818
|
+
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
|
|
822
|
+
/**
|
|
823
|
+
* Owns the CDK-Overlay lifecycle shared by the library's connected overlay
|
|
824
|
+
* components (popover, menu, select): create/attach, dismissal wiring
|
|
825
|
+
* (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
|
|
826
|
+
* positional and dismissal differences between components are expressed through
|
|
827
|
+
* {@link ConnectedOverlayConfig} rather than duplicated per component.
|
|
828
|
+
*
|
|
829
|
+
* Create one via {@link createOverlayManager} from a component field initializer
|
|
830
|
+
* so it is bound to the host's injection context.
|
|
831
|
+
*/
|
|
832
|
+
class OverlayManager {
|
|
833
|
+
_overlay = inject(Overlay);
|
|
834
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
835
|
+
_destroyRef = inject(DestroyRef);
|
|
836
|
+
_overlayRef = null;
|
|
837
|
+
_config = null;
|
|
838
|
+
_isOpen = signal(false, /* @ts-ignore */
|
|
839
|
+
...(ngDevMode ? [{ debugName: "_isOpen" }] : /* istanbul ignore next */ []));
|
|
840
|
+
// Armed by `ignoreTrailingAuxClick` on open: swallow the first outside
|
|
841
|
+
// `auxclick` so the right-click gesture that opened a context menu doesn't
|
|
842
|
+
// immediately dismiss it. Consumed one-shot (not on a timer) because the user
|
|
843
|
+
// may hold the button arbitrarily long before releasing — the `auxclick`
|
|
844
|
+
// fires on release — so the guard must survive until that first `auxclick`
|
|
845
|
+
// actually arrives. Later outside pointers still dismiss.
|
|
846
|
+
_ignoreTrailingAuxClick = false;
|
|
847
|
+
isOpen = this._isOpen.asReadonly();
|
|
848
|
+
// Dispose the overlay with the host. Registered in a field initializer so no
|
|
849
|
+
// constructor is needed.
|
|
850
|
+
_teardown = this._destroyRef.onDestroy(() => this._dispose());
|
|
851
|
+
open(config) {
|
|
852
|
+
if (this._isOpen())
|
|
853
|
+
return;
|
|
854
|
+
this._config = config;
|
|
855
|
+
if (!this._overlayRef) {
|
|
856
|
+
this._overlayRef = this._overlay.create({
|
|
857
|
+
positionStrategy: this._buildPositionStrategy(config),
|
|
858
|
+
scrollStrategy: config.scrollStrategy === 'close'
|
|
859
|
+
? this._overlay.scrollStrategies.close()
|
|
860
|
+
: this._overlay.scrollStrategies.reposition(),
|
|
861
|
+
hasBackdrop: config.hasBackdrop ?? true,
|
|
862
|
+
backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
|
|
863
|
+
...(config.panelClass != null && { panelClass: config.panelClass }),
|
|
864
|
+
});
|
|
865
|
+
this._wireDismissal(this._overlayRef, config);
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
// Reused ref (`reuse: true`): re-apply the position strategy so a new
|
|
869
|
+
// origin/point takes effect instead of reopening at the previous spot.
|
|
870
|
+
this._overlayRef.updatePositionStrategy(this._buildPositionStrategy(config));
|
|
871
|
+
}
|
|
872
|
+
if (config.minWidth != null) {
|
|
873
|
+
this._overlayRef.updateSize({ minWidth: config.minWidth });
|
|
874
|
+
}
|
|
875
|
+
this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
|
|
876
|
+
this._isOpen.set(true);
|
|
877
|
+
this._ignoreTrailingAuxClick = Boolean(config.ignoreTrailingAuxClick);
|
|
878
|
+
}
|
|
879
|
+
close() {
|
|
880
|
+
if (!this._isOpen())
|
|
881
|
+
return;
|
|
882
|
+
this._isOpen.set(false);
|
|
883
|
+
this._ignoreTrailingAuxClick = false;
|
|
884
|
+
const overlayRef = this._overlayRef;
|
|
885
|
+
const config = this._config;
|
|
886
|
+
if (overlayRef) {
|
|
887
|
+
// Detach (not dispose) so the pane survives while Angular's `animate.leave`
|
|
888
|
+
// plays the panel's exit animation. A reused overlay keeps its ref for the
|
|
889
|
+
// next open; a one-off overlay is disposed once the animation has finished,
|
|
890
|
+
// so the pane is never torn down mid-animation.
|
|
891
|
+
overlayRef.detach();
|
|
892
|
+
const reuse = Boolean(config && config.reuse);
|
|
893
|
+
if (!reuse) {
|
|
894
|
+
this._overlayRef = null;
|
|
895
|
+
disposeAfterLeaveAnimation(overlayRef);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (config && config.onClose)
|
|
899
|
+
config.onClose();
|
|
900
|
+
}
|
|
901
|
+
// Private
|
|
902
|
+
_buildPositionStrategy(config) {
|
|
903
|
+
let strategy = this._overlay
|
|
904
|
+
.position()
|
|
905
|
+
.flexibleConnectedTo(config.origin)
|
|
906
|
+
.withPositions(config.positions);
|
|
907
|
+
if (config.flexibleDimensions === false)
|
|
908
|
+
strategy = strategy.withFlexibleDimensions(false);
|
|
909
|
+
if (config.push === false)
|
|
910
|
+
strategy = strategy.withPush(false);
|
|
911
|
+
return strategy;
|
|
912
|
+
}
|
|
913
|
+
_wireDismissal(overlayRef, config) {
|
|
914
|
+
const hasBackdrop = config.hasBackdrop ?? true;
|
|
915
|
+
if (config.closeOnBackdropClick ?? hasBackdrop) {
|
|
916
|
+
overlayRef
|
|
917
|
+
.backdropClick()
|
|
918
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
919
|
+
.subscribe(() => this.close());
|
|
920
|
+
}
|
|
921
|
+
if (config.closeOnOutsidePointer ?? !hasBackdrop) {
|
|
922
|
+
overlayRef
|
|
923
|
+
.outsidePointerEvents()
|
|
924
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'), filter(event => {
|
|
925
|
+
// Swallow exactly the first outside `auxclick` after an armed open —
|
|
926
|
+
// the release of the right-click that opened a context menu — then
|
|
927
|
+
// let every later outside pointer dismiss as usual.
|
|
928
|
+
if (this._ignoreTrailingAuxClick && event.type === 'auxclick') {
|
|
929
|
+
this._ignoreTrailingAuxClick = false;
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
return true;
|
|
933
|
+
}))
|
|
934
|
+
.subscribe(() => this.close());
|
|
935
|
+
}
|
|
936
|
+
if (config.closeOnEscape ?? true) {
|
|
937
|
+
overlayRef
|
|
938
|
+
.keydownEvents()
|
|
939
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
|
|
940
|
+
.subscribe(() => this.close());
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
_dispose() {
|
|
944
|
+
this._overlayRef?.dispose();
|
|
945
|
+
this._overlayRef = null;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Creates an {@link OverlayManager} bound to the current injection context.
|
|
950
|
+
* Call from a component/directive field initializer or constructor.
|
|
951
|
+
*/
|
|
952
|
+
function createOverlayManager() {
|
|
953
|
+
return new OverlayManager();
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Shared base for the single {@link Select} and {@link MultiSelect} controls.
|
|
958
|
+
* Owns everything the two listbox-combobox controls have in common: the option
|
|
959
|
+
* inputs, the connected overlay lifecycle, roving `aria-activedescendant`
|
|
960
|
+
* navigation, and the keyboard handler. The per-control differences (the value
|
|
961
|
+
* shape, the selected-state check, how the trigger label is built and what a
|
|
962
|
+
* commit does) are expressed through the abstract members below.
|
|
963
|
+
*/
|
|
964
|
+
class AbstractSelect extends ValueFormControl {
|
|
965
|
+
overlay = createOverlayManager();
|
|
966
|
+
_document = inject(DOCUMENT);
|
|
967
|
+
triggerElement = viewChild('trigger', /* @ts-ignore */
|
|
968
|
+
...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
|
|
969
|
+
panelTemplate = viewChild('panel', /* @ts-ignore */
|
|
970
|
+
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
971
|
+
virtualScrollRef = viewChild(VirtualScroll, /* @ts-ignore */
|
|
972
|
+
...(ngDevMode ? [{ debugName: "virtualScrollRef" }] : /* istanbul ignore next */ []));
|
|
973
|
+
/**
|
|
974
|
+
* Whether the panel has already been rendered open, distinguishing the render that
|
|
975
|
+
* opens it from the ones that follow while it stays open.
|
|
976
|
+
*/
|
|
977
|
+
_panelWasOpen = false;
|
|
978
|
+
/**
|
|
979
|
+
* Keeps the active option visible inside the scrolling panel. Focus stays on the
|
|
980
|
+
* trigger and only `aria-activedescendant` moves, so the browser never scrolls the
|
|
981
|
+
* option list on its own — every write of `activeIndex` (keyboard navigation, the
|
|
982
|
+
* initial index on open, a filter narrowing the list) has to be followed by an
|
|
983
|
+
* explicit scroll. Running after render guarantees the option's element exists even
|
|
984
|
+
* when the same change re-rendered the list. `nearest` leaves an already-visible
|
|
985
|
+
* option where it is, so pointer-driven activation never causes a scroll.
|
|
986
|
+
*/
|
|
987
|
+
_scrollActiveOptionIntoView = afterRenderEffect(() => {
|
|
988
|
+
const isOpen = this.isOpen();
|
|
989
|
+
const wasOpen = this._panelWasOpen;
|
|
990
|
+
this._panelWasOpen = isOpen;
|
|
991
|
+
if (!isOpen)
|
|
992
|
+
return;
|
|
993
|
+
const virtualScroll = this.virtualScrollRef();
|
|
994
|
+
// The overlay pane is attached (and re-attached — it is reused across opens)
|
|
995
|
+
// after the panel's view is created, so the viewport's cached measurement is
|
|
996
|
+
// stale until it is re-measured in the first render of an open panel.
|
|
997
|
+
if (virtualScroll && !wasOpen)
|
|
998
|
+
virtualScroll.checkViewportSize();
|
|
999
|
+
const index = this.activeIndex();
|
|
1000
|
+
if (index < 0)
|
|
1001
|
+
return;
|
|
1002
|
+
// The option elements are re-created when the visible list changes, so the scroll
|
|
1003
|
+
// has to re-run then too, not only when the index moves.
|
|
1004
|
+
this.visibleOptions();
|
|
1005
|
+
if (virtualScroll) {
|
|
1006
|
+
// `aria-activedescendant` may only reference a rendered element; scrolling the
|
|
1007
|
+
// index into view keeps it inside the rendered window, and the viewport's render
|
|
1008
|
+
// buffers cover the moment between the index moving and the window following.
|
|
1009
|
+
virtualScroll.scrollIndexIntoView(index);
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
const option = this._document.getElementById(this.optionId(index));
|
|
1013
|
+
if (option)
|
|
1014
|
+
option.scrollIntoView({ block: 'nearest' });
|
|
1015
|
+
});
|
|
1016
|
+
/**
|
|
1017
|
+
* Consumer template rendered inside each option button in place of the plain
|
|
1018
|
+
* label (`<ng-template #option let-context>`). The button itself — and with it
|
|
1019
|
+
* the option's ARIA, activation, and hover behavior — stays owned by the
|
|
1020
|
+
* control; the template only customizes the visual content.
|
|
1021
|
+
*/
|
|
1022
|
+
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
1023
|
+
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
1024
|
+
// Shared inputs (config-independent)
|
|
1025
|
+
options = input([], /* @ts-ignore */
|
|
1026
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1027
|
+
optionLabel = input(undefined, /* @ts-ignore */
|
|
1028
|
+
...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
1029
|
+
optionValue = input(undefined, /* @ts-ignore */
|
|
1030
|
+
...(ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
1031
|
+
optionDisabled = input(undefined, /* @ts-ignore */
|
|
1032
|
+
...(ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
|
|
1033
|
+
tabindex = input(0, /* @ts-ignore */
|
|
1034
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
1035
|
+
isOpen = this.overlay.isOpen;
|
|
1036
|
+
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
1037
|
+
label: this.optionLabel(),
|
|
1038
|
+
value: this.optionValue(),
|
|
1039
|
+
disabled: this.optionDisabled(),
|
|
1040
|
+
}), /* @ts-ignore */
|
|
1041
|
+
...(ngDevMode ? [{ debugName: "normalizedOptions" }] : /* istanbul ignore next */ []));
|
|
1042
|
+
/**
|
|
1043
|
+
* Options actually shown in the panel and traversed by keyboard navigation. Defaults to the full
|
|
1044
|
+
* normalized list; a filtering control (an editable combobox) narrows it via
|
|
1045
|
+
* {@link filterVisibleOptions}. `activeIndex` always indexes into this list, never the raw one.
|
|
1046
|
+
*/
|
|
1047
|
+
visibleOptions = computed(() => this.filterVisibleOptions(this.normalizedOptions()), /* @ts-ignore */
|
|
1048
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
1049
|
+
/**
|
|
1050
|
+
* Index of the option keyboard navigation rests on, within `visibleOptions`; −1
|
|
1051
|
+
* means none. When the visible list changes under it (the options swapped while the
|
|
1052
|
+
* panel is open), an index that fell out of range snaps to the last enabled option,
|
|
1053
|
+
* so `aria-activedescendant` never references an element that no longer exists.
|
|
1054
|
+
*/
|
|
1055
|
+
activeIndex = linkedSignal({ ...(ngDevMode ? { debugName: "activeIndex" } : /* istanbul ignore next */ {}), source: this.visibleOptions,
|
|
1056
|
+
computation: (options, previous) => {
|
|
1057
|
+
if (previous === undefined)
|
|
1058
|
+
return -1;
|
|
1059
|
+
if (previous.value < options.length)
|
|
1060
|
+
return previous.value;
|
|
1061
|
+
for (let index = options.length - 1; index >= 0; index--) {
|
|
1062
|
+
if (!options[index].disabled)
|
|
1063
|
+
return index;
|
|
1064
|
+
}
|
|
1065
|
+
return -1;
|
|
1066
|
+
} });
|
|
1067
|
+
activeDescendantId = computed(() => {
|
|
1068
|
+
const index = this.activeIndex();
|
|
1069
|
+
if (index < 0)
|
|
1070
|
+
return null;
|
|
1071
|
+
return this.optionId(index);
|
|
1072
|
+
}, /* @ts-ignore */
|
|
1073
|
+
...(ngDevMode ? [{ debugName: "activeDescendantId" }] : /* istanbul ignore next */ []));
|
|
1074
|
+
/**
|
|
1075
|
+
* Height of the virtualized option viewport: sized to the options, capped so the
|
|
1076
|
+
* panel — viewport plus its block padding — never exceeds the panel's max-height.
|
|
1077
|
+
* A short list therefore produces a short panel instead of an empty scroll area.
|
|
1078
|
+
* Bound to the viewport's `--tls-virtual-scroll-height` custom property.
|
|
1079
|
+
*/
|
|
1080
|
+
virtualPanelHeight = computed(() => {
|
|
1081
|
+
const prefix = this.panelCssVariablePrefix;
|
|
1082
|
+
const contentHeight = this.visibleOptions().length * this.virtualScrollItemSize();
|
|
1083
|
+
return `min(${contentHeight}px, calc(var(${prefix}-max-height) - 2 * var(${prefix}-padding-block)))`;
|
|
1084
|
+
}, /* @ts-ignore */
|
|
1085
|
+
...(ngDevMode ? [{ debugName: "virtualPanelHeight" }] : /* istanbul ignore next */ []));
|
|
1086
|
+
hostClasses = computed(() => {
|
|
1087
|
+
const array = [this.hostClassBase];
|
|
1088
|
+
if (this.isOpen())
|
|
1089
|
+
array.push(`${this.hostClassBase}--open`);
|
|
1090
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1091
|
+
if (this.fluid())
|
|
1092
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1093
|
+
return array.concat(this.controlClasses());
|
|
1094
|
+
}, /* @ts-ignore */
|
|
1095
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
1096
|
+
get listboxId() {
|
|
1097
|
+
return `${this.uniqueId}-listbox`;
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Narrows the option list shown in the panel. The listbox controls show every option; an editable
|
|
1101
|
+
* combobox overrides this to filter by the typed query.
|
|
1102
|
+
*/
|
|
1103
|
+
filterVisibleOptions(options) {
|
|
1104
|
+
return options;
|
|
1105
|
+
}
|
|
1106
|
+
/** Hook invoked after the panel has closed, once the trigger has regained focus. */
|
|
1107
|
+
onClosed() {
|
|
1108
|
+
// No-op by default; an editable combobox overrides this to reconcile its text.
|
|
1109
|
+
}
|
|
1110
|
+
// Protected methods
|
|
1111
|
+
open() {
|
|
1112
|
+
const triggerElement = this.triggerElement();
|
|
1113
|
+
const panelTemplate = this.panelTemplate();
|
|
1114
|
+
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1115
|
+
return;
|
|
1116
|
+
this.overlay.open({
|
|
1117
|
+
content: panelTemplate,
|
|
1118
|
+
origin: triggerElement,
|
|
1119
|
+
positions: [
|
|
1120
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1121
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1122
|
+
],
|
|
1123
|
+
flexibleDimensions: false,
|
|
1124
|
+
push: false,
|
|
1125
|
+
panelClass: this.panelClass,
|
|
1126
|
+
// The control handles Escape itself via the trigger's keydown handler.
|
|
1127
|
+
closeOnEscape: false,
|
|
1128
|
+
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
1129
|
+
reuse: true,
|
|
1130
|
+
onClose: () => {
|
|
1131
|
+
this.activeIndex.set(-1);
|
|
1132
|
+
const trigger = this.triggerElement();
|
|
1133
|
+
if (trigger)
|
|
1134
|
+
trigger.nativeElement.focus();
|
|
1135
|
+
this.onClosed();
|
|
1136
|
+
},
|
|
1137
|
+
});
|
|
1138
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
1139
|
+
}
|
|
1140
|
+
close() {
|
|
1141
|
+
this.overlay.close();
|
|
1142
|
+
}
|
|
1143
|
+
toggle() {
|
|
1144
|
+
if (this.isOpen()) {
|
|
1145
|
+
this.close();
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
this.open();
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
onOptionHover(event, index, disabled) {
|
|
1152
|
+
// A touch "enter" is a tap in progress, not a hover; the click that follows
|
|
1153
|
+
// commits the option, so the active index has nothing to track.
|
|
1154
|
+
if (event.pointerType === 'touch')
|
|
1155
|
+
return;
|
|
1156
|
+
if (!disabled)
|
|
1157
|
+
this.activeIndex.set(index);
|
|
1158
|
+
}
|
|
1159
|
+
onKeydown(event) {
|
|
1160
|
+
if (event.key === 'ArrowDown') {
|
|
1161
|
+
event.preventDefault();
|
|
1162
|
+
if (this.isOpen()) {
|
|
1163
|
+
this.moveActive(1);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
this.open();
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
else if (event.key === 'ArrowUp') {
|
|
1170
|
+
event.preventDefault();
|
|
1171
|
+
if (this.isOpen()) {
|
|
1172
|
+
this.moveActive(-1);
|
|
1173
|
+
}
|
|
1174
|
+
else {
|
|
1175
|
+
this.open();
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
else if (event.key === 'Enter' || event.key === ' ') {
|
|
1179
|
+
event.preventDefault();
|
|
1180
|
+
if (!this.isOpen()) {
|
|
1181
|
+
this.open();
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
const active = this.visibleOptions()[this.activeIndex()];
|
|
1185
|
+
if (active && !active.disabled)
|
|
1186
|
+
this.commitActiveOption(active);
|
|
1187
|
+
}
|
|
1188
|
+
else if (event.key === 'Home') {
|
|
1189
|
+
if (!this.isOpen())
|
|
1190
|
+
return;
|
|
1191
|
+
event.preventDefault();
|
|
1192
|
+
this.moveActiveToEdge(1);
|
|
1193
|
+
}
|
|
1194
|
+
else if (event.key === 'End') {
|
|
1195
|
+
if (!this.isOpen())
|
|
1196
|
+
return;
|
|
1197
|
+
event.preventDefault();
|
|
1198
|
+
this.moveActiveToEdge(-1);
|
|
1199
|
+
}
|
|
1200
|
+
else if (event.key === 'Escape') {
|
|
1201
|
+
event.preventDefault();
|
|
1202
|
+
if (this.isOpen())
|
|
1203
|
+
this.close();
|
|
1204
|
+
}
|
|
1205
|
+
else if (event.key === 'Tab') {
|
|
1206
|
+
if (this.isOpen())
|
|
1207
|
+
this.close();
|
|
1208
|
+
}
|
|
1209
|
+
else if ((event.key === 'Delete' || event.key === 'Backspace') &&
|
|
1210
|
+
this.clearable() &&
|
|
1211
|
+
this.hasValue()) {
|
|
1212
|
+
event.preventDefault();
|
|
1213
|
+
this.clear();
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
optionId(index) {
|
|
1217
|
+
return `${this.uniqueId}-option-${index}`;
|
|
1218
|
+
}
|
|
1219
|
+
/** Context handed to the consumer's option template for the option at `index`. */
|
|
1220
|
+
optionContext(option, index) {
|
|
1221
|
+
return {
|
|
1222
|
+
$implicit: {
|
|
1223
|
+
option: option.source,
|
|
1224
|
+
value: option.value,
|
|
1225
|
+
label: option.label,
|
|
1226
|
+
index,
|
|
1227
|
+
selected: this.isOptionSelected(option),
|
|
1228
|
+
active: index === this.activeIndex(),
|
|
1229
|
+
disabled: option.disabled,
|
|
1230
|
+
},
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
moveActive(direction) {
|
|
1234
|
+
const options = this.visibleOptions();
|
|
1235
|
+
let next = this.activeIndex() + direction;
|
|
1236
|
+
while (next >= 0 && next < options.length) {
|
|
1237
|
+
if (!options[next].disabled) {
|
|
1238
|
+
this.activeIndex.set(next);
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
next += direction;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
// Private methods
|
|
1245
|
+
moveActiveToEdge(direction) {
|
|
1246
|
+
const options = this.visibleOptions();
|
|
1247
|
+
let next = direction === 1 ? 0 : options.length - 1;
|
|
1248
|
+
while (next >= 0 && next < options.length) {
|
|
1249
|
+
if (!options[next].disabled) {
|
|
1250
|
+
this.activeIndex.set(next);
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
next += direction;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1257
|
+
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 });
|
|
1258
|
+
}
|
|
1259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, decorators: [{
|
|
1260
|
+
type: Directive
|
|
1261
|
+
}], 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 }] }] } });
|
|
1262
|
+
|
|
1263
|
+
// Form control base classes
|
|
1264
|
+
|
|
1265
|
+
/** Matches a quoted literal in a `date-fns` format pattern, e.g. the `'h'` in `"HH 'h' mm"`. */
|
|
1266
|
+
const QUOTED_LITERAL = /'[^']*'/g;
|
|
1267
|
+
/** Day-period tokens (`a`, `b`, `B`) — their presence marks a pattern as 12-hour. */
|
|
1268
|
+
const DAY_PERIOD_TOKEN = /[abB]/;
|
|
1269
|
+
/**
|
|
1270
|
+
* Whether times render on a 12-hour clock. A `'locale'` cycle probes the configured
|
|
1271
|
+
* `date-fns` locale's short time pattern for a day-period token; with no locale
|
|
1272
|
+
* configured `date-fns` formats as `en-US`, which is 12-hour.
|
|
1273
|
+
*/
|
|
1274
|
+
const isHour12 = (config) => {
|
|
1275
|
+
if (config.hourCycle !== 'locale')
|
|
1276
|
+
return config.hourCycle === 12;
|
|
1277
|
+
const locale = config.dateFns;
|
|
1278
|
+
if (!locale)
|
|
1279
|
+
return true;
|
|
1280
|
+
return DAY_PERIOD_TOKEN.test(locale.formatLong.time({ width: 'short' }).replace(QUOTED_LITERAL, ''));
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* `date-fns` format options carrying the configured locale, or `undefined` when none is set
|
|
1285
|
+
* (so `date-fns` falls back to its built-in `en-US`). Returning `undefined` rather than
|
|
1286
|
+
* `{ locale: undefined }` satisfies `exactOptionalPropertyTypes`.
|
|
1287
|
+
*/
|
|
1288
|
+
const localeFormatOptions = (config) => config.dateFns ? { locale: config.dateFns } : undefined;
|
|
1289
|
+
|
|
1290
|
+
const DEFAULT_LOCALE_CONFIG = { hourCycle: 'locale' };
|
|
1291
|
+
|
|
1292
|
+
const LOCALE_CONFIG = new InjectionToken('LOCALE_CONFIG', {
|
|
1293
|
+
factory: () => DEFAULT_LOCALE_CONFIG,
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
class QuerySyncDirective {
|
|
1297
|
+
_router = inject(Router);
|
|
1298
|
+
_route = inject(ActivatedRoute);
|
|
1299
|
+
syncToUrl(param, value) {
|
|
1300
|
+
void this._router.navigate([], {
|
|
1301
|
+
relativeTo: this._route,
|
|
1302
|
+
queryParams: { [param]: value },
|
|
1303
|
+
queryParamsHandling: 'merge',
|
|
1304
|
+
replaceUrl: true,
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
readParam(param) {
|
|
1308
|
+
return this._route.snapshot.queryParamMap.get(param);
|
|
1309
|
+
}
|
|
1310
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1311
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: QuerySyncDirective, isStandalone: true, ngImport: i0 });
|
|
1312
|
+
}
|
|
1313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: QuerySyncDirective, decorators: [{
|
|
1314
|
+
type: Directive
|
|
1315
|
+
}] });
|
|
994
1316
|
|
|
995
1317
|
/** Attribute a delegated tooltip reads its content from, and matches its items by. */
|
|
996
1318
|
const DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE = 'data-tooltip';
|
|
@@ -1969,6 +2291,10 @@ const DEFAULT_ICONS = {
|
|
|
1969
2291
|
'chevrons-left': svg('<polyline points="11 17 6 12 11 7" /><polyline points="18 17 13 12 18 7" />'),
|
|
1970
2292
|
'chevrons-right': svg('<polyline points="13 17 18 12 13 7" /><polyline points="6 17 11 12 6 7" />'),
|
|
1971
2293
|
close: svg('<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />'),
|
|
2294
|
+
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" />'),
|
|
2295
|
+
// The same star, solid. Stroked like the outline version so the two glyphs
|
|
2296
|
+
// share an identical footprint and can be layered over one another.
|
|
2297
|
+
'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
2298
|
success: svg('<circle cx="12" cy="12" r="10" /><polyline points="8 12 11 15 16 9" />'),
|
|
1973
2299
|
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
2300
|
'<line x1="12" y1="9" x2="12" y2="13" /><line x1="12" y1="17" x2="12.01" y2="17" />'),
|
|
@@ -2477,6 +2803,12 @@ const DAYS_PER_WEEK = 7;
|
|
|
2477
2803
|
const MONTH_GRID_ROWS = 6;
|
|
2478
2804
|
/** Default cap on events shown in a month day cell before a "+N more" affordance appears. */
|
|
2479
2805
|
const DEFAULT_MAX_EVENTS_PER_DAY = 3;
|
|
2806
|
+
/**
|
|
2807
|
+
* Dots a day cell shows beneath its number in the dense month layout. Past this many the dots
|
|
2808
|
+
* stop conveying a count and only cost width, so further events go unmarked — the cell's
|
|
2809
|
+
* accessible summary still reports the true total.
|
|
2810
|
+
*/
|
|
2811
|
+
const MAX_DAY_MARKERS = 3;
|
|
2480
2812
|
/** `date-fns` format token for the month/week/day title in the header. */
|
|
2481
2813
|
const MONTH_TITLE_FORMAT = 'MMMM yyyy';
|
|
2482
2814
|
/** `date-fns` format token for a day-of-month number. */
|
|
@@ -2572,6 +2904,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
2572
2904
|
|
|
2573
2905
|
const DEFAULT_CALENDAR_CONFIG = {
|
|
2574
2906
|
view: 'month',
|
|
2907
|
+
views: CALENDAR_VIEW_ORDER,
|
|
2575
2908
|
weekStartsOn: 0,
|
|
2576
2909
|
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
2577
2910
|
hourStart: 0,
|
|
@@ -2585,6 +2918,7 @@ const DEFAULT_CALENDAR_CONFIG = {
|
|
|
2585
2918
|
allDay: 'All day',
|
|
2586
2919
|
noEvents: 'No events',
|
|
2587
2920
|
more: count => `+${count} more`,
|
|
2921
|
+
eventCount: count => (count === 1 ? '1 event' : `${count} events`),
|
|
2588
2922
|
views: {
|
|
2589
2923
|
month: 'Month',
|
|
2590
2924
|
week: 'Week',
|
|
@@ -2745,8 +3079,14 @@ class CalendarMonthView {
|
|
|
2745
3079
|
...(ngDevMode ? [{ debugName: "weekDays" }] : /* istanbul ignore next */ []));
|
|
2746
3080
|
maxEventsPerDay = input.required(/* @ts-ignore */
|
|
2747
3081
|
...(ngDevMode ? [{ debugName: "maxEventsPerDay" }] : /* istanbul ignore next */ []));
|
|
3082
|
+
/** Whether day cells are held to a 1:1 ratio instead of sizing to the events they hold. */
|
|
3083
|
+
squareCells = input(false, /* @ts-ignore */
|
|
3084
|
+
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
2748
3085
|
eventTemplate = input(undefined, /* @ts-ignore */
|
|
2749
3086
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
3087
|
+
/** Replaces what a day cell renders, leaving the cell's own semantics and chrome in place. */
|
|
3088
|
+
dayTemplate = input(undefined, /* @ts-ignore */
|
|
3089
|
+
...(ngDevMode ? [{ debugName: "dayTemplate" }] : /* istanbul ignore next */ []));
|
|
2750
3090
|
/** Accessible name for the grid, announced when focus enters it. */
|
|
2751
3091
|
label = input(undefined, /* @ts-ignore */
|
|
2752
3092
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -2772,9 +3112,13 @@ class CalendarMonthView {
|
|
|
2772
3112
|
const weekDays = days.slice(index, index + DAYS_PER_WEEK);
|
|
2773
3113
|
const segments = assignWeekLanes(weekDays, events);
|
|
2774
3114
|
const hiddenPerColumn = new Array(weekDays.length).fill(0);
|
|
3115
|
+
// Segments already carry each event clipped to the columns it covers, so bucketing them
|
|
3116
|
+
// here costs nothing beyond the walk — far cheaper than re-testing every event per day.
|
|
3117
|
+
const eventsPerColumn = weekDays.map(() => []);
|
|
2775
3118
|
const bars = [];
|
|
2776
3119
|
for (const segment of segments) {
|
|
2777
|
-
|
|
3120
|
+
const beyondLanes = segment.lane >= maxLanes;
|
|
3121
|
+
if (!beyondLanes) {
|
|
2778
3122
|
bars.push({
|
|
2779
3123
|
event: segment.event,
|
|
2780
3124
|
gridColumn: `${segment.startColumn + 1} / span ${segment.endColumn - segment.startColumn + 1}`,
|
|
@@ -2783,19 +3127,32 @@ class CalendarMonthView {
|
|
|
2783
3127
|
continuesAfter: segment.continuesAfter,
|
|
2784
3128
|
});
|
|
2785
3129
|
}
|
|
2786
|
-
|
|
2787
|
-
|
|
3130
|
+
for (let column = segment.startColumn; column <= segment.endColumn; column++) {
|
|
3131
|
+
eventsPerColumn[column].push(segment.event);
|
|
3132
|
+
if (beyondLanes)
|
|
2788
3133
|
hiddenPerColumn[column]++;
|
|
2789
|
-
}
|
|
2790
3134
|
}
|
|
2791
3135
|
}
|
|
2792
|
-
const cells = weekDays.map((date, column) =>
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
3136
|
+
const cells = weekDays.map((date, column) => {
|
|
3137
|
+
// Lane packing orders segments by column and span; a day's own events read chronologically.
|
|
3138
|
+
const dayEvents = eventsPerColumn[column].sort((first, second) => first.start.getTime() - second.start.getTime());
|
|
3139
|
+
const dayNumber = format(date, DAY_NUMBER_FORMAT, this._dateOptions);
|
|
3140
|
+
const inCurrentMonth = isSameMonth(date, activeDate);
|
|
3141
|
+
const isToday = isSameDay(date, now);
|
|
3142
|
+
return {
|
|
3143
|
+
date,
|
|
3144
|
+
dayNumber,
|
|
3145
|
+
inCurrentMonth,
|
|
3146
|
+
isToday,
|
|
3147
|
+
hiddenCount: hiddenPerColumn[column],
|
|
3148
|
+
context: { $implicit: date, dayNumber, inCurrentMonth, isToday, events: dayEvents },
|
|
3149
|
+
eventCount: dayEvents.length,
|
|
3150
|
+
markers: dayEvents.slice(0, MAX_DAY_MARKERS).map(event => ({
|
|
3151
|
+
id: event.id,
|
|
3152
|
+
classes: this._markerClasses(event.color),
|
|
3153
|
+
})),
|
|
3154
|
+
};
|
|
3155
|
+
});
|
|
2799
3156
|
weeks.push({ days: cells, bars });
|
|
2800
3157
|
}
|
|
2801
3158
|
return weeks;
|
|
@@ -2806,18 +3163,32 @@ class CalendarMonthView {
|
|
|
2806
3163
|
moreLabel(count) {
|
|
2807
3164
|
return this._config.labels.more(count);
|
|
2808
3165
|
}
|
|
3166
|
+
/** Localized event-count summary, the only textual form the dense layout's dots have. */
|
|
3167
|
+
eventCountLabel(count) {
|
|
3168
|
+
return this._config.labels.eventCount(count);
|
|
3169
|
+
}
|
|
2809
3170
|
/** Space would scroll the page; consume it and select the focused day instead. */
|
|
2810
3171
|
onDaySpace(event, date) {
|
|
2811
3172
|
event.preventDefault();
|
|
2812
3173
|
this.dateSelect.emit(date);
|
|
2813
3174
|
}
|
|
3175
|
+
// Private methods
|
|
3176
|
+
_markerClasses(eventColor) {
|
|
3177
|
+
const classes = ['tls-calendar-month-view__marker'];
|
|
3178
|
+
if (eventColor)
|
|
3179
|
+
classes.push(`tls-calendar-month-view__marker--${eventColor}`);
|
|
3180
|
+
return classes;
|
|
3181
|
+
}
|
|
2814
3182
|
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
|
|
3183
|
+
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
3184
|
}
|
|
2817
3185
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, decorators: [{
|
|
2818
3186
|
type: Component,
|
|
2819
|
-
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem], host: {
|
|
2820
|
-
|
|
3187
|
+
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem, NgTemplateOutlet], host: {
|
|
3188
|
+
class: 'tls-calendar-month-view',
|
|
3189
|
+
'[class.tls-calendar-month-view--square]': 'squareCells()',
|
|
3190
|
+
}, 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" }]
|
|
3191
|
+
}], 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
3192
|
|
|
2822
3193
|
const eventEnd = (event) => (event.end ?? event.start).getTime();
|
|
2823
3194
|
/**
|
|
@@ -3024,6 +3395,37 @@ class Calendar {
|
|
|
3024
3395
|
...(ngDevMode ? [{ debugName: "showAllDayRow" }] : /* istanbul ignore next */ []));
|
|
3025
3396
|
maxEventsPerDay = input(this._config.maxEventsPerDay, /* @ts-ignore */
|
|
3026
3397
|
...(ngDevMode ? [{ debugName: "maxEventsPerDay" }] : /* istanbul ignore next */ []));
|
|
3398
|
+
/**
|
|
3399
|
+
* Views the switcher offers, in the order they appear. Narrowing it to one entry hides the
|
|
3400
|
+
* switcher, and the active view is pulled back into the set whenever it falls outside.
|
|
3401
|
+
*/
|
|
3402
|
+
views = input(this._config.views, /* @ts-ignore */
|
|
3403
|
+
...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
|
|
3404
|
+
/** Whether the header renders at all; when false, drive the calendar through its own API. */
|
|
3405
|
+
showHeader = input(true, /* @ts-ignore */
|
|
3406
|
+
...(ngDevMode ? [{ debugName: "showHeader" }] : /* istanbul ignore next */ []));
|
|
3407
|
+
/** Whether the header shows the period title. */
|
|
3408
|
+
showTitle = input(true, /* @ts-ignore */
|
|
3409
|
+
...(ngDevMode ? [{ debugName: "showTitle" }] : /* istanbul ignore next */ []));
|
|
3410
|
+
/** Whether the header shows the previous/today/next controls. */
|
|
3411
|
+
showNavigation = input(true, /* @ts-ignore */
|
|
3412
|
+
...(ngDevMode ? [{ debugName: "showNavigation" }] : /* istanbul ignore next */ []));
|
|
3413
|
+
/** Whether the header shows the view switcher; it is hidden anyway with fewer than two views. */
|
|
3414
|
+
showViewSwitcher = input(true, /* @ts-ignore */
|
|
3415
|
+
...(ngDevMode ? [{ debugName: "showViewSwitcher" }] : /* istanbul ignore next */ []));
|
|
3416
|
+
/**
|
|
3417
|
+
* Density of the layout: `'auto'` lets the rendered width decide, `true` pins the dense layout
|
|
3418
|
+
* on and `false` pins it off. The dense month grid marks each day with a dot per event rather
|
|
3419
|
+
* than laying out event bars, so only `dateSelect` fires there — `eventSelect` has no target.
|
|
3420
|
+
*/
|
|
3421
|
+
compact = input('auto', /* @ts-ignore */
|
|
3422
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
3423
|
+
/**
|
|
3424
|
+
* Whether the month grid holds its day cells to a 1:1 ratio. Off by default, where a cell is
|
|
3425
|
+
* as tall as the events it has to show; on, the grid's height follows from its width alone.
|
|
3426
|
+
*/
|
|
3427
|
+
squareCells = input(false, /* @ts-ignore */
|
|
3428
|
+
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
3027
3429
|
/** Accessible name forwarded to the active view's grid. */
|
|
3028
3430
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
3029
3431
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -3039,18 +3441,33 @@ class Calendar {
|
|
|
3039
3441
|
activeDate = model(new Date(), /* @ts-ignore */
|
|
3040
3442
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
3041
3443
|
labels = this._config.labels;
|
|
3042
|
-
viewOptions = CALENDAR_VIEW_ORDER.map(value => ({ label: this._config.labels.views[value], value }));
|
|
3043
3444
|
eventTemplate = contentChild('eventTemplate', /* @ts-ignore */
|
|
3044
3445
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
3446
|
+
dayTemplate = contentChild('dayTemplate', /* @ts-ignore */
|
|
3447
|
+
...(ngDevMode ? [{ debugName: "dayTemplate" }] : /* istanbul ignore next */ []));
|
|
3045
3448
|
_dateOptions = localeFormatOptions(this._locale);
|
|
3046
3449
|
/** Ticking current time, so the "Today" affordance stays correct across midnight. */
|
|
3047
3450
|
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
3048
3451
|
// Computed
|
|
3049
|
-
hostClasses = computed(() =>
|
|
3050
|
-
'tls-calendar',
|
|
3051
|
-
|
|
3052
|
-
|
|
3452
|
+
hostClasses = computed(() => {
|
|
3453
|
+
const classes = ['tls-calendar', `tls-calendar--${this.view()}`];
|
|
3454
|
+
// Pinned off contributes no class at all, so neither dense rule can match.
|
|
3455
|
+
const compact = this.compact();
|
|
3456
|
+
if (compact === true)
|
|
3457
|
+
classes.push('tls-calendar--compact');
|
|
3458
|
+
if (compact === 'auto')
|
|
3459
|
+
classes.push('tls-calendar--compact-auto');
|
|
3460
|
+
return classes;
|
|
3461
|
+
}, /* @ts-ignore */
|
|
3053
3462
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3463
|
+
viewOptions = computed(() => this.views().map(value => ({ label: this.labels.views[value], value })), /* @ts-ignore */
|
|
3464
|
+
...(ngDevMode ? [{ debugName: "viewOptions" }] : /* istanbul ignore next */ []));
|
|
3465
|
+
/** A lone view has nothing to switch between, so the group is suppressed regardless. */
|
|
3466
|
+
showsViewSwitcher = computed(() => this.showViewSwitcher() && this.views().length > 1, /* @ts-ignore */
|
|
3467
|
+
...(ngDevMode ? [{ debugName: "showsViewSwitcher" }] : /* istanbul ignore next */ []));
|
|
3468
|
+
/** Suppresses the header wrapper once every part it would hold is hidden. */
|
|
3469
|
+
showsHeader = computed(() => this.showHeader() && (this.showNavigation() || this.showTitle() || this.showsViewSwitcher()), /* @ts-ignore */
|
|
3470
|
+
...(ngDevMode ? [{ debugName: "showsHeader" }] : /* istanbul ignore next */ []));
|
|
3054
3471
|
/** Whether the active period already includes today, so "Today" would be a no-op. */
|
|
3055
3472
|
isViewingToday = computed(() => {
|
|
3056
3473
|
const activeDate = this.activeDate();
|
|
@@ -3112,6 +3529,14 @@ class Calendar {
|
|
|
3112
3529
|
constructor() {
|
|
3113
3530
|
// Surface the visible window so consumers can fetch events for it (fires on first render too).
|
|
3114
3531
|
effect(() => this.rangeChange.emit(this.visibleRange()));
|
|
3532
|
+
// An active view outside the offered set would be unreachable once hidden from the
|
|
3533
|
+
// switcher, so it snaps to the first view on offer.
|
|
3534
|
+
effect(() => {
|
|
3535
|
+
const views = this.views();
|
|
3536
|
+
if (views.length === 0 || views.includes(this.view()))
|
|
3537
|
+
return;
|
|
3538
|
+
this.view.set(views[0]);
|
|
3539
|
+
});
|
|
3115
3540
|
}
|
|
3116
3541
|
// Public methods
|
|
3117
3542
|
/** Moves to the next period in the current view's unit. */
|
|
@@ -3157,14 +3582,14 @@ class Calendar {
|
|
|
3157
3582
|
return `${format(start, 'MMM d', this._dateOptions)} – ${format(end, 'MMM d, yyyy', this._dateOptions)}`;
|
|
3158
3583
|
}
|
|
3159
3584
|
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
|
|
3585
|
+
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
3586
|
}
|
|
3162
3587
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, decorators: [{
|
|
3163
3588
|
type: Component,
|
|
3164
3589
|
args: [{ selector: 'tls-calendar', imports: [Button, ToggleGroup, CalendarMonthView, CalendarTimeGrid, CalendarAgendaView, Icon], host: {
|
|
3165
3590
|
'[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 }] }] } });
|
|
3591
|
+
}, 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" }]
|
|
3592
|
+
}], 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
3593
|
|
|
3169
3594
|
const DEFAULT_CHIP_CONFIG = {
|
|
3170
3595
|
color: 'primary',
|
|
@@ -3312,6 +3737,7 @@ const DEFAULT_CONFIRM_CONFIG = {
|
|
|
3312
3737
|
confirmButton: { label: 'Confirm' },
|
|
3313
3738
|
cancelButton: { label: 'Cancel', variant: 'text' },
|
|
3314
3739
|
actionsAlign: 'end',
|
|
3740
|
+
size: 'md',
|
|
3315
3741
|
};
|
|
3316
3742
|
|
|
3317
3743
|
const CONFIRM_CONFIG = new InjectionToken('CONFIRM_CONFIG', {
|
|
@@ -3346,6 +3772,8 @@ class ConfirmPanel {
|
|
|
3346
3772
|
...(ngDevMode ? [{ debugName: "modal" }] : /* istanbul ignore next */ []));
|
|
3347
3773
|
actionsAlign = input(this._config.actionsAlign, /* @ts-ignore */
|
|
3348
3774
|
...(ngDevMode ? [{ debugName: "actionsAlign" }] : /* istanbul ignore next */ []));
|
|
3775
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
3776
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3349
3777
|
// Outputs
|
|
3350
3778
|
confirmed = output();
|
|
3351
3779
|
cancelled = output();
|
|
@@ -3358,6 +3786,8 @@ class ConfirmPanel {
|
|
|
3358
3786
|
...(ngDevMode ? [{ debugName: "resolvedConfirm" }] : /* istanbul ignore next */ []));
|
|
3359
3787
|
resolvedCancel = computed(() => this._resolve(this.cancel(), this._config.cancelButton), /* @ts-ignore */
|
|
3360
3788
|
...(ngDevMode ? [{ debugName: "resolvedCancel" }] : /* istanbul ignore next */ []));
|
|
3789
|
+
sizeClass = computed(() => `tls-confirm--${this.size()}`, /* @ts-ignore */
|
|
3790
|
+
...(ngDevMode ? [{ debugName: "sizeClass" }] : /* istanbul ignore next */ []));
|
|
3361
3791
|
actionsClasses = computed(() => [
|
|
3362
3792
|
'tls-confirm__actions',
|
|
3363
3793
|
`tls-confirm__actions--${this.actionsAlign()}`,
|
|
@@ -3391,7 +3821,7 @@ class ConfirmPanel {
|
|
|
3391
3821
|
confirmButton.focus();
|
|
3392
3822
|
}
|
|
3393
3823
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ConfirmPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3394
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ConfirmPanel, isStandalone: true, selector: "tls-confirm-panel", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: true, isRequired: false, transformFunction: null }, cancel: { classPropertyName: "cancel", publicName: "cancel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, actionsAlign: { classPropertyName: "actionsAlign", publicName: "actionsAlign", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, host: { attributes: { "role": "alertdialog", "animate.enter": "tls-confirm--enter", "animate.leave": "tls-confirm--leave" }, properties: { "attr.aria-modal": "modal() ? \"true\" : \"false\"", "id": "id", "attr.aria-labelledby": "title() ? titleId : null", "attr.aria-describedby": "messageId", "attr.aria-label": "ariaLabel() ?? null" }, classAttribute: "tls-confirm" }, ngImport: i0, template: `
|
|
3824
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ConfirmPanel, isStandalone: true, selector: "tls-confirm-panel", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: true, isRequired: false, transformFunction: null }, cancel: { classPropertyName: "cancel", publicName: "cancel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, actionsAlign: { classPropertyName: "actionsAlign", publicName: "actionsAlign", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, host: { attributes: { "role": "alertdialog", "animate.enter": "tls-confirm--enter", "animate.leave": "tls-confirm--leave" }, properties: { "class": "sizeClass()", "attr.aria-modal": "modal() ? \"true\" : \"false\"", "id": "id", "attr.aria-labelledby": "title() ? titleId : null", "attr.aria-describedby": "messageId", "attr.aria-label": "ariaLabel() ?? null" }, classAttribute: "tls-confirm" }, ngImport: i0, template: `
|
|
3395
3825
|
@if (title()) {
|
|
3396
3826
|
<h2 class="tls-confirm__title" [id]="titleId">{{ title() }}</h2>
|
|
3397
3827
|
}
|
|
@@ -3465,6 +3895,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3465
3895
|
`,
|
|
3466
3896
|
host: {
|
|
3467
3897
|
class: 'tls-confirm',
|
|
3898
|
+
'[class]': 'sizeClass()',
|
|
3468
3899
|
role: 'alertdialog',
|
|
3469
3900
|
'[attr.aria-modal]': 'modal() ? "true" : "false"',
|
|
3470
3901
|
'[id]': 'id',
|
|
@@ -3475,7 +3906,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3475
3906
|
'animate.leave': 'tls-confirm--leave',
|
|
3476
3907
|
},
|
|
3477
3908
|
}]
|
|
3478
|
-
}], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], confirm: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirm", required: false }] }], cancel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancel", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], actionsAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsAlign", required: false }] }], confirmed: [{ type: i0.Output, args: ["confirmed"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
|
|
3909
|
+
}], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], confirm: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirm", required: false }] }], cancel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancel", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], actionsAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsAlign", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], confirmed: [{ type: i0.Output, args: ["confirmed"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
|
|
3479
3910
|
|
|
3480
3911
|
/**
|
|
3481
3912
|
* Declarative confirm dialog anchored to a trigger. Sits in the template
|
|
@@ -3500,6 +3931,8 @@ class Confirm {
|
|
|
3500
3931
|
...(ngDevMode ? [{ debugName: "cancel" }] : /* istanbul ignore next */ []));
|
|
3501
3932
|
actionsAlign = input(this._config.actionsAlign, /* @ts-ignore */
|
|
3502
3933
|
...(ngDevMode ? [{ debugName: "actionsAlign" }] : /* istanbul ignore next */ []));
|
|
3934
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
3935
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3503
3936
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
3504
3937
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
3505
3938
|
position = input(this._config.position, /* @ts-ignore */
|
|
@@ -3563,7 +3996,7 @@ class Confirm {
|
|
|
3563
3996
|
this.cancelled.emit();
|
|
3564
3997
|
}
|
|
3565
3998
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Confirm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3566
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Confirm, isStandalone: true, selector: "tls-confirm", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: true, isRequired: false, transformFunction: null }, cancel: { classPropertyName: "cancel", publicName: "cancel", isSignal: true, isRequired: false, transformFunction: null }, actionsAlign: { classPropertyName: "actionsAlign", publicName: "actionsAlign", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
3999
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Confirm, isStandalone: true, selector: "tls-confirm", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: true, isRequired: false, transformFunction: null }, cancel: { classPropertyName: "cancel", publicName: "cancel", isSignal: true, isRequired: false, transformFunction: null }, actionsAlign: { classPropertyName: "actionsAlign", publicName: "actionsAlign", 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 }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirmed: "confirmed", cancelled: "cancelled" }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
3567
4000
|
<ng-template #content>
|
|
3568
4001
|
<tls-confirm-panel
|
|
3569
4002
|
[title]="title()"
|
|
@@ -3571,12 +4004,13 @@ class Confirm {
|
|
|
3571
4004
|
[confirm]="confirm()"
|
|
3572
4005
|
[cancel]="cancel()"
|
|
3573
4006
|
[actionsAlign]="actionsAlign()"
|
|
4007
|
+
[size]="size()"
|
|
3574
4008
|
[ariaLabel]="ariaLabel()"
|
|
3575
4009
|
(confirmed)="onConfirm()"
|
|
3576
4010
|
(cancelled)="onCancel()"
|
|
3577
4011
|
></tls-confirm-panel>
|
|
3578
4012
|
</ng-template>
|
|
3579
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ConfirmPanel, selector: "tls-confirm-panel", inputs: ["title", "message", "confirm", "cancel", "ariaLabel", "modal", "actionsAlign"], outputs: ["confirmed", "cancelled"] }] });
|
|
4013
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ConfirmPanel, selector: "tls-confirm-panel", inputs: ["title", "message", "confirm", "cancel", "ariaLabel", "modal", "actionsAlign", "size"], outputs: ["confirmed", "cancelled"] }] });
|
|
3580
4014
|
}
|
|
3581
4015
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Confirm, decorators: [{
|
|
3582
4016
|
type: Component,
|
|
@@ -3591,6 +4025,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3591
4025
|
[confirm]="confirm()"
|
|
3592
4026
|
[cancel]="cancel()"
|
|
3593
4027
|
[actionsAlign]="actionsAlign()"
|
|
4028
|
+
[size]="size()"
|
|
3594
4029
|
[ariaLabel]="ariaLabel()"
|
|
3595
4030
|
(confirmed)="onConfirm()"
|
|
3596
4031
|
(cancelled)="onCancel()"
|
|
@@ -3598,7 +4033,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3598
4033
|
</ng-template>
|
|
3599
4034
|
`,
|
|
3600
4035
|
}]
|
|
3601
|
-
}], propDecorators: { _templateRef: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], confirm: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirm", required: false }] }], cancel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancel", required: false }] }], actionsAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsAlign", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], confirmed: [{ type: i0.Output, args: ["confirmed"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
|
|
4036
|
+
}], propDecorators: { _templateRef: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], confirm: [{ type: i0.Input, args: [{ isSignal: true, alias: "confirm", required: false }] }], cancel: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancel", required: false }] }], actionsAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsAlign", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], confirmed: [{ type: i0.Output, args: ["confirmed"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
|
|
3602
4037
|
|
|
3603
4038
|
// Dimmed backdrop behind a centered modal confirm. Shared with `tls-dialog` so
|
|
3604
4039
|
// the two modal surfaces render an identical scrim.
|
|
@@ -3660,6 +4095,7 @@ class ConfirmService {
|
|
|
3660
4095
|
panelRef.setInput('confirm', options.confirm);
|
|
3661
4096
|
panelRef.setInput('cancel', options.cancel);
|
|
3662
4097
|
panelRef.setInput('actionsAlign', options.actionsAlign ?? this._config.actionsAlign);
|
|
4098
|
+
panelRef.setInput('size', options.size ?? this._config.size);
|
|
3663
4099
|
panelRef.setInput('ariaLabel', options.ariaLabel);
|
|
3664
4100
|
panelRef.setInput('modal', modal);
|
|
3665
4101
|
}
|
|
@@ -3725,23 +4161,71 @@ const DIALOG_CONFIG = new InjectionToken('DIALOG_CONFIG', {
|
|
|
3725
4161
|
});
|
|
3726
4162
|
|
|
3727
4163
|
class Dialog extends CdkDialogContainer {
|
|
4164
|
+
// Injections
|
|
3728
4165
|
_tlsConfig = inject(DIALOG_CONFIG);
|
|
3729
|
-
_dialogRef = inject(DialogRef);
|
|
3730
|
-
|
|
4166
|
+
_dialogRef = inject(DialogRef$1);
|
|
4167
|
+
// State
|
|
4168
|
+
_state = signal('enter', /* @ts-ignore */
|
|
4169
|
+
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
4170
|
+
_closing = false;
|
|
4171
|
+
// Computed
|
|
4172
|
+
hostClasses = computed(() => [
|
|
4173
|
+
'tls-dialog',
|
|
4174
|
+
`tls-dialog--${this._tlsConfig.size}`,
|
|
4175
|
+
`tls-dialog--${this._state()}`,
|
|
4176
|
+
], /* @ts-ignore */
|
|
4177
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
4178
|
+
// Accessors
|
|
3731
4179
|
get config() {
|
|
3732
4180
|
return this._tlsConfig;
|
|
3733
4181
|
}
|
|
4182
|
+
// Public methods
|
|
4183
|
+
// Plays the exit animation, then disposes the overlay once it finishes. Routed
|
|
4184
|
+
// through here for every dismissal path (close button, backdrop, Escape)
|
|
4185
|
+
// because the CDK ref's `close()` disposes synchronously, which would skip the exit.
|
|
4186
|
+
animatedClose(result) {
|
|
4187
|
+
if (this._closing)
|
|
4188
|
+
return;
|
|
4189
|
+
this._closing = true;
|
|
4190
|
+
this._state.set('leave');
|
|
4191
|
+
afterLeaveAnimation(this._elementRef.nativeElement, () => this._dialogRef.close(result));
|
|
4192
|
+
}
|
|
4193
|
+
// Protected methods
|
|
3734
4194
|
close() {
|
|
3735
|
-
this.
|
|
4195
|
+
this.animatedClose();
|
|
3736
4196
|
}
|
|
3737
4197
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3738
|
-
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"] }] });
|
|
4198
|
+
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"] }] });
|
|
3739
4199
|
}
|
|
3740
4200
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, decorators: [{
|
|
3741
4201
|
type: Component,
|
|
3742
|
-
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" }]
|
|
4202
|
+
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" }]
|
|
3743
4203
|
}] });
|
|
3744
4204
|
|
|
4205
|
+
/**
|
|
4206
|
+
* Handle to an open dialog. Provided to the dialog's content component (inject it
|
|
4207
|
+
* instead of the CDK `DialogRef`) and returned from {@link DialogService.open}.
|
|
4208
|
+
*
|
|
4209
|
+
* `close` routes through the container so the exit animation plays before the
|
|
4210
|
+
* overlay is disposed, unlike the CDK `DialogRef` which disposes synchronously.
|
|
4211
|
+
*/
|
|
4212
|
+
class DialogRef {
|
|
4213
|
+
_cdkRef;
|
|
4214
|
+
_container;
|
|
4215
|
+
closed;
|
|
4216
|
+
constructor(_cdkRef, _container) {
|
|
4217
|
+
this._cdkRef = _cdkRef;
|
|
4218
|
+
this._container = _container;
|
|
4219
|
+
this.closed = _cdkRef.closed;
|
|
4220
|
+
}
|
|
4221
|
+
get componentInstance() {
|
|
4222
|
+
return this._cdkRef.componentInstance;
|
|
4223
|
+
}
|
|
4224
|
+
close(result) {
|
|
4225
|
+
this._container.animatedClose(result);
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
|
|
3745
4229
|
/**
|
|
3746
4230
|
* Top region of a dialog, holding its title and any supporting text. Keeps its
|
|
3747
4231
|
* padding out of the scrolling body so the title stays put while the content
|
|
@@ -3834,6 +4318,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3834
4318
|
class DialogService {
|
|
3835
4319
|
_dialog = inject(Dialog$1);
|
|
3836
4320
|
_config = inject(DIALOG_CONFIG);
|
|
4321
|
+
// Currently-open dialogs, tracked so `closeAll` can play each exit animation and
|
|
4322
|
+
// so it closes dialogs only (the CDK `Dialog` is shared with `tls-drawer`).
|
|
4323
|
+
_openDialogs = new Set();
|
|
3837
4324
|
open(component, config) {
|
|
3838
4325
|
const resolvedConfig = {
|
|
3839
4326
|
size: config?.size ?? this._config.size,
|
|
@@ -3842,23 +4329,49 @@ class DialogService {
|
|
|
3842
4329
|
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
3843
4330
|
footerAlign: config?.footerAlign ?? this._config.footerAlign,
|
|
3844
4331
|
};
|
|
3845
|
-
|
|
4332
|
+
let dialogRef;
|
|
4333
|
+
const cdkRef = this._dialog.open(component, {
|
|
3846
4334
|
container: {
|
|
3847
4335
|
type: Dialog,
|
|
3848
4336
|
providers: () => [{ provide: DIALOG_CONFIG, useValue: resolvedConfig }],
|
|
3849
4337
|
},
|
|
4338
|
+
// Built against the content injector so the dialog's content can `inject(DialogRef)`
|
|
4339
|
+
// to close itself. The same instance is returned to the caller below.
|
|
4340
|
+
providers: (ref, _cdkConfig, container) => {
|
|
4341
|
+
dialogRef = new DialogRef(ref, container);
|
|
4342
|
+
return [{ provide: DialogRef, useValue: dialogRef }];
|
|
4343
|
+
},
|
|
3850
4344
|
hasBackdrop: true,
|
|
3851
4345
|
backdropClass: 'tls-dialog-backdrop',
|
|
3852
|
-
|
|
4346
|
+
// Suppress CDK's synchronous auto-close so every dismissal routes through
|
|
4347
|
+
// `DialogRef.close`, which plays the exit animation before disposal.
|
|
4348
|
+
disableClose: true,
|
|
3853
4349
|
role: config?.role ?? 'dialog',
|
|
3854
4350
|
ariaLabel: config?.ariaLabel ?? null,
|
|
3855
4351
|
ariaLabelledBy: config?.ariaLabelledBy ?? null,
|
|
3856
4352
|
ariaDescribedBy: config?.ariaDescribedBy ?? null,
|
|
3857
4353
|
data: config?.data,
|
|
3858
4354
|
});
|
|
4355
|
+
const trackedRef = dialogRef;
|
|
4356
|
+
this._openDialogs.add(trackedRef);
|
|
4357
|
+
cdkRef.closed.subscribe(() => this._openDialogs.delete(trackedRef));
|
|
4358
|
+
this._wireDismissal(cdkRef, dialogRef, resolvedConfig);
|
|
4359
|
+
return dialogRef;
|
|
3859
4360
|
}
|
|
3860
4361
|
closeAll() {
|
|
3861
|
-
|
|
4362
|
+
// Iterating a snapshot: `close` is animated, so removal happens later (on
|
|
4363
|
+
// `closed`), but guard against any synchronous mutation regardless.
|
|
4364
|
+
for (const dialogRef of [...this._openDialogs])
|
|
4365
|
+
dialogRef.close();
|
|
4366
|
+
}
|
|
4367
|
+
// Private methods
|
|
4368
|
+
_wireDismissal(cdkRef, dialogRef, config) {
|
|
4369
|
+
if (!config.backdropClose)
|
|
4370
|
+
return;
|
|
4371
|
+
cdkRef.backdropClick.pipe(takeUntil(cdkRef.closed)).subscribe(() => dialogRef.close());
|
|
4372
|
+
cdkRef.keydownEvents
|
|
4373
|
+
.pipe(takeUntil(cdkRef.closed), filter(event => event.key === 'Escape'))
|
|
4374
|
+
.subscribe(() => dialogRef.close());
|
|
3862
4375
|
}
|
|
3863
4376
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3864
4377
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogService, providedIn: 'root' });
|
|
@@ -3911,13 +4424,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3911
4424
|
}, 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" }]
|
|
3912
4425
|
}], 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 }] }] } });
|
|
3913
4426
|
|
|
3914
|
-
// Upper bound for how long to keep the drawer alive after a close is requested so
|
|
3915
|
-
// its slide-out (`--leave`) animation can finish before disposal. The `animationend`
|
|
3916
|
-
// listener disposes early; this fallback covers the case where no exit animation
|
|
3917
|
-
// runs (e.g. the `none` motion level, where nothing is emitted).
|
|
3918
|
-
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
3919
4427
|
// Named size tokens, used to tell a preset apart from a custom CSS-length string.
|
|
3920
|
-
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full'];
|
|
4428
|
+
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full', 'auto'];
|
|
3921
4429
|
|
|
3922
4430
|
const DEFAULT_DRAWER_CONFIG = {
|
|
3923
4431
|
side: 'end',
|
|
@@ -3925,6 +4433,7 @@ const DEFAULT_DRAWER_CONFIG = {
|
|
|
3925
4433
|
closeable: true,
|
|
3926
4434
|
backdropClose: true,
|
|
3927
4435
|
rounded: false,
|
|
4436
|
+
grabber: false,
|
|
3928
4437
|
closeLabel: 'Close drawer',
|
|
3929
4438
|
};
|
|
3930
4439
|
|
|
@@ -3935,7 +4444,7 @@ const DRAWER_CONFIG = new InjectionToken('DRAWER_CONFIG', {
|
|
|
3935
4444
|
class Drawer extends CdkDialogContainer {
|
|
3936
4445
|
// Injections
|
|
3937
4446
|
_tlsConfig = inject(DRAWER_CONFIG);
|
|
3938
|
-
_dialogRef = inject(DialogRef);
|
|
4447
|
+
_dialogRef = inject(DialogRef$1);
|
|
3939
4448
|
// State
|
|
3940
4449
|
_state = signal('enter', /* @ts-ignore */
|
|
3941
4450
|
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
@@ -3971,7 +4480,7 @@ class Drawer extends CdkDialogContainer {
|
|
|
3971
4480
|
return;
|
|
3972
4481
|
this._closing = true;
|
|
3973
4482
|
this._state.set('leave');
|
|
3974
|
-
this.
|
|
4483
|
+
afterLeaveAnimation(this._elementRef.nativeElement, () => this._dialogRef.close(result));
|
|
3975
4484
|
}
|
|
3976
4485
|
// Protected methods
|
|
3977
4486
|
close() {
|
|
@@ -3985,46 +4494,15 @@ class Drawer extends CdkDialogContainer {
|
|
|
3985
4494
|
_isNamedSize(size) {
|
|
3986
4495
|
return DRAWER_NAMED_SIZES.includes(size);
|
|
3987
4496
|
}
|
|
3988
|
-
// Invokes `onDone` when the leave animation ends, disposing immediately when no
|
|
3989
|
-
// slide-out actually runs (e.g. the `none` motion level, where the motion mixin
|
|
3990
|
-
// emits nothing) so reduced-motion users don't wait out the fallback timeout.
|
|
3991
|
-
_afterLeaveAnimation(onDone) {
|
|
3992
|
-
const element = this._elementRef.nativeElement;
|
|
3993
|
-
let settled = false;
|
|
3994
|
-
const finalize = () => {
|
|
3995
|
-
if (settled)
|
|
3996
|
-
return;
|
|
3997
|
-
settled = true;
|
|
3998
|
-
window.clearTimeout(timeoutId);
|
|
3999
|
-
element.removeEventListener('animationend', onAnimationEnd);
|
|
4000
|
-
onDone();
|
|
4001
|
-
};
|
|
4002
|
-
// Only the host's own slide-out finalizes; ignore `animationend` bubbling up
|
|
4003
|
-
// from animated content inside the drawer.
|
|
4004
|
-
const onAnimationEnd = (event) => {
|
|
4005
|
-
if (event.target === element)
|
|
4006
|
-
finalize();
|
|
4007
|
-
};
|
|
4008
|
-
element.addEventListener('animationend', onAnimationEnd);
|
|
4009
|
-
// Safety net if `animationend` never arrives (e.g. the pane is torn down early).
|
|
4010
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
4011
|
-
// The `--leave` class applies on the next change detection; on the following
|
|
4012
|
-
// frame, close at once if no animation is running. When motion is enabled the
|
|
4013
|
-
// computed `animationName` is never `none`, so this cannot finalize early.
|
|
4014
|
-
requestAnimationFrame(() => {
|
|
4015
|
-
if (getComputedStyle(element).animationName === 'none')
|
|
4016
|
-
finalize();
|
|
4017
|
-
});
|
|
4018
|
-
}
|
|
4019
4497
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4020
|
-
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"] }] });
|
|
4498
|
+
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"] }] });
|
|
4021
4499
|
}
|
|
4022
4500
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, decorators: [{
|
|
4023
4501
|
type: Component,
|
|
4024
4502
|
args: [{ selector: 'tls-drawer', imports: [CdkPortalOutlet, Icon], host: {
|
|
4025
4503
|
'[class]': 'hostClasses()',
|
|
4026
4504
|
'[style.--tls-drawer-size]': 'customSize',
|
|
4027
|
-
}, 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" }]
|
|
4505
|
+
}, 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" }]
|
|
4028
4506
|
}] });
|
|
4029
4507
|
|
|
4030
4508
|
/**
|
|
@@ -4066,6 +4544,7 @@ class DrawerService {
|
|
|
4066
4544
|
closeable: config?.closeable ?? this._config.closeable,
|
|
4067
4545
|
backdropClose: config?.backdropClose ?? this._config.backdropClose,
|
|
4068
4546
|
rounded: config?.rounded ?? this._config.rounded,
|
|
4547
|
+
grabber: config?.grabber ?? this._config.grabber,
|
|
4069
4548
|
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
4070
4549
|
};
|
|
4071
4550
|
let drawerRef;
|
|
@@ -4467,6 +4946,9 @@ const DEFAULT_AUTOCOMPLETE_CONFIG = {
|
|
|
4467
4946
|
filterMode: 'contains',
|
|
4468
4947
|
emptyMessage: 'No results',
|
|
4469
4948
|
clearLabel: 'Clear',
|
|
4949
|
+
virtualScroll: false,
|
|
4950
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
4951
|
+
virtualScrollItemSize: 39,
|
|
4470
4952
|
};
|
|
4471
4953
|
|
|
4472
4954
|
const AUTOCOMPLETE_CONFIG = new InjectionToken('AUTOCOMPLETE_CONFIG', {
|
|
@@ -4480,6 +4962,7 @@ class Autocomplete extends AbstractSelect {
|
|
|
4480
4962
|
uniqueId = `tls-autocomplete-${Autocomplete._nextUniqueId++}`;
|
|
4481
4963
|
hostClassBase = 'tls-autocomplete';
|
|
4482
4964
|
panelClass = 'tls-autocomplete-panel';
|
|
4965
|
+
panelCssVariablePrefix = '--tls-autocomplete-panel';
|
|
4483
4966
|
value = model(null, /* @ts-ignore */
|
|
4484
4967
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
4485
4968
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -4494,6 +4977,8 @@ class Autocomplete extends AbstractSelect {
|
|
|
4494
4977
|
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
4495
4978
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
4496
4979
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
4980
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4981
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
4497
4982
|
hasValue = computed(() => {
|
|
4498
4983
|
const value = this.value();
|
|
4499
4984
|
return value !== null && value !== undefined;
|
|
@@ -4603,14 +5088,14 @@ class Autocomplete extends AbstractSelect {
|
|
|
4603
5088
|
this.select(option);
|
|
4604
5089
|
}
|
|
4605
5090
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4606
|
-
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 <
|
|
5091
|
+
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"] }] });
|
|
4607
5092
|
}
|
|
4608
5093
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
|
|
4609
5094
|
type: Component,
|
|
4610
|
-
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
5095
|
+
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
4611
5096
|
'[class]': 'hostClasses()',
|
|
4612
|
-
}, 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 <
|
|
4613
|
-
}], 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 }] }] } });
|
|
5097
|
+
}, 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" }]
|
|
5098
|
+
}], 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 }] }] } });
|
|
4614
5099
|
|
|
4615
5100
|
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
4616
5101
|
|
|
@@ -6071,6 +6556,220 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6071
6556
|
}, 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" }]
|
|
6072
6557
|
}], 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 }] }] } });
|
|
6073
6558
|
|
|
6559
|
+
const DEFAULT_RATING_CONFIG = {
|
|
6560
|
+
color: 'golden',
|
|
6561
|
+
size: 'md',
|
|
6562
|
+
max: 5,
|
|
6563
|
+
allowHalf: false,
|
|
6564
|
+
allowClear: true,
|
|
6565
|
+
preview: false,
|
|
6566
|
+
labels: {
|
|
6567
|
+
star: value => (value === 1 ? '1 star' : `${value} stars`),
|
|
6568
|
+
},
|
|
6569
|
+
};
|
|
6570
|
+
|
|
6571
|
+
const RATING_CONFIG = new InjectionToken('RATING_CONFIG', {
|
|
6572
|
+
factory: () => DEFAULT_RATING_CONFIG,
|
|
6573
|
+
});
|
|
6574
|
+
|
|
6575
|
+
/**
|
|
6576
|
+
* A star-rating control holding a number of stars, where 0 means unrated. Each
|
|
6577
|
+
* selectable increment (a whole star, or each half when `allowHalf` is on) is a
|
|
6578
|
+
* native radio positioned over its slice of the star row, so the group gets the
|
|
6579
|
+
* radio pattern's focus and arrow-key behaviour natively. The host is the
|
|
6580
|
+
* composite's `radiogroup` container and carries the group-level ARIA.
|
|
6581
|
+
*/
|
|
6582
|
+
class Rating extends ValueFormControl {
|
|
6583
|
+
// Injections
|
|
6584
|
+
_config = inject(RATING_CONFIG);
|
|
6585
|
+
CLASS_NAME = 'tls-rating';
|
|
6586
|
+
// Inputs
|
|
6587
|
+
value = model(0, /* @ts-ignore */
|
|
6588
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6589
|
+
max = input(this._config.max, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6590
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
6591
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
6592
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
6593
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
6594
|
+
/** Offers half-star options: each star becomes two radios, one per half. */
|
|
6595
|
+
allowHalf = input(this._config.allowHalf, { ...(ngDevMode ? { debugName: "allowHalf" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6596
|
+
/** Re-activating the currently selected option resets the value to 0 (unrated). */
|
|
6597
|
+
allowClear = input(this._config.allowClear, { ...(ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6598
|
+
/**
|
|
6599
|
+
* Renders the hover preview's *difference* from the committed value as a
|
|
6600
|
+
* translucent ghost: hovering above the value ghosts only the stars being
|
|
6601
|
+
* added, hovering below ghosts only the part being removed, and the solid
|
|
6602
|
+
* fill always shows the part both agree on.
|
|
6603
|
+
*/
|
|
6604
|
+
preview = input(this._config.preview, { ...(ngDevMode ? { debugName: "preview" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6605
|
+
// State
|
|
6606
|
+
static _counter = 0;
|
|
6607
|
+
/** Groups the radios when the consumer supplies no `name`; unique per instance. */
|
|
6608
|
+
_autoName = `tls-rating-${Rating._counter++}`;
|
|
6609
|
+
/** Option value previewed under the pointer, or null when nothing is hovered. */
|
|
6610
|
+
_hovered = signal(null, /* @ts-ignore */
|
|
6611
|
+
...(ngDevMode ? [{ debugName: "_hovered" }] : /* istanbul ignore next */ []));
|
|
6612
|
+
/** Star currently playing the selection pop animation, or null. */
|
|
6613
|
+
_popped = signal(null, /* @ts-ignore */
|
|
6614
|
+
...(ngDevMode ? [{ debugName: "_popped" }] : /* istanbul ignore next */ []));
|
|
6615
|
+
/** Consumer-provided star slot rendered in place of the built-in star icon. */
|
|
6616
|
+
starTemplate = contentChild('starTemplate', /* @ts-ignore */
|
|
6617
|
+
...(ngDevMode ? [{ debugName: "starTemplate" }] : /* istanbul ignore next */ []));
|
|
6618
|
+
/**
|
|
6619
|
+
* Activating an unchecked radio fires `change` then `click`; a click on the
|
|
6620
|
+
* already-checked one fires `click` alone. This flag marks the `change` so the
|
|
6621
|
+
* trailing `click` is not mistaken for a re-activation that should clear.
|
|
6622
|
+
*/
|
|
6623
|
+
_suppressClear = false;
|
|
6624
|
+
_inputs = viewChildren('radio', /* @ts-ignore */
|
|
6625
|
+
...(ngDevMode ? [{ debugName: "_inputs" }] : /* istanbul ignore next */ []));
|
|
6626
|
+
// Computed
|
|
6627
|
+
hostClasses = computed(() => {
|
|
6628
|
+
const className = this.CLASS_NAME;
|
|
6629
|
+
const array = [`${className}--${this.size()}`, `${className}--${this.color()}`];
|
|
6630
|
+
return array.concat(this.controlClasses());
|
|
6631
|
+
}, /* @ts-ignore */
|
|
6632
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
6633
|
+
stars = computed(() => Array.from({ length: Math.max(0, Math.floor(this.max())) }, (_, index) => index + 1), /* @ts-ignore */
|
|
6634
|
+
...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
6635
|
+
radioName = computed(() => this.name() || this._autoName, /* @ts-ignore */
|
|
6636
|
+
...(ngDevMode ? [{ debugName: "radioName" }] : /* istanbul ignore next */ []));
|
|
6637
|
+
/**
|
|
6638
|
+
* Hovered option that should actually drive the preview: none while the
|
|
6639
|
+
* control is non-interactive, so a readonly/disabled flip mid-hover cannot
|
|
6640
|
+
* leave a stale preview on screen.
|
|
6641
|
+
*/
|
|
6642
|
+
_previewedOption = computed(() => this.notInteractive() ? null : this._hovered(), /* @ts-ignore */
|
|
6643
|
+
...(ngDevMode ? [{ debugName: "_previewedOption" }] : /* istanbul ignore next */ []));
|
|
6644
|
+
// Protected methods
|
|
6645
|
+
/**
|
|
6646
|
+
* Solidly filled share of the given star, 0–100. Reads the hovered preview
|
|
6647
|
+
* when one is active, the committed value otherwise; a fractional value fills
|
|
6648
|
+
* its star partially, so a non-interactive rating can display an average like
|
|
6649
|
+
* 4.3. In ghost mode the solid fill shows only the part the committed value
|
|
6650
|
+
* and the hovered one agree on — the delta belongs to the ghost layer.
|
|
6651
|
+
*/
|
|
6652
|
+
fillPercent(star) {
|
|
6653
|
+
const hovered = this._previewedOption();
|
|
6654
|
+
const value = this.value();
|
|
6655
|
+
let display;
|
|
6656
|
+
if (hovered === null)
|
|
6657
|
+
display = value;
|
|
6658
|
+
else if (this.preview())
|
|
6659
|
+
display = Math.min(value, hovered);
|
|
6660
|
+
else
|
|
6661
|
+
display = hovered;
|
|
6662
|
+
return this._starShare(display, star);
|
|
6663
|
+
}
|
|
6664
|
+
/**
|
|
6665
|
+
* Ghost-layer share of the given star, 0–100: reaches whichever of the
|
|
6666
|
+
* committed and hovered values is larger, so the part peeking out from under
|
|
6667
|
+
* the solid fill is exactly their difference — the stars a click would add,
|
|
6668
|
+
* or the part it would remove.
|
|
6669
|
+
*/
|
|
6670
|
+
ghostPercent(star) {
|
|
6671
|
+
const hovered = this._previewedOption();
|
|
6672
|
+
if (hovered === null)
|
|
6673
|
+
return 0;
|
|
6674
|
+
return this._starShare(Math.max(this.value(), hovered), star);
|
|
6675
|
+
}
|
|
6676
|
+
starLabel(option) {
|
|
6677
|
+
return this._config.labels.star(option);
|
|
6678
|
+
}
|
|
6679
|
+
/** Whether the displayed value (hover preview first, else committed) fills the star only partially. */
|
|
6680
|
+
isHalf(star) {
|
|
6681
|
+
const share = this._starShare(this._previewedOption() ?? this.value(), star);
|
|
6682
|
+
return share > 0 && share < 100;
|
|
6683
|
+
}
|
|
6684
|
+
onChange(option) {
|
|
6685
|
+
// A radio has no native readonly, so a readonly (or disabled-but-still-
|
|
6686
|
+
// reachable) rating reverts the native check instead of committing it.
|
|
6687
|
+
if (this.notInteractive()) {
|
|
6688
|
+
this._syncNativeChecked();
|
|
6689
|
+
return;
|
|
6690
|
+
}
|
|
6691
|
+
this._suppressClear = true;
|
|
6692
|
+
this.value.set(option);
|
|
6693
|
+
this._pop(option);
|
|
6694
|
+
}
|
|
6695
|
+
isPopped(star) {
|
|
6696
|
+
return this._popped() === star;
|
|
6697
|
+
}
|
|
6698
|
+
onPopAnimationEnd(star) {
|
|
6699
|
+
if (this._popped() === star)
|
|
6700
|
+
this._popped.set(null);
|
|
6701
|
+
}
|
|
6702
|
+
onClick(option) {
|
|
6703
|
+
if (this.notInteractive())
|
|
6704
|
+
return;
|
|
6705
|
+
if (this._suppressClear) {
|
|
6706
|
+
this._suppressClear = false;
|
|
6707
|
+
return;
|
|
6708
|
+
}
|
|
6709
|
+
if (this.allowClear() && this.value() === option)
|
|
6710
|
+
this.value.set(0);
|
|
6711
|
+
}
|
|
6712
|
+
onPointerDown() {
|
|
6713
|
+
// A stale flag from an earlier keyboard arrow change would swallow the next
|
|
6714
|
+
// pointer click's clearing; a fresh pointer interaction starts clean.
|
|
6715
|
+
this._suppressClear = false;
|
|
6716
|
+
}
|
|
6717
|
+
onPointerEnter(option) {
|
|
6718
|
+
if (this.notInteractive())
|
|
6719
|
+
return;
|
|
6720
|
+
this._hovered.set(option);
|
|
6721
|
+
}
|
|
6722
|
+
onPointerLeave() {
|
|
6723
|
+
this._hovered.set(null);
|
|
6724
|
+
}
|
|
6725
|
+
// Private methods
|
|
6726
|
+
_starShare(display, star) {
|
|
6727
|
+
return Math.min(Math.max(display - (star - 1), 0), 1) * 100;
|
|
6728
|
+
}
|
|
6729
|
+
/**
|
|
6730
|
+
* Plays the selection pop on the star containing the committed option. When
|
|
6731
|
+
* that star is already popping (e.g. its other half was just selected), the
|
|
6732
|
+
* class is dropped for a frame and re-applied, so the animation restarts.
|
|
6733
|
+
*/
|
|
6734
|
+
_pop(option) {
|
|
6735
|
+
const star = Math.ceil(option);
|
|
6736
|
+
if (this._popped() === star) {
|
|
6737
|
+
this._popped.set(null);
|
|
6738
|
+
requestAnimationFrame(() => this._popped.set(star));
|
|
6739
|
+
return;
|
|
6740
|
+
}
|
|
6741
|
+
this._popped.set(star);
|
|
6742
|
+
}
|
|
6743
|
+
/**
|
|
6744
|
+
* Restores every radio's native checked state from the model. Needed after a
|
|
6745
|
+
* reverted change: the browser has already moved the native check to the
|
|
6746
|
+
* activated radio, and the unchanged `checked` bindings won't move it back.
|
|
6747
|
+
*/
|
|
6748
|
+
_syncNativeChecked() {
|
|
6749
|
+
for (const inputRef of this._inputs()) {
|
|
6750
|
+
const element = inputRef.nativeElement;
|
|
6751
|
+
element.checked = Number(element.value) === this.value();
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Rating, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6755
|
+
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"] }] });
|
|
6756
|
+
}
|
|
6757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Rating, decorators: [{
|
|
6758
|
+
type: Component,
|
|
6759
|
+
args: [{ selector: 'tls-rating', imports: [Icon, NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Rating) }], host: {
|
|
6760
|
+
role: 'radiogroup',
|
|
6761
|
+
'[class]': 'hostClasses()',
|
|
6762
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
6763
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
6764
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
6765
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
6766
|
+
'[attr.aria-required]': "required() ? 'true' : null",
|
|
6767
|
+
'[attr.aria-readonly]': "readonly() ? 'true' : null",
|
|
6768
|
+
'[attr.aria-busy]': "pending() ? 'true' : null",
|
|
6769
|
+
'(pointerleave)': 'onPointerLeave()',
|
|
6770
|
+
}, 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"] }]
|
|
6771
|
+
}], 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 }] }] } });
|
|
6772
|
+
|
|
6074
6773
|
const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
6075
6774
|
size: 'md',
|
|
6076
6775
|
placeholder: '',
|
|
@@ -6079,6 +6778,9 @@ const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
|
6079
6778
|
maxLabels: 2,
|
|
6080
6779
|
clearLabel: 'Clear',
|
|
6081
6780
|
selectedCountLabel: count => `${count} selected`,
|
|
6781
|
+
virtualScroll: false,
|
|
6782
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
6783
|
+
virtualScrollItemSize: 39,
|
|
6082
6784
|
};
|
|
6083
6785
|
|
|
6084
6786
|
const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
|
|
@@ -6092,6 +6794,7 @@ class MultiSelect extends AbstractSelect {
|
|
|
6092
6794
|
uniqueId = `tls-multi-select-${MultiSelect._nextUniqueId++}`;
|
|
6093
6795
|
hostClassBase = 'tls-multi-select';
|
|
6094
6796
|
panelClass = 'tls-multi-select-panel';
|
|
6797
|
+
panelCssVariablePrefix = '--tls-multi-select-panel';
|
|
6095
6798
|
value = model([], /* @ts-ignore */
|
|
6096
6799
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6097
6800
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -6104,6 +6807,8 @@ class MultiSelect extends AbstractSelect {
|
|
|
6104
6807
|
...(ngDevMode ? [{ debugName: "maxLabels" }] : /* istanbul ignore next */ []));
|
|
6105
6808
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
6106
6809
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
6810
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6811
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6107
6812
|
hasValue = computed(() => this.value().length > 0, /* @ts-ignore */
|
|
6108
6813
|
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
6109
6814
|
selectedValues = computed(() => new Set(this.value()), /* @ts-ignore */
|
|
@@ -6150,14 +6855,14 @@ class MultiSelect extends AbstractSelect {
|
|
|
6150
6855
|
this.toggleOption(option);
|
|
6151
6856
|
}
|
|
6152
6857
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6153
|
-
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 <
|
|
6858
|
+
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"] }] });
|
|
6154
6859
|
}
|
|
6155
6860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
6156
6861
|
type: Component,
|
|
6157
|
-
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
6862
|
+
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
6158
6863
|
'[class]': 'hostClasses()',
|
|
6159
|
-
}, 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 <
|
|
6160
|
-
}], 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 }] }] } });
|
|
6864
|
+
}, 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" }]
|
|
6865
|
+
}], 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 }] }] } });
|
|
6161
6866
|
|
|
6162
6867
|
const DEFAULT_SELECT_CONFIG = {
|
|
6163
6868
|
size: 'md',
|
|
@@ -6165,6 +6870,9 @@ const DEFAULT_SELECT_CONFIG = {
|
|
|
6165
6870
|
fluid: false,
|
|
6166
6871
|
clearable: false,
|
|
6167
6872
|
clearLabel: 'Clear',
|
|
6873
|
+
virtualScroll: false,
|
|
6874
|
+
// The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
6875
|
+
virtualScrollItemSize: 39,
|
|
6168
6876
|
};
|
|
6169
6877
|
|
|
6170
6878
|
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
@@ -6178,6 +6886,7 @@ class Select extends AbstractSelect {
|
|
|
6178
6886
|
uniqueId = `tls-select-${Select._nextUniqueId++}`;
|
|
6179
6887
|
hostClassBase = 'tls-select';
|
|
6180
6888
|
panelClass = 'tls-select-panel';
|
|
6889
|
+
panelCssVariablePrefix = '--tls-select-panel';
|
|
6181
6890
|
value = model(null, /* @ts-ignore */
|
|
6182
6891
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
6183
6892
|
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
@@ -6188,6 +6897,8 @@ class Select extends AbstractSelect {
|
|
|
6188
6897
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6189
6898
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
6190
6899
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
6900
|
+
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6901
|
+
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
6191
6902
|
hasValue = computed(() => {
|
|
6192
6903
|
const value = this.value();
|
|
6193
6904
|
return value !== null && value !== undefined && value !== '';
|
|
@@ -6227,14 +6938,14 @@ class Select extends AbstractSelect {
|
|
|
6227
6938
|
this.select(option);
|
|
6228
6939
|
}
|
|
6229
6940
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6230
|
-
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 <
|
|
6941
|
+
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"] }] });
|
|
6231
6942
|
}
|
|
6232
6943
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
6233
6944
|
type: Component,
|
|
6234
|
-
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
6945
|
+
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
6235
6946
|
'[class]': 'hostClasses()',
|
|
6236
|
-
}, 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 <
|
|
6237
|
-
}], 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 }] }] } });
|
|
6947
|
+
}, 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" }]
|
|
6948
|
+
}], 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 }] }] } });
|
|
6238
6949
|
|
|
6239
6950
|
const DEFAULT_SLIDER_CONFIG = {
|
|
6240
6951
|
color: 'primary',
|
|
@@ -7454,11 +8165,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7454
8165
|
}]
|
|
7455
8166
|
}], ctorParameters: () => [], propDecorators: { tlsPaginationQuerySync: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsPaginationQuerySync", required: false }] }] } });
|
|
7456
8167
|
|
|
8168
|
+
const DEFAULT_PROGRESS_CONFIG = {
|
|
8169
|
+
max: 100,
|
|
8170
|
+
color: 'primary',
|
|
8171
|
+
size: 'md',
|
|
8172
|
+
activeSegmentScale: 2,
|
|
8173
|
+
};
|
|
8174
|
+
|
|
8175
|
+
const PROGRESS_CONFIG = new InjectionToken('PROGRESS_CONFIG', {
|
|
8176
|
+
factory: () => DEFAULT_PROGRESS_CONFIG,
|
|
8177
|
+
});
|
|
8178
|
+
|
|
8179
|
+
/**
|
|
8180
|
+
* A read-only linear progress indicator. Renders one continuous bar by
|
|
8181
|
+
* default; `segments` splits the track into that many discrete pills that fill
|
|
8182
|
+
* in order as the value advances — the idiom for step-based flows ("step 2 of
|
|
8183
|
+
* 6"). The host carries the `progressbar` role and the value ARIA.
|
|
8184
|
+
*/
|
|
8185
|
+
class Progress {
|
|
8186
|
+
// Injections
|
|
8187
|
+
_config = inject(PROGRESS_CONFIG);
|
|
8188
|
+
// Inputs
|
|
8189
|
+
value = input(0, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8190
|
+
max = input(this._config.max, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8191
|
+
/**
|
|
8192
|
+
* Splits the track into this many equal segments, filled one after another
|
|
8193
|
+
* as the value grows, the segment at the boundary partially. `null` renders
|
|
8194
|
+
* one continuous bar.
|
|
8195
|
+
*/
|
|
8196
|
+
segments = input(null, /* @ts-ignore */
|
|
8197
|
+
...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
8198
|
+
/**
|
|
8199
|
+
* Segment rendered wider than the rest, marking the step in progress: a
|
|
8200
|
+
* zero-based index, or `'latest'` to follow the frontmost segment the value
|
|
8201
|
+
* has reached. `null` keeps every segment the same width. Only meaningful
|
|
8202
|
+
* with `segments`.
|
|
8203
|
+
*/
|
|
8204
|
+
activeSegment = input(null, /* @ts-ignore */
|
|
8205
|
+
...(ngDevMode ? [{ debugName: "activeSegment" }] : /* istanbul ignore next */ []));
|
|
8206
|
+
/** Width of the active segment relative to the others (a flex-grow ratio). */
|
|
8207
|
+
activeSegmentScale = input(this._config.activeSegmentScale, { ...(ngDevMode ? { debugName: "activeSegmentScale" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
8208
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
8209
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
8210
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
8211
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
8212
|
+
/** Accessible name for the progressbar. */
|
|
8213
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
8214
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
8215
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
8216
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
8217
|
+
// Computed
|
|
8218
|
+
hostClasses = computed(() => {
|
|
8219
|
+
const className = 'tls-progress';
|
|
8220
|
+
const array = [className];
|
|
8221
|
+
array.push(`${className}--${this.color()}`);
|
|
8222
|
+
array.push(`${className}--${this.size()}`);
|
|
8223
|
+
return array;
|
|
8224
|
+
}, /* @ts-ignore */
|
|
8225
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
8226
|
+
/** Value clamped into [0, max]; the number exposed through ARIA. */
|
|
8227
|
+
clampedValue = computed(() => Math.min(Math.max(this.value(), 0), this.max()), /* @ts-ignore */
|
|
8228
|
+
...(ngDevMode ? [{ debugName: "clampedValue" }] : /* istanbul ignore next */ []));
|
|
8229
|
+
/** Filled share of the whole track, 0–1. */
|
|
8230
|
+
_fraction = computed(() => {
|
|
8231
|
+
const max = this.max();
|
|
8232
|
+
if (max <= 0)
|
|
8233
|
+
return 0;
|
|
8234
|
+
return this.clampedValue() / max;
|
|
8235
|
+
}, /* @ts-ignore */
|
|
8236
|
+
...(ngDevMode ? [{ debugName: "_fraction" }] : /* istanbul ignore next */ []));
|
|
8237
|
+
/**
|
|
8238
|
+
* Per-segment fill percentages, 0–100. A continuous bar is a single
|
|
8239
|
+
* segment, so one loop renders both looks; in segmented mode the overall
|
|
8240
|
+
* fraction is distributed across the segments in order, so each is full,
|
|
8241
|
+
* empty, or — at the boundary — partial.
|
|
8242
|
+
*/
|
|
8243
|
+
segmentFills = computed(() => {
|
|
8244
|
+
const segments = this.segments();
|
|
8245
|
+
const fraction = this._fraction();
|
|
8246
|
+
if (segments === null || segments < 2)
|
|
8247
|
+
return [fraction * 100];
|
|
8248
|
+
const count = Math.floor(segments);
|
|
8249
|
+
return Array.from({ length: count }, (_, index) => Math.min(Math.max(fraction * count - index, 0), 1) * 100);
|
|
8250
|
+
}, /* @ts-ignore */
|
|
8251
|
+
...(ngDevMode ? [{ debugName: "segmentFills" }] : /* istanbul ignore next */ []));
|
|
8252
|
+
/**
|
|
8253
|
+
* Index of the emphasized segment, or `null` when none: the clamped
|
|
8254
|
+
* consumer-picked index, or — for `'latest'` — the frontmost segment the
|
|
8255
|
+
* value has reached (the first one when nothing is filled yet).
|
|
8256
|
+
*/
|
|
8257
|
+
activeIndex = computed(() => {
|
|
8258
|
+
const activeSegment = this.activeSegment();
|
|
8259
|
+
if (activeSegment === null)
|
|
8260
|
+
return null;
|
|
8261
|
+
const count = this.segmentFills().length;
|
|
8262
|
+
if (count < 2)
|
|
8263
|
+
return null;
|
|
8264
|
+
const index = activeSegment === 'latest'
|
|
8265
|
+
? Math.ceil(this._fraction() * count) - 1
|
|
8266
|
+
: Math.floor(activeSegment);
|
|
8267
|
+
return Math.min(Math.max(index, 0), count - 1);
|
|
8268
|
+
}, /* @ts-ignore */
|
|
8269
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
8270
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Progress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8271
|
+
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"] });
|
|
8272
|
+
}
|
|
8273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Progress, decorators: [{
|
|
8274
|
+
type: Component,
|
|
8275
|
+
args: [{ selector: 'tls-progress', imports: [], host: {
|
|
8276
|
+
role: 'progressbar',
|
|
8277
|
+
'[class]': 'hostClasses()',
|
|
8278
|
+
'aria-valuemin': '0',
|
|
8279
|
+
'[attr.aria-valuemax]': 'max()',
|
|
8280
|
+
'[attr.aria-valuenow]': 'clampedValue()',
|
|
8281
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
8282
|
+
'[attr.aria-labelledby]': 'ariaLabelledby() ?? null',
|
|
8283
|
+
}, 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"] }]
|
|
8284
|
+
}], 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 }] }] } });
|
|
8285
|
+
|
|
7457
8286
|
const DEFAULT_SKELETON_CONFIG = {
|
|
7458
8287
|
size: null,
|
|
7459
8288
|
width: null,
|
|
7460
8289
|
height: null,
|
|
7461
|
-
radius:
|
|
8290
|
+
radius: 'md',
|
|
7462
8291
|
duration: 2500,
|
|
7463
8292
|
rounded: false,
|
|
7464
8293
|
animate: true,
|
|
@@ -7469,7 +8298,9 @@ const SKELETON_CONFIG = new InjectionToken('SKELETON_CONFIG', {
|
|
|
7469
8298
|
});
|
|
7470
8299
|
|
|
7471
8300
|
class Skeleton {
|
|
8301
|
+
// Injections
|
|
7472
8302
|
_config = inject(SKELETON_CONFIG);
|
|
8303
|
+
// Inputs
|
|
7473
8304
|
size = input(this._config.size, /* @ts-ignore */
|
|
7474
8305
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
7475
8306
|
width = input(this._config.width, /* @ts-ignore */
|
|
@@ -7482,6 +8313,7 @@ class Skeleton {
|
|
|
7482
8313
|
...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
7483
8314
|
rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7484
8315
|
animate = input(this._config.animate, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
8316
|
+
// Computed
|
|
7485
8317
|
hostClasses = computed(() => {
|
|
7486
8318
|
const className = 'tls-skeleton';
|
|
7487
8319
|
const array = [className];
|
|
@@ -7495,17 +8327,16 @@ class Skeleton {
|
|
|
7495
8327
|
const size = this.size();
|
|
7496
8328
|
const width = this.width() ?? size;
|
|
7497
8329
|
const height = this.height() ?? size;
|
|
7498
|
-
const rounded = this.rounded();
|
|
7499
|
-
const radius = this.radius();
|
|
7500
8330
|
return {
|
|
7501
|
-
'--tls-skeleton-width': this.
|
|
7502
|
-
'--tls-skeleton-height': this.
|
|
7503
|
-
'--tls-skeleton-radius': rounded ? '50%' :
|
|
8331
|
+
'--tls-skeleton-width': this._resolveDimension(width),
|
|
8332
|
+
'--tls-skeleton-height': this._resolveDimension(height),
|
|
8333
|
+
'--tls-skeleton-radius': this.rounded() ? '50%' : `var(--radius-${this.radius()})`,
|
|
7504
8334
|
'--tls-skeleton-duration': `${this.duration()}ms`,
|
|
7505
8335
|
};
|
|
7506
8336
|
}, /* @ts-ignore */
|
|
7507
8337
|
...(ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []));
|
|
7508
|
-
|
|
8338
|
+
// Private methods
|
|
8339
|
+
_resolveDimension(value) {
|
|
7509
8340
|
if (value === null)
|
|
7510
8341
|
return '100%';
|
|
7511
8342
|
if (typeof value === 'string')
|
|
@@ -7916,9 +8747,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7916
8747
|
const DEFAULT_STEP_CONFIG = {
|
|
7917
8748
|
color: 'primary',
|
|
7918
8749
|
};
|
|
8750
|
+
const DEFAULT_STEPPER_LABELS = {
|
|
8751
|
+
completed: 'Completed',
|
|
8752
|
+
invalid: 'Invalid',
|
|
8753
|
+
};
|
|
7919
8754
|
const DEFAULT_STEPPER_CONFIG = {
|
|
7920
8755
|
orientation: 'horizontal',
|
|
8756
|
+
labelPosition: 'end',
|
|
7921
8757
|
linear: false,
|
|
8758
|
+
labels: DEFAULT_STEPPER_LABELS,
|
|
7922
8759
|
step: DEFAULT_STEP_CONFIG,
|
|
7923
8760
|
};
|
|
7924
8761
|
|
|
@@ -7943,6 +8780,12 @@ class Step {
|
|
|
7943
8780
|
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
7944
8781
|
disabled = input(false, /* @ts-ignore */
|
|
7945
8782
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
8783
|
+
/**
|
|
8784
|
+
* Marks the step's content as invalid: its header takes the danger hue and
|
|
8785
|
+
* assistive technology hears the invalid state. Drive it from the step's
|
|
8786
|
+
* form validity to surface errors in the navigation.
|
|
8787
|
+
*/
|
|
8788
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7946
8789
|
hostClasses = computed(() => {
|
|
7947
8790
|
const className = 'tls-step';
|
|
7948
8791
|
const array = [className];
|
|
@@ -7954,17 +8797,19 @@ class Step {
|
|
|
7954
8797
|
}, /* @ts-ignore */
|
|
7955
8798
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
7956
8799
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7957
|
-
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" });
|
|
8800
|
+
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" });
|
|
7958
8801
|
}
|
|
7959
8802
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, decorators: [{
|
|
7960
8803
|
type: Component,
|
|
7961
8804
|
args: [{ selector: 'tls-step', imports: [], hostDirectives: [{ directive: TabPanel, inputs: ['value'] }], host: {
|
|
7962
8805
|
'[class]': 'hostClasses()',
|
|
7963
8806
|
}, template: "<ng-content></ng-content>\n" }]
|
|
7964
|
-
}], 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 }] }] } });
|
|
8807
|
+
}], 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 }] }] } });
|
|
7965
8808
|
|
|
7966
8809
|
class Stepper {
|
|
7967
8810
|
_config = inject(STEPPER_CONFIG);
|
|
8811
|
+
/** Visually hidden state texts appended to a step's accessible name. */
|
|
8812
|
+
labels = this._config.labels;
|
|
7968
8813
|
steps = contentChildren(Step, /* @ts-ignore */
|
|
7969
8814
|
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
7970
8815
|
completedTemplateRef = contentChild('completedTemplate', /* @ts-ignore */
|
|
@@ -7975,6 +8820,8 @@ class Stepper {
|
|
|
7975
8820
|
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
7976
8821
|
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
7977
8822
|
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
8823
|
+
labelPosition = input(this._config.labelPosition, /* @ts-ignore */
|
|
8824
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
7978
8825
|
completed = input(false, /* @ts-ignore */
|
|
7979
8826
|
...(ngDevMode ? [{ debugName: "completed" }] : /* istanbul ignore next */ []));
|
|
7980
8827
|
linear = input(this._config.linear, /* @ts-ignore */
|
|
@@ -7989,6 +8836,7 @@ class Stepper {
|
|
|
7989
8836
|
const className = 'tls-stepper';
|
|
7990
8837
|
const array = [className];
|
|
7991
8838
|
array.push(`${className}--${this.orientation()}`);
|
|
8839
|
+
array.push(`${className}--label-${this.labelPosition()}`);
|
|
7992
8840
|
if (this.completed())
|
|
7993
8841
|
array.push(`${className}--completed`);
|
|
7994
8842
|
return array;
|
|
@@ -8005,14 +8853,14 @@ class Stepper {
|
|
|
8005
8853
|
this.stepSelect.emit({ index, value });
|
|
8006
8854
|
}
|
|
8007
8855
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8008
|
-
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-
|
|
8856
|
+
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"] }] });
|
|
8009
8857
|
}
|
|
8010
8858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, decorators: [{
|
|
8011
8859
|
type: Component,
|
|
8012
8860
|
args: [{ selector: 'tls-stepper', imports: [NgTemplateOutlet, TabList, Tab$1], hostDirectives: [Tabs$1], host: {
|
|
8013
8861
|
'[class]': 'hostClasses()',
|
|
8014
|
-
}, 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-
|
|
8015
|
-
}], 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"] }] } });
|
|
8862
|
+
}, 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" }]
|
|
8863
|
+
}], 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"] }] } });
|
|
8016
8864
|
|
|
8017
8865
|
const DEFAULT_TAB_NAV_CONFIG = {
|
|
8018
8866
|
variant: 'flat',
|
|
@@ -8176,6 +9024,12 @@ class Table {
|
|
|
8176
9024
|
striped = input(this._config.striped, { ...(ngDevMode ? { debugName: "striped" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
8177
9025
|
trackBy = input(/* @ts-ignore */
|
|
8178
9026
|
...(ngDevMode ? [undefined, { debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
9027
|
+
/**
|
|
9028
|
+
* Bounds the table's height, in pixels. When set, the host becomes the scroll
|
|
9029
|
+
* container for the rows and the header row sticks to its top edge while they
|
|
9030
|
+
* scroll. Left unset the table grows with its content and nothing scrolls.
|
|
9031
|
+
*/
|
|
9032
|
+
maxHeight = input(undefined, { ...(ngDevMode ? { debugName: "maxHeight" } : /* istanbul ignore next */ {}), transform: value => value === undefined || value === null ? undefined : numberAttribute(value) });
|
|
8179
9033
|
/** Accessible name for the table, forwarded to the inner `<table>` element. */
|
|
8180
9034
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
8181
9035
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -8211,15 +9065,10 @@ class Table {
|
|
|
8211
9065
|
return filtered;
|
|
8212
9066
|
}, []), /* @ts-ignore */
|
|
8213
9067
|
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
8214
|
-
resolvedTrackBy = computed(() =>
|
|
8215
|
-
const trackBy = this.trackBy();
|
|
8216
|
-
if (trackBy === undefined)
|
|
8217
|
-
return (_, row) => row;
|
|
8218
|
-
if (typeof trackBy === 'string')
|
|
8219
|
-
return (_, row) => row[trackBy];
|
|
8220
|
-
return trackBy;
|
|
8221
|
-
}, /* @ts-ignore */
|
|
9068
|
+
resolvedTrackBy = computed(() => resolveTrackBy(this.trackBy()), /* @ts-ignore */
|
|
8222
9069
|
...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : /* istanbul ignore next */ []));
|
|
9070
|
+
scrollable = computed(() => this.maxHeight() !== undefined, /* @ts-ignore */
|
|
9071
|
+
...(ngDevMode ? [{ debugName: "scrollable" }] : /* istanbul ignore next */ []));
|
|
8223
9072
|
classes = computed(() => {
|
|
8224
9073
|
const className = 'tls-table';
|
|
8225
9074
|
const array = [className];
|
|
@@ -8259,7 +9108,7 @@ class Table {
|
|
|
8259
9108
|
return definition;
|
|
8260
9109
|
}
|
|
8261
9110
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8262
|
-
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"] }] });
|
|
9111
|
+
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"] }] });
|
|
8263
9112
|
}
|
|
8264
9113
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Table, decorators: [{
|
|
8265
9114
|
type: Component,
|
|
@@ -8275,8 +9124,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
8275
9124
|
CdkRow,
|
|
8276
9125
|
CdkRowDef,
|
|
8277
9126
|
NgTemplateOutlet,
|
|
8278
|
-
], host: {
|
|
8279
|
-
|
|
9127
|
+
], host: {
|
|
9128
|
+
class: 'tls-table-container',
|
|
9129
|
+
'[class.tls-table-container--scrollable]': 'scrollable()',
|
|
9130
|
+
'[style.max-height.px]': 'maxHeight() ?? null',
|
|
9131
|
+
}, 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"] }]
|
|
9132
|
+
}], 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 }] }] } });
|
|
8280
9133
|
|
|
8281
9134
|
// A declarative content holder: the host element itself is never rendered. `tls-tabs`
|
|
8282
9135
|
// reads the captured content/header templates and renders them inside its own
|
|
@@ -9053,10 +9906,20 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9053
9906
|
provide: POPOVER_CONFIG,
|
|
9054
9907
|
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, components.popover),
|
|
9055
9908
|
},
|
|
9909
|
+
{
|
|
9910
|
+
provide: PROGRESS_CONFIG,
|
|
9911
|
+
useValue: deepMerge(DEFAULT_PROGRESS_CONFIG, components.progress),
|
|
9912
|
+
},
|
|
9056
9913
|
{
|
|
9057
9914
|
provide: RADIO_BUTTON_CONFIG,
|
|
9058
9915
|
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, components.radioButton),
|
|
9059
9916
|
},
|
|
9917
|
+
{
|
|
9918
|
+
provide: RATING_CONFIG,
|
|
9919
|
+
// `labels` is a deep-partial override; deepMerge merges it recursively, but its
|
|
9920
|
+
// `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
9921
|
+
useValue: deepMerge(DEFAULT_RATING_CONFIG, components.rating),
|
|
9922
|
+
},
|
|
9060
9923
|
{
|
|
9061
9924
|
provide: SELECT_CONFIG,
|
|
9062
9925
|
useValue: deepMerge(DEFAULT_SELECT_CONFIG, components.select),
|
|
@@ -9075,6 +9938,9 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9075
9938
|
},
|
|
9076
9939
|
{
|
|
9077
9940
|
provide: STEPPER_CONFIG,
|
|
9941
|
+
// `labels` and `step` are deep-partial overrides; deepMerge merges them
|
|
9942
|
+
// recursively, but its `Partial<T>` signature only models a shallow
|
|
9943
|
+
// partial, so cast to it.
|
|
9078
9944
|
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, components.stepper),
|
|
9079
9945
|
},
|
|
9080
9946
|
{
|
|
@@ -9109,6 +9975,10 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9109
9975
|
provide: TOOLTIP_CONFIG,
|
|
9110
9976
|
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, components.tooltip),
|
|
9111
9977
|
},
|
|
9978
|
+
{
|
|
9979
|
+
provide: VIRTUAL_SCROLL_CONFIG,
|
|
9980
|
+
useValue: deepMerge(DEFAULT_VIRTUAL_SCROLL_CONFIG, components.virtualScroll),
|
|
9981
|
+
},
|
|
9112
9982
|
]);
|
|
9113
9983
|
};
|
|
9114
9984
|
|
|
@@ -9116,5 +9986,5 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
9116
9986
|
* Generated bundle index. Do not edit.
|
|
9117
9987
|
*/
|
|
9118
9988
|
|
|
9119
|
-
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 };
|
|
9989
|
+
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 };
|
|
9120
9990
|
//# sourceMappingURL=thalassic-ui.mjs.map
|