@thalassic/ui 22.12.0 → 22.14.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 +712 -298
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +303 -60
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, Component, Injectable, makeEnvironmentProviders,
|
|
2
|
+
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, contentChild, Component, Injectable, makeEnvironmentProviders, forwardRef, PLATFORM_ID, output, effect, ElementRef, afterNextRender, linkedSignal, numberAttribute, Renderer2, viewChildren, contentChildren, isDevMode, untracked, TemplateRef, provideEnvironmentInitializer, DOCUMENT } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
5
5
|
import { takeUntilDestroyed, rxResource, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
@@ -8,7 +8,7 @@ import { Router, ActivatedRoute, RouterLink, NavigationStart, RouterLinkActive }
|
|
|
8
8
|
import { NgComponentOutlet, NgTemplateOutlet, LocationStrategy, isPlatformBrowser } from '@angular/common';
|
|
9
9
|
import { HttpClient } from '@angular/common/http';
|
|
10
10
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
11
|
-
import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, format, startOfDay, isBefore, isAfter,
|
|
11
|
+
import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, format, startOfDay, isBefore, isAfter, isSameDay, differenceInCalendarDays, isSameMonth, addHours, differenceInMinutes, isSameWeek, addMonths, addWeeks, subMonths, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setHours, setMinutes, setYear } from 'date-fns';
|
|
12
12
|
import { Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
13
13
|
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
14
14
|
import { filter as filter$1 } from 'rxjs/operators';
|
|
@@ -284,11 +284,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
284
284
|
type: Directive
|
|
285
285
|
}], 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
286
|
|
|
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
|
+
/**
|
|
292
|
+
* Disposes a detached overlay once the panel's exit animation has finished, so
|
|
293
|
+
* the pane is not torn down while `animate.leave` is still playing. Falls back
|
|
294
|
+
* to a timeout when no animation runs (e.g. the `none` motion level).
|
|
295
|
+
*
|
|
296
|
+
* Shared by every surface that detaches a pane to let the exit animation play
|
|
297
|
+
* (connected overlays, confirm, tooltip).
|
|
298
|
+
*/
|
|
299
|
+
function disposeAfterLeaveAnimation(overlayRef) {
|
|
300
|
+
const paneElement = overlayRef.overlayElement;
|
|
301
|
+
if (!paneElement) {
|
|
302
|
+
overlayRef.dispose();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
let settled = false;
|
|
306
|
+
const finalize = () => {
|
|
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
|
+
}
|
|
317
|
+
|
|
287
318
|
const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
|
|
288
|
-
// Upper bound for how long to keep a non-reused pane alive after detach so the
|
|
289
|
-
// panel's `animate.leave` can finish. Disposes on `animationend`; this only
|
|
290
|
-
// fires when no exit animation runs (e.g. the `none` motion level).
|
|
291
|
-
const LEAVE_ANIMATION_FALLBACK_MS$3 = 500;
|
|
292
319
|
/**
|
|
293
320
|
* Owns the CDK-Overlay lifecycle shared by the library's connected overlay
|
|
294
321
|
* components (popover, menu, select): create/attach, dismissal wiring
|
|
@@ -362,7 +389,7 @@ class OverlayManager {
|
|
|
362
389
|
const reuse = Boolean(config && config.reuse);
|
|
363
390
|
if (!reuse) {
|
|
364
391
|
this._overlayRef = null;
|
|
365
|
-
|
|
392
|
+
disposeAfterLeaveAnimation(overlayRef);
|
|
366
393
|
}
|
|
367
394
|
}
|
|
368
395
|
if (config && config.onClose)
|
|
@@ -410,29 +437,6 @@ class OverlayManager {
|
|
|
410
437
|
.subscribe(() => this.close());
|
|
411
438
|
}
|
|
412
439
|
}
|
|
413
|
-
/**
|
|
414
|
-
* Disposes a detached overlay once the panel's exit animation has finished, so
|
|
415
|
-
* the pane is not torn down while `animate.leave` is still playing. Falls back
|
|
416
|
-
* to a timeout when no animation runs (e.g. the `none` motion level).
|
|
417
|
-
*/
|
|
418
|
-
_disposeAfterAnimation(overlayRef) {
|
|
419
|
-
const paneElement = overlayRef.overlayElement;
|
|
420
|
-
if (!paneElement) {
|
|
421
|
-
overlayRef.dispose();
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
let settled = false;
|
|
425
|
-
const finalize = () => {
|
|
426
|
-
if (settled)
|
|
427
|
-
return;
|
|
428
|
-
settled = true;
|
|
429
|
-
window.clearTimeout(timeoutId);
|
|
430
|
-
paneElement.removeEventListener('animationend', finalize);
|
|
431
|
-
overlayRef.dispose();
|
|
432
|
-
};
|
|
433
|
-
paneElement.addEventListener('animationend', finalize);
|
|
434
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS$3);
|
|
435
|
-
}
|
|
436
440
|
_dispose() {
|
|
437
441
|
this._overlayRef?.dispose();
|
|
438
442
|
this._overlayRef = null;
|
|
@@ -460,6 +464,14 @@ class AbstractSelect extends ValueFormControl {
|
|
|
460
464
|
...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
|
|
461
465
|
panelTemplate = viewChild('panel', /* @ts-ignore */
|
|
462
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 */ []));
|
|
463
475
|
// Shared inputs (config-independent)
|
|
464
476
|
options = input([], /* @ts-ignore */
|
|
465
477
|
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
@@ -559,7 +571,11 @@ class AbstractSelect extends ValueFormControl {
|
|
|
559
571
|
this.open();
|
|
560
572
|
}
|
|
561
573
|
}
|
|
562
|
-
onOptionHover(index, disabled) {
|
|
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;
|
|
563
579
|
if (!disabled)
|
|
564
580
|
this.activeIndex.set(index);
|
|
565
581
|
}
|
|
@@ -623,6 +639,20 @@ class AbstractSelect extends ValueFormControl {
|
|
|
623
639
|
optionId(index) {
|
|
624
640
|
return `${this.uniqueId}-option-${index}`;
|
|
625
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
|
+
}
|
|
626
656
|
moveActive(direction) {
|
|
627
657
|
const options = this.visibleOptions();
|
|
628
658
|
let next = this.activeIndex() + direction;
|
|
@@ -647,14 +677,27 @@ class AbstractSelect extends ValueFormControl {
|
|
|
647
677
|
}
|
|
648
678
|
}
|
|
649
679
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
650
|
-
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 } }, 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 });
|
|
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 });
|
|
651
681
|
}
|
|
652
682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: AbstractSelect, decorators: [{
|
|
653
683
|
type: Directive
|
|
654
|
-
}], propDecorators: { triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelTemplate: [{ type: i0.ViewChild, args: ['panel', { 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 }] }] } });
|
|
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 }] }] } });
|
|
655
685
|
|
|
656
686
|
// Form control base classes
|
|
657
687
|
|
|
688
|
+
/**
|
|
689
|
+
* `date-fns` format options carrying the configured locale, or `undefined` when none is set
|
|
690
|
+
* (so `date-fns` falls back to its built-in `en-US`). Returning `undefined` rather than
|
|
691
|
+
* `{ locale: undefined }` satisfies `exactOptionalPropertyTypes`.
|
|
692
|
+
*/
|
|
693
|
+
const localeFormatOptions = (config) => config.dateFns ? { locale: config.dateFns } : undefined;
|
|
694
|
+
|
|
695
|
+
const DEFAULT_LOCALE_CONFIG = {};
|
|
696
|
+
|
|
697
|
+
const LOCALE_CONFIG = new InjectionToken('LOCALE_CONFIG', {
|
|
698
|
+
factory: () => DEFAULT_LOCALE_CONFIG,
|
|
699
|
+
});
|
|
700
|
+
|
|
658
701
|
class QuerySyncDirective {
|
|
659
702
|
_router = inject(Router);
|
|
660
703
|
_route = inject(ActivatedRoute);
|
|
@@ -886,6 +929,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
886
929
|
args: [{ providedIn: 'root' }]
|
|
887
930
|
}] });
|
|
888
931
|
|
|
932
|
+
// Elements removed from fetched SVG markup: script execution, nested browsing
|
|
933
|
+
// contexts, and foreignObject (which can embed arbitrary HTML).
|
|
934
|
+
const DISALLOWED_ELEMENTS = ['script', 'foreignobject', 'iframe', 'object', 'embed', 'link', 'meta'];
|
|
935
|
+
// Attribute URLs must be same-document references (`#id`); anything else —
|
|
936
|
+
// external resources, `javascript:`, `data:` — is stripped.
|
|
937
|
+
const URL_ATTRIBUTES = ['href', 'xlink:href', 'src'];
|
|
889
938
|
class IconService {
|
|
890
939
|
_http = inject(HttpClient);
|
|
891
940
|
_sanitizer = inject(DomSanitizer);
|
|
@@ -913,23 +962,59 @@ class IconService {
|
|
|
913
962
|
const safeSvg = this._makeSafe(svg);
|
|
914
963
|
return this._sanitizer.bypassSecurityTrustHtml(safeSvg);
|
|
915
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Sanitizes SVG markup by parsing it into a DOM tree and stripping dangerous
|
|
967
|
+
* nodes and attributes, so obfuscated markup (unquoted attributes, entity
|
|
968
|
+
* tricks) cannot slip through the way it could with pattern matching on the
|
|
969
|
+
* raw text. The cleaned tree is serialized back to markup.
|
|
970
|
+
*
|
|
971
|
+
* Without a DOM parser (server-side rendering), the markup is dropped rather
|
|
972
|
+
* than passed through unsanitized; the icon renders once the browser takes
|
|
973
|
+
* over.
|
|
974
|
+
*/
|
|
916
975
|
_makeSafe(svg) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
976
|
+
if (typeof DOMParser === 'undefined')
|
|
977
|
+
return '';
|
|
978
|
+
const parsed = new DOMParser().parseFromString(svg, 'image/svg+xml');
|
|
979
|
+
if (parsed.querySelector('parsererror'))
|
|
980
|
+
return '';
|
|
981
|
+
const root = parsed.documentElement;
|
|
982
|
+
this._sanitizeElement(root);
|
|
983
|
+
return new XMLSerializer().serializeToString(root);
|
|
984
|
+
}
|
|
985
|
+
_sanitizeElement(element) {
|
|
986
|
+
// Snapshot: children are removed while iterating.
|
|
987
|
+
for (const child of Array.from(element.children)) {
|
|
988
|
+
if (DISALLOWED_ELEMENTS.includes(child.localName.toLowerCase())) {
|
|
989
|
+
child.remove();
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
this._sanitizeElement(child);
|
|
993
|
+
}
|
|
994
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
995
|
+
if (this._isAttributeDisallowed(attribute.name, attribute.value)) {
|
|
996
|
+
element.removeAttribute(attribute.name);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
// `<style>` text can pull external resources; keep local rules only.
|
|
1000
|
+
if (element.localName.toLowerCase() === 'style' && element.textContent) {
|
|
1001
|
+
element.textContent = element.textContent
|
|
1002
|
+
.replace(/@import[^;]*;?/gi, '')
|
|
1003
|
+
.replace(/url\s*\(\s*(?!\s*["']?#)[^)]*\)/gi, 'none');
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
_isAttributeDisallowed(name, value) {
|
|
1007
|
+
const attributeName = name.toLowerCase();
|
|
1008
|
+
// Event handlers (onclick, onload, …) regardless of quoting or casing.
|
|
1009
|
+
if (attributeName.startsWith('on'))
|
|
1010
|
+
return true;
|
|
1011
|
+
// URL-bearing attributes may only reference into the same document.
|
|
1012
|
+
if (URL_ATTRIBUTES.includes(attributeName))
|
|
1013
|
+
return !value.trim().startsWith('#');
|
|
1014
|
+
// Inline style may not pull external resources.
|
|
1015
|
+
if (attributeName === 'style')
|
|
1016
|
+
return /url\s*\(\s*(?!\s*["']?#)/i.test(value) || /@import/i.test(value);
|
|
1017
|
+
return false;
|
|
933
1018
|
}
|
|
934
1019
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
935
1020
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: IconService, providedIn: 'root' });
|
|
@@ -1442,6 +1527,25 @@ const buildOverlayPositions = (position, offset) => {
|
|
|
1442
1527
|
}));
|
|
1443
1528
|
};
|
|
1444
1529
|
|
|
1530
|
+
/**
|
|
1531
|
+
* A signal of the current time, refreshed every `intervalMs` (browser only), so
|
|
1532
|
+
* time-dependent computed's — a current-time indicator, a "today" highlight —
|
|
1533
|
+
* stay correct while the view is left open instead of freezing at first render.
|
|
1534
|
+
*
|
|
1535
|
+
* Must be called from an injection context (a field initializer or
|
|
1536
|
+
* constructor); the refresh interval is cleared when that context is destroyed.
|
|
1537
|
+
* On the server the signal holds the construction time and never ticks.
|
|
1538
|
+
*/
|
|
1539
|
+
const createNowSignal = (intervalMs) => {
|
|
1540
|
+
const now = signal(new Date(), /* @ts-ignore */
|
|
1541
|
+
...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
|
|
1542
|
+
if (isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
1543
|
+
const handle = setInterval(() => now.set(new Date()), intervalMs);
|
|
1544
|
+
inject(DestroyRef).onDestroy(() => clearInterval(handle));
|
|
1545
|
+
}
|
|
1546
|
+
return now.asReadonly();
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1445
1549
|
/** Escapes RegExp metacharacters so the string matches literally inside a pattern. */
|
|
1446
1550
|
const escapeRegularExpression = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1447
1551
|
|
|
@@ -1477,15 +1581,12 @@ const HOUR_LABEL_FORMAT = 'h a';
|
|
|
1477
1581
|
const AGENDA_WEEKDAY_FORMAT = 'EEEE';
|
|
1478
1582
|
/** `date-fns` format token for an agenda day's date, e.g. "Jul 22". */
|
|
1479
1583
|
const AGENDA_DATE_FORMAT = 'MMM d';
|
|
1584
|
+
/** How often the calendar's notion of "now" refreshes (current-time line, today highlight). */
|
|
1585
|
+
const NOW_REFRESH_INTERVAL_MS = 60_000;
|
|
1480
1586
|
/** Views that prefix an event chip with its start time; the month grid shows the title alone. */
|
|
1481
1587
|
const TIME_AWARE_VIEWS = ['week', 'day', 'agenda'];
|
|
1482
|
-
/** View switcher
|
|
1483
|
-
const
|
|
1484
|
-
{ label: 'Month', value: 'month' },
|
|
1485
|
-
{ label: 'Week', value: 'week' },
|
|
1486
|
-
{ label: 'Day', value: 'day' },
|
|
1487
|
-
{ label: 'Agenda', value: 'agenda' },
|
|
1488
|
-
];
|
|
1588
|
+
/** View switcher order; labels are resolved from the calendar config for localization. */
|
|
1589
|
+
const CALENDAR_VIEW_ORDER = ['month', 'week', 'day', 'agenda'];
|
|
1489
1590
|
|
|
1490
1591
|
/**
|
|
1491
1592
|
* Renders a single event as an interactive chip. Owns color resolution, the consumer
|
|
@@ -1493,6 +1594,8 @@ const CALENDAR_VIEW_OPTIONS = [
|
|
|
1493
1594
|
* (a month cell's list, a time-grid block, an agenda row).
|
|
1494
1595
|
*/
|
|
1495
1596
|
class CalendarEventItem {
|
|
1597
|
+
// Injections
|
|
1598
|
+
_locale = inject(LOCALE_CONFIG);
|
|
1496
1599
|
// Inputs
|
|
1497
1600
|
event = input.required(/* @ts-ignore */
|
|
1498
1601
|
...(ngDevMode ? [{ debugName: "event" }] : /* istanbul ignore next */ []));
|
|
@@ -1502,6 +1605,8 @@ class CalendarEventItem {
|
|
|
1502
1605
|
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1503
1606
|
// Outputs
|
|
1504
1607
|
activate = output();
|
|
1608
|
+
// State
|
|
1609
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
1505
1610
|
// Computed
|
|
1506
1611
|
classes = computed(() => {
|
|
1507
1612
|
const classes = ['tls-calendar-event__button'];
|
|
@@ -1521,7 +1626,7 @@ class CalendarEventItem {
|
|
|
1521
1626
|
const event = this.event();
|
|
1522
1627
|
const view = this.view();
|
|
1523
1628
|
if (TIME_AWARE_VIEWS.includes(view) && event.allDay !== true) {
|
|
1524
|
-
return `${format(event.start, 'p')} ${event.title}`;
|
|
1629
|
+
return `${format(event.start, 'p', this._dateOptions)} ${event.title}`;
|
|
1525
1630
|
}
|
|
1526
1631
|
return event.title;
|
|
1527
1632
|
}, /* @ts-ignore */
|
|
@@ -1540,6 +1645,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1540
1645
|
args: [{ selector: 'tls-calendar-event', imports: [NgTemplateOutlet], host: { class: 'tls-calendar-event' }, template: "<button\n type=\"button\"\n tabindex=\"-1\"\n [class]=\"classes()\"\n (click)=\"onClick($event)\"\n>\n @if (template(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"context()\" />\n } @else {\n <span class=\"tls-calendar-event__label\">{{ defaultLabel() }}</span>\n }\n</button>\n" }]
|
|
1541
1646
|
}], propDecorators: { event: [{ type: i0.Input, args: [{ isSignal: true, alias: "event", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }] } });
|
|
1542
1647
|
|
|
1648
|
+
const DEFAULT_CALENDAR_CONFIG = {
|
|
1649
|
+
view: 'month',
|
|
1650
|
+
weekStartsOn: 0,
|
|
1651
|
+
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
1652
|
+
hourStart: 0,
|
|
1653
|
+
hourEnd: 24,
|
|
1654
|
+
showAllDayRow: true,
|
|
1655
|
+
maxEventsPerDay: DEFAULT_MAX_EVENTS_PER_DAY,
|
|
1656
|
+
labels: {
|
|
1657
|
+
previous: 'Previous',
|
|
1658
|
+
next: 'Next',
|
|
1659
|
+
today: 'Today',
|
|
1660
|
+
allDay: 'All day',
|
|
1661
|
+
noEvents: 'No events',
|
|
1662
|
+
more: count => `+${count} more`,
|
|
1663
|
+
views: {
|
|
1664
|
+
month: 'Month',
|
|
1665
|
+
week: 'Week',
|
|
1666
|
+
day: 'Day',
|
|
1667
|
+
agenda: 'Agenda',
|
|
1668
|
+
},
|
|
1669
|
+
},
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
const CALENDAR_CONFIG = new InjectionToken('CALENDAR_CONFIG', {
|
|
1673
|
+
factory: () => DEFAULT_CALENDAR_CONFIG,
|
|
1674
|
+
});
|
|
1675
|
+
|
|
1543
1676
|
/**
|
|
1544
1677
|
* Whether `event` overlaps the calendar day `day`. Compared at day granularity via `startOfDay`,
|
|
1545
1678
|
* so a spring-forward day (only 23h long) never mis-buckets an event into an adjacent column.
|
|
@@ -1564,6 +1697,9 @@ const eventsForDay = (day, events) => events
|
|
|
1564
1697
|
* omitted. Reuses the shared event chip and template slot; carries list — not grid — semantics.
|
|
1565
1698
|
*/
|
|
1566
1699
|
class CalendarAgendaView {
|
|
1700
|
+
// Injections
|
|
1701
|
+
_locale = inject(LOCALE_CONFIG);
|
|
1702
|
+
_config = inject(CALENDAR_CONFIG);
|
|
1567
1703
|
// Inputs
|
|
1568
1704
|
activeDate = input.required(/* @ts-ignore */
|
|
1569
1705
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
@@ -1577,23 +1713,29 @@ class CalendarAgendaView {
|
|
|
1577
1713
|
// Outputs
|
|
1578
1714
|
dateSelect = output();
|
|
1579
1715
|
eventSelect = output();
|
|
1716
|
+
// State
|
|
1717
|
+
noEventsLabel = this._config.labels.noEvents;
|
|
1718
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
1719
|
+
/** Ticking current time, so the today marker tracks the clock across midnight. */
|
|
1720
|
+
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
1580
1721
|
// Computed
|
|
1581
1722
|
days = computed(() => {
|
|
1582
1723
|
const activeDate = this.activeDate();
|
|
1583
1724
|
const events = this.events();
|
|
1725
|
+
const now = this._now();
|
|
1584
1726
|
return eachDayOfInterval({ start: startOfMonth(activeDate), end: endOfMonth(activeDate) })
|
|
1585
1727
|
.map(date => ({
|
|
1586
1728
|
date,
|
|
1587
|
-
weekday: format(date, AGENDA_WEEKDAY_FORMAT),
|
|
1588
|
-
dateLabel: format(date, AGENDA_DATE_FORMAT),
|
|
1589
|
-
isToday:
|
|
1729
|
+
weekday: format(date, AGENDA_WEEKDAY_FORMAT, this._dateOptions),
|
|
1730
|
+
dateLabel: format(date, AGENDA_DATE_FORMAT, this._dateOptions),
|
|
1731
|
+
isToday: isSameDay(date, now),
|
|
1590
1732
|
events: eventsForDay(date, events),
|
|
1591
1733
|
}))
|
|
1592
1734
|
.filter(day => day.events.length > 0);
|
|
1593
1735
|
}, /* @ts-ignore */
|
|
1594
1736
|
...(ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []));
|
|
1595
1737
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarAgendaView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1596
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarAgendaView, isStandalone: true, selector: "tls-calendar-agenda-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", 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: { attributes: { "role": "list" }, properties: { "attr.aria-label": "label() ?? null" }, classAttribute: "tls-calendar-agenda-view" }, ngImport: i0, template: "@for (day of days(); track day.date.getTime()) {\n <div class=\"tls-calendar-agenda-view__day\" role=\"listitem\">\n <button\n type=\"button\"\n class=\"tls-calendar-agenda-view__date\"\n [class.tls-calendar-agenda-view__date--today]=\"day.isToday\"\n (click)=\"dateSelect.emit(day.date)\"\n >\n <span class=\"tls-calendar-agenda-view__weekday\">{{ day.weekday }}</span>\n <span class=\"tls-calendar-agenda-view__date-label\">{{ day.dateLabel }}</span>\n </button>\n\n <ul class=\"tls-calendar-agenda-view__events\">\n @for (event of day.events; track event.id) {\n <li>\n <tls-calendar-event\n view=\"agenda\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n </li>\n }\n </ul>\n </div>\n} @empty {\n <p class=\"tls-calendar-agenda-view__empty\">
|
|
1738
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarAgendaView, isStandalone: true, selector: "tls-calendar-agenda-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", 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: { attributes: { "role": "list" }, properties: { "attr.aria-label": "label() ?? null" }, classAttribute: "tls-calendar-agenda-view" }, ngImport: i0, template: "@for (day of days(); track day.date.getTime()) {\n <div class=\"tls-calendar-agenda-view__day\" role=\"listitem\">\n <button\n type=\"button\"\n class=\"tls-calendar-agenda-view__date\"\n [class.tls-calendar-agenda-view__date--today]=\"day.isToday\"\n (click)=\"dateSelect.emit(day.date)\"\n >\n <span class=\"tls-calendar-agenda-view__weekday\">{{ day.weekday }}</span>\n <span class=\"tls-calendar-agenda-view__date-label\">{{ day.dateLabel }}</span>\n </button>\n\n <ul class=\"tls-calendar-agenda-view__events\">\n @for (event of day.events; track event.id) {\n <li>\n <tls-calendar-event\n view=\"agenda\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n </li>\n }\n </ul>\n </div>\n} @empty {\n <p class=\"tls-calendar-agenda-view__empty\">{{ noEventsLabel }}</p>\n}\n", dependencies: [{ kind: "component", type: CalendarEventItem, selector: "tls-calendar-event", inputs: ["event", "view", "template"], outputs: ["activate"] }] });
|
|
1597
1739
|
}
|
|
1598
1740
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarAgendaView, decorators: [{
|
|
1599
1741
|
type: Component,
|
|
@@ -1601,7 +1743,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1601
1743
|
class: 'tls-calendar-agenda-view',
|
|
1602
1744
|
role: 'list',
|
|
1603
1745
|
'[attr.aria-label]': 'label() ?? null',
|
|
1604
|
-
}, template: "@for (day of days(); track day.date.getTime()) {\n <div class=\"tls-calendar-agenda-view__day\" role=\"listitem\">\n <button\n type=\"button\"\n class=\"tls-calendar-agenda-view__date\"\n [class.tls-calendar-agenda-view__date--today]=\"day.isToday\"\n (click)=\"dateSelect.emit(day.date)\"\n >\n <span class=\"tls-calendar-agenda-view__weekday\">{{ day.weekday }}</span>\n <span class=\"tls-calendar-agenda-view__date-label\">{{ day.dateLabel }}</span>\n </button>\n\n <ul class=\"tls-calendar-agenda-view__events\">\n @for (event of day.events; track event.id) {\n <li>\n <tls-calendar-event\n view=\"agenda\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n </li>\n }\n </ul>\n </div>\n} @empty {\n <p class=\"tls-calendar-agenda-view__empty\">
|
|
1746
|
+
}, template: "@for (day of days(); track day.date.getTime()) {\n <div class=\"tls-calendar-agenda-view__day\" role=\"listitem\">\n <button\n type=\"button\"\n class=\"tls-calendar-agenda-view__date\"\n [class.tls-calendar-agenda-view__date--today]=\"day.isToday\"\n (click)=\"dateSelect.emit(day.date)\"\n >\n <span class=\"tls-calendar-agenda-view__weekday\">{{ day.weekday }}</span>\n <span class=\"tls-calendar-agenda-view__date-label\">{{ day.dateLabel }}</span>\n </button>\n\n <ul class=\"tls-calendar-agenda-view__events\">\n @for (event of day.events; track event.id) {\n <li>\n <tls-calendar-event\n view=\"agenda\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n </li>\n }\n </ul>\n </div>\n} @empty {\n <p class=\"tls-calendar-agenda-view__empty\">{{ noEventsLabel }}</p>\n}\n" }]
|
|
1605
1747
|
}], propDecorators: { activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }], events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: true }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", 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"] }] } });
|
|
1606
1748
|
|
|
1607
1749
|
/**
|
|
@@ -1664,6 +1806,9 @@ const assignWeekLanes = (weekDays, events) => {
|
|
|
1664
1806
|
};
|
|
1665
1807
|
|
|
1666
1808
|
class CalendarMonthView {
|
|
1809
|
+
// Injections
|
|
1810
|
+
_locale = inject(LOCALE_CONFIG);
|
|
1811
|
+
_config = inject(CALENDAR_CONFIG);
|
|
1667
1812
|
// Inputs
|
|
1668
1813
|
activeDate = input.required(/* @ts-ignore */
|
|
1669
1814
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
@@ -1683,6 +1828,10 @@ class CalendarMonthView {
|
|
|
1683
1828
|
// Outputs
|
|
1684
1829
|
dateSelect = output();
|
|
1685
1830
|
eventSelect = output();
|
|
1831
|
+
// State
|
|
1832
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
1833
|
+
/** Ticking current time, so the today highlight tracks the clock across midnight. */
|
|
1834
|
+
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
1686
1835
|
// Computed
|
|
1687
1836
|
weekdayHeaders = computed(() => rotateWeekDays(this.weekDays(), this.weekStartsOn()), /* @ts-ignore */
|
|
1688
1837
|
...(ngDevMode ? [{ debugName: "weekdayHeaders" }] : /* istanbul ignore next */ []));
|
|
@@ -1690,6 +1839,7 @@ class CalendarMonthView {
|
|
|
1690
1839
|
const activeDate = this.activeDate();
|
|
1691
1840
|
const maxLanes = this.maxEventsPerDay();
|
|
1692
1841
|
const events = this.events();
|
|
1842
|
+
const now = this._now();
|
|
1693
1843
|
// A fixed 6-week window keeps the grid height from reflowing between months.
|
|
1694
1844
|
const days = buildMonthDays(activeDate, this.weekStartsOn(), MONTH_GRID_ROWS);
|
|
1695
1845
|
const weeks = [];
|
|
@@ -1716,9 +1866,9 @@ class CalendarMonthView {
|
|
|
1716
1866
|
}
|
|
1717
1867
|
const cells = weekDays.map((date, column) => ({
|
|
1718
1868
|
date,
|
|
1719
|
-
dayNumber: format(date, DAY_NUMBER_FORMAT),
|
|
1869
|
+
dayNumber: format(date, DAY_NUMBER_FORMAT, this._dateOptions),
|
|
1720
1870
|
inCurrentMonth: isSameMonth(date, activeDate),
|
|
1721
|
-
isToday:
|
|
1871
|
+
isToday: isSameDay(date, now),
|
|
1722
1872
|
hiddenCount: hiddenPerColumn[column],
|
|
1723
1873
|
}));
|
|
1724
1874
|
weeks.push({ days: cells, bars });
|
|
@@ -1727,17 +1877,21 @@ class CalendarMonthView {
|
|
|
1727
1877
|
}, /* @ts-ignore */
|
|
1728
1878
|
...(ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []));
|
|
1729
1879
|
// Protected methods
|
|
1880
|
+
/** Localized "+N more" label for a day cell with `count` hidden events. */
|
|
1881
|
+
moreLabel(count) {
|
|
1882
|
+
return this._config.labels.more(count);
|
|
1883
|
+
}
|
|
1730
1884
|
/** Space would scroll the page; consume it and select the focused day instead. */
|
|
1731
1885
|
onDaySpace(event, date) {
|
|
1732
1886
|
event.preventDefault();
|
|
1733
1887
|
this.dateSelect.emit(date);
|
|
1734
1888
|
}
|
|
1735
1889
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1736
|
-
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 @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\"
|
|
1890
|
+
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 @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\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"] }] });
|
|
1737
1891
|
}
|
|
1738
1892
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, decorators: [{
|
|
1739
1893
|
type: Component,
|
|
1740
|
-
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem], host: { class: 'tls-calendar-month-view' }, 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 @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\"
|
|
1894
|
+
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem], host: { class: 'tls-calendar-month-view' }, 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 @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\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" }]
|
|
1741
1895
|
}], 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 }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", 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"] }] } });
|
|
1742
1896
|
|
|
1743
1897
|
const eventEnd = (event) => (event.end ?? event.start).getTime();
|
|
@@ -1795,6 +1949,9 @@ const assignEventLanes = (events) => {
|
|
|
1795
1949
|
* a header row. Shared by the week (seven columns) and day (single column) views.
|
|
1796
1950
|
*/
|
|
1797
1951
|
class CalendarTimeGrid {
|
|
1952
|
+
// Injections
|
|
1953
|
+
_locale = inject(LOCALE_CONFIG);
|
|
1954
|
+
_config = inject(CALENDAR_CONFIG);
|
|
1798
1955
|
// Inputs
|
|
1799
1956
|
days = input.required(/* @ts-ignore */
|
|
1800
1957
|
...(ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []));
|
|
@@ -1818,6 +1975,10 @@ class CalendarTimeGrid {
|
|
|
1818
1975
|
eventSelect = output();
|
|
1819
1976
|
// State
|
|
1820
1977
|
hourHeight = HOUR_HEIGHT;
|
|
1978
|
+
allDayLabel = this._config.labels.allDay;
|
|
1979
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
1980
|
+
/** Ticking current time, so the now line and today highlight track the clock. */
|
|
1981
|
+
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
1821
1982
|
// Computed
|
|
1822
1983
|
hours = computed(() => {
|
|
1823
1984
|
const hours = [];
|
|
@@ -1830,13 +1991,14 @@ class CalendarTimeGrid {
|
|
|
1830
1991
|
const events = this.events();
|
|
1831
1992
|
const hourStart = this.hourStart();
|
|
1832
1993
|
const hourEnd = this.hourEnd();
|
|
1994
|
+
const now = this._now();
|
|
1833
1995
|
return this.days().map(day => {
|
|
1834
1996
|
const dayStart = startOfDay(day);
|
|
1835
1997
|
const windowStart = addHours(dayStart, hourStart);
|
|
1836
1998
|
const windowEnd = addHours(dayStart, hourEnd);
|
|
1837
1999
|
const dayEvents = events.filter(event => eventCoversDay(event, dayStart));
|
|
1838
2000
|
const allDayEvents = dayEvents.filter(event => this._isAllDay(event));
|
|
1839
|
-
const timed = dayEvents.filter(event => !this._isAllDay(event));
|
|
2001
|
+
const timed = dayEvents.filter(event => !this._isAllDay(event) && this._overlapsWindow(event, windowStart, windowEnd));
|
|
1840
2002
|
const timedEvents = assignEventLanes(timed).map(laid => {
|
|
1841
2003
|
const start = this._clamp(laid.event.start, windowStart, windowEnd);
|
|
1842
2004
|
const end = this._clamp(laid.event.end ?? laid.event.start, windowStart, windowEnd);
|
|
@@ -1848,15 +2010,15 @@ class CalendarTimeGrid {
|
|
|
1848
2010
|
height: Math.max(MIN_EVENT_HEIGHT, differenceInMinutes(end, start) * PX_PER_MINUTE),
|
|
1849
2011
|
};
|
|
1850
2012
|
});
|
|
1851
|
-
return { date: day, isToday:
|
|
2013
|
+
return { date: day, isToday: isSameDay(day, now), heading: format(day, TIME_GRID_HEADING_FORMAT, this._dateOptions), allDayEvents, timedEvents };
|
|
1852
2014
|
});
|
|
1853
2015
|
}, /* @ts-ignore */
|
|
1854
2016
|
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1855
2017
|
/** Vertical offset (px) of the current-time line, or null when now is off-screen. */
|
|
1856
2018
|
nowOffset = computed(() => {
|
|
1857
|
-
|
|
2019
|
+
const now = this._now();
|
|
2020
|
+
if (!this.days().some(day => isSameDay(day, now)))
|
|
1858
2021
|
return null;
|
|
1859
|
-
const now = new Date();
|
|
1860
2022
|
const dayStart = startOfDay(now);
|
|
1861
2023
|
const windowStart = addHours(dayStart, this.hourStart());
|
|
1862
2024
|
const windowEnd = addHours(dayStart, this.hourEnd());
|
|
@@ -1867,7 +2029,7 @@ class CalendarTimeGrid {
|
|
|
1867
2029
|
...(ngDevMode ? [{ debugName: "nowOffset" }] : /* istanbul ignore next */ []));
|
|
1868
2030
|
// Protected methods
|
|
1869
2031
|
hourLabel(hour) {
|
|
1870
|
-
return format(addHours(startOfDay(new Date()), hour), HOUR_LABEL_FORMAT);
|
|
2032
|
+
return format(addHours(startOfDay(new Date()), hour), HOUR_LABEL_FORMAT, this._dateOptions);
|
|
1871
2033
|
}
|
|
1872
2034
|
laneOffset(layout) {
|
|
1873
2035
|
return (layout.lane * 100) / layout.laneCount;
|
|
@@ -1879,11 +2041,24 @@ class CalendarTimeGrid {
|
|
|
1879
2041
|
_isAllDay(event) {
|
|
1880
2042
|
return event.allDay === true || !isSameDay(event.start, event.end ?? event.start);
|
|
1881
2043
|
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Whether the event has any visible span inside the rendered hour window.
|
|
2046
|
+
* Events entirely before `hourStart` or after `hourEnd` are excluded — clamping
|
|
2047
|
+
* them would paint a zero-length sliver pinned to the window edge. An instant
|
|
2048
|
+
* (zero-duration) event counts while its start sits inside the window.
|
|
2049
|
+
*/
|
|
2050
|
+
_overlapsWindow(event, windowStart, windowEnd) {
|
|
2051
|
+
const start = event.start;
|
|
2052
|
+
const end = event.end ?? event.start;
|
|
2053
|
+
if (end.getTime() === start.getTime())
|
|
2054
|
+
return start >= windowStart && start < windowEnd;
|
|
2055
|
+
return end > windowStart && start < windowEnd;
|
|
2056
|
+
}
|
|
1882
2057
|
_clamp(date, min, max) {
|
|
1883
2058
|
return new Date(Math.min(Math.max(date.getTime(), min.getTime()), max.getTime()));
|
|
1884
2059
|
}
|
|
1885
2060
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarTimeGrid, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1886
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarTimeGrid, isStandalone: true, selector: "tls-calendar-time-grid", inputs: { days: { classPropertyName: "days", publicName: "days", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: true, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: true, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: true, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", 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: { attributes: { "role": "group" }, properties: { "attr.aria-label": "label() ?? null", "style.--tls-calendar-hour-height.px": "hourHeight", "style.--tls-calendar-columns": "days().length" }, classAttribute: "tls-calendar-time-grid" }, ngImport: i0, template: "<div class=\"tls-calendar-time-grid__header\">\n <div class=\"tls-calendar-time-grid__gutter-spacer\"></div>\n @for (column of columns(); track column.date.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar-time-grid__heading\"\n [class.tls-calendar-time-grid__heading--today]=\"column.isToday\"\n (click)=\"dateSelect.emit(column.date)\"\n >\n {{ column.heading }}\n </button>\n }\n</div>\n\n@if (showAllDayRow()) {\n <div class=\"tls-calendar-time-grid__all-day\">\n <div class=\"tls-calendar-time-grid__gutter-label\">
|
|
2061
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarTimeGrid, isStandalone: true, selector: "tls-calendar-time-grid", inputs: { days: { classPropertyName: "days", publicName: "days", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: true, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: true, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: true, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", 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: { attributes: { "role": "group" }, properties: { "attr.aria-label": "label() ?? null", "style.--tls-calendar-hour-height.px": "hourHeight", "style.--tls-calendar-columns": "days().length" }, classAttribute: "tls-calendar-time-grid" }, ngImport: i0, template: "<div class=\"tls-calendar-time-grid__header\">\n <div class=\"tls-calendar-time-grid__gutter-spacer\"></div>\n @for (column of columns(); track column.date.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar-time-grid__heading\"\n [class.tls-calendar-time-grid__heading--today]=\"column.isToday\"\n (click)=\"dateSelect.emit(column.date)\"\n >\n {{ column.heading }}\n </button>\n }\n</div>\n\n@if (showAllDayRow()) {\n <div class=\"tls-calendar-time-grid__all-day\">\n <div class=\"tls-calendar-time-grid__gutter-label\">{{ allDayLabel }}</div>\n @for (column of columns(); track column.date.getTime()) {\n <div class=\"tls-calendar-time-grid__all-day-cell\">\n @for (event of column.allDayEvents; track event.id) {\n <tls-calendar-event\n [view]=\"view()\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n </div>\n }\n </div>\n}\n\n<div class=\"tls-calendar-time-grid__body\">\n <div class=\"tls-calendar-time-grid__gutter\">\n @for (hour of hours(); track hour) {\n <div class=\"tls-calendar-time-grid__hour-label\">{{ hourLabel(hour) }}</div>\n }\n </div>\n\n @for (column of columns(); track column.date.getTime()) {\n <div\n class=\"tls-calendar-time-grid__column\"\n [class.tls-calendar-time-grid__column--today]=\"column.isToday\"\n >\n @for (hour of hours(); track hour) {\n <div class=\"tls-calendar-time-grid__hour-line\"></div>\n }\n\n @for (layout of column.timedEvents; track layout.event.id) {\n <tls-calendar-event\n class=\"tls-calendar-time-grid__event\"\n [view]=\"view()\"\n [event]=\"layout.event\"\n [template]=\"eventTemplate()\"\n [style.top.px]=\"layout.top\"\n [style.height.px]=\"layout.height\"\n [style.inset-inline-start.%]=\"laneOffset(layout)\"\n [style.width.%]=\"laneWidth(layout)\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n\n @if (column.isToday && nowOffset() !== null) {\n <div class=\"tls-calendar-time-grid__now\" [style.top.px]=\"nowOffset()\"></div>\n }\n </div>\n }\n</div>\n", dependencies: [{ kind: "component", type: CalendarEventItem, selector: "tls-calendar-event", inputs: ["event", "view", "template"], outputs: ["activate"] }] });
|
|
1887
2062
|
}
|
|
1888
2063
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarTimeGrid, decorators: [{
|
|
1889
2064
|
type: Component,
|
|
@@ -1893,26 +2068,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1893
2068
|
'[attr.aria-label]': 'label() ?? null',
|
|
1894
2069
|
'[style.--tls-calendar-hour-height.px]': 'hourHeight',
|
|
1895
2070
|
'[style.--tls-calendar-columns]': 'days().length',
|
|
1896
|
-
}, template: "<div class=\"tls-calendar-time-grid__header\">\n <div class=\"tls-calendar-time-grid__gutter-spacer\"></div>\n @for (column of columns(); track column.date.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar-time-grid__heading\"\n [class.tls-calendar-time-grid__heading--today]=\"column.isToday\"\n (click)=\"dateSelect.emit(column.date)\"\n >\n {{ column.heading }}\n </button>\n }\n</div>\n\n@if (showAllDayRow()) {\n <div class=\"tls-calendar-time-grid__all-day\">\n <div class=\"tls-calendar-time-grid__gutter-label\">
|
|
2071
|
+
}, template: "<div class=\"tls-calendar-time-grid__header\">\n <div class=\"tls-calendar-time-grid__gutter-spacer\"></div>\n @for (column of columns(); track column.date.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar-time-grid__heading\"\n [class.tls-calendar-time-grid__heading--today]=\"column.isToday\"\n (click)=\"dateSelect.emit(column.date)\"\n >\n {{ column.heading }}\n </button>\n }\n</div>\n\n@if (showAllDayRow()) {\n <div class=\"tls-calendar-time-grid__all-day\">\n <div class=\"tls-calendar-time-grid__gutter-label\">{{ allDayLabel }}</div>\n @for (column of columns(); track column.date.getTime()) {\n <div class=\"tls-calendar-time-grid__all-day-cell\">\n @for (event of column.allDayEvents; track event.id) {\n <tls-calendar-event\n [view]=\"view()\"\n [event]=\"event\"\n [template]=\"eventTemplate()\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n </div>\n }\n </div>\n}\n\n<div class=\"tls-calendar-time-grid__body\">\n <div class=\"tls-calendar-time-grid__gutter\">\n @for (hour of hours(); track hour) {\n <div class=\"tls-calendar-time-grid__hour-label\">{{ hourLabel(hour) }}</div>\n }\n </div>\n\n @for (column of columns(); track column.date.getTime()) {\n <div\n class=\"tls-calendar-time-grid__column\"\n [class.tls-calendar-time-grid__column--today]=\"column.isToday\"\n >\n @for (hour of hours(); track hour) {\n <div class=\"tls-calendar-time-grid__hour-line\"></div>\n }\n\n @for (layout of column.timedEvents; track layout.event.id) {\n <tls-calendar-event\n class=\"tls-calendar-time-grid__event\"\n [view]=\"view()\"\n [event]=\"layout.event\"\n [template]=\"eventTemplate()\"\n [style.top.px]=\"layout.top\"\n [style.height.px]=\"layout.height\"\n [style.inset-inline-start.%]=\"laneOffset(layout)\"\n [style.width.%]=\"laneWidth(layout)\"\n (activate)=\"eventSelect.emit($event)\"\n />\n }\n\n @if (column.isToday && nowOffset() !== null) {\n <div class=\"tls-calendar-time-grid__now\" [style.top.px]=\"nowOffset()\"></div>\n }\n </div>\n }\n</div>\n" }]
|
|
1897
2072
|
}], propDecorators: { days: [{ type: i0.Input, args: [{ isSignal: true, alias: "days", required: true }] }], events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: true }] }], hourStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStart", required: true }] }], hourEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourEnd", required: true }] }], showAllDayRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllDayRow", required: true }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", 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"] }] } });
|
|
1898
2073
|
|
|
1899
|
-
const DEFAULT_CALENDAR_CONFIG = {
|
|
1900
|
-
view: 'month',
|
|
1901
|
-
weekStartsOn: 0,
|
|
1902
|
-
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
1903
|
-
hourStart: 0,
|
|
1904
|
-
hourEnd: 24,
|
|
1905
|
-
showAllDayRow: true,
|
|
1906
|
-
maxEventsPerDay: DEFAULT_MAX_EVENTS_PER_DAY,
|
|
1907
|
-
};
|
|
1908
|
-
|
|
1909
|
-
const CALENDAR_CONFIG = new InjectionToken('CALENDAR_CONFIG', {
|
|
1910
|
-
factory: () => DEFAULT_CALENDAR_CONFIG,
|
|
1911
|
-
});
|
|
1912
|
-
|
|
1913
2074
|
class Calendar {
|
|
1914
2075
|
// Injections
|
|
1915
2076
|
_config = inject(CALENDAR_CONFIG);
|
|
2077
|
+
_locale = inject(LOCALE_CONFIG);
|
|
1916
2078
|
// Inputs
|
|
1917
2079
|
events = input([], /* @ts-ignore */
|
|
1918
2080
|
...(ngDevMode ? [{ debugName: "events" }] : /* istanbul ignore next */ []));
|
|
@@ -1942,9 +2104,13 @@ class Calendar {
|
|
|
1942
2104
|
/** Anchor date driving the visible range; navigation shifts it by the view's unit. */
|
|
1943
2105
|
activeDate = model(new Date(), /* @ts-ignore */
|
|
1944
2106
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
1945
|
-
|
|
2107
|
+
labels = this._config.labels;
|
|
2108
|
+
viewOptions = CALENDAR_VIEW_ORDER.map(value => ({ label: this._config.labels.views[value], value }));
|
|
1946
2109
|
eventTemplate = contentChild('eventTemplate', /* @ts-ignore */
|
|
1947
2110
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
2111
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
2112
|
+
/** Ticking current time, so the "Today" affordance stays correct across midnight. */
|
|
2113
|
+
_now = createNowSignal(NOW_REFRESH_INTERVAL_MS);
|
|
1948
2114
|
// Computed
|
|
1949
2115
|
hostClasses = computed(() => [
|
|
1950
2116
|
'tls-calendar',
|
|
@@ -1954,7 +2120,7 @@ class Calendar {
|
|
|
1954
2120
|
/** Whether the active period already includes today, so "Today" would be a no-op. */
|
|
1955
2121
|
isViewingToday = computed(() => {
|
|
1956
2122
|
const activeDate = this.activeDate();
|
|
1957
|
-
const now =
|
|
2123
|
+
const now = this._now();
|
|
1958
2124
|
switch (this.view()) {
|
|
1959
2125
|
case 'week':
|
|
1960
2126
|
return isSameWeek(activeDate, now, { weekStartsOn: this.weekStartsOn() });
|
|
@@ -1971,9 +2137,9 @@ class Calendar {
|
|
|
1971
2137
|
case 'week':
|
|
1972
2138
|
return this._weekTitle(activeDate);
|
|
1973
2139
|
case 'day':
|
|
1974
|
-
return format(activeDate, DAY_TITLE_FORMAT);
|
|
2140
|
+
return format(activeDate, DAY_TITLE_FORMAT, this._dateOptions);
|
|
1975
2141
|
default:
|
|
1976
|
-
return format(activeDate, MONTH_TITLE_FORMAT);
|
|
2142
|
+
return format(activeDate, MONTH_TITLE_FORMAT, this._dateOptions);
|
|
1977
2143
|
}
|
|
1978
2144
|
}, /* @ts-ignore */
|
|
1979
2145
|
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
@@ -2054,16 +2220,16 @@ class Calendar {
|
|
|
2054
2220
|
}
|
|
2055
2221
|
_weekTitle(activeDate) {
|
|
2056
2222
|
const { start, end } = this._weekBounds(activeDate);
|
|
2057
|
-
return `${format(start, 'MMM d')} – ${format(end, 'MMM d, yyyy')}`;
|
|
2223
|
+
return `${format(start, 'MMM d', this._dateOptions)} – ${format(end, 'MMM d, yyyy', this._dateOptions)}`;
|
|
2058
2224
|
}
|
|
2059
2225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2060
|
-
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 <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n ariaLabel=\"
|
|
2226
|
+
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 <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 <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n\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</div>\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 [eventTemplate]=\"eventTemplate()\"\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", "eventTemplate", "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"] }] });
|
|
2061
2227
|
}
|
|
2062
2228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, decorators: [{
|
|
2063
2229
|
type: Component,
|
|
2064
2230
|
args: [{ selector: 'tls-calendar', imports: [Button, ToggleGroup, CalendarMonthView, CalendarTimeGrid, CalendarAgendaView, Icon], host: {
|
|
2065
2231
|
'[class]': 'hostClasses()',
|
|
2066
|
-
}, template: "<div class=\"tls-calendar__header\">\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n ariaLabel=\"
|
|
2232
|
+
}, template: "<div class=\"tls-calendar__header\">\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 <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n\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</div>\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 [eventTemplate]=\"eventTemplate()\"\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" }]
|
|
2067
2233
|
}], 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 }] }] } });
|
|
2068
2234
|
|
|
2069
2235
|
const DEFAULT_CHIP_CONFIG = {
|
|
@@ -2500,10 +2666,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
2500
2666
|
}]
|
|
2501
2667
|
}], 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"] }] } });
|
|
2502
2668
|
|
|
2503
|
-
// Upper bound for how long to keep a detached confirm pane alive so its
|
|
2504
|
-
// `animate.leave` can finish. Disposes on `animationend`; this timeout only
|
|
2505
|
-
// fires when no exit animation runs (e.g. the `none` motion level).
|
|
2506
|
-
const LEAVE_ANIMATION_FALLBACK_MS$2 = 500;
|
|
2507
2669
|
// Dimmed backdrop behind a centered modal confirm. Shared with `tls-dialog` so
|
|
2508
2670
|
// the two modal surfaces render an identical scrim.
|
|
2509
2671
|
const MODAL_BACKDROP_CLASS = 'tls-dialog-backdrop';
|
|
@@ -2606,22 +2768,7 @@ class ConfirmService {
|
|
|
2606
2768
|
// then disposes the pane once that animation finishes.
|
|
2607
2769
|
_dismiss(overlayRef) {
|
|
2608
2770
|
overlayRef.detach();
|
|
2609
|
-
|
|
2610
|
-
if (!paneElement) {
|
|
2611
|
-
overlayRef.dispose();
|
|
2612
|
-
return;
|
|
2613
|
-
}
|
|
2614
|
-
let settled = false;
|
|
2615
|
-
const finalize = () => {
|
|
2616
|
-
if (settled)
|
|
2617
|
-
return;
|
|
2618
|
-
settled = true;
|
|
2619
|
-
window.clearTimeout(timeoutId);
|
|
2620
|
-
paneElement.removeEventListener('animationend', finalize);
|
|
2621
|
-
overlayRef.dispose();
|
|
2622
|
-
};
|
|
2623
|
-
paneElement.addEventListener('animationend', finalize);
|
|
2624
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS$2);
|
|
2771
|
+
disposeAfterLeaveAnimation(overlayRef);
|
|
2625
2772
|
}
|
|
2626
2773
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ConfirmService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2627
2774
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ConfirmService, providedIn: 'root' });
|
|
@@ -2635,6 +2782,7 @@ const DEFAULT_DIALOG_CONFIG = {
|
|
|
2635
2782
|
size: 'md',
|
|
2636
2783
|
closeable: true,
|
|
2637
2784
|
backdropClose: true,
|
|
2785
|
+
closeLabel: 'Close dialog',
|
|
2638
2786
|
};
|
|
2639
2787
|
|
|
2640
2788
|
const DIALOG_CONFIG = new InjectionToken('DIALOG_CONFIG', {
|
|
@@ -2652,11 +2800,11 @@ class Dialog extends CdkDialogContainer {
|
|
|
2652
2800
|
this._dialogRef.close();
|
|
2653
2801
|
}
|
|
2654
2802
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2655
|
-
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 <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"
|
|
2803
|
+
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 <button class=\"tls-dialog__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"] }] });
|
|
2656
2804
|
}
|
|
2657
2805
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Dialog, decorators: [{
|
|
2658
2806
|
type: Component,
|
|
2659
|
-
args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet, Icon], host: { '[class]': 'hostClasses' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"
|
|
2807
|
+
args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet, Icon], host: { '[class]': 'hostClasses' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" [attr.aria-label]=\"config.closeLabel\" (click)=\"close()\">\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n" }]
|
|
2660
2808
|
}] });
|
|
2661
2809
|
|
|
2662
2810
|
class DialogService {
|
|
@@ -2667,6 +2815,7 @@ class DialogService {
|
|
|
2667
2815
|
size: config?.size ?? this._config.size,
|
|
2668
2816
|
closeable: config?.closeable ?? this._config.closeable,
|
|
2669
2817
|
backdropClose: config?.backdropClose ?? this._config.backdropClose,
|
|
2818
|
+
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
2670
2819
|
};
|
|
2671
2820
|
return this._dialog.open(component, {
|
|
2672
2821
|
container: {
|
|
@@ -2741,7 +2890,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
2741
2890
|
// its slide-out (`--leave`) animation can finish before disposal. The `animationend`
|
|
2742
2891
|
// listener disposes early; this fallback covers the case where no exit animation
|
|
2743
2892
|
// runs (e.g. the `none` motion level, where nothing is emitted).
|
|
2744
|
-
const LEAVE_ANIMATION_FALLBACK_MS
|
|
2893
|
+
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
2745
2894
|
// Named size tokens, used to tell a preset apart from a custom CSS-length string.
|
|
2746
2895
|
const DRAWER_NAMED_SIZES = ['sm', 'md', 'lg', 'full'];
|
|
2747
2896
|
|
|
@@ -2751,6 +2900,7 @@ const DEFAULT_DRAWER_CONFIG = {
|
|
|
2751
2900
|
closeable: true,
|
|
2752
2901
|
backdropClose: true,
|
|
2753
2902
|
rounded: false,
|
|
2903
|
+
closeLabel: 'Close drawer',
|
|
2754
2904
|
};
|
|
2755
2905
|
|
|
2756
2906
|
const DRAWER_CONFIG = new InjectionToken('DRAWER_CONFIG', {
|
|
@@ -2832,7 +2982,7 @@ class Drawer extends CdkDialogContainer {
|
|
|
2832
2982
|
};
|
|
2833
2983
|
element.addEventListener('animationend', onAnimationEnd);
|
|
2834
2984
|
// Safety net if `animationend` never arrives (e.g. the pane is torn down early).
|
|
2835
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS
|
|
2985
|
+
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
2836
2986
|
// The `--leave` class applies on the next change detection; on the following
|
|
2837
2987
|
// frame, close at once if no animation is running. When motion is enabled the
|
|
2838
2988
|
// computed `animationName` is never `none`, so this cannot finalize early.
|
|
@@ -2842,14 +2992,14 @@ class Drawer extends CdkDialogContainer {
|
|
|
2842
2992
|
});
|
|
2843
2993
|
}
|
|
2844
2994
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2845
|
-
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\" aria-label=\"
|
|
2995
|
+
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"] }] });
|
|
2846
2996
|
}
|
|
2847
2997
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Drawer, decorators: [{
|
|
2848
2998
|
type: Component,
|
|
2849
2999
|
args: [{ selector: 'tls-drawer', imports: [CdkPortalOutlet, Icon], host: {
|
|
2850
3000
|
'[class]': 'hostClasses()',
|
|
2851
3001
|
'[style.--tls-drawer-size]': 'customSize',
|
|
2852
|
-
}, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-drawer__close\" type=\"button\" aria-label=\"
|
|
3002
|
+
}, 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" }]
|
|
2853
3003
|
}] });
|
|
2854
3004
|
|
|
2855
3005
|
/**
|
|
@@ -2891,6 +3041,7 @@ class DrawerService {
|
|
|
2891
3041
|
closeable: config?.closeable ?? this._config.closeable,
|
|
2892
3042
|
backdropClose: config?.backdropClose ?? this._config.backdropClose,
|
|
2893
3043
|
rounded: config?.rounded ?? this._config.rounded,
|
|
3044
|
+
closeLabel: config?.closeLabel ?? this._config.closeLabel,
|
|
2894
3045
|
};
|
|
2895
3046
|
let drawerRef;
|
|
2896
3047
|
const dialogRef = this._dialog.open(component, {
|
|
@@ -3039,6 +3190,12 @@ const DEFAULT_FORM_ITEM_ERROR_MESSAGES = {
|
|
|
3039
3190
|
},
|
|
3040
3191
|
pattern: () => 'Invalid format',
|
|
3041
3192
|
};
|
|
3193
|
+
/**
|
|
3194
|
+
* Message rendered for a validation error whose `kind` has no entry in the
|
|
3195
|
+
* configured {@link ErrorMessageMap} and that carries no `message` of its own
|
|
3196
|
+
* (e.g. a custom validator).
|
|
3197
|
+
*/
|
|
3198
|
+
const DEFAULT_FORM_ITEM_UNKNOWN_ERROR_MESSAGE = () => 'Invalid value';
|
|
3042
3199
|
|
|
3043
3200
|
const DEFAULT_FORM_ITEM_CONFIG = {
|
|
3044
3201
|
reserveErrorSpace: true,
|
|
@@ -3046,6 +3203,7 @@ const DEFAULT_FORM_ITEM_CONFIG = {
|
|
|
3046
3203
|
displayErrors: true,
|
|
3047
3204
|
showRequiredMarker: true,
|
|
3048
3205
|
errorMessages: DEFAULT_FORM_ITEM_ERROR_MESSAGES,
|
|
3206
|
+
unknownErrorMessage: DEFAULT_FORM_ITEM_UNKNOWN_ERROR_MESSAGE,
|
|
3049
3207
|
};
|
|
3050
3208
|
|
|
3051
3209
|
const FORM_ITEM_CONFIG = new InjectionToken('FORM_ITEM_CONFIG', {
|
|
@@ -3170,10 +3328,14 @@ class FormItem {
|
|
|
3170
3328
|
_getErrorMessages(errors) {
|
|
3171
3329
|
const array = [];
|
|
3172
3330
|
for (const error of errors) {
|
|
3173
|
-
if (error.message)
|
|
3331
|
+
if (error.message) {
|
|
3174
3332
|
array.push(error.message);
|
|
3175
|
-
|
|
3176
|
-
|
|
3333
|
+
continue;
|
|
3334
|
+
}
|
|
3335
|
+
// A custom validator's kind may have no configured message; fall back to
|
|
3336
|
+
// the generic one rather than failing on the missing entry.
|
|
3337
|
+
const messageFunction = this._config.errorMessages[error.kind] ?? this._config.unknownErrorMessage;
|
|
3338
|
+
array.push(messageFunction(error.fieldTree));
|
|
3177
3339
|
}
|
|
3178
3340
|
return array;
|
|
3179
3341
|
}
|
|
@@ -3279,6 +3441,7 @@ const DEFAULT_AUTOCOMPLETE_CONFIG = {
|
|
|
3279
3441
|
clearable: false,
|
|
3280
3442
|
filterMode: 'contains',
|
|
3281
3443
|
emptyMessage: 'No results',
|
|
3444
|
+
clearLabel: 'Clear',
|
|
3282
3445
|
};
|
|
3283
3446
|
|
|
3284
3447
|
const AUTOCOMPLETE_CONFIG = new InjectionToken('AUTOCOMPLETE_CONFIG', {
|
|
@@ -3304,6 +3467,8 @@ class Autocomplete extends AbstractSelect {
|
|
|
3304
3467
|
...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
3305
3468
|
emptyMessage = input(this._config.emptyMessage, /* @ts-ignore */
|
|
3306
3469
|
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
3470
|
+
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
3471
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
3307
3472
|
hasValue = computed(() => {
|
|
3308
3473
|
const value = this.value();
|
|
3309
3474
|
return value !== null && value !== undefined;
|
|
@@ -3331,6 +3496,9 @@ class Autocomplete extends AbstractSelect {
|
|
|
3331
3496
|
this.value.set(option.value);
|
|
3332
3497
|
this.close();
|
|
3333
3498
|
}
|
|
3499
|
+
isOptionSelected(option) {
|
|
3500
|
+
return option.value === this.value();
|
|
3501
|
+
}
|
|
3334
3502
|
onInput(event) {
|
|
3335
3503
|
const target = event.target;
|
|
3336
3504
|
this.query.set(target.value);
|
|
@@ -3410,14 +3578,14 @@ class Autocomplete extends AbstractSelect {
|
|
|
3410
3578
|
this.select(option);
|
|
3411
3579
|
}
|
|
3412
3580
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3413
|
-
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 } }, 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 aria-label=\"
|
|
3581
|
+
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 <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 <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 (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 </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\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"] }] });
|
|
3414
3582
|
}
|
|
3415
3583
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
|
|
3416
3584
|
type: Component,
|
|
3417
|
-
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon], host: {
|
|
3585
|
+
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
3418
3586
|
'[class]': 'hostClasses()',
|
|
3419
|
-
}, 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 aria-label=\"
|
|
3420
|
-
}], 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 }] }] } });
|
|
3587
|
+
}, 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 <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 <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 (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 </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n</ng-template>\n" }]
|
|
3588
|
+
}], 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 }] }] } });
|
|
3421
3589
|
|
|
3422
3590
|
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
3423
3591
|
|
|
@@ -3444,9 +3612,19 @@ class Checkbox extends CheckboxFormControl {
|
|
|
3444
3612
|
}, /* @ts-ignore */
|
|
3445
3613
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3446
3614
|
// Protected methods
|
|
3447
|
-
toggle() {
|
|
3448
|
-
if (this.notInteractive())
|
|
3615
|
+
toggle(event) {
|
|
3616
|
+
if (this.notInteractive()) {
|
|
3617
|
+
// Keep the native input from flipping its own checked state.
|
|
3618
|
+
if (event)
|
|
3619
|
+
event.preventDefault();
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
// Activating an indeterminate checkbox resolves it to checked.
|
|
3623
|
+
if (this.indeterminate()) {
|
|
3624
|
+
this.indeterminate.set(false);
|
|
3625
|
+
this.checked.set(true);
|
|
3449
3626
|
return;
|
|
3627
|
+
}
|
|
3450
3628
|
this.checked.update(prev => !prev);
|
|
3451
3629
|
}
|
|
3452
3630
|
onKeyboardToggle(event) {
|
|
@@ -3454,15 +3632,13 @@ class Checkbox extends CheckboxFormControl {
|
|
|
3454
3632
|
this.toggle();
|
|
3455
3633
|
}
|
|
3456
3634
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3457
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: {
|
|
3635
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-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 [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\"\n (click)=\"toggle($event)\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3458
3636
|
}
|
|
3459
3637
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, decorators: [{
|
|
3460
3638
|
type: Component,
|
|
3461
3639
|
args: [{ selector: 'tls-checkbox', imports: [Icon], host: {
|
|
3462
|
-
role: 'checkbox',
|
|
3463
3640
|
'[class]': 'hostClasses()',
|
|
3464
|
-
|
|
3465
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-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 [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n" }]
|
|
3641
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-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 [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\"\n (click)=\"toggle($event)\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n" }]
|
|
3466
3642
|
}], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
3467
3643
|
|
|
3468
3644
|
const DEFAULT_POPOVER_CONFIG = {
|
|
@@ -3549,6 +3725,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3549
3725
|
}], propDecorators: { _templateRef: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
3550
3726
|
|
|
3551
3727
|
class DatePickerCalendar {
|
|
3728
|
+
// Injections
|
|
3729
|
+
_locale = inject(LOCALE_CONFIG);
|
|
3730
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
3552
3731
|
// Inputs
|
|
3553
3732
|
viewDate = input.required(/* @ts-ignore */
|
|
3554
3733
|
...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
@@ -3565,7 +3744,7 @@ class DatePickerCalendar {
|
|
|
3565
3744
|
// Computed
|
|
3566
3745
|
displayedWeekDays = computed(() => rotateWeekDays(this.weekDays(), this.weekStartsOn()), /* @ts-ignore */
|
|
3567
3746
|
...(ngDevMode ? [{ debugName: "displayedWeekDays" }] : /* istanbul ignore next */ []));
|
|
3568
|
-
headerLabel = computed(() => format(this.viewDate(), 'MMMM yyyy'), /* @ts-ignore */
|
|
3747
|
+
headerLabel = computed(() => format(this.viewDate(), 'MMMM yyyy', this._dateOptions), /* @ts-ignore */
|
|
3569
3748
|
...(ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []));
|
|
3570
3749
|
days = computed(() => buildMonthDays(this.viewDate(), this.weekStartsOn()), /* @ts-ignore */
|
|
3571
3750
|
...(ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []));
|
|
@@ -3577,7 +3756,7 @@ class DatePickerCalendar {
|
|
|
3577
3756
|
this.viewDateChange.emit(addMonths(this.viewDate(), 1));
|
|
3578
3757
|
}
|
|
3579
3758
|
getDayLabel(day) {
|
|
3580
|
-
return format(day, 'd');
|
|
3759
|
+
return format(day, 'd', this._dateOptions);
|
|
3581
3760
|
}
|
|
3582
3761
|
isSelectedDay(day) {
|
|
3583
3762
|
const selected = this.selectedDate();
|
|
@@ -3611,6 +3790,9 @@ const DATE_TIME_PICKER_CONFIG = new InjectionToken('DATE_TIME_PICKER_CONFIG', {
|
|
|
3611
3790
|
|
|
3612
3791
|
const MONTH_INDEXES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
3613
3792
|
class MonthPicker {
|
|
3793
|
+
// Injections
|
|
3794
|
+
_locale = inject(LOCALE_CONFIG);
|
|
3795
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
3614
3796
|
// Inputs
|
|
3615
3797
|
viewDate = input.required(/* @ts-ignore */
|
|
3616
3798
|
...(ngDevMode ? [{ debugName: "viewDate" }] : /* istanbul ignore next */ []));
|
|
@@ -3622,11 +3804,11 @@ class MonthPicker {
|
|
|
3622
3804
|
navigateUp = output();
|
|
3623
3805
|
// Computed
|
|
3624
3806
|
months = MONTH_INDEXES;
|
|
3625
|
-
yearLabel = computed(() => format(this.viewDate(), 'yyyy'), /* @ts-ignore */
|
|
3807
|
+
yearLabel = computed(() => format(this.viewDate(), 'yyyy', this._dateOptions), /* @ts-ignore */
|
|
3626
3808
|
...(ngDevMode ? [{ debugName: "yearLabel" }] : /* istanbul ignore next */ []));
|
|
3627
3809
|
// Protected methods
|
|
3628
3810
|
getMonthLabel(monthIndex) {
|
|
3629
|
-
return format(setMonth(new Date(2000, 0, 1), monthIndex), 'MMM');
|
|
3811
|
+
return format(setMonth(new Date(2000, 0, 1), monthIndex), 'MMM', this._dateOptions);
|
|
3630
3812
|
}
|
|
3631
3813
|
prevYear() {
|
|
3632
3814
|
this.viewDateChange.emit(subYears(this.viewDate(), 1));
|
|
@@ -3752,6 +3934,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3752
3934
|
class DateTimePicker extends ValueFormControl {
|
|
3753
3935
|
// Injections
|
|
3754
3936
|
config = inject(DATE_TIME_PICKER_CONFIG);
|
|
3937
|
+
_locale = inject(LOCALE_CONFIG);
|
|
3938
|
+
_dateOptions = localeFormatOptions(this._locale);
|
|
3755
3939
|
// View children
|
|
3756
3940
|
popoverComponent = viewChild('popoverRef', /* @ts-ignore */
|
|
3757
3941
|
...(ngDevMode ? [{ debugName: "popoverComponent" }] : /* istanbul ignore next */ []));
|
|
@@ -3795,14 +3979,14 @@ class DateTimePicker extends ValueFormControl {
|
|
|
3795
3979
|
return this.placeholder();
|
|
3796
3980
|
const mode = this.mode();
|
|
3797
3981
|
if (mode === 'calendar')
|
|
3798
|
-
return format(value, 'MMM d, yyyy');
|
|
3982
|
+
return format(value, 'MMM d, yyyy', this._dateOptions);
|
|
3799
3983
|
if (mode === 'month-picker')
|
|
3800
|
-
return format(value, 'MMMM yyyy');
|
|
3984
|
+
return format(value, 'MMMM yyyy', this._dateOptions);
|
|
3801
3985
|
if (mode === 'year-picker')
|
|
3802
|
-
return format(value, 'yyyy');
|
|
3986
|
+
return format(value, 'yyyy', this._dateOptions);
|
|
3803
3987
|
if (mode === 'time-picker')
|
|
3804
|
-
return format(value, 'HH:mm');
|
|
3805
|
-
return format(value, 'MMM d, yyyy HH:mm');
|
|
3988
|
+
return format(value, 'HH:mm', this._dateOptions);
|
|
3989
|
+
return format(value, 'MMM d, yyyy HH:mm', this._dateOptions);
|
|
3806
3990
|
}, /* @ts-ignore */
|
|
3807
3991
|
...(ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []));
|
|
3808
3992
|
constructor() {
|
|
@@ -4033,6 +4217,10 @@ const DEFAULT_FILE_INPUT_CONFIG = {
|
|
|
4033
4217
|
accept: '',
|
|
4034
4218
|
fluid: false,
|
|
4035
4219
|
hideFileList: false,
|
|
4220
|
+
chooseFileLabel: 'Choose file',
|
|
4221
|
+
chooseFilesLabel: 'Choose files',
|
|
4222
|
+
dropZoneFileLabel: 'Upload file',
|
|
4223
|
+
dropZoneFilesLabel: 'Upload files',
|
|
4036
4224
|
};
|
|
4037
4225
|
|
|
4038
4226
|
const FILE_INPUT_CONFIG = new InjectionToken('FILE_INPUT_CONFIG', {
|
|
@@ -4061,6 +4249,8 @@ class FileInput extends ValueFormControl {
|
|
|
4061
4249
|
nativeInput = viewChild.required('nativeInput');
|
|
4062
4250
|
dragState = signal('idle', /* @ts-ignore */
|
|
4063
4251
|
...(ngDevMode ? [{ debugName: "dragState" }] : /* istanbul ignore next */ []));
|
|
4252
|
+
/** Nesting depth of the active drag: dragenter/dragleave pairs fired by the drop zone's children. */
|
|
4253
|
+
_dragDepth = 0;
|
|
4064
4254
|
dropZoneTemplate = contentChild('dropZone', /* @ts-ignore */
|
|
4065
4255
|
...(ngDevMode ? [{ debugName: "dropZoneTemplate" }] : /* istanbul ignore next */ []));
|
|
4066
4256
|
fileTemplate = contentChild('file', /* @ts-ignore */
|
|
@@ -4074,8 +4264,16 @@ class FileInput extends ValueFormControl {
|
|
|
4074
4264
|
return array.concat(this.controlClasses());
|
|
4075
4265
|
}, /* @ts-ignore */
|
|
4076
4266
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
4077
|
-
triggerLabel = computed(() => this.multiple() ?
|
|
4267
|
+
triggerLabel = computed(() => this.multiple() ? this._config.chooseFilesLabel : this._config.chooseFileLabel, /* @ts-ignore */
|
|
4078
4268
|
...(ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []));
|
|
4269
|
+
/** Accessible name for the drop zone: the consumer's, or the configured fallback. */
|
|
4270
|
+
dropZoneLabel = computed(() => {
|
|
4271
|
+
const consumerLabel = this.ariaLabel();
|
|
4272
|
+
if (consumerLabel)
|
|
4273
|
+
return consumerLabel;
|
|
4274
|
+
return this.multiple() ? this._config.dropZoneFilesLabel : this._config.dropZoneFileLabel;
|
|
4275
|
+
}, /* @ts-ignore */
|
|
4276
|
+
...(ngDevMode ? [{ debugName: "dropZoneLabel" }] : /* istanbul ignore next */ []));
|
|
4079
4277
|
acceptHint = computed(() => {
|
|
4080
4278
|
const accept = this.accept().trim();
|
|
4081
4279
|
if (!accept)
|
|
@@ -4107,6 +4305,9 @@ class FileInput extends ValueFormControl {
|
|
|
4107
4305
|
event.preventDefault();
|
|
4108
4306
|
this.openFilePicker();
|
|
4109
4307
|
}
|
|
4308
|
+
onDragEnter() {
|
|
4309
|
+
this._dragDepth++;
|
|
4310
|
+
}
|
|
4110
4311
|
onDragOver(event) {
|
|
4111
4312
|
event.preventDefault();
|
|
4112
4313
|
if (this.notInteractive() || !event.dataTransfer)
|
|
@@ -4116,11 +4317,16 @@ class FileInput extends ValueFormControl {
|
|
|
4116
4317
|
event.dataTransfer.dropEffect = rejected ? 'none' : 'copy';
|
|
4117
4318
|
this.dragState.set(rejected ? 'invalid' : 'valid');
|
|
4118
4319
|
}
|
|
4320
|
+
// `dragleave` also fires when the pointer crosses onto a child of the drop
|
|
4321
|
+
// zone; only a leave that balances every enter means the drag actually left.
|
|
4119
4322
|
onDragLeave() {
|
|
4120
|
-
this.
|
|
4323
|
+
this._dragDepth = Math.max(0, this._dragDepth - 1);
|
|
4324
|
+
if (this._dragDepth === 0)
|
|
4325
|
+
this.dragState.set('idle');
|
|
4121
4326
|
}
|
|
4122
4327
|
onDrop(event) {
|
|
4123
4328
|
event.preventDefault();
|
|
4329
|
+
this._dragDepth = 0;
|
|
4124
4330
|
this.dragState.set('idle');
|
|
4125
4331
|
if (this.notInteractive() || !event.dataTransfer)
|
|
4126
4332
|
return;
|
|
@@ -4197,11 +4403,11 @@ class FileInput extends ValueFormControl {
|
|
|
4197
4403
|
return !matches;
|
|
4198
4404
|
}
|
|
4199
4405
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4200
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FileInput, isStandalone: true, selector: "tls-file-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, hideFileList: { classPropertyName: "hideFileList", publicName: "hideFileList", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nativeInput", first: true, predicate: ["nativeInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"
|
|
4406
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FileInput, isStandalone: true, selector: "tls-file-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, hideFileList: { classPropertyName: "hideFileList", publicName: "hideFileList", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "nativeInput", first: true, predicate: ["nativeInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragenter)=\"onDragEnter()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n >\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-input__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n </div>\n}\n@if (value().length && !hideFileList()) {\n <ul class=\"tls-file-input__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-input__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-input__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-input__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "[tlsButton]" }] });
|
|
4201
4407
|
}
|
|
4202
4408
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FileInput, decorators: [{
|
|
4203
4409
|
type: Component,
|
|
4204
|
-
args: [{ selector: 'tls-file-input', imports: [NgTemplateOutlet, ButtonDirective], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], host: { '[class]': 'classes()' }, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"
|
|
4410
|
+
args: [{ selector: 'tls-file-input', imports: [NgTemplateOutlet, ButtonDirective], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileInput) }], host: { '[class]': 'classes()' }, template: "<input\n #nativeInput\n class=\"tls-file-input__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n@if (variant() === 'button') {\n <button\n type=\"button\"\n tlsButton\n variant=\"outlined\"\n [size]=\"size()\"\n [disabled]=\"notInteractive()\"\n [attr.disabled]=\"notInteractive() ? '' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"openFilePicker()\"\n >\n {{ triggerLabel() }}\n </button>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n} @else {\n <div\n class=\"tls-file-input__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"dropZoneLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-file-input__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-input__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-input__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragenter)=\"onDragEnter()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n >\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-input__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-input__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n </div>\n}\n@if (value().length && !hideFileList()) {\n <ul class=\"tls-file-input__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-input__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-input__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-input__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n" }]
|
|
4205
4411
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], hideFileList: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFileList", required: false }] }], nativeInput: [{ type: i0.ViewChild, args: ['nativeInput', { isSignal: true }] }], dropZoneTemplate: [{ type: i0.ContentChild, args: ['dropZone', { isSignal: true }] }], fileTemplate: [{ type: i0.ContentChild, args: ['file', { isSignal: true }] }] } });
|
|
4206
4412
|
|
|
4207
4413
|
const DEFAULT_INPUT_CONFIG = {
|
|
@@ -4325,12 +4531,33 @@ class InputNumber extends ValueFormControl {
|
|
|
4325
4531
|
const parsed = target.valueAsNumber;
|
|
4326
4532
|
this.value.set(isNaN(parsed) ? null : parsed);
|
|
4327
4533
|
}
|
|
4534
|
+
/**
|
|
4535
|
+
* Clamps a typed value into `[min, max]` once editing is committed (`change`
|
|
4536
|
+
* fires on blur/Enter). The spinner arrows already honor the bounds natively;
|
|
4537
|
+
* clamping only here keeps mid-typing values ("1" on the way to "10") intact.
|
|
4538
|
+
*/
|
|
4539
|
+
onChange(event) {
|
|
4540
|
+
const current = this.value();
|
|
4541
|
+
if (current === null)
|
|
4542
|
+
return;
|
|
4543
|
+
const min = this.min();
|
|
4544
|
+
const max = this.max();
|
|
4545
|
+
let clamped = current;
|
|
4546
|
+
if (min !== undefined && clamped < min)
|
|
4547
|
+
clamped = min;
|
|
4548
|
+
if (max !== undefined && clamped > max)
|
|
4549
|
+
clamped = max;
|
|
4550
|
+
if (clamped === current)
|
|
4551
|
+
return;
|
|
4552
|
+
this.value.set(clamped);
|
|
4553
|
+
event.target.value = String(clamped);
|
|
4554
|
+
}
|
|
4328
4555
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputNumber, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4329
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InputNumber, isStandalone: true, selector: "tls-input-number", 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 }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, hideArrows: { classPropertyName: "hideArrows", publicName: "hideArrows", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"number\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value() ?? ''\"\n [attr.min]=\"min() ?? null\"\n [attr.max]=\"max() ?? null\"\n [step]=\"step()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"], dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
4556
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InputNumber, isStandalone: true, selector: "tls-input-number", 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 }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, hideArrows: { classPropertyName: "hideArrows", publicName: "hideArrows", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"number\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value() ?? ''\"\n [attr.min]=\"min() ?? null\"\n [attr.max]=\"max() ?? null\"\n [step]=\"step()\"\n (input)=\"onInput($event)\"\n (change)=\"onChange($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"], dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
4330
4557
|
}
|
|
4331
4558
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InputNumber, decorators: [{
|
|
4332
4559
|
type: Component,
|
|
4333
|
-
args: [{ selector: 'tls-input-number', imports: [Loader], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], template: "<input\n type=\"number\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value() ?? ''\"\n [attr.min]=\"min() ?? null\"\n [attr.max]=\"max() ?? null\"\n [step]=\"step()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"] }]
|
|
4560
|
+
args: [{ selector: 'tls-input-number', imports: [Loader], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], template: "<input\n type=\"number\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value() ?? ''\"\n [attr.min]=\"min() ?? null\"\n [attr.max]=\"max() ?? null\"\n [step]=\"step()\"\n (input)=\"onInput($event)\"\n (change)=\"onChange($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"] }]
|
|
4334
4561
|
}], 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 }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], hideArrows: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideArrows", required: false }] }] } });
|
|
4335
4562
|
|
|
4336
4563
|
// Token characters recognised inside a mask pattern; every other character is a
|
|
@@ -4517,6 +4744,10 @@ const DEFAULT_PASSWORD_CONFIG = {
|
|
|
4517
4744
|
size: 'md',
|
|
4518
4745
|
placeholder: '',
|
|
4519
4746
|
fluid: false,
|
|
4747
|
+
showAriaLabel: 'Show password',
|
|
4748
|
+
hideAriaLabel: 'Hide password',
|
|
4749
|
+
showLabel: 'Show',
|
|
4750
|
+
hideLabel: 'Hide',
|
|
4520
4751
|
};
|
|
4521
4752
|
|
|
4522
4753
|
const PASSWORD_CONFIG = new InjectionToken('PASSWORD_CONFIG', {
|
|
@@ -4541,8 +4772,14 @@ class Password extends ValueFormControl {
|
|
|
4541
4772
|
...(ngDevMode ? [{ debugName: "showIconTemplate" }] : /* istanbul ignore next */ []));
|
|
4542
4773
|
hideIconTemplate = contentChild('hideIcon', /* @ts-ignore */
|
|
4543
4774
|
...(ngDevMode ? [{ debugName: "hideIconTemplate" }] : /* istanbul ignore next */ []));
|
|
4775
|
+
// State
|
|
4776
|
+
showLabel = this._config.showLabel;
|
|
4777
|
+
hideLabel = this._config.hideLabel;
|
|
4778
|
+
// Computed
|
|
4544
4779
|
type = computed(() => (this.visible() ? 'text' : 'password'), /* @ts-ignore */
|
|
4545
4780
|
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
4781
|
+
toggleAriaLabel = computed(() => this.visible() ? this._config.hideAriaLabel : this._config.showAriaLabel, /* @ts-ignore */
|
|
4782
|
+
...(ngDevMode ? [{ debugName: "toggleAriaLabel" }] : /* istanbul ignore next */ []));
|
|
4546
4783
|
// Protected methods
|
|
4547
4784
|
onInput(event) {
|
|
4548
4785
|
const target = event.target;
|
|
@@ -4554,13 +4791,13 @@ class Password extends ValueFormControl {
|
|
|
4554
4791
|
this.visible.update(prev => !prev);
|
|
4555
4792
|
}
|
|
4556
4793
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4557
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", 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 } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { classAttribute: "tls-password" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "showIconTemplate", first: true, predicate: ["showIcon"], descendants: true, isSignal: true }, { propertyName: "hideIconTemplate", first: true, predicate: ["hideIcon"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"
|
|
4794
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", 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 } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { classAttribute: "tls-password" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "showIconTemplate", first: true, predicate: ["showIcon"], descendants: true, isSignal: true }, { propertyName: "hideIconTemplate", first: true, predicate: ["hideIcon"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"toggleAriaLabel()\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ showLabel }}\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ hideLabel }}\n }\n </span>\n </button>\n</tls-form-control-group>\n", dependencies: [{ kind: "component", type: FormControlGroup, selector: "tls-form-control-group", inputs: ["size", "fluid"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
4558
4795
|
}
|
|
4559
4796
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Password, decorators: [{
|
|
4560
4797
|
type: Component,
|
|
4561
4798
|
args: [{ selector: 'tls-password', imports: [FormControlGroup, NgTemplateOutlet, Loader], host: {
|
|
4562
4799
|
class: 'tls-password',
|
|
4563
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"
|
|
4800
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"effectiveInputId()\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"toggleAriaLabel()\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ showLabel }}\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ hideLabel }}\n }\n </span>\n </button>\n</tls-form-control-group>\n" }]
|
|
4564
4801
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], 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 }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], showIconTemplate: [{ type: i0.ContentChild, args: ['showIcon', { isSignal: true }] }], hideIconTemplate: [{ type: i0.ContentChild, args: ['hideIcon', { isSignal: true }] }] } });
|
|
4565
4802
|
|
|
4566
4803
|
// Matches strings containing only numeric digits (0–9).
|
|
@@ -4645,22 +4882,28 @@ class PinInput extends ValueFormControl {
|
|
|
4645
4882
|
}
|
|
4646
4883
|
onPaste(event, index) {
|
|
4647
4884
|
event.preventDefault();
|
|
4885
|
+
if (this.notInteractive())
|
|
4886
|
+
return;
|
|
4648
4887
|
const clipboardData = event.clipboardData;
|
|
4649
4888
|
if (!clipboardData)
|
|
4650
4889
|
return;
|
|
4651
|
-
|
|
4890
|
+
// Keep only the characters the input accepts, so text copied with
|
|
4891
|
+
// separators ("123 456", "123-456") pastes as its usable digits.
|
|
4652
4892
|
const allowedRegExp = this._getAllowedRegularExpression();
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4893
|
+
const chars = clipboardData
|
|
4894
|
+
.getData('text')
|
|
4895
|
+
.split('')
|
|
4896
|
+
.filter(char => allowedRegExp.test(char))
|
|
4897
|
+
.slice(0, this.length() - index);
|
|
4656
4898
|
if (!chars.length)
|
|
4657
4899
|
return;
|
|
4900
|
+
// Overwrite from the focused cell onward.
|
|
4658
4901
|
const array = this._getValueArray();
|
|
4659
|
-
for (let
|
|
4660
|
-
array[index +
|
|
4902
|
+
for (let offset = 0; offset < chars.length; offset++) {
|
|
4903
|
+
array[index + offset] = chars[offset];
|
|
4661
4904
|
}
|
|
4662
4905
|
this._commitArray(array);
|
|
4663
|
-
this._focusCell(
|
|
4906
|
+
this._focusCell(index + chars.length);
|
|
4664
4907
|
}
|
|
4665
4908
|
onFocus(event) {
|
|
4666
4909
|
event.target.select();
|
|
@@ -4718,6 +4961,12 @@ const RADIO_BUTTON_CONFIG = new InjectionToken('RADIO_BUTTON_CONFIG', {
|
|
|
4718
4961
|
factory: () => DEFAULT_RADIO_BUTTON_CONFIG,
|
|
4719
4962
|
});
|
|
4720
4963
|
|
|
4964
|
+
/**
|
|
4965
|
+
* A single radio option bound to a shared `value` model; the option whose
|
|
4966
|
+
* `radioValue` equals the model is checked. When several radio buttons form one
|
|
4967
|
+
* group, wrap each in its own `tls-form-item` (the item's label names that
|
|
4968
|
+
* option), rather than one item around the whole group.
|
|
4969
|
+
*/
|
|
4721
4970
|
class RadioButton extends ValueFormControl {
|
|
4722
4971
|
_config = inject(RADIO_BUTTON_CONFIG);
|
|
4723
4972
|
CLASS_NAME = 'tls-radio-button';
|
|
@@ -4745,14 +4994,14 @@ class RadioButton extends ValueFormControl {
|
|
|
4745
4994
|
this.value.set(this.radioValue());
|
|
4746
4995
|
}
|
|
4747
4996
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RadioButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4748
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: RadioButton, isStandalone: true, selector: "tls-radio-button", inputs: { radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, 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" });
|
|
4997
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: RadioButton, isStandalone: true, selector: "tls-radio-button", inputs: { radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()", "tabindex": "-1" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => RadioButton) }], usesInheritance: true, ngImport: i0, 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" });
|
|
4749
4998
|
}
|
|
4750
4999
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RadioButton, decorators: [{
|
|
4751
5000
|
type: Component,
|
|
4752
5001
|
args: [{ selector: 'tls-radio-button', imports: [], host: {
|
|
4753
5002
|
'[class]': 'hostClasses()',
|
|
4754
5003
|
'[tabindex]': '-1',
|
|
4755
|
-
}, 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" }]
|
|
5004
|
+
}, 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" }]
|
|
4756
5005
|
}], 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 }] }] } });
|
|
4757
5006
|
|
|
4758
5007
|
const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
@@ -4761,6 +5010,8 @@ const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
|
4761
5010
|
fluid: false,
|
|
4762
5011
|
clearable: false,
|
|
4763
5012
|
maxLabels: 2,
|
|
5013
|
+
clearLabel: 'Clear',
|
|
5014
|
+
selectedCountLabel: count => `${count} selected`,
|
|
4764
5015
|
};
|
|
4765
5016
|
|
|
4766
5017
|
const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
|
|
@@ -4784,6 +5035,8 @@ class MultiSelect extends AbstractSelect {
|
|
|
4784
5035
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4785
5036
|
maxLabels = input(this._config.maxLabels, /* @ts-ignore */
|
|
4786
5037
|
...(ngDevMode ? [{ debugName: "maxLabels" }] : /* istanbul ignore next */ []));
|
|
5038
|
+
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
5039
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
4787
5040
|
hasValue = computed(() => this.value().length > 0, /* @ts-ignore */
|
|
4788
5041
|
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
4789
5042
|
selectedValues = computed(() => new Set(this.value()), /* @ts-ignore */
|
|
@@ -4794,7 +5047,7 @@ class MultiSelect extends AbstractSelect {
|
|
|
4794
5047
|
return '';
|
|
4795
5048
|
const max = this.maxLabels();
|
|
4796
5049
|
if (selected.length > max)
|
|
4797
|
-
return
|
|
5050
|
+
return this._config.selectedCountLabel(selected.length);
|
|
4798
5051
|
const optionMap = new Map(this.normalizedOptions().map(option => [option.value, option.label]));
|
|
4799
5052
|
return selected.map(value => optionMap.get(value) ?? String(value)).join(', ');
|
|
4800
5053
|
}, /* @ts-ignore */
|
|
@@ -4802,6 +5055,9 @@ class MultiSelect extends AbstractSelect {
|
|
|
4802
5055
|
isSelected(option) {
|
|
4803
5056
|
return this.selectedValues().has(option.value);
|
|
4804
5057
|
}
|
|
5058
|
+
isOptionSelected(option) {
|
|
5059
|
+
return this.isSelected(option);
|
|
5060
|
+
}
|
|
4805
5061
|
toggleOption(option) {
|
|
4806
5062
|
if (option.disabled)
|
|
4807
5063
|
return;
|
|
@@ -4827,20 +5083,21 @@ class MultiSelect extends AbstractSelect {
|
|
|
4827
5083
|
this.toggleOption(option);
|
|
4828
5084
|
}
|
|
4829
5085
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4830
|
-
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 } }, 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 aria-label=\"
|
|
5086
|
+
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 <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 <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 (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 </li>\n }\n </ul>\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"] }] });
|
|
4831
5087
|
}
|
|
4832
5088
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
4833
5089
|
type: Component,
|
|
4834
|
-
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon], host: {
|
|
5090
|
+
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
4835
5091
|
'[class]': 'hostClasses()',
|
|
4836
|
-
}, 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 aria-label=\"
|
|
4837
|
-
}], 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 }] }] } });
|
|
5092
|
+
}, 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 <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 <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 (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 </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
5093
|
+
}], 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 }] }] } });
|
|
4838
5094
|
|
|
4839
5095
|
const DEFAULT_SELECT_CONFIG = {
|
|
4840
5096
|
size: 'md',
|
|
4841
5097
|
placeholder: '',
|
|
4842
5098
|
fluid: false,
|
|
4843
5099
|
clearable: false,
|
|
5100
|
+
clearLabel: 'Clear',
|
|
4844
5101
|
};
|
|
4845
5102
|
|
|
4846
5103
|
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
@@ -4862,6 +5119,8 @@ class Select extends AbstractSelect {
|
|
|
4862
5119
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4863
5120
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4864
5121
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5122
|
+
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
5123
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
4865
5124
|
hasValue = computed(() => {
|
|
4866
5125
|
const value = this.value();
|
|
4867
5126
|
return value !== null && value !== undefined && value !== '';
|
|
@@ -4882,24 +5141,33 @@ class Select extends AbstractSelect {
|
|
|
4882
5141
|
this.value.set(option.value);
|
|
4883
5142
|
this.close();
|
|
4884
5143
|
}
|
|
5144
|
+
isOptionSelected(option) {
|
|
5145
|
+
return option.value === this.value();
|
|
5146
|
+
}
|
|
4885
5147
|
clear() {
|
|
4886
5148
|
this.value.set(null);
|
|
4887
5149
|
}
|
|
4888
5150
|
getInitialActiveIndex() {
|
|
4889
|
-
|
|
5151
|
+
const options = this.visibleOptions();
|
|
5152
|
+
const selectedIndex = options.findIndex(option => !option.disabled && option.value === this.value());
|
|
5153
|
+
if (selectedIndex !== -1)
|
|
5154
|
+
return selectedIndex;
|
|
5155
|
+
// No selection: start on the first enabled option, matching the other
|
|
5156
|
+
// listbox controls, so the panel opens with a visible active option.
|
|
5157
|
+
return options.findIndex(option => !option.disabled);
|
|
4890
5158
|
}
|
|
4891
5159
|
commitActiveOption(option) {
|
|
4892
5160
|
this.select(option);
|
|
4893
5161
|
}
|
|
4894
5162
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4895
|
-
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 } }, 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 aria-label=\"
|
|
5163
|
+
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 <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 <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 (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 </li>\n }\n </ul>\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"] }] });
|
|
4896
5164
|
}
|
|
4897
5165
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
4898
5166
|
type: Component,
|
|
4899
|
-
args: [{ selector: 'tls-select', imports: [Loader, Icon], host: {
|
|
5167
|
+
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet], host: {
|
|
4900
5168
|
'[class]': 'hostClasses()',
|
|
4901
|
-
}, 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 aria-label=\"
|
|
4902
|
-
}], 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 }] }] } });
|
|
5169
|
+
}, 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 <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 <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 (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 </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
5170
|
+
}], 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 }] }] } });
|
|
4903
5171
|
|
|
4904
5172
|
const DEFAULT_SWITCH_CONFIG = {
|
|
4905
5173
|
color: 'primary',
|
|
@@ -4927,9 +5195,13 @@ class Switch extends CheckboxFormControl {
|
|
|
4927
5195
|
}, /* @ts-ignore */
|
|
4928
5196
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
4929
5197
|
// Protected methods
|
|
4930
|
-
toggle() {
|
|
4931
|
-
if (this.notInteractive())
|
|
5198
|
+
toggle(event) {
|
|
5199
|
+
if (this.notInteractive()) {
|
|
5200
|
+
// Keep the native input from flipping its own checked state.
|
|
5201
|
+
if (event)
|
|
5202
|
+
event.preventDefault();
|
|
4932
5203
|
return;
|
|
5204
|
+
}
|
|
4933
5205
|
this.checked.update(prev => !prev);
|
|
4934
5206
|
}
|
|
4935
5207
|
onKeyboardToggle(event) {
|
|
@@ -4937,22 +5209,14 @@ class Switch extends CheckboxFormControl {
|
|
|
4937
5209
|
this.toggle();
|
|
4938
5210
|
}
|
|
4939
5211
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Switch, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4940
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Switch, isStandalone: true, selector: "tls-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: {
|
|
5212
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Switch, isStandalone: true, selector: "tls-switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { listeners: { "click": "toggle($event)" }, properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"checkbox\"\n role=\"switch\"\n class=\"tls-switch-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 (blur)=\"touched.set(true)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" });
|
|
4941
5213
|
}
|
|
4942
5214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Switch, decorators: [{
|
|
4943
5215
|
type: Component,
|
|
4944
5216
|
args: [{ selector: 'tls-switch', host: {
|
|
4945
|
-
role: 'switch',
|
|
4946
5217
|
'[class]': 'hostClasses()',
|
|
4947
|
-
'
|
|
4948
|
-
|
|
4949
|
-
'[attr.aria-disabled]': 'disabled()',
|
|
4950
|
-
'[attr.aria-readonly]': 'readonly()',
|
|
4951
|
-
'(click)': 'toggle()',
|
|
4952
|
-
'(blur)': 'touched.set(true)',
|
|
4953
|
-
'(keydown.space)': 'onKeyboardToggle($event)',
|
|
4954
|
-
'(keydown.enter)': 'onKeyboardToggle($event)',
|
|
4955
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], template: "<input\n type=\"checkbox\"\n class=\"tls-switch-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 [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" }]
|
|
5218
|
+
'(click)': 'toggle($event)',
|
|
5219
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], template: "<input\n type=\"checkbox\"\n role=\"switch\"\n class=\"tls-switch-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 (blur)=\"touched.set(true)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" }]
|
|
4956
5220
|
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
4957
5221
|
|
|
4958
5222
|
const DEFAULT_TEXTAREA_CONFIG = {
|
|
@@ -5847,6 +6111,13 @@ const DEFAULT_PAGINATION_CONFIG = {
|
|
|
5847
6111
|
siblings: 1,
|
|
5848
6112
|
showFirstButton: false,
|
|
5849
6113
|
showLastButton: false,
|
|
6114
|
+
labels: {
|
|
6115
|
+
first: 'First page',
|
|
6116
|
+
previous: 'Previous page',
|
|
6117
|
+
next: 'Next page',
|
|
6118
|
+
last: 'Last page',
|
|
6119
|
+
page: page => `Page ${page}`,
|
|
6120
|
+
},
|
|
5850
6121
|
};
|
|
5851
6122
|
|
|
5852
6123
|
const PAGINATION_CONFIG = new InjectionToken('PAGINATION_CONFIG', {
|
|
@@ -5874,15 +6145,32 @@ class Pagination {
|
|
|
5874
6145
|
...(ngDevMode ? [{ debugName: "siblings" }] : /* istanbul ignore next */ []));
|
|
5875
6146
|
showFirstButton = input(this._config.showFirstButton, { ...(ngDevMode ? { debugName: "showFirstButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5876
6147
|
showLastButton = input(this._config.showLastButton, { ...(ngDevMode ? { debugName: "showLastButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6148
|
+
labels = this._config.labels;
|
|
5877
6149
|
pageCount = computed(() => Math.ceil(this.total() / this.pageSize()), /* @ts-ignore */
|
|
5878
6150
|
...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
|
|
6151
|
+
/** Last valid page; at least 1 so the current page never leaves the 1-based range. */
|
|
6152
|
+
lastValidPage = computed(() => Math.max(1, this.pageCount()), /* @ts-ignore */
|
|
6153
|
+
...(ngDevMode ? [{ debugName: "lastValidPage" }] : /* istanbul ignore next */ []));
|
|
5879
6154
|
visiblePages = computed(() => this._buildPages(this.pageCount(), this.value(), this.siblings(), this.boundaries()), /* @ts-ignore */
|
|
5880
6155
|
...(ngDevMode ? [{ debugName: "visiblePages" }] : /* istanbul ignore next */ []));
|
|
5881
6156
|
classes = computed(() => ['tls-pagination', `tls-pagination--${this.size()}`], /* @ts-ignore */
|
|
5882
6157
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
6158
|
+
constructor() {
|
|
6159
|
+
// Normalize an out-of-range page — a shrinking `total`, or an external set
|
|
6160
|
+
// (e.g. a query-param restore) beyond the last page — back into range. While
|
|
6161
|
+
// `total` is 0 the range is unknown (it usually arrives async), so a
|
|
6162
|
+
// restored page is left alone rather than clamped against nothing.
|
|
6163
|
+
effect(() => {
|
|
6164
|
+
if (this.pageCount() < 1)
|
|
6165
|
+
return;
|
|
6166
|
+
const clamped = this._clamp(this.value());
|
|
6167
|
+
if (clamped !== this.value())
|
|
6168
|
+
this.value.set(clamped);
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
5883
6171
|
// Protected methods
|
|
5884
6172
|
setPage(page) {
|
|
5885
|
-
this.value.set(page);
|
|
6173
|
+
this.value.set(this._clamp(page));
|
|
5886
6174
|
}
|
|
5887
6175
|
firstPage() {
|
|
5888
6176
|
this.value.set(1);
|
|
@@ -5891,12 +6179,15 @@ class Pagination {
|
|
|
5891
6179
|
this.value.update(page => Math.max(1, page - 1));
|
|
5892
6180
|
}
|
|
5893
6181
|
nextPage() {
|
|
5894
|
-
this.value.update(page => Math.min(this.
|
|
6182
|
+
this.value.update(page => Math.min(this.lastValidPage(), page + 1));
|
|
5895
6183
|
}
|
|
5896
6184
|
lastPage() {
|
|
5897
|
-
this.value.set(this.
|
|
6185
|
+
this.value.set(this.lastValidPage());
|
|
5898
6186
|
}
|
|
5899
6187
|
// Private methods
|
|
6188
|
+
_clamp(page) {
|
|
6189
|
+
return Math.min(Math.max(1, page), this.lastValidPage());
|
|
6190
|
+
}
|
|
5900
6191
|
/** Returns an inclusive array of integers from start to end. Returns [] if end < start. */
|
|
5901
6192
|
_range(start, end) {
|
|
5902
6193
|
const length = end - start + 1;
|
|
@@ -5932,7 +6223,7 @@ class Pagination {
|
|
|
5932
6223
|
];
|
|
5933
6224
|
}
|
|
5934
6225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Pagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5935
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Pagination, isStandalone: true, selector: "tls-pagination", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, boundaries: { classPropertyName: "boundaries", publicName: "boundaries", isSignal: true, isRequired: false, transformFunction: null }, siblings: { classPropertyName: "siblings", publicName: "siblings", isSignal: true, isRequired: false, transformFunction: null }, showFirstButton: { classPropertyName: "showFirstButton", publicName: "showFirstButton", isSignal: true, isRequired: false, transformFunction: null }, showLastButton: { classPropertyName: "showLastButton", publicName: "showLastButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "navigation" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabelledby() ? null : ariaLabel()", "attr.aria-labelledby": "ariaLabelledby() ?? null" } }, ngImport: i0, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-left\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-right\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
6226
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Pagination, isStandalone: true, selector: "tls-pagination", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, boundaries: { classPropertyName: "boundaries", publicName: "boundaries", isSignal: true, isRequired: false, transformFunction: null }, siblings: { classPropertyName: "siblings", publicName: "siblings", isSignal: true, isRequired: false, transformFunction: null }, showFirstButton: { classPropertyName: "showFirstButton", publicName: "showFirstButton", isSignal: true, isRequired: false, transformFunction: null }, showLastButton: { classPropertyName: "showLastButton", publicName: "showLastButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "navigation" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabelledby() ? null : ariaLabel()", "attr.aria-labelledby": "ariaLabelledby() ?? null" } }, ngImport: i0, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.first\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-left\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.previous\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n [attr.aria-label]=\"labels.page(item)\"\n [attr.aria-current]=\"value() === item ? 'page' : null\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.next\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.last\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-right\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
5936
6227
|
}
|
|
5937
6228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Pagination, decorators: [{
|
|
5938
6229
|
type: Component,
|
|
@@ -5941,8 +6232,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
5941
6232
|
'[class]': 'classes()',
|
|
5942
6233
|
'[attr.aria-label]': 'ariaLabelledby() ? null : ariaLabel()',
|
|
5943
6234
|
'[attr.aria-labelledby]': 'ariaLabelledby() ?? null',
|
|
5944
|
-
}, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-left\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-right\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n" }]
|
|
5945
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], boundaries: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaries", required: false }] }], siblings: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblings", required: false }] }], showFirstButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFirstButton", required: false }] }], showLastButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLastButton", required: false }] }] } });
|
|
6235
|
+
}, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.first\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-left\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.previous\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n [attr.aria-label]=\"labels.page(item)\"\n [attr.aria-current]=\"value() === item ? 'page' : null\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.next\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [attr.aria-label]=\"labels.last\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <tls-icon name=\"chevrons-right\" aria-hidden=\"true\" />\n </span>\n </button>\n}\n" }]
|
|
6236
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], boundaries: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaries", required: false }] }], siblings: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblings", required: false }] }], showFirstButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFirstButton", required: false }] }], showLastButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLastButton", required: false }] }] } });
|
|
5946
6237
|
|
|
5947
6238
|
const DEFAULT_PAGINATION_QUERY_SYNC_CONFIG = {
|
|
5948
6239
|
paramKey: 'page',
|
|
@@ -5950,6 +6241,12 @@ const DEFAULT_PAGINATION_QUERY_SYNC_CONFIG = {
|
|
|
5950
6241
|
|
|
5951
6242
|
const PAGINATION_QUERY_SYNC_CONFIG = new InjectionToken('PAGINATION_QUERY_SYNC_CONFIG', { factory: () => DEFAULT_PAGINATION_QUERY_SYNC_CONFIG });
|
|
5952
6243
|
|
|
6244
|
+
/**
|
|
6245
|
+
* Mirrors the current page into a URL query param. The param is only written
|
|
6246
|
+
* once the page actually changes — the initial page (the default, or the one
|
|
6247
|
+
* restored from the URL) never stamps the param, so a freshly loaded page
|
|
6248
|
+
* keeps its URL untouched.
|
|
6249
|
+
*/
|
|
5953
6250
|
class PaginationQuerySyncDirective extends QuerySyncDirective {
|
|
5954
6251
|
_pagination = inject(Pagination);
|
|
5955
6252
|
_config = inject(PAGINATION_QUERY_SYNC_CONFIG);
|
|
@@ -5957,11 +6254,23 @@ class PaginationQuerySyncDirective extends QuerySyncDirective {
|
|
|
5957
6254
|
// The selector doubles as the input, so a valueless `tlsPaginationQuerySync` binds `''`.
|
|
5958
6255
|
// Coerce an empty value back to the configured default param key.
|
|
5959
6256
|
tlsPaginationQuerySync = input(this._config.paramKey, { ...(ngDevMode ? { debugName: "tlsPaginationQuerySync" } : /* istanbul ignore next */ {}), transform: (value) => value || this._config.paramKey });
|
|
6257
|
+
// State
|
|
6258
|
+
/** Last page mirrored to the URL; `null` until the initial page settles. */
|
|
6259
|
+
_lastSynced = null;
|
|
5960
6260
|
constructor() {
|
|
5961
6261
|
super();
|
|
5962
6262
|
effect(() => {
|
|
5963
6263
|
const page = this._pagination.value();
|
|
5964
6264
|
const param = this.tlsPaginationQuerySync();
|
|
6265
|
+
// The first settled page is the page's initial state; recording it would
|
|
6266
|
+
// stamp the URL on load without any user interaction.
|
|
6267
|
+
if (this._lastSynced === null) {
|
|
6268
|
+
this._lastSynced = page;
|
|
6269
|
+
return;
|
|
6270
|
+
}
|
|
6271
|
+
if (page === this._lastSynced)
|
|
6272
|
+
return;
|
|
6273
|
+
this._lastSynced = page;
|
|
5965
6274
|
this.syncToUrl(param, page);
|
|
5966
6275
|
});
|
|
5967
6276
|
}
|
|
@@ -6547,6 +6856,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6547
6856
|
const DEFAULT_TAB_NAV_CONFIG = {
|
|
6548
6857
|
variant: 'flat',
|
|
6549
6858
|
orientation: 'horizontal',
|
|
6859
|
+
divider: false,
|
|
6550
6860
|
};
|
|
6551
6861
|
|
|
6552
6862
|
const TAB_NAV_CONFIG = new InjectionToken('TAB_NAV_CONFIG', {
|
|
@@ -6569,6 +6879,10 @@ const TAB_NAV_CONFIG = new InjectionToken('TAB_NAV_CONFIG', {
|
|
|
6569
6879
|
* <a tlsTabLink routerLink="security" routerLinkActive>Security</a>
|
|
6570
6880
|
* </nav>
|
|
6571
6881
|
* ```
|
|
6882
|
+
*
|
|
6883
|
+
* Set `divider` to draw a separator between every pair of links. The
|
|
6884
|
+
* separators are presentational only — they carry no semantics and are not
|
|
6885
|
+
* announced to assistive technology.
|
|
6572
6886
|
*/
|
|
6573
6887
|
class TabNavDirective {
|
|
6574
6888
|
// Injections
|
|
@@ -6578,17 +6892,20 @@ class TabNavDirective {
|
|
|
6578
6892
|
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
6579
6893
|
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
6580
6894
|
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
6895
|
+
divider = input(this._config.divider, { ...(ngDevMode ? { debugName: "divider" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6581
6896
|
// Computed
|
|
6582
6897
|
hostClasses = computed(() => {
|
|
6583
6898
|
const className = 'tls-tab-header';
|
|
6584
6899
|
const array = ['tls-tab-nav', className];
|
|
6585
6900
|
array.push(`${className}--${this.variant()}`);
|
|
6586
6901
|
array.push(`${className}--${this.orientation()}`);
|
|
6902
|
+
if (this.divider())
|
|
6903
|
+
array.push(`${className}--divided`);
|
|
6587
6904
|
return array;
|
|
6588
6905
|
}, /* @ts-ignore */
|
|
6589
6906
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
6590
6907
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TabNavDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6591
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TabNavDirective, isStandalone: true, selector: "nav[tlsTabNav]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0 });
|
|
6908
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TabNavDirective, isStandalone: true, selector: "nav[tlsTabNav]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, divider: { classPropertyName: "divider", publicName: "divider", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0 });
|
|
6592
6909
|
}
|
|
6593
6910
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TabNavDirective, decorators: [{
|
|
6594
6911
|
type: Directive,
|
|
@@ -6598,7 +6915,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6598
6915
|
'[class]': 'hostClasses()',
|
|
6599
6916
|
},
|
|
6600
6917
|
}]
|
|
6601
|
-
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
|
|
6918
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], divider: [{ type: i0.Input, args: [{ isSignal: true, alias: "divider", required: false }] }] } });
|
|
6602
6919
|
|
|
6603
6920
|
/**
|
|
6604
6921
|
* One link inside a `nav[tlsTabNav]` strip. The anchor plays both tab-header
|
|
@@ -6874,6 +7191,20 @@ class Tabs {
|
|
|
6874
7191
|
this.selected.set(firstEnabledTab.value());
|
|
6875
7192
|
});
|
|
6876
7193
|
}
|
|
7194
|
+
// Public methods
|
|
7195
|
+
/**
|
|
7196
|
+
* Resolves serialized text (e.g. a URL query param) back to the matching
|
|
7197
|
+
* tab's actual value, so a numeric tab value round-trips with its own type
|
|
7198
|
+
* instead of a string that would never match. Returns `undefined` when no tab
|
|
7199
|
+
* matches — including while the projected tabs have not resolved yet, so a
|
|
7200
|
+
* reactive caller can retry once they have.
|
|
7201
|
+
*/
|
|
7202
|
+
findTabValue(text) {
|
|
7203
|
+
const match = this.tabs().find(tab => String(tab.value()) === text);
|
|
7204
|
+
if (!match)
|
|
7205
|
+
return undefined;
|
|
7206
|
+
return match.value();
|
|
7207
|
+
}
|
|
6877
7208
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6878
7209
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Tabs, isStandalone: true, selector: "tls-tabs", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, headerPosition: { classPropertyName: "headerPosition", publicName: "headerPosition", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", 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: { selected: "selectedChange" }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], hostDirectives: [{ directive: i1.Tabs }], ngImport: i0, template: "<ul\n ngTabList\n [class]=\"headerClasses()\"\n [orientation]=\"orientation()\"\n [softDisabled]=\"false\"\n [(selectedTab)]=\"selected\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (tab of tabs(); track tab) {\n <li\n role=\"presentation\"\n class=\"tls-tab-header__item\"\n [class.tls-tab-header__item--active]=\"ariaTab.selected()\"\n [class.tls-tab-header__item--disabled]=\"tab.disabled()\"\n >\n <button\n #ariaTab=\"ngTab\"\n ngTab\n class=\"tls-tab-header__item-control\"\n type=\"button\"\n [value]=\"tab.value()\"\n [disabled]=\"tab.disabled()\"\n [attr.aria-label]=\"tab.headerTemplateRef() ? tab.label() : null\"\n >\n @if (tab.headerTemplateRef(); as headerTemplateRef) {\n <ng-container [ngTemplateOutlet]=\"headerTemplateRef\"></ng-container>\n } @else {\n {{ tab.label() }}\n }\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n @for (tab of tabs(); track tab) {\n <div ngTabPanel class=\"tls-tab\" [value]=\"tab.value()\" [preserveContent]=\"true\">\n <ng-template ngTabContent>\n <ng-container [ngTemplateOutlet]=\"tab.contentTemplateRef()\"></ng-container>\n </ng-template>\n </div>\n }\n</div>\n", dependencies: [{ 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"] }, { kind: "directive", type: TabPanel, selector: "[ngTabPanel]", inputs: ["id", "value"], exportAs: ["ngTabPanel"] }, { kind: "directive", type: TabContent, selector: "ng-template[ngTabContent]", exportAs: ["ngTabContent"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
6879
7210
|
}
|
|
@@ -6892,6 +7223,12 @@ const TABS_QUERY_SYNC_CONFIG = new InjectionToken('TABS_QUERY_SYNC_CONFIG', {
|
|
|
6892
7223
|
factory: () => DEFAULT_TABS_QUERY_SYNC_CONFIG,
|
|
6893
7224
|
});
|
|
6894
7225
|
|
|
7226
|
+
/**
|
|
7227
|
+
* Mirrors the selected tab into a URL query param. The param is only written
|
|
7228
|
+
* once the selection actually changes — the initial selection (the default
|
|
7229
|
+
* first tab, or the one restored from the URL) never stamps the param, so a
|
|
7230
|
+
* freshly loaded page keeps its URL untouched.
|
|
7231
|
+
*/
|
|
6895
7232
|
class TabsQuerySyncDirective extends QuerySyncDirective {
|
|
6896
7233
|
_tabs = inject(Tabs);
|
|
6897
7234
|
_config = inject(TABS_QUERY_SYNC_CONFIG);
|
|
@@ -6899,22 +7236,47 @@ class TabsQuerySyncDirective extends QuerySyncDirective {
|
|
|
6899
7236
|
// The selector doubles as the input, so a valueless `tlsTabsQuerySync` binds `''`.
|
|
6900
7237
|
// Coerce an empty value back to the configured default param key.
|
|
6901
7238
|
tlsTabsQuerySync = input(this._config.paramKey, { ...(ngDevMode ? { debugName: "tlsTabsQuerySync" } : /* istanbul ignore next */ {}), transform: (value) => value || this._config.paramKey });
|
|
7239
|
+
// State
|
|
7240
|
+
/** Param value captured once at startup, pending until a matching tab resolves. */
|
|
7241
|
+
_pendingRestore = null;
|
|
7242
|
+
_restoreRead = false;
|
|
7243
|
+
/** Last selection mirrored to the URL; `undefined` until the initial selection settles. */
|
|
7244
|
+
_lastSynced;
|
|
6902
7245
|
constructor() {
|
|
6903
7246
|
super();
|
|
7247
|
+
// Restore the selection from the URL. Tab values may be numbers, so the
|
|
7248
|
+
// param is matched against each tab's serialized value; projected tabs
|
|
7249
|
+
// resolve after init, so this retries until a match appears.
|
|
7250
|
+
effect(() => {
|
|
7251
|
+
if (!this._restoreRead) {
|
|
7252
|
+
this._restoreRead = true;
|
|
7253
|
+
this._pendingRestore = this.readParam(this.tlsTabsQuerySync());
|
|
7254
|
+
}
|
|
7255
|
+
if (this._pendingRestore === null)
|
|
7256
|
+
return;
|
|
7257
|
+
const value = this._tabs.findTabValue(this._pendingRestore);
|
|
7258
|
+
if (value === undefined)
|
|
7259
|
+
return;
|
|
7260
|
+
this._pendingRestore = null;
|
|
7261
|
+
this._tabs.selected.set(value);
|
|
7262
|
+
});
|
|
6904
7263
|
effect(() => {
|
|
6905
7264
|
const selected = this._tabs.selected();
|
|
6906
7265
|
const param = this.tlsTabsQuerySync();
|
|
6907
7266
|
if (selected === undefined)
|
|
6908
7267
|
return;
|
|
7268
|
+
// The first settled selection is the page's initial state; recording it
|
|
7269
|
+
// would stamp the URL on load without any user interaction.
|
|
7270
|
+
if (this._lastSynced === undefined) {
|
|
7271
|
+
this._lastSynced = selected;
|
|
7272
|
+
return;
|
|
7273
|
+
}
|
|
7274
|
+
if (selected === this._lastSynced)
|
|
7275
|
+
return;
|
|
7276
|
+
this._lastSynced = selected;
|
|
6909
7277
|
this.syncToUrl(param, selected);
|
|
6910
7278
|
});
|
|
6911
7279
|
}
|
|
6912
|
-
// Lifecycle
|
|
6913
|
-
ngOnInit() {
|
|
6914
|
-
const value = this.readParam(this.tlsTabsQuerySync());
|
|
6915
|
-
if (value !== null)
|
|
6916
|
-
this._tabs.selected.set(value);
|
|
6917
|
-
}
|
|
6918
7280
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TabsQuerySyncDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6919
7281
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TabsQuerySyncDirective, isStandalone: true, selector: "tls-tabs[tlsTabsQuerySync]", inputs: { tlsTabsQuerySync: { classPropertyName: "tlsTabsQuerySync", publicName: "tlsTabsQuerySync", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
6920
7282
|
}
|
|
@@ -6965,6 +7327,9 @@ class Toast {
|
|
|
6965
7327
|
...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
|
|
6966
7328
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
6967
7329
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
7330
|
+
/** Accessible name for the close button. */
|
|
7331
|
+
dismissLabel = input('Dismiss', /* @ts-ignore */
|
|
7332
|
+
...(ngDevMode ? [{ debugName: "dismissLabel" }] : /* istanbul ignore next */ []));
|
|
6968
7333
|
// Outputs
|
|
6969
7334
|
dismissed = output();
|
|
6970
7335
|
actionTriggered = output();
|
|
@@ -6998,7 +7363,7 @@ class Toast {
|
|
|
6998
7363
|
this.dismissed.emit();
|
|
6999
7364
|
}
|
|
7000
7365
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Toast, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7001
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Toast, isStandalone: true, selector: "tls-toast", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showProgress: { classPropertyName: "showProgress", publicName: "showProgress", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, paused: { classPropertyName: "paused", publicName: "paused", isSignal: true, isRequired: false, transformFunction: null }, action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismissed: "dismissed", actionTriggered: "actionTriggered" }, host: { attributes: { "animate.enter": "tls-toast--enter", "animate.leave": "tls-toast--leave" }, properties: { "class": "hostClasses()", "attr.role": "role()", "attr.aria-label": "ariaLabel() ?? null" } }, ngImport: i0, template: "<!--\n The surface is a deliberate wrapper, not a redundant one: the host element is\n the stacking layer positioned by `ToastOutlet` (transform / scale / z-index),\n while the surface is the visible card that plays the enter / leave animation \u2014\n keeping the two transforms on separate elements so they never conflict.\n-->\n<div class=\"tls-toast__surface\">\n @if (showIcon()) {\n <tls-icon class=\"tls-toast__icon\" [name]=\"icon()\" aria-hidden=\"true\" />\n }\n\n <div class=\"tls-toast__body\">\n @if (title(); as title) {\n <p class=\"tls-toast__title\">{{ title }}</p>\n }\n <p class=\"tls-toast__message\">{{ message() }}</p>\n </div>\n\n @if (action(); as action) {\n <tls-button\n class=\"tls-toast__action\"\n variant=\"text\"\n size=\"sm\"\n [color]=\"color()\"\n [label]=\"action.label\"\n (click)=\"onAction()\"\n />\n }\n\n @if (closable()) {\n <button type=\"button\" class=\"tls-toast__close\" aria-label=\"
|
|
7366
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Toast, isStandalone: true, selector: "tls-toast", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showProgress: { classPropertyName: "showProgress", publicName: "showProgress", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, paused: { classPropertyName: "paused", publicName: "paused", isSignal: true, isRequired: false, transformFunction: null }, action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, dismissLabel: { classPropertyName: "dismissLabel", publicName: "dismissLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismissed: "dismissed", actionTriggered: "actionTriggered" }, host: { attributes: { "animate.enter": "tls-toast--enter", "animate.leave": "tls-toast--leave" }, properties: { "class": "hostClasses()", "attr.role": "role()", "attr.aria-label": "ariaLabel() ?? null" } }, ngImport: i0, template: "<!--\n The surface is a deliberate wrapper, not a redundant one: the host element is\n the stacking layer positioned by `ToastOutlet` (transform / scale / z-index),\n while the surface is the visible card that plays the enter / leave animation \u2014\n keeping the two transforms on separate elements so they never conflict.\n-->\n<div class=\"tls-toast__surface\">\n @if (showIcon()) {\n <tls-icon class=\"tls-toast__icon\" [name]=\"icon()\" aria-hidden=\"true\" />\n }\n\n <div class=\"tls-toast__body\">\n @if (title(); as title) {\n <p class=\"tls-toast__title\">{{ title }}</p>\n }\n <p class=\"tls-toast__message\">{{ message() }}</p>\n </div>\n\n @if (action(); as action) {\n <tls-button\n class=\"tls-toast__action\"\n variant=\"text\"\n size=\"sm\"\n [color]=\"color()\"\n [label]=\"action.label\"\n (click)=\"onAction()\"\n />\n }\n\n @if (closable()) {\n <button type=\"button\" class=\"tls-toast__close\" [attr.aria-label]=\"dismissLabel()\" (click)=\"onClose()\">\n <tls-icon class=\"tls-toast__close-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n }\n\n @if (progressVisible()) {\n <span class=\"tls-toast__progress\" [style.--tls-toast-duration]=\"progressDuration()\" aria-hidden=\"true\"></span>\n }\n</div>\n", dependencies: [{ 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"] }] });
|
|
7002
7367
|
}
|
|
7003
7368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Toast, decorators: [{
|
|
7004
7369
|
type: Component,
|
|
@@ -7008,8 +7373,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7008
7373
|
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
7009
7374
|
'animate.enter': 'tls-toast--enter',
|
|
7010
7375
|
'animate.leave': 'tls-toast--leave',
|
|
7011
|
-
}, template: "<!--\n The surface is a deliberate wrapper, not a redundant one: the host element is\n the stacking layer positioned by `ToastOutlet` (transform / scale / z-index),\n while the surface is the visible card that plays the enter / leave animation \u2014\n keeping the two transforms on separate elements so they never conflict.\n-->\n<div class=\"tls-toast__surface\">\n @if (showIcon()) {\n <tls-icon class=\"tls-toast__icon\" [name]=\"icon()\" aria-hidden=\"true\" />\n }\n\n <div class=\"tls-toast__body\">\n @if (title(); as title) {\n <p class=\"tls-toast__title\">{{ title }}</p>\n }\n <p class=\"tls-toast__message\">{{ message() }}</p>\n </div>\n\n @if (action(); as action) {\n <tls-button\n class=\"tls-toast__action\"\n variant=\"text\"\n size=\"sm\"\n [color]=\"color()\"\n [label]=\"action.label\"\n (click)=\"onAction()\"\n />\n }\n\n @if (closable()) {\n <button type=\"button\" class=\"tls-toast__close\" aria-label=\"
|
|
7012
|
-
}], propDecorators: { message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], showProgress: [{ type: i0.Input, args: [{ isSignal: true, alias: "showProgress", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], paused: [{ type: i0.Input, args: [{ isSignal: true, alias: "paused", required: false }] }], action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], dismissed: [{ type: i0.Output, args: ["dismissed"] }], actionTriggered: [{ type: i0.Output, args: ["actionTriggered"] }] } });
|
|
7376
|
+
}, template: "<!--\n The surface is a deliberate wrapper, not a redundant one: the host element is\n the stacking layer positioned by `ToastOutlet` (transform / scale / z-index),\n while the surface is the visible card that plays the enter / leave animation \u2014\n keeping the two transforms on separate elements so they never conflict.\n-->\n<div class=\"tls-toast__surface\">\n @if (showIcon()) {\n <tls-icon class=\"tls-toast__icon\" [name]=\"icon()\" aria-hidden=\"true\" />\n }\n\n <div class=\"tls-toast__body\">\n @if (title(); as title) {\n <p class=\"tls-toast__title\">{{ title }}</p>\n }\n <p class=\"tls-toast__message\">{{ message() }}</p>\n </div>\n\n @if (action(); as action) {\n <tls-button\n class=\"tls-toast__action\"\n variant=\"text\"\n size=\"sm\"\n [color]=\"color()\"\n [label]=\"action.label\"\n (click)=\"onAction()\"\n />\n }\n\n @if (closable()) {\n <button type=\"button\" class=\"tls-toast__close\" [attr.aria-label]=\"dismissLabel()\" (click)=\"onClose()\">\n <tls-icon class=\"tls-toast__close-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n }\n\n @if (progressVisible()) {\n <span class=\"tls-toast__progress\" [style.--tls-toast-duration]=\"progressDuration()\" aria-hidden=\"true\"></span>\n }\n</div>\n" }]
|
|
7377
|
+
}], propDecorators: { message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], showIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIcon", required: false }] }], showProgress: [{ type: i0.Input, args: [{ isSignal: true, alias: "showProgress", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], paused: [{ type: i0.Input, args: [{ isSignal: true, alias: "paused", required: false }] }], action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], dismissLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissLabel", required: false }] }], dismissed: [{ type: i0.Output, args: ["dismissed"] }], actionTriggered: [{ type: i0.Output, args: ["actionTriggered"] }] } });
|
|
7013
7378
|
|
|
7014
7379
|
// Base stacking order applied to the front toast; toasts further back subtract
|
|
7015
7380
|
// their depth from this so the newest always paints on top.
|
|
@@ -7026,11 +7391,6 @@ const TOAST_COLLAPSED_VISIBLE_DEPTH = 3;
|
|
|
7026
7391
|
// in sync with `--spacing-3` in `_toast.scss`; it is a transform offset computed
|
|
7027
7392
|
// in TypeScript, so it lives here as a number rather than a spacing token.
|
|
7028
7393
|
const TOAST_EXPANDED_GAP = 12;
|
|
7029
|
-
// Upper bound for how long to keep the outlet overlay's pane alive after a toast
|
|
7030
|
-
// starts leaving, so Angular's `animate.leave` can finish. Disposal happens on
|
|
7031
|
-
// `animationend`; this only fires when no exit animation runs (e.g. the `none`
|
|
7032
|
-
// motion level).
|
|
7033
|
-
const TOAST_LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
7034
7394
|
|
|
7035
7395
|
const DEFAULT_TOAST_CONFIG = {
|
|
7036
7396
|
position: 'top-end',
|
|
@@ -7048,6 +7408,8 @@ const DEFAULT_TOAST_CONFIG = {
|
|
|
7048
7408
|
showIcon: true,
|
|
7049
7409
|
showProgress: true,
|
|
7050
7410
|
pauseOnHover: true,
|
|
7411
|
+
regionLabel: 'Notifications',
|
|
7412
|
+
dismissLabel: 'Dismiss',
|
|
7051
7413
|
};
|
|
7052
7414
|
|
|
7053
7415
|
const TOAST_CONFIG = new InjectionToken('TOAST_CONFIG', {
|
|
@@ -7203,6 +7565,7 @@ class ToastOutlet {
|
|
|
7203
7565
|
// Injections
|
|
7204
7566
|
_service = inject(ToastService);
|
|
7205
7567
|
_destroyRef = inject(DestroyRef);
|
|
7568
|
+
_elementRef = inject(ElementRef);
|
|
7206
7569
|
// State
|
|
7207
7570
|
toasts = this._service.toasts;
|
|
7208
7571
|
_pointerInside = signal(false, /* @ts-ignore */
|
|
@@ -7219,6 +7582,10 @@ class ToastOutlet {
|
|
|
7219
7582
|
// Computed
|
|
7220
7583
|
position = computed(() => this._service.config.position, /* @ts-ignore */
|
|
7221
7584
|
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
7585
|
+
regionLabel = computed(() => this._service.config.regionLabel, /* @ts-ignore */
|
|
7586
|
+
...(ngDevMode ? [{ debugName: "regionLabel" }] : /* istanbul ignore next */ []));
|
|
7587
|
+
dismissLabel = computed(() => this._service.config.dismissLabel, /* @ts-ignore */
|
|
7588
|
+
...(ngDevMode ? [{ debugName: "dismissLabel" }] : /* istanbul ignore next */ []));
|
|
7222
7589
|
expanded = computed(() => this._service.config.stacking === 'expanded' || this._interacting(), /* @ts-ignore */
|
|
7223
7590
|
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
7224
7591
|
// Auto-dismiss is frozen while interacting (when `pauseOnHover` is on); the
|
|
@@ -7302,6 +7669,15 @@ class ToastOutlet {
|
|
|
7302
7669
|
this._service.resume();
|
|
7303
7670
|
}
|
|
7304
7671
|
});
|
|
7672
|
+
// An emptied stack ends the interaction: without this, a touch-expanded
|
|
7673
|
+
// pile would still count as "interacting" when the next toast arrives,
|
|
7674
|
+
// freezing its auto-dismiss timer from the start.
|
|
7675
|
+
effect(() => {
|
|
7676
|
+
if (this.toasts().length > 0)
|
|
7677
|
+
return;
|
|
7678
|
+
this._pointerInside.set(false);
|
|
7679
|
+
this._focusInside.set(false);
|
|
7680
|
+
});
|
|
7305
7681
|
this._destroyRef.onDestroy(() => {
|
|
7306
7682
|
if (this._resizeObserver)
|
|
7307
7683
|
this._resizeObserver.disconnect();
|
|
@@ -7319,7 +7695,20 @@ class ToastOutlet {
|
|
|
7319
7695
|
onPointerEnter() {
|
|
7320
7696
|
this._pointerInside.set(true);
|
|
7321
7697
|
}
|
|
7322
|
-
onPointerLeave() {
|
|
7698
|
+
onPointerLeave(event) {
|
|
7699
|
+
// A tap retires its pointer immediately, firing `pointerleave` within the
|
|
7700
|
+
// same gesture — collapsing here would undo the expansion the tap just
|
|
7701
|
+
// made. A touch-expanded pile stays open; it collapses once its toasts are
|
|
7702
|
+
// dismissed (or with focus, via `focusout`).
|
|
7703
|
+
if (event.pointerType === 'touch')
|
|
7704
|
+
return;
|
|
7705
|
+
this._pointerInside.set(false);
|
|
7706
|
+
}
|
|
7707
|
+
onDocumentPointerDown(event) {
|
|
7708
|
+
if (event.pointerType !== 'touch' || !this._pointerInside())
|
|
7709
|
+
return;
|
|
7710
|
+
if (this._elementRef.nativeElement.contains(event.target))
|
|
7711
|
+
return;
|
|
7323
7712
|
this._pointerInside.set(false);
|
|
7324
7713
|
}
|
|
7325
7714
|
onFocusIn() {
|
|
@@ -7333,11 +7722,16 @@ class ToastOutlet {
|
|
|
7333
7722
|
this._heights.set(this._toastElements().map(element => element.nativeElement.offsetHeight));
|
|
7334
7723
|
}
|
|
7335
7724
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToastOutlet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7336
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToastOutlet, isStandalone: true, selector: "tls-toast-outlet", host: { classAttribute: "tls-toast-outlet" }, viewQueries: [{ propertyName: "_toastElements", predicate: ["toastEl"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div\n [class]=\"regionClasses()\"\n role=\"region\"\n aria-label=\"
|
|
7725
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToastOutlet, isStandalone: true, selector: "tls-toast-outlet", host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)" }, classAttribute: "tls-toast-outlet" }, viewQueries: [{ propertyName: "_toastElements", predicate: ["toastEl"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div\n [class]=\"regionClasses()\"\n role=\"region\"\n [attr.aria-label]=\"regionLabel()\"\n [style.height.px]=\"regionHeight()\"\n (pointerenter)=\"onPointerEnter()\"\n (pointerleave)=\"onPointerLeave($event)\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut()\"\n>\n @for (toast of toasts(); track toast.id; let index = $index) {\n <tls-toast\n #toastEl\n [style.transform]=\"layouts()[index].transform\"\n [style.z-index]=\"layouts()[index].zIndex\"\n [style.--tls-toast-depth-opacity]=\"layouts()[index].depthOpacity\"\n [message]=\"toast.message\"\n [title]=\"toast.title\"\n [color]=\"toast.color\"\n [duration]=\"toast.duration\"\n [paused]=\"paused()\"\n [closable]=\"toast.closable\"\n [showIcon]=\"toast.showIcon\"\n [showProgress]=\"toast.showProgress\"\n [action]=\"toast.action\"\n [ariaLabel]=\"toast.ariaLabel\"\n [dismissLabel]=\"dismissLabel()\"\n (dismissed)=\"onDismiss(toast.id)\"\n (actionTriggered)=\"onAction(toast)\"\n ></tls-toast>\n }\n</div>\n", dependencies: [{ kind: "component", type: Toast, selector: "tls-toast", inputs: ["message", "title", "color", "closable", "showIcon", "showProgress", "duration", "paused", "action", "ariaLabel", "dismissLabel"], outputs: ["dismissed", "actionTriggered"] }] });
|
|
7337
7726
|
}
|
|
7338
7727
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToastOutlet, decorators: [{
|
|
7339
7728
|
type: Component,
|
|
7340
|
-
args: [{ selector: 'tls-toast-outlet', imports: [Toast], host: {
|
|
7729
|
+
args: [{ selector: 'tls-toast-outlet', imports: [Toast], host: {
|
|
7730
|
+
class: 'tls-toast-outlet',
|
|
7731
|
+
// Touch has no hover-out; a tap outside the stack is what collapses a
|
|
7732
|
+
// touch-expanded pile (and resumes the auto-dismiss timers).
|
|
7733
|
+
'(document:pointerdown)': 'onDocumentPointerDown($event)',
|
|
7734
|
+
}, template: "<div\n [class]=\"regionClasses()\"\n role=\"region\"\n [attr.aria-label]=\"regionLabel()\"\n [style.height.px]=\"regionHeight()\"\n (pointerenter)=\"onPointerEnter()\"\n (pointerleave)=\"onPointerLeave($event)\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut()\"\n>\n @for (toast of toasts(); track toast.id; let index = $index) {\n <tls-toast\n #toastEl\n [style.transform]=\"layouts()[index].transform\"\n [style.z-index]=\"layouts()[index].zIndex\"\n [style.--tls-toast-depth-opacity]=\"layouts()[index].depthOpacity\"\n [message]=\"toast.message\"\n [title]=\"toast.title\"\n [color]=\"toast.color\"\n [duration]=\"toast.duration\"\n [paused]=\"paused()\"\n [closable]=\"toast.closable\"\n [showIcon]=\"toast.showIcon\"\n [showProgress]=\"toast.showProgress\"\n [action]=\"toast.action\"\n [ariaLabel]=\"toast.ariaLabel\"\n [dismissLabel]=\"dismissLabel()\"\n (dismissed)=\"onDismiss(toast.id)\"\n (actionTriggered)=\"onAction(toast)\"\n ></tls-toast>\n }\n</div>\n" }]
|
|
7341
7735
|
}], ctorParameters: () => [], propDecorators: { _toastElements: [{ type: i0.ViewChildren, args: ['toastEl', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
7342
7736
|
|
|
7343
7737
|
class Tooltip {
|
|
@@ -7401,11 +7795,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7401
7795
|
}]
|
|
7402
7796
|
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }, { type: i0.Output, args: ["contentChange"] }], templateData: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateData", required: false }] }, { type: i0.Output, args: ["templateDataChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }, { type: i0.Output, args: ["colorChange"] }] } });
|
|
7403
7797
|
|
|
7404
|
-
// Upper bound for how long to keep a detached tooltip pane alive so its
|
|
7405
|
-
// `animate.leave` can finish. Disposes on `animationend`; this timeout only
|
|
7406
|
-
// fires when no exit animation runs (e.g. the `none` motion level).
|
|
7407
|
-
const LEAVE_ANIMATION_FALLBACK_MS = 500;
|
|
7408
|
-
|
|
7409
7798
|
class TooltipService {
|
|
7410
7799
|
_overlay = inject(Overlay);
|
|
7411
7800
|
_overlayRef = null;
|
|
@@ -7440,7 +7829,7 @@ class TooltipService {
|
|
|
7440
7829
|
const overlayRef = this._overlayRef;
|
|
7441
7830
|
this._overlayRef = null;
|
|
7442
7831
|
overlayRef.detach();
|
|
7443
|
-
|
|
7832
|
+
disposeAfterLeaveAnimation(overlayRef);
|
|
7444
7833
|
}
|
|
7445
7834
|
dispose() {
|
|
7446
7835
|
if (!this._overlayRef)
|
|
@@ -7448,27 +7837,6 @@ class TooltipService {
|
|
|
7448
7837
|
this._overlayRef.dispose();
|
|
7449
7838
|
this._overlayRef = null;
|
|
7450
7839
|
}
|
|
7451
|
-
// Private methods
|
|
7452
|
-
// Disposes a detached overlay once the tooltip's exit animation has finished.
|
|
7453
|
-
// Falls back to a timeout when no animation runs (e.g. the `none` motion level).
|
|
7454
|
-
_disposeAfterAnimation(overlayRef) {
|
|
7455
|
-
const paneElement = overlayRef.overlayElement;
|
|
7456
|
-
if (!paneElement) {
|
|
7457
|
-
overlayRef.dispose();
|
|
7458
|
-
return;
|
|
7459
|
-
}
|
|
7460
|
-
let settled = false;
|
|
7461
|
-
const finalize = () => {
|
|
7462
|
-
if (settled)
|
|
7463
|
-
return;
|
|
7464
|
-
settled = true;
|
|
7465
|
-
window.clearTimeout(timeoutId);
|
|
7466
|
-
paneElement.removeEventListener('animationend', finalize);
|
|
7467
|
-
overlayRef.dispose();
|
|
7468
|
-
};
|
|
7469
|
-
paneElement.addEventListener('animationend', finalize);
|
|
7470
|
-
const timeoutId = window.setTimeout(finalize, LEAVE_ANIMATION_FALLBACK_MS);
|
|
7471
|
-
}
|
|
7472
7840
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7473
7841
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService });
|
|
7474
7842
|
}
|
|
@@ -7488,12 +7856,22 @@ const TOOLTIP_CONFIG = new InjectionToken('TOOLTIP_CONFIG', {
|
|
|
7488
7856
|
factory: () => DEFAULT_TOOLTIP_CONFIG,
|
|
7489
7857
|
});
|
|
7490
7858
|
|
|
7859
|
+
/**
|
|
7860
|
+
* Attaches a tooltip to the host element. Shows on hover and on keyboard focus,
|
|
7861
|
+
* toggles on touch, and dismisses on Escape without moving the pointer or focus
|
|
7862
|
+
* (WCAG 1.4.13). The tooltip is linked to the host via `aria-describedby` while
|
|
7863
|
+
* visible.
|
|
7864
|
+
*
|
|
7865
|
+
* Interaction is driven by pointer events, branching on `pointerType`: mouse
|
|
7866
|
+
* and pen get hover semantics, touch gets tap-to-toggle. A single stream avoids
|
|
7867
|
+
* the synthesized mouse events browsers replay after a tap.
|
|
7868
|
+
*/
|
|
7491
7869
|
class TooltipDirective {
|
|
7492
7870
|
_tooltipService = inject(TooltipService);
|
|
7493
7871
|
_elementRef = inject(ElementRef);
|
|
7494
7872
|
_renderer = inject(Renderer2);
|
|
7495
7873
|
_config = inject(TOOLTIP_CONFIG);
|
|
7496
|
-
content = input('
|
|
7874
|
+
content = input('', { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), alias: 'tlsTooltip' });
|
|
7497
7875
|
data = input(null, /* @ts-ignore */
|
|
7498
7876
|
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
7499
7877
|
tooltipDisabled = input(false, /* @ts-ignore */
|
|
@@ -7518,42 +7896,66 @@ class TooltipDirective {
|
|
|
7518
7896
|
}, /* @ts-ignore */
|
|
7519
7897
|
...(ngDevMode ? [{ debugName: "_positions" }] : /* istanbul ignore next */ []));
|
|
7520
7898
|
// Protected methods
|
|
7521
|
-
|
|
7522
|
-
|
|
7899
|
+
onPointerEnter(event) {
|
|
7900
|
+
// A touch "enter" is a tap, not a hover — toggle instead. The default is
|
|
7901
|
+
// not prevented, so the tap still activates an interactive host.
|
|
7902
|
+
if (event.pointerType === 'touch') {
|
|
7903
|
+
if (this._visible()) {
|
|
7904
|
+
this._hide();
|
|
7905
|
+
}
|
|
7906
|
+
else {
|
|
7907
|
+
this._show();
|
|
7908
|
+
}
|
|
7909
|
+
return;
|
|
7910
|
+
}
|
|
7911
|
+
this._show({ x: event.clientX, y: event.clientY });
|
|
7523
7912
|
}
|
|
7524
|
-
|
|
7913
|
+
onPointerMove(event) {
|
|
7914
|
+
if (event.pointerType === 'touch')
|
|
7915
|
+
return;
|
|
7525
7916
|
if (this.tooltipOrigin() === 'cursor') {
|
|
7526
7917
|
this._tooltipService.move({ x: event.clientX, y: event.clientY }, this._positions());
|
|
7527
7918
|
}
|
|
7528
7919
|
}
|
|
7529
|
-
|
|
7920
|
+
onPointerLeave(event) {
|
|
7921
|
+
// A tap retires its pointer immediately, firing `pointerleave` within the
|
|
7922
|
+
// same gesture; hiding here would undo the toggle the tap just made.
|
|
7923
|
+
if (event.pointerType === 'touch')
|
|
7924
|
+
return;
|
|
7530
7925
|
this._hide();
|
|
7531
7926
|
}
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7927
|
+
onFocus() {
|
|
7928
|
+
// No cursor to anchor to; a focus-triggered tooltip always anchors to the element.
|
|
7929
|
+
this._show();
|
|
7930
|
+
}
|
|
7931
|
+
onBlur() {
|
|
7932
|
+
this._hide();
|
|
7933
|
+
}
|
|
7934
|
+
/** Dismisses the tooltip without moving the pointer or focus (WCAG 1.4.13). */
|
|
7935
|
+
onEscape() {
|
|
7936
|
+
if (this._visible())
|
|
7535
7937
|
this._hide();
|
|
7536
|
-
}
|
|
7537
|
-
else {
|
|
7538
|
-
this._show(event.touches[0]);
|
|
7539
|
-
}
|
|
7540
7938
|
}
|
|
7541
7939
|
// Private methods
|
|
7542
|
-
_show(
|
|
7543
|
-
if (this.tooltipDisabled())
|
|
7940
|
+
_show(point) {
|
|
7941
|
+
if (this.tooltipDisabled() || this._visible())
|
|
7942
|
+
return;
|
|
7943
|
+
// Nothing to render — an empty string would show a bare bubble.
|
|
7944
|
+
const content = this.content();
|
|
7945
|
+
if (content === '')
|
|
7544
7946
|
return;
|
|
7545
7947
|
this._visible.set(true);
|
|
7546
7948
|
const tooltipPortal = new ComponentPortal(Tooltip);
|
|
7547
|
-
const origin = this.tooltipOrigin() === 'cursor'
|
|
7548
|
-
? { x: event.clientX, y: event.clientY }
|
|
7549
|
-
: this._elementRef.nativeElement;
|
|
7949
|
+
const origin = this.tooltipOrigin() === 'cursor' && point ? point : this._elementRef.nativeElement;
|
|
7550
7950
|
const tooltipRef = this._tooltipService.show(origin, this._positions(), tooltipPortal);
|
|
7551
|
-
tooltipRef.instance.content.set(
|
|
7951
|
+
tooltipRef.instance.content.set(content);
|
|
7552
7952
|
tooltipRef.instance.templateData.set(this.data());
|
|
7553
7953
|
tooltipRef.instance.color.set(this.tooltipColor());
|
|
7554
7954
|
this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', tooltipRef.instance.id);
|
|
7555
7955
|
}
|
|
7556
7956
|
_hide() {
|
|
7957
|
+
if (!this._visible())
|
|
7958
|
+
return;
|
|
7557
7959
|
this._tooltipService.hide();
|
|
7558
7960
|
this._visible.set(false);
|
|
7559
7961
|
this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
|
|
@@ -7564,7 +7966,7 @@ class TooltipDirective {
|
|
|
7564
7966
|
this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
|
|
7565
7967
|
}
|
|
7566
7968
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
7567
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "
|
|
7969
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerenter": "onPointerEnter($event)", "pointermove": "onPointerMove($event)", "pointerleave": "onPointerLeave($event)", "focus": "onFocus()", "blur": "onBlur()", "document:keydown.escape": "onEscape()" } }, providers: [TooltipService], ngImport: i0 });
|
|
7568
7970
|
}
|
|
7569
7971
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
7570
7972
|
type: Directive,
|
|
@@ -7572,25 +7974,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
7572
7974
|
selector: '[tlsTooltip]',
|
|
7573
7975
|
providers: [TooltipService],
|
|
7574
7976
|
host: {
|
|
7575
|
-
'(
|
|
7576
|
-
'(
|
|
7577
|
-
'(
|
|
7578
|
-
'(
|
|
7977
|
+
'(pointerenter)': 'onPointerEnter($event)',
|
|
7978
|
+
'(pointermove)': 'onPointerMove($event)',
|
|
7979
|
+
'(pointerleave)': 'onPointerLeave($event)',
|
|
7980
|
+
'(focus)': 'onFocus()',
|
|
7981
|
+
'(blur)': 'onBlur()',
|
|
7982
|
+
'(document:keydown.escape)': 'onEscape()',
|
|
7579
7983
|
},
|
|
7580
7984
|
}]
|
|
7581
7985
|
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltip", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], tooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOrigin", required: false }] }], tooltipPositions: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPositions", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOffset", required: false }] }], tooltipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipColor", required: false }] }] } });
|
|
7582
7986
|
|
|
7583
7987
|
// Features
|
|
7584
7988
|
|
|
7585
|
-
const provideThalassicUIConfig = (config) => {
|
|
7989
|
+
const provideThalassicUIConfig = (config = {}) => {
|
|
7990
|
+
const components = config.components ?? {};
|
|
7586
7991
|
// Query-sync configs nest under their parent feature in the public API but resolve to their own
|
|
7587
7992
|
// separate DI tokens, so split the nested `querySync` off from the component's own config.
|
|
7588
|
-
const { querySync: paginationQuerySync, ...pagination } =
|
|
7589
|
-
const { querySync: tabsQuerySync, ...tabs } =
|
|
7993
|
+
const { querySync: paginationQuerySync, ...pagination } = components.pagination ?? {};
|
|
7994
|
+
const { querySync: tabsQuerySync, ...tabs } = components.tabs ?? {};
|
|
7590
7995
|
const accessibility = deepMerge(DEFAULT_ACCESSIBILITY_CONFIG, config.accessibility);
|
|
7591
7996
|
return makeEnvironmentProviders([
|
|
7592
7997
|
// Cross-cutting accessibility policy
|
|
7593
7998
|
{ provide: ACCESSIBILITY_CONFIG, useValue: accessibility },
|
|
7999
|
+
// Cross-cutting locale for date formatting
|
|
8000
|
+
{
|
|
8001
|
+
provide: LOCALE_CONFIG,
|
|
8002
|
+
useValue: deepMerge(DEFAULT_LOCALE_CONFIG, config.locale),
|
|
8003
|
+
},
|
|
7594
8004
|
// Reflect the touch-target opt-out onto the document root. Absent the attribute the
|
|
7595
8005
|
// expansion is active (accessible by default); this only disables it. The overflow is
|
|
7596
8006
|
// transparent, so a late (browser-only) reflection causes no visual flash.
|
|
@@ -7609,83 +8019,87 @@ const provideThalassicUIConfig = (config) => {
|
|
|
7609
8019
|
// Components
|
|
7610
8020
|
{
|
|
7611
8021
|
provide: ALERT_CONFIG,
|
|
7612
|
-
useValue: deepMerge(DEFAULT_ALERT_CONFIG,
|
|
8022
|
+
useValue: deepMerge(DEFAULT_ALERT_CONFIG, components.alert),
|
|
7613
8023
|
},
|
|
7614
8024
|
{
|
|
7615
8025
|
provide: AUTOCOMPLETE_CONFIG,
|
|
7616
|
-
useValue: deepMerge(DEFAULT_AUTOCOMPLETE_CONFIG,
|
|
8026
|
+
useValue: deepMerge(DEFAULT_AUTOCOMPLETE_CONFIG, components.autocomplete),
|
|
7617
8027
|
},
|
|
7618
8028
|
{
|
|
7619
8029
|
provide: BUTTON_CONFIG,
|
|
7620
|
-
useValue: deepMerge(DEFAULT_BUTTON_CONFIG,
|
|
8030
|
+
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, components.button),
|
|
7621
8031
|
},
|
|
7622
8032
|
{
|
|
7623
8033
|
provide: CALENDAR_CONFIG,
|
|
7624
|
-
|
|
8034
|
+
// `labels` is a deep-partial override; deepMerge merges it recursively, but its
|
|
8035
|
+
// `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
8036
|
+
useValue: deepMerge(DEFAULT_CALENDAR_CONFIG, components.calendar),
|
|
7625
8037
|
},
|
|
7626
8038
|
{
|
|
7627
8039
|
provide: CHECKBOX_CONFIG,
|
|
7628
|
-
useValue: deepMerge(DEFAULT_CHECKBOX_CONFIG,
|
|
8040
|
+
useValue: deepMerge(DEFAULT_CHECKBOX_CONFIG, components.checkbox),
|
|
7629
8041
|
},
|
|
7630
|
-
{ provide: CHIP_CONFIG, useValue: deepMerge(DEFAULT_CHIP_CONFIG,
|
|
8042
|
+
{ provide: CHIP_CONFIG, useValue: deepMerge(DEFAULT_CHIP_CONFIG, components.chip) },
|
|
7631
8043
|
{
|
|
7632
8044
|
provide: CHIP_CONTROL_CONFIG,
|
|
7633
|
-
useValue: deepMerge(DEFAULT_CHIP_CONTROL_CONFIG,
|
|
8045
|
+
useValue: deepMerge(DEFAULT_CHIP_CONTROL_CONFIG, components.chipControl),
|
|
7634
8046
|
},
|
|
7635
8047
|
{
|
|
7636
8048
|
provide: CHIP_GROUP_CONFIG,
|
|
7637
|
-
useValue: deepMerge(DEFAULT_CHIP_GROUP_CONFIG,
|
|
8049
|
+
useValue: deepMerge(DEFAULT_CHIP_GROUP_CONFIG, components.chipGroup),
|
|
7638
8050
|
},
|
|
7639
8051
|
{
|
|
7640
8052
|
provide: CHIP_INPUT_CONFIG,
|
|
7641
|
-
useValue: deepMerge(DEFAULT_CHIP_INPUT_CONFIG,
|
|
8053
|
+
useValue: deepMerge(DEFAULT_CHIP_INPUT_CONFIG, components.chipInput),
|
|
7642
8054
|
},
|
|
7643
8055
|
{
|
|
7644
8056
|
provide: DATE_TIME_PICKER_CONFIG,
|
|
7645
|
-
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG,
|
|
8057
|
+
useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, components.dateTimePicker),
|
|
7646
8058
|
},
|
|
7647
8059
|
{
|
|
7648
8060
|
provide: DIALOG_CONFIG,
|
|
7649
|
-
useValue: deepMerge(DEFAULT_DIALOG_CONFIG,
|
|
8061
|
+
useValue: deepMerge(DEFAULT_DIALOG_CONFIG, components.dialog),
|
|
7650
8062
|
},
|
|
7651
8063
|
{
|
|
7652
8064
|
provide: DIVIDER_CONFIG,
|
|
7653
|
-
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG,
|
|
8065
|
+
useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, components.divider),
|
|
7654
8066
|
},
|
|
7655
8067
|
{
|
|
7656
8068
|
provide: FILE_INPUT_CONFIG,
|
|
7657
|
-
useValue: deepMerge(DEFAULT_FILE_INPUT_CONFIG,
|
|
8069
|
+
useValue: deepMerge(DEFAULT_FILE_INPUT_CONFIG, components.fileInput),
|
|
7658
8070
|
},
|
|
7659
8071
|
{
|
|
7660
8072
|
provide: FORM_CONTROL_GROUP_CONFIG,
|
|
7661
|
-
useValue: deepMerge(DEFAULT_FORM_CONTROL_GROUP_CONFIG,
|
|
8073
|
+
useValue: deepMerge(DEFAULT_FORM_CONTROL_GROUP_CONFIG, components.formControlGroup),
|
|
7662
8074
|
},
|
|
7663
8075
|
{
|
|
7664
8076
|
provide: FORM_ITEM_CONFIG,
|
|
7665
|
-
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG,
|
|
8077
|
+
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, components.formItem),
|
|
7666
8078
|
},
|
|
7667
8079
|
{
|
|
7668
8080
|
provide: HIGHLIGHT_CONFIG,
|
|
7669
|
-
useValue: deepMerge(DEFAULT_HIGHLIGHT_CONFIG,
|
|
8081
|
+
useValue: deepMerge(DEFAULT_HIGHLIGHT_CONFIG, components.highlight),
|
|
7670
8082
|
},
|
|
7671
|
-
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG,
|
|
8083
|
+
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, components.icon) },
|
|
7672
8084
|
{
|
|
7673
8085
|
provide: IMAGE_COMPARE_CONFIG,
|
|
7674
|
-
useValue: deepMerge(DEFAULT_IMAGE_COMPARE_CONFIG,
|
|
8086
|
+
useValue: deepMerge(DEFAULT_IMAGE_COMPARE_CONFIG, components.imageCompare),
|
|
7675
8087
|
},
|
|
7676
|
-
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG,
|
|
8088
|
+
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, components.input) },
|
|
7677
8089
|
{
|
|
7678
8090
|
provide: LOADER_CONFIG,
|
|
7679
|
-
useValue: deepMerge(DEFAULT_LOADER_CONFIG,
|
|
8091
|
+
useValue: deepMerge(DEFAULT_LOADER_CONFIG, components.loader),
|
|
7680
8092
|
},
|
|
7681
|
-
{ provide: MARK_CONFIG, useValue: deepMerge(DEFAULT_MARK_CONFIG,
|
|
7682
|
-
{ provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG,
|
|
8093
|
+
{ provide: MARK_CONFIG, useValue: deepMerge(DEFAULT_MARK_CONFIG, components.mark) },
|
|
8094
|
+
{ provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG, components.menu) },
|
|
7683
8095
|
{
|
|
7684
8096
|
provide: MULTI_SELECT_CONFIG,
|
|
7685
|
-
useValue: deepMerge(DEFAULT_MULTI_SELECT_CONFIG,
|
|
8097
|
+
useValue: deepMerge(DEFAULT_MULTI_SELECT_CONFIG, components.multiSelect),
|
|
7686
8098
|
},
|
|
7687
8099
|
{
|
|
7688
8100
|
provide: PAGINATION_CONFIG,
|
|
8101
|
+
// `labels` is a deep-partial override; deepMerge merges it recursively, but its
|
|
8102
|
+
// `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
7689
8103
|
useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, pagination),
|
|
7690
8104
|
},
|
|
7691
8105
|
{
|
|
@@ -7694,44 +8108,44 @@ const provideThalassicUIConfig = (config) => {
|
|
|
7694
8108
|
},
|
|
7695
8109
|
{
|
|
7696
8110
|
provide: PASSWORD_CONFIG,
|
|
7697
|
-
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG,
|
|
8111
|
+
useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, components.password),
|
|
7698
8112
|
},
|
|
7699
8113
|
{
|
|
7700
8114
|
provide: PIN_INPUT_CONFIG,
|
|
7701
|
-
useValue: deepMerge(DEFAULT_PIN_INPUT_CONFIG,
|
|
8115
|
+
useValue: deepMerge(DEFAULT_PIN_INPUT_CONFIG, components.pinInput),
|
|
7702
8116
|
},
|
|
7703
8117
|
{
|
|
7704
8118
|
provide: POPOVER_CONFIG,
|
|
7705
|
-
useValue: deepMerge(DEFAULT_POPOVER_CONFIG,
|
|
8119
|
+
useValue: deepMerge(DEFAULT_POPOVER_CONFIG, components.popover),
|
|
7706
8120
|
},
|
|
7707
8121
|
{
|
|
7708
8122
|
provide: RADIO_BUTTON_CONFIG,
|
|
7709
|
-
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG,
|
|
8123
|
+
useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, components.radioButton),
|
|
7710
8124
|
},
|
|
7711
8125
|
{
|
|
7712
8126
|
provide: SELECT_CONFIG,
|
|
7713
|
-
useValue: deepMerge(DEFAULT_SELECT_CONFIG,
|
|
8127
|
+
useValue: deepMerge(DEFAULT_SELECT_CONFIG, components.select),
|
|
7714
8128
|
},
|
|
7715
8129
|
{
|
|
7716
8130
|
provide: SKELETON_CONFIG,
|
|
7717
|
-
useValue: deepMerge(DEFAULT_SKELETON_CONFIG,
|
|
8131
|
+
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, components.skeleton),
|
|
7718
8132
|
},
|
|
7719
8133
|
{
|
|
7720
8134
|
provide: SPLITTER_CONFIG,
|
|
7721
|
-
useValue: deepMerge(DEFAULT_SPLITTER_CONFIG,
|
|
8135
|
+
useValue: deepMerge(DEFAULT_SPLITTER_CONFIG, components.splitter),
|
|
7722
8136
|
},
|
|
7723
8137
|
{
|
|
7724
8138
|
provide: STEPPER_CONFIG,
|
|
7725
|
-
useValue: deepMerge(DEFAULT_STEPPER_CONFIG,
|
|
8139
|
+
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, components.stepper),
|
|
7726
8140
|
},
|
|
7727
8141
|
{
|
|
7728
8142
|
provide: SWITCH_CONFIG,
|
|
7729
|
-
useValue: deepMerge(DEFAULT_SWITCH_CONFIG,
|
|
8143
|
+
useValue: deepMerge(DEFAULT_SWITCH_CONFIG, components.switch),
|
|
7730
8144
|
},
|
|
7731
|
-
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG,
|
|
8145
|
+
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, components.table) },
|
|
7732
8146
|
{
|
|
7733
8147
|
provide: TAB_NAV_CONFIG,
|
|
7734
|
-
useValue: deepMerge(DEFAULT_TAB_NAV_CONFIG,
|
|
8148
|
+
useValue: deepMerge(DEFAULT_TAB_NAV_CONFIG, components.tabNav),
|
|
7735
8149
|
},
|
|
7736
8150
|
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, tabs) },
|
|
7737
8151
|
{
|
|
@@ -7740,21 +8154,21 @@ const provideThalassicUIConfig = (config) => {
|
|
|
7740
8154
|
},
|
|
7741
8155
|
{
|
|
7742
8156
|
provide: TEXTAREA_CONFIG,
|
|
7743
|
-
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG,
|
|
8157
|
+
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, components.textarea),
|
|
7744
8158
|
},
|
|
7745
8159
|
{
|
|
7746
8160
|
provide: TOAST_CONFIG,
|
|
7747
8161
|
// `severityColors` is a deep-partial override; deepMerge merges it recursively,
|
|
7748
8162
|
// but its `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
7749
|
-
useValue: deepMerge(DEFAULT_TOAST_CONFIG,
|
|
8163
|
+
useValue: deepMerge(DEFAULT_TOAST_CONFIG, components.toast),
|
|
7750
8164
|
},
|
|
7751
8165
|
{
|
|
7752
8166
|
provide: TOGGLE_GROUP_CONFIG,
|
|
7753
|
-
useValue: deepMerge(DEFAULT_TOGGLE_GROUP_CONFIG,
|
|
8167
|
+
useValue: deepMerge(DEFAULT_TOGGLE_GROUP_CONFIG, components.toggleGroup),
|
|
7754
8168
|
},
|
|
7755
8169
|
{
|
|
7756
8170
|
provide: TOOLTIP_CONFIG,
|
|
7757
|
-
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG,
|
|
8171
|
+
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, components.tooltip),
|
|
7758
8172
|
},
|
|
7759
8173
|
]);
|
|
7760
8174
|
};
|