@thalassic/ui 22.27.0 → 22.28.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 +1902 -782
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +888 -227
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, DOCUMENT, signal, DestroyRef, Injectable, ElementRef, model, input, computed, booleanAttribute, output, linkedSignal, untracked, Directive, PLATFORM_ID, numberAttribute, viewChild, contentChild, Component, ViewContainerRef, afterNextRender,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { InjectionToken, inject, DOCUMENT, signal, DestroyRef, Injectable, ElementRef, model, input, computed, booleanAttribute, output, linkedSignal, untracked, Directive, PLATFORM_ID, numberAttribute, viewChild, contentChild, Component, ViewContainerRef, afterNextRender, RendererStyleFlags2, Injector, Renderer2, afterRenderEffect, makeEnvironmentProviders, contentChildren, Service, effect, TemplateRef, viewChildren, forwardRef, ChangeDetectorRef, isDevMode, LOCALE_ID, provideEnvironmentInitializer } from '@angular/core';
|
|
3
|
+
import { InputModalityDetector, ConfigurableFocusTrapFactory, FocusTrapFactory } from '@angular/cdk/a11y';
|
|
4
|
+
import * as i1 from '@thalassic/core';
|
|
5
|
+
import { SWIPE_DEFAULT_MIN_VELOCITY, DRAG_DISMISS_RATIO, ViewportService, DRAG_DISMISS_POINTER_TYPES, MOTION_ATTRIBUTE, PanDirective, PAGING_EDGE_RESISTANCE, resolvePagingStep, PAGING_FLICK_VELOCITY, PAGING_COMMIT_RATIO, resistPagingDrag, DEFAULT_PAN_CONFIG, PAN_CONFIG, MotionService, deepMerge, SwipeDirective, HAPTIC_FEEDBACK } from '@thalassic/core';
|
|
6
|
+
import * as i1$1 from '@angular/cdk/scrolling';
|
|
7
|
+
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkScrollable, ViewportRuler } from '@angular/cdk/scrolling';
|
|
8
|
+
import { eachDayOfInterval, endOfWeek, endOfMonth, startOfWeek, startOfMonth, startOfDay, format, isSameMonth, isSameDay, addDays, subMonths, subWeeks, isBefore, isAfter, differenceInCalendarDays, addMonths, addHours, differenceInMinutes, isSameWeek, addWeeks, endOfDay, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setMinutes, setHours, setYear } from 'date-fns';
|
|
5
9
|
import { isPlatformBrowser, NgComponentOutlet, NgTemplateOutlet, LocationStrategy, DOCUMENT as DOCUMENT$1 } from '@angular/common';
|
|
6
10
|
import { Overlay, OverlayContainer } from '@angular/cdk/overlay';
|
|
7
11
|
import { TemplatePortal, ComponentPortal, CdkPortalOutlet, DomPortal } from '@angular/cdk/portal';
|
|
8
12
|
import { takeUntilDestroyed, rxResource, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
9
13
|
import { filter, throwError, map, shareReplay, of, Subscription, takeUntil } from 'rxjs';
|
|
14
|
+
import { enUS } from 'date-fns/locale';
|
|
10
15
|
import { Router, ActivatedRoute, RouterLink, NavigationStart, RouterLinkActive } from '@angular/router';
|
|
11
16
|
import { AccordionGroup, AccordionTrigger, AccordionPanel, AccordionContent } from '@angular/aria/accordion';
|
|
12
17
|
import { HttpClient } from '@angular/common/http';
|
|
13
18
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
14
|
-
import * as i1 from '@thalassic/core';
|
|
15
|
-
import { MOTION_ATTRIBUTE, SwipeDirective, MotionService, resolvePagingStep, resistPagingDrag, PanDirective, ViewportService, SWIPE_DEFAULT_MIN_VELOCITY, DRAG_DISMISS_RATIO, PAN_CONFIG, DRAG_DISMISS_POINTER_TYPES, DEFAULT_PAN_CONFIG, deepMerge, HAPTIC_FEEDBACK } from '@thalassic/core';
|
|
16
19
|
import { Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
17
|
-
import { InputModalityDetector, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
18
20
|
import { Directionality } from '@angular/cdk/bidi';
|
|
19
21
|
import { filter as filter$1 } from 'rxjs/operators';
|
|
20
22
|
import { CdkDialogContainer, DialogRef as DialogRef$1, Dialog as Dialog$1, DIALOG_DATA } from '@angular/cdk/dialog';
|
|
@@ -22,7 +24,7 @@ import { Menu as Menu$1, MenuItem } from '@angular/aria/menu';
|
|
|
22
24
|
import { FORM_FIELD } from '@angular/forms/signals';
|
|
23
25
|
import { Listbox, Option } from '@angular/aria/listbox';
|
|
24
26
|
import { coerceArray } from '@angular/cdk/coercion';
|
|
25
|
-
import * as i1$
|
|
27
|
+
import * as i1$2 from '@angular/aria/tabs';
|
|
26
28
|
import { TabPanel, TabList, Tab as Tab$1, Tabs as Tabs$1, TabContent } from '@angular/aria/tabs';
|
|
27
29
|
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
28
30
|
|
|
@@ -1185,6 +1187,12 @@ class OverlayManager {
|
|
|
1185
1187
|
_destroyRef = inject(DestroyRef);
|
|
1186
1188
|
_overlayRef = null;
|
|
1187
1189
|
_config = null;
|
|
1190
|
+
/**
|
|
1191
|
+
* How the kept overlay was created to present. Its scroll strategy, backdrop
|
|
1192
|
+
* and dismissal are fixed at creation, so a reused overlay serves only opens
|
|
1193
|
+
* that present the same way.
|
|
1194
|
+
*/
|
|
1195
|
+
_presentation = 'connected';
|
|
1188
1196
|
_isOpen = signal(false, /* @ts-ignore */
|
|
1189
1197
|
...(ngDevMode ? [{ debugName: "_isOpen" }] : /* istanbul ignore next */ []));
|
|
1190
1198
|
/**
|
|
@@ -1210,8 +1218,15 @@ class OverlayManager {
|
|
|
1210
1218
|
if (this._isOpen())
|
|
1211
1219
|
return;
|
|
1212
1220
|
this._config = config;
|
|
1213
|
-
const
|
|
1221
|
+
const presentation = config.presentation ?? 'connected';
|
|
1222
|
+
const sheet = presentation === 'sheet';
|
|
1223
|
+
// A reused overlay kept from an open that presented the other way — the
|
|
1224
|
+
// viewport crossed a sheet breakpoint in between — cannot be re-placed into
|
|
1225
|
+
// this one, so it is replaced.
|
|
1226
|
+
if (this._overlayRef && this._presentation !== presentation)
|
|
1227
|
+
this._dispose();
|
|
1214
1228
|
if (!this._overlayRef) {
|
|
1229
|
+
this._presentation = presentation;
|
|
1215
1230
|
this._overlayRef = this._overlay.create({
|
|
1216
1231
|
positionStrategy: this._buildPositionStrategy(config),
|
|
1217
1232
|
// A sheet blocks the page's scroll for its lifetime — it is a modal
|
|
@@ -1314,10 +1329,10 @@ class OverlayManager {
|
|
|
1314
1329
|
overlayRef
|
|
1315
1330
|
.outsidePointerEvents()
|
|
1316
1331
|
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'), filter(event => {
|
|
1317
|
-
const
|
|
1318
|
-
if (!
|
|
1332
|
+
const target = event.target;
|
|
1333
|
+
if (!config.insideElements || !(target instanceof Node))
|
|
1319
1334
|
return true;
|
|
1320
|
-
return !
|
|
1335
|
+
return !config.insideElements.some(element => element.contains(target));
|
|
1321
1336
|
}), filter(event => {
|
|
1322
1337
|
// Swallow exactly the first outside `auxclick` after an armed open —
|
|
1323
1338
|
// the release of the right-click that opened a context menu — then
|
|
@@ -1366,63 +1381,538 @@ function settleAfterRender(injector, element, applyTarget, onDone) {
|
|
|
1366
1381
|
}
|
|
1367
1382
|
|
|
1368
1383
|
/**
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1384
|
+
* Whether a released drag commits to the state it was moving toward.
|
|
1385
|
+
*
|
|
1386
|
+
* A flick decides, whichever way it points: a short flick toward the target is
|
|
1387
|
+
* as clear an intent as a slow drag past the ratio, and a drag that reverses
|
|
1388
|
+
* into a flick reads as the flick. Only failing a flick does distance decide.
|
|
1389
|
+
* Requiring both a flick and the distance would strand each on its own.
|
|
1390
|
+
*
|
|
1391
|
+
* `velocity` is signed toward the commit direction in px/ms; `progress` is the
|
|
1392
|
+
* share of the extent travelled toward it, 0 to 1.
|
|
1375
1393
|
*/
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1394
|
+
function decideCommit(velocity, progress) {
|
|
1395
|
+
if (velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
1396
|
+
return true;
|
|
1397
|
+
if (-velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
1398
|
+
return false;
|
|
1399
|
+
return progress >= DRAG_DISMISS_RATIO;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Which detent a released drag settles on, among `heights` (ascending, one per
|
|
1404
|
+
* detent), having started at `startIndex` and let go at `releaseHeight` with
|
|
1405
|
+
* `velocity` px/ms toward a larger height.
|
|
1406
|
+
*
|
|
1407
|
+
* A flick decides, whichever way it points, and moves one detent from where
|
|
1408
|
+
* the drag began — never skipping one, so a hard flick from the bottom of a
|
|
1409
|
+
* three-detent sheet lands on the middle. Failing a flick, distance decides:
|
|
1410
|
+
* the nearest detent beyond the start wins, except that leaving the start detent takes the
|
|
1411
|
+
* same share of the gap a drag-to-dismiss commits at, so a short slow drag
|
|
1412
|
+
* snaps back.
|
|
1413
|
+
*/
|
|
1414
|
+
function resolveDetent(heights, startIndex, releaseHeight, velocity) {
|
|
1415
|
+
const last = heights.length - 1;
|
|
1416
|
+
if (velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
1417
|
+
return Math.min(last, startIndex + 1);
|
|
1418
|
+
if (-velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
1419
|
+
return Math.max(0, startIndex - 1);
|
|
1420
|
+
const start = heights[startIndex];
|
|
1421
|
+
const direction = releaseHeight > start ? 1 : releaseHeight < start ? -1 : 0;
|
|
1422
|
+
if (direction === 0)
|
|
1423
|
+
return startIndex;
|
|
1424
|
+
const neighbour = startIndex + direction;
|
|
1425
|
+
if (neighbour < 0 || neighbour > last)
|
|
1426
|
+
return startIndex;
|
|
1427
|
+
const gap = heights[neighbour] - start;
|
|
1428
|
+
if ((releaseHeight - start) / gap < DRAG_DISMISS_RATIO)
|
|
1429
|
+
return startIndex;
|
|
1430
|
+
// Past the bias: the nearest detent from the neighbour onward in this direction.
|
|
1431
|
+
// A tie goes to the farther detent, as every boundary here resolves in the drag's favour.
|
|
1432
|
+
let winner = neighbour;
|
|
1433
|
+
for (let index = neighbour; index >= 0 && index <= last; index += direction) {
|
|
1434
|
+
if (Math.abs(heights[index] - releaseHeight) > Math.abs(heights[winner] - releaseHeight))
|
|
1435
|
+
break;
|
|
1436
|
+
winner = index;
|
|
1437
|
+
}
|
|
1438
|
+
return winner;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Share of the finger's travel a rubber band follows at its very start —
|
|
1443
|
+
* UIScrollView's constant, so a stretch reads like the platform's.
|
|
1444
|
+
*/
|
|
1445
|
+
const RUBBER_BAND_RESISTANCE = 0.55;
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
* How far a surface follows a pull of `overshoot` px past the end of its
|
|
1449
|
+
* travel: at first a fixed share of the finger's travel, then less and less,
|
|
1450
|
+
* approaching `limit` without reaching it. The stretch keeps giving, so the end
|
|
1451
|
+
* of the travel reads as elastic rather than as a wall the finger runs into.
|
|
1452
|
+
*
|
|
1453
|
+
* @example
|
|
1454
|
+
* rubberBand(20, 48); // 8.9 — about half the finger's travel
|
|
1455
|
+
* rubberBand(100, 48); // 25.6
|
|
1456
|
+
* rubberBand(1000, 48); // 44.1 — still short of the limit
|
|
1457
|
+
*/
|
|
1458
|
+
function rubberBand(overshoot, limit) {
|
|
1459
|
+
return limit * (1 - 1 / ((overshoot * RUBBER_BAND_RESISTANCE) / limit + 1));
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* The overshoot `rubberBand` answers with `stretch` — its inverse, for picking
|
|
1463
|
+
* a stretched surface up where it is drawn without pulling it in a second
|
|
1464
|
+
* time. A stretch at or past the limit, which no overshoot reaches, reads as
|
|
1465
|
+
* an unbounded one.
|
|
1466
|
+
*
|
|
1467
|
+
* @example
|
|
1468
|
+
* rubberBandOvershoot(8.9, 48); // 20 (to rounding)
|
|
1469
|
+
* rubberBandOvershoot(48, 48); // Infinity
|
|
1470
|
+
*/
|
|
1471
|
+
function rubberBandOvershoot(stretch, limit) {
|
|
1472
|
+
if (stretch >= limit)
|
|
1473
|
+
return Number.POSITIVE_INFINITY;
|
|
1474
|
+
return (stretch * limit) / (RUBBER_BAND_RESISTANCE * (limit - stretch));
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* Custom properties a settle writes on the surface and its scrim, for a
|
|
1479
|
+
* stylesheet's settle transition to read: the duration in `ms` and a `linear()`
|
|
1480
|
+
* easing that traces the spring's travel.
|
|
1481
|
+
*/
|
|
1482
|
+
const SETTLE_DURATION_PROPERTY = '--tls-settle-duration';
|
|
1483
|
+
const SETTLE_EASING_PROPERTY = '--tls-settle-easing';
|
|
1484
|
+
/**
|
|
1485
|
+
* Period in ms of the settle spring's undamped swing — SwiftUI's `response`.
|
|
1486
|
+
* Critically damped at this response, a settle from rest covers nine tenths of
|
|
1487
|
+
* its travel in about 200ms, on a par with an overlay's default motion.
|
|
1488
|
+
*/
|
|
1489
|
+
const SETTLE_SPRING_RESPONSE = 320;
|
|
1490
|
+
/**
|
|
1491
|
+
* Distance in px from the target at which a settle counts as arrived: the
|
|
1492
|
+
* transition ends there and the last fraction of a pixel lands in one step.
|
|
1493
|
+
*/
|
|
1494
|
+
const SETTLE_REST_DISTANCE = 0.5;
|
|
1495
|
+
/** Longest a settle may run, in ms, however far it travels. */
|
|
1496
|
+
const SETTLE_MAX_DURATION = 1000;
|
|
1497
|
+
/** Spacing in ms of the points the `linear()` easing samples: one 60Hz frame. */
|
|
1498
|
+
const SETTLE_SAMPLE_INTERVAL = 1000 / 60;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* The travel of a critically damped spring over `distance` px, launched at
|
|
1502
|
+
* `velocity` px/ms, as a duration and a `linear()` easing for a CSS transition
|
|
1503
|
+
* to play. Both are signed along one axis, so a velocity that shares the
|
|
1504
|
+
* distance's sign heads for the target.
|
|
1505
|
+
*
|
|
1506
|
+
* Launched with the finger's speed, the surface leaves the release at the pace
|
|
1507
|
+
* it was moving and eases into the target, instead of starting every settle at
|
|
1508
|
+
* one fixed curve's speed whatever the hand was doing. The launch is capped at
|
|
1509
|
+
* the spring's own angular frequency, the fastest a critically damped spring
|
|
1510
|
+
* can start without passing its target — a surface that overshot its largest
|
|
1511
|
+
* detent would lift off the edge it is pinned to. A launch away from the target
|
|
1512
|
+
* carries on that way briefly before the spring turns it round, as momentum
|
|
1513
|
+
* does on the platforms.
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* settleCurve(0.2, 0); // { duration: 0, easing: 'linear' } — already there
|
|
1517
|
+
* settleCurve(300, 0); // { duration: 450, easing: 'linear(0, 0.0405, 0.1323, …, 1)' } — from rest, gathers speed
|
|
1518
|
+
* settleCurve(300, 1.5); // { duration: 433, easing: 'linear(0, 0.0989, 0.2174, …, 1)' } — launch capped at the frequency
|
|
1519
|
+
* settleCurve(40, -0.4); // { duration: 350, easing: 'linear(0, -0.0767, -0.0402, …, 1)' } — carries on away, then turns
|
|
1520
|
+
*/
|
|
1521
|
+
function settleCurve(distance, velocity) {
|
|
1522
|
+
const span = Math.abs(distance);
|
|
1523
|
+
if (span < SETTLE_REST_DISTANCE)
|
|
1524
|
+
return { duration: 0, easing: 'linear' };
|
|
1525
|
+
const frequency = (2 * Math.PI) / SETTLE_SPRING_RESPONSE;
|
|
1526
|
+
// Progress per ms the spring starts at, clamped both ways to the frequency.
|
|
1527
|
+
const launch = Math.max(-frequency, Math.min(frequency, velocity / distance));
|
|
1528
|
+
// Critically damped: what is left of the travel is (1 + (ω − v₀)·t)·e^(−ω·t).
|
|
1529
|
+
const progressAt = (time) => 1 - (1 + (frequency - launch) * time) * Math.exp(-frequency * time);
|
|
1530
|
+
let duration = SETTLE_SAMPLE_INTERVAL;
|
|
1531
|
+
while (duration < SETTLE_MAX_DURATION &&
|
|
1532
|
+
Math.abs(1 - progressAt(duration)) * span >= SETTLE_REST_DISTANCE) {
|
|
1533
|
+
duration += SETTLE_SAMPLE_INTERVAL;
|
|
1534
|
+
}
|
|
1535
|
+
const steps = Math.ceil(duration / SETTLE_SAMPLE_INTERVAL);
|
|
1536
|
+
const points = [];
|
|
1537
|
+
for (let step = 0; step < steps; step += 1) {
|
|
1538
|
+
points.push(`${Number(progressAt((duration * step) / steps).toFixed(4))}`);
|
|
1539
|
+
}
|
|
1540
|
+
// The residual under the rest distance lands with the final point.
|
|
1541
|
+
points.push('1');
|
|
1542
|
+
return { duration: Math.round(duration), easing: `linear(${points.join(', ')})` };
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Moves a dragged surface along one axis: writes its displacement to the
|
|
1547
|
+
* custom property the stylesheet turns into a translate, keeps a scrim's
|
|
1548
|
+
* opacity in step with the drag, and settles the surface to where a release
|
|
1549
|
+
* sent it through the stylesheet's transition.
|
|
1550
|
+
*
|
|
1551
|
+
* The engine knows nothing of what the offsets mean — where rest is, what
|
|
1552
|
+
* range is legal, which release commits — and no pan events; the owning
|
|
1553
|
+
* component maps its gesture onto `begin`, `follow` and `settle`.
|
|
1554
|
+
*/
|
|
1555
|
+
class DragMotion {
|
|
1556
|
+
_options;
|
|
1557
|
+
// State
|
|
1558
|
+
_state = signal('idle', /* @ts-ignore */
|
|
1559
|
+
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
1560
|
+
/** Bound to the surface's `--dragging` / `--settling` classes. */
|
|
1561
|
+
state = this._state.asReadonly();
|
|
1562
|
+
_surface = null;
|
|
1390
1563
|
/**
|
|
1391
|
-
*
|
|
1392
|
-
* the options, so an empty list collapses it to zero — and a measurement taken then would
|
|
1393
|
-
* describe a viewport that no longer exists once options arrive.
|
|
1564
|
+
* Incremented by begin and rest; a settle belongs to the gesture that started it.
|
|
1394
1565
|
*/
|
|
1395
|
-
|
|
1566
|
+
_gesture = 0;
|
|
1567
|
+
constructor(_options) {
|
|
1568
|
+
this._options = _options;
|
|
1569
|
+
}
|
|
1570
|
+
// Public methods
|
|
1571
|
+
/** Travel in px of the gesture in progress, from rest to fully committed; 0 outside a gesture. */
|
|
1572
|
+
get extent() {
|
|
1573
|
+
if (this._surface === null)
|
|
1574
|
+
return 0;
|
|
1575
|
+
return this._surface.extent ?? 0;
|
|
1576
|
+
}
|
|
1577
|
+
/** Takes hold of the surface for one gesture. */
|
|
1578
|
+
begin(surface) {
|
|
1579
|
+
this._gesture += 1;
|
|
1580
|
+
this._surface = surface;
|
|
1581
|
+
this._state.set('dragging');
|
|
1582
|
+
// Both track the finger for the drag's duration, so their transitions —
|
|
1583
|
+
// which exist to animate the settle — must not lag it. Set inline rather
|
|
1584
|
+
// than left to the `--dragging` class, which renders a frame later: the
|
|
1585
|
+
// first offset the drag writes would otherwise start a transition of its
|
|
1586
|
+
// own, from wherever a settle caught mid-flight had got to.
|
|
1587
|
+
this._options.renderer.setStyle(surface.panel, 'transition', 'none');
|
|
1588
|
+
if (surface.backdrop !== null) {
|
|
1589
|
+
this._options.renderer.setStyle(surface.backdrop, 'transition', 'none');
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1396
1592
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
* option list on its own — every write of `activeIndex` (keyboard navigation, the
|
|
1400
|
-
* initial index on open, a filter narrowing the list) has to be followed by an
|
|
1401
|
-
* explicit scroll. Running after render guarantees the option's element exists even
|
|
1402
|
-
* when the same change re-rendered the list. `nearest` leaves an already-visible
|
|
1403
|
-
* option where it is, so pointer-driven activation never causes a scroll.
|
|
1593
|
+
* Moves the surface to `offset` px. The offset is written as given: what
|
|
1594
|
+
* range is legal is the caller's rule.
|
|
1404
1595
|
*/
|
|
1405
|
-
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
this._panelWasOpen = isOpen;
|
|
1409
|
-
if (!isOpen)
|
|
1596
|
+
follow(offset) {
|
|
1597
|
+
const surface = this._surface;
|
|
1598
|
+
if (surface === null)
|
|
1410
1599
|
return;
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1600
|
+
this._write(surface, offset);
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Animates the surface to `target` px through the stylesheet's settle
|
|
1604
|
+
* transition, then calls `done`. The state stays `settling` until `rest` is
|
|
1605
|
+
* called: a settle that ends in a dispose keeps its class on until the
|
|
1606
|
+
* overlay is gone, so the keyframe the class stands down cannot replay.
|
|
1607
|
+
*
|
|
1608
|
+
* `velocity` is the surface's speed at the start, in px/ms along the offset
|
|
1609
|
+
* (positive as the offset grows) — a released finger's. The settle's timing
|
|
1610
|
+
* goes onto the surface and its scrim as `--tls-settle-duration` and
|
|
1611
|
+
* `--tls-settle-easing` (see `settleCurve`), for a settle transition to
|
|
1612
|
+
* read, so the stylesheet keeps the motion's gating while the curve carries
|
|
1613
|
+
* the hand's momentum on.
|
|
1614
|
+
*
|
|
1615
|
+
* A `begin` or `rest` that arrives before the settle finishes supersedes it:
|
|
1616
|
+
* a superseded settle neither moves the surface nor reports `done`.
|
|
1617
|
+
*/
|
|
1618
|
+
settle(target, done, velocity = 0) {
|
|
1619
|
+
const surface = this._surface;
|
|
1620
|
+
const gesture = this._gesture;
|
|
1621
|
+
if (surface === null)
|
|
1622
|
+
return;
|
|
1623
|
+
this._state.set('settling');
|
|
1624
|
+
this._options.renderer.removeStyle(surface.panel, 'transition');
|
|
1625
|
+
if (surface.backdrop !== null)
|
|
1626
|
+
this._options.renderer.removeStyle(surface.backdrop, 'transition');
|
|
1627
|
+
// Marked by the gesture counter rather than the surface: a caller that
|
|
1628
|
+
// reuses one surface object across gestures must still be able to supersede.
|
|
1629
|
+
settleAfterRender(this._options.injector, surface.panel, () => {
|
|
1630
|
+
if (this._gesture !== gesture)
|
|
1631
|
+
return;
|
|
1632
|
+
// The curve goes on in the same style change as the target, so the
|
|
1633
|
+
// transition the target starts is timed by it.
|
|
1634
|
+
this._writeCurve(surface, target, velocity);
|
|
1635
|
+
this._write(surface, target);
|
|
1636
|
+
}, () => {
|
|
1637
|
+
if (this._gesture === gesture)
|
|
1638
|
+
done();
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* A settle from rest with no drag: takes hold of `surface` and settles it to
|
|
1643
|
+
* `target` in one step, for a change asked by a click, a key or code rather
|
|
1644
|
+
* than a finger. Supersedes a running settle the way a `begin` does.
|
|
1645
|
+
*/
|
|
1646
|
+
moveTo(surface, target, done) {
|
|
1647
|
+
this.begin(surface);
|
|
1648
|
+
this.settle(target, done);
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Lets go of the surface; the transform is the stylesheet's again. The
|
|
1652
|
+
* settle's timing comes off with it, so a transition that outlives the
|
|
1653
|
+
* gesture — a scrim's fade on close — keeps the stylesheet's own pace rather
|
|
1654
|
+
* than the curve of the last settle.
|
|
1655
|
+
*/
|
|
1656
|
+
rest() {
|
|
1657
|
+
const surface = this._surface;
|
|
1658
|
+
this._gesture += 1;
|
|
1659
|
+
this._surface = null;
|
|
1660
|
+
this._state.set('idle');
|
|
1661
|
+
if (surface === null)
|
|
1662
|
+
return;
|
|
1663
|
+
for (const element of [surface.panel, surface.backdrop]) {
|
|
1664
|
+
if (element === null)
|
|
1665
|
+
continue;
|
|
1666
|
+
// A gesture let go of without a settle still holds the suppression `begin` wrote.
|
|
1667
|
+
this._options.renderer.removeStyle(element, 'transition');
|
|
1668
|
+
this._options.renderer.removeStyle(element, SETTLE_DURATION_PROPERTY, RendererStyleFlags2.DashCase);
|
|
1669
|
+
this._options.renderer.removeStyle(element, SETTLE_EASING_PROPERTY, RendererStyleFlags2.DashCase);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
// Private methods
|
|
1673
|
+
/**
|
|
1674
|
+
* Writes the timing of a settle to `target` onto the surface and its scrim.
|
|
1675
|
+
* The travel starts from the offset last written inline, which is where a
|
|
1676
|
+
* released drag left the surface; a settle that supersedes another starts
|
|
1677
|
+
* from the other's target, and the browser's own retargeting of the running
|
|
1678
|
+
* transition covers the difference.
|
|
1679
|
+
*/
|
|
1680
|
+
_writeCurve(surface, target, velocity) {
|
|
1681
|
+
const { property, renderer } = this._options;
|
|
1682
|
+
const written = Number.parseFloat(surface.panel.style.getPropertyValue(property));
|
|
1683
|
+
const from = Number.isNaN(written) ? target : written;
|
|
1684
|
+
const { duration, easing } = settleCurve(target - from, velocity);
|
|
1685
|
+
for (const element of [surface.panel, surface.backdrop]) {
|
|
1686
|
+
if (element === null)
|
|
1687
|
+
continue;
|
|
1688
|
+
renderer.setStyle(element, SETTLE_DURATION_PROPERTY, `${duration}ms`, RendererStyleFlags2.DashCase);
|
|
1689
|
+
renderer.setStyle(element, SETTLE_EASING_PROPERTY, easing, RendererStyleFlags2.DashCase);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Only the backdrop's progress is clamped to the extent; the offset itself
|
|
1694
|
+
* is written unclamped.
|
|
1695
|
+
*/
|
|
1696
|
+
_write(surface, offset) {
|
|
1697
|
+
const { property, backdropOpacity, renderer } = this._options;
|
|
1698
|
+
renderer.setStyle(surface.panel, property, `${offset}px`, RendererStyleFlags2.DashCase);
|
|
1699
|
+
if (surface.backdrop === null || backdropOpacity === undefined)
|
|
1700
|
+
return;
|
|
1701
|
+
const extent = surface.extent ?? 0;
|
|
1702
|
+
const progress = extent > 0 ? Math.min(1, Math.max(0, offset / extent)) : 0;
|
|
1703
|
+
renderer.setStyle(surface.backdrop, 'opacity', `${backdropOpacity(progress)}`);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* The translation in px that `element`'s transform puts it at this frame. A
|
|
1709
|
+
* transform mid-transition reads as the running value rather than its target,
|
|
1710
|
+
* so a surface caught by a new drag while it settles is picked up where it is
|
|
1711
|
+
* drawn. An element with no transform reads as untranslated.
|
|
1712
|
+
*/
|
|
1713
|
+
function drawnTranslation(element) {
|
|
1714
|
+
const transform = getComputedStyle(element).transform;
|
|
1715
|
+
if (transform === '' || transform === 'none')
|
|
1716
|
+
return { x: 0, y: 0 };
|
|
1717
|
+
const matrix = new DOMMatrixReadOnly(transform);
|
|
1718
|
+
return { x: matrix.m41, y: matrix.m42 };
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* Drags an overlay shown as a bottom sheet shut: the finger carries the pane
|
|
1723
|
+
* toward the bottom edge, and a release either sends it out and closes the
|
|
1724
|
+
* overlay or settles it back open. The sheet does not overshoot open, so travel
|
|
1725
|
+
* upward is clamped away.
|
|
1726
|
+
*
|
|
1727
|
+
* The owning component forwards its pane's pan events to the `on*` methods and
|
|
1728
|
+
* calls `reset` on every open; the pane binds `motion.state()` to its
|
|
1729
|
+
* `--dragging` / `--settling` classes, under which the stylesheet turns the
|
|
1730
|
+
* property named in the options into a translate.
|
|
1731
|
+
*/
|
|
1732
|
+
class SheetDragDismissal {
|
|
1733
|
+
_options;
|
|
1734
|
+
// State
|
|
1735
|
+
/** The pane's motion, whose state the stylesheet's drag and settle classes follow. */
|
|
1736
|
+
motion;
|
|
1737
|
+
/** Set once a release commits to closing, so a late pan event cannot catch the leaving pane. */
|
|
1738
|
+
_closing = false;
|
|
1739
|
+
/**
|
|
1740
|
+
* How far below its rest the pane was drawn when the drag began: 0 from
|
|
1741
|
+
* rest, the settle's position when caught mid-flight.
|
|
1742
|
+
*/
|
|
1743
|
+
_lead = 0;
|
|
1744
|
+
constructor(_options) {
|
|
1745
|
+
this._options = _options;
|
|
1746
|
+
this.motion = new DragMotion({
|
|
1747
|
+
property: _options.property,
|
|
1748
|
+
// The scrim thins as the sheet leaves.
|
|
1749
|
+
backdropOpacity: progress => 1 - progress,
|
|
1750
|
+
renderer: _options.renderer,
|
|
1751
|
+
injector: _options.injector,
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
// Public methods
|
|
1755
|
+
/** Readies a fresh open: the pane is stamped anew each time, so only this state carries over. */
|
|
1756
|
+
reset() {
|
|
1757
|
+
this.motion.rest();
|
|
1758
|
+
this._closing = false;
|
|
1759
|
+
}
|
|
1760
|
+
onPanStart(pane, event) {
|
|
1761
|
+
if (this._closing)
|
|
1762
|
+
return;
|
|
1763
|
+
// Caught mid-settle, the pane is picked up where it is drawn: the drag
|
|
1764
|
+
// stops the settle's transition, which would otherwise leave it at the
|
|
1765
|
+
// settle's end.
|
|
1766
|
+
this._lead = this.motion.state() === 'settling' ? drawnTranslation(pane).y : 0;
|
|
1767
|
+
// The pane is sized by its content, so only the rendered box is authoritative.
|
|
1768
|
+
this.motion.begin({
|
|
1769
|
+
panel: pane,
|
|
1770
|
+
backdrop: this._options.backdrop(),
|
|
1771
|
+
extent: pane.getBoundingClientRect().height,
|
|
1772
|
+
});
|
|
1773
|
+
this.motion.follow(Math.max(0, this._travel(event)));
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Fired outside the Angular zone (see `PanDirective.panMove`), so it writes
|
|
1777
|
+
* to the DOM directly and never touches a signal.
|
|
1778
|
+
*/
|
|
1779
|
+
onPanMove(event) {
|
|
1780
|
+
if (this._closing)
|
|
1781
|
+
return;
|
|
1782
|
+
this.motion.follow(Math.max(0, this._travel(event)));
|
|
1783
|
+
}
|
|
1784
|
+
onPanEnd(event) {
|
|
1785
|
+
if (this._closing)
|
|
1786
|
+
return;
|
|
1787
|
+
const extent = this.motion.extent;
|
|
1788
|
+
const travel = Math.max(0, this._travel(event));
|
|
1789
|
+
const progress = extent > 0 ? travel / extent : 0;
|
|
1790
|
+
if (decideCommit(event.velocityY, progress)) {
|
|
1791
|
+
// A finger that carried the pane past the edge has already hidden it: it
|
|
1792
|
+
// leaves from there rather than travelling back to the edge unseen.
|
|
1793
|
+
this._close(Math.max(extent, travel), event.velocityY);
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
// The drag runs down the offset's own axis, so the finger's velocity is
|
|
1797
|
+
// already signed along it.
|
|
1798
|
+
this.motion.settle(0, () => this.motion.rest(), event.velocityY);
|
|
1799
|
+
}
|
|
1800
|
+
onPanCancel() {
|
|
1801
|
+
if (this._closing)
|
|
1802
|
+
return;
|
|
1803
|
+
this.motion.settle(0, () => this.motion.rest());
|
|
1804
|
+
}
|
|
1805
|
+
// Private methods
|
|
1806
|
+
/** Travel toward the bottom edge in px: where the drag picked the pane up, plus the finger's travel since. */
|
|
1807
|
+
_travel(event) {
|
|
1808
|
+
return this._lead + event.deltaY;
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Continues the drag out to `target` px — past the bottom edge, or further
|
|
1812
|
+
* where the finger already went — at the finger's `velocity`, and closes on
|
|
1813
|
+
* arrival. A dismissal that began as a drag must not route through the
|
|
1814
|
+
* leave keyframe: that starts from the fully open position, so the pane
|
|
1815
|
+
* would snap back for a frame before leaving — the stylesheet stands the
|
|
1816
|
+
* keyframe down while the drag state classes are on.
|
|
1817
|
+
*/
|
|
1818
|
+
_close(target, velocity) {
|
|
1819
|
+
this._closing = true;
|
|
1820
|
+
this.motion.settle(target, () => this._options.close(), velocity);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Custom property an option list shown as a sheet is dragged by: written on the sheet while a
|
|
1826
|
+
* finger carries it toward the bottom edge, and turned into its translate by the stylesheet.
|
|
1827
|
+
*/
|
|
1828
|
+
const OPTION_SHEET_DRAG_PROPERTY = '--tls-option-sheet-drag';
|
|
1829
|
+
|
|
1830
|
+
/**
|
|
1831
|
+
* The `<label>` elements that name a control: those pointing at it through `for` and any
|
|
1832
|
+
* wrapping it, as the browser keeps them current. An element that cannot be labelled has none.
|
|
1833
|
+
*/
|
|
1834
|
+
function labelsOf(element) {
|
|
1835
|
+
if (element instanceof HTMLInputElement ||
|
|
1836
|
+
element instanceof HTMLButtonElement ||
|
|
1837
|
+
element instanceof HTMLSelectElement ||
|
|
1838
|
+
element instanceof HTMLTextAreaElement) {
|
|
1839
|
+
return Array.from(element.labels ?? []);
|
|
1840
|
+
}
|
|
1841
|
+
return [];
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* Shared base for the single {@link Select} and {@link MultiSelect} controls.
|
|
1846
|
+
* Owns everything the two listbox-combobox controls have in common: the option
|
|
1847
|
+
* inputs, the connected overlay lifecycle, roving `aria-activedescendant`
|
|
1848
|
+
* navigation, and the keyboard handler. The per-control differences (the value
|
|
1849
|
+
* shape, the selected-state check, how the trigger label is built and what a
|
|
1850
|
+
* commit does) are expressed through the abstract members below.
|
|
1851
|
+
*/
|
|
1852
|
+
class AbstractSelect extends ValueFormControl {
|
|
1853
|
+
overlay = createOverlayManager();
|
|
1854
|
+
_document = inject(DOCUMENT);
|
|
1855
|
+
_injector = inject(Injector);
|
|
1856
|
+
_renderer = inject(Renderer2);
|
|
1857
|
+
_inputModalityDetector = inject(InputModalityDetector);
|
|
1858
|
+
/**
|
|
1859
|
+
* Optional: only apps that call `provideViewport()` register it, and without it every list
|
|
1860
|
+
* opens beside its field.
|
|
1861
|
+
*/
|
|
1862
|
+
_viewportService = inject(ViewportService, { optional: true });
|
|
1863
|
+
triggerElement = viewChild('trigger', /* @ts-ignore */
|
|
1864
|
+
...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
|
|
1865
|
+
panelTemplate = viewChild('panel', /* @ts-ignore */
|
|
1866
|
+
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
1867
|
+
virtualScrollRef = viewChild(VirtualScroll, /* @ts-ignore */
|
|
1868
|
+
...(ngDevMode ? [{ debugName: "virtualScrollRef" }] : /* istanbul ignore next */ []));
|
|
1869
|
+
/**
|
|
1870
|
+
* Whether the panel has already been rendered open, distinguishing the render that
|
|
1871
|
+
* opens it from the ones that follow while it stays open.
|
|
1872
|
+
*/
|
|
1873
|
+
_panelWasOpen = false;
|
|
1874
|
+
/**
|
|
1875
|
+
* Whether the virtualized viewport last rendered with nothing in it. Its height is sized to
|
|
1876
|
+
* the options, so an empty list collapses it to zero — and a measurement taken then would
|
|
1877
|
+
* describe a viewport that no longer exists once options arrive.
|
|
1878
|
+
*/
|
|
1879
|
+
_viewportWasCollapsed = true;
|
|
1880
|
+
/**
|
|
1881
|
+
* The option the list opened on — the current choice, or the first that can be chosen —
|
|
1882
|
+
* which the first render of an open panel brings into view even while no option is active.
|
|
1883
|
+
*/
|
|
1884
|
+
_openingIndex = -1;
|
|
1885
|
+
/**
|
|
1886
|
+
* Keeps the active option visible inside the scrolling panel. Focus stays on the
|
|
1887
|
+
* trigger and only `aria-activedescendant` moves, so the browser never scrolls the
|
|
1888
|
+
* option list on its own — every write of `activeIndex` (keyboard navigation, the
|
|
1889
|
+
* initial index on open, a filter narrowing the list) has to be followed by an
|
|
1890
|
+
* explicit scroll. Running after render guarantees the option's element exists even
|
|
1891
|
+
* when the same change re-rendered the list. `nearest` leaves an already-visible
|
|
1892
|
+
* option where it is, so pointer-driven activation never causes a scroll.
|
|
1893
|
+
*/
|
|
1894
|
+
_scrollActiveOptionIntoView = afterRenderEffect(() => {
|
|
1895
|
+
const isOpen = this.isOpen();
|
|
1896
|
+
const wasOpen = this._panelWasOpen;
|
|
1897
|
+
this._panelWasOpen = isOpen;
|
|
1898
|
+
if (!isOpen)
|
|
1899
|
+
return;
|
|
1900
|
+
const virtualScroll = this.virtualScrollRef();
|
|
1901
|
+
// The option elements are re-created when the visible list changes, so the scroll
|
|
1902
|
+
// has to re-run then too, not only when the index moves.
|
|
1903
|
+
const optionCount = this.visibleOptions().length;
|
|
1904
|
+
const viewportWasCollapsed = this._viewportWasCollapsed;
|
|
1905
|
+
this._viewportWasCollapsed = optionCount === 0;
|
|
1906
|
+
// The overlay pane is attached (and re-attached — it is reused across opens) after the
|
|
1907
|
+
// panel's view is created, so the viewport's cached measurement is stale until it is
|
|
1908
|
+
// re-measured in the first render of an open panel. A panel opened on an empty list —
|
|
1420
1909
|
// everything filtered out, or a list still being fetched — measures a viewport of no
|
|
1421
1910
|
// height, so the first options to arrive call for a fresh measurement too.
|
|
1422
1911
|
if (virtualScroll && (!wasOpen || (viewportWasCollapsed && optionCount > 0))) {
|
|
1423
1912
|
virtualScroll.checkViewportSize();
|
|
1424
1913
|
}
|
|
1425
|
-
|
|
1914
|
+
// A list opened with no active option still opens on the current choice.
|
|
1915
|
+
const index = this.activeIndex() < 0 && !wasOpen ? this._openingIndex : this.activeIndex();
|
|
1426
1916
|
if (index < 0)
|
|
1427
1917
|
return;
|
|
1428
1918
|
if (virtualScroll) {
|
|
@@ -1464,6 +1954,23 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1464
1954
|
tabindex = input(0, /* @ts-ignore */
|
|
1465
1955
|
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
1466
1956
|
isOpen = this.overlay.isOpen;
|
|
1957
|
+
/**
|
|
1958
|
+
* Whether the list on screen is shown as a bottom sheet. Captured per open — not derived
|
|
1959
|
+
* live — so a viewport resize mid-open cannot restyle a pane the overlay has already placed
|
|
1960
|
+
* the other way.
|
|
1961
|
+
*/
|
|
1962
|
+
presentsAsSheet = signal(false, /* @ts-ignore */
|
|
1963
|
+
...(ngDevMode ? [{ debugName: "presentsAsSheet" }] : /* istanbul ignore next */ []));
|
|
1964
|
+
/** The drag that carries the list shut while it is shown as a sheet. */
|
|
1965
|
+
sheetDismissal = new SheetDragDismissal({
|
|
1966
|
+
property: OPTION_SHEET_DRAG_PROPERTY,
|
|
1967
|
+
backdrop: () => this.overlay.backdropElement,
|
|
1968
|
+
close: () => this.close(),
|
|
1969
|
+
renderer: this._renderer,
|
|
1970
|
+
injector: this._injector,
|
|
1971
|
+
});
|
|
1972
|
+
/** Pointers that may drag a sheet shut: a finger or a pen, never a mouse. */
|
|
1973
|
+
sheetDragPointerTypes = DRAG_DISMISS_POINTER_TYPES;
|
|
1467
1974
|
normalizedOptions = computed(() => normalizeOptions(this.options(), {
|
|
1468
1975
|
label: this.optionLabel(),
|
|
1469
1976
|
value: this.optionValue(),
|
|
@@ -1529,7 +2036,7 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1529
2036
|
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1530
2037
|
if (this.fluid())
|
|
1531
2038
|
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1532
|
-
return array.concat(this.
|
|
2039
|
+
return array.concat(this.hostModifierClasses(), this.controlClasses());
|
|
1533
2040
|
}, /* @ts-ignore */
|
|
1534
2041
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
1535
2042
|
get listboxId() {
|
|
@@ -1542,10 +2049,10 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1542
2049
|
*/
|
|
1543
2050
|
panelMatchesFieldWidth = false;
|
|
1544
2051
|
/**
|
|
1545
|
-
* Host modifiers
|
|
1546
|
-
* within the host-class computation, so signals a control reads here stay reactive.
|
|
2052
|
+
* Host modifiers only one control has — a state or a variant — listed alongside the shared ones.
|
|
2053
|
+
* Read from within the host-class computation, so signals a control reads here stay reactive.
|
|
1547
2054
|
*/
|
|
1548
|
-
|
|
2055
|
+
hostModifierClasses() {
|
|
1549
2056
|
return [];
|
|
1550
2057
|
}
|
|
1551
2058
|
/**
|
|
@@ -1555,6 +2062,13 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1555
2062
|
filterVisibleOptions(options) {
|
|
1556
2063
|
return options;
|
|
1557
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Breakpoint at or below which the list opens as a bottom sheet; `null` keeps it beside the
|
|
2067
|
+
* field at every width. A control offering the sheet overrides this.
|
|
2068
|
+
*/
|
|
2069
|
+
sheetBreakpoint() {
|
|
2070
|
+
return null;
|
|
2071
|
+
}
|
|
1558
2072
|
/** Hook invoked after the panel has closed, once the trigger has regained focus. */
|
|
1559
2073
|
onClosed() {
|
|
1560
2074
|
// No-op by default; an editable combobox overrides this to reconcile its text.
|
|
@@ -1582,10 +2096,12 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1582
2096
|
const panelTemplate = this.panelTemplate();
|
|
1583
2097
|
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1584
2098
|
return;
|
|
2099
|
+
const sheet = this._prefersSheet();
|
|
2100
|
+
this.presentsAsSheet.set(sheet);
|
|
2101
|
+
this.sheetDismissal.reset();
|
|
1585
2102
|
// Anchored to the frame rather than the trigger inside it, so the panel lines up with
|
|
1586
|
-
// the field's outer edges.
|
|
2103
|
+
// the field's outer edges.
|
|
1587
2104
|
const frameElement = this.frameElement();
|
|
1588
|
-
const fieldWidth = frameElement.getBoundingClientRect().width;
|
|
1589
2105
|
this.overlay.open({
|
|
1590
2106
|
content: panelTemplate,
|
|
1591
2107
|
origin: frameElement,
|
|
@@ -1593,28 +2109,28 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1593
2109
|
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1594
2110
|
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1595
2111
|
],
|
|
1596
|
-
flexibleDimensions: false,
|
|
1597
|
-
push: false,
|
|
1598
2112
|
panelClass: this.panelClass,
|
|
1599
|
-
// No backdrop: a press elsewhere closes the list and lands where it was aimed, focusing
|
|
1600
|
-
// another field on the first press rather than only dismissing the list, as the WAI-ARIA
|
|
1601
|
-
// combobox pattern and a native autocomplete do. Presses on the field itself stay with
|
|
1602
|
-
// the field, and presses in the list leave focus on the trigger, which drives the list
|
|
1603
|
-
// from the keyboard while its options are only pointed at.
|
|
1604
|
-
hasBackdrop: false,
|
|
1605
|
-
insideElement: frameElement,
|
|
1606
2113
|
keepFocusOnPanePress: true,
|
|
1607
2114
|
// The control handles Escape itself via the trigger's keydown handler.
|
|
1608
2115
|
closeOnEscape: false,
|
|
1609
|
-
...(this.panelMatchesFieldWidth ? { width: fieldWidth } : { minWidth: fieldWidth }),
|
|
1610
2116
|
reuse: true,
|
|
2117
|
+
// A sheet keeps the modal dismissal a sheet implies: the scrim and the blocked scroll the
|
|
2118
|
+
// overlay gives it, closing on a press of the scrim.
|
|
2119
|
+
...(sheet
|
|
2120
|
+
? { presentation: 'sheet' }
|
|
2121
|
+
: this._besideFieldPlacement(frameElement, triggerElement.nativeElement)),
|
|
1611
2122
|
onClose: cause => {
|
|
1612
2123
|
this.activeIndex.set(-1);
|
|
1613
2124
|
this.restoreFocusAfterPanel(cause);
|
|
1614
2125
|
this.onClosed();
|
|
1615
2126
|
},
|
|
1616
2127
|
});
|
|
1617
|
-
this.
|
|
2128
|
+
this._openingIndex = this.getInitialActiveIndex();
|
|
2129
|
+
// A sheet a finger opened marks no option active: the mark is the keyboard's place in the
|
|
2130
|
+
// list, and under a finger it reads as a stray selection. The arrow keys pick it up from the
|
|
2131
|
+
// opening option on their first press.
|
|
2132
|
+
const openedByTouch = sheet && this._inputModalityDetector.mostRecentModality === 'touch';
|
|
2133
|
+
this.activeIndex.set(openedByTouch ? -1 : this._openingIndex);
|
|
1618
2134
|
}
|
|
1619
2135
|
close() {
|
|
1620
2136
|
this.overlay.close();
|
|
@@ -1636,22 +2152,16 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1636
2152
|
this.activeIndex.set(index);
|
|
1637
2153
|
}
|
|
1638
2154
|
onKeydown(event) {
|
|
1639
|
-
if (event.key === 'ArrowDown') {
|
|
2155
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
1640
2156
|
event.preventDefault();
|
|
1641
|
-
if (this.isOpen()) {
|
|
1642
|
-
this.moveActive(1);
|
|
1643
|
-
}
|
|
1644
|
-
else {
|
|
2157
|
+
if (!this.isOpen()) {
|
|
1645
2158
|
this.open();
|
|
1646
2159
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
event.preventDefault();
|
|
1650
|
-
if (this.isOpen()) {
|
|
1651
|
-
this.moveActive(-1);
|
|
2160
|
+
else if (this.activeIndex() < 0) {
|
|
2161
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
1652
2162
|
}
|
|
1653
2163
|
else {
|
|
1654
|
-
this.
|
|
2164
|
+
this.moveActive(event.key === 'ArrowDown' ? 1 : -1);
|
|
1655
2165
|
}
|
|
1656
2166
|
}
|
|
1657
2167
|
else if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -1728,6 +2238,35 @@ class AbstractSelect extends ValueFormControl {
|
|
|
1728
2238
|
}
|
|
1729
2239
|
}
|
|
1730
2240
|
// Private methods
|
|
2241
|
+
/**
|
|
2242
|
+
* Whether this open shows the list as a sheet: the control offers one and the viewport is at
|
|
2243
|
+
* or below its breakpoint.
|
|
2244
|
+
*/
|
|
2245
|
+
_prefersSheet() {
|
|
2246
|
+
const sheetBelow = this.sheetBreakpoint();
|
|
2247
|
+
if (!sheetBelow || !this._viewportService)
|
|
2248
|
+
return false;
|
|
2249
|
+
return this._viewportService.isBelow(sheetBelow)();
|
|
2250
|
+
}
|
|
2251
|
+
/** How the list is placed when it opens beside the field rather than as a sheet. */
|
|
2252
|
+
_besideFieldPlacement(frameElement, triggerElement) {
|
|
2253
|
+
// Measured unrounded: a fluid field's width is fractional.
|
|
2254
|
+
const fieldWidth = frameElement.getBoundingClientRect().width;
|
|
2255
|
+
return {
|
|
2256
|
+
flexibleDimensions: false,
|
|
2257
|
+
push: false,
|
|
2258
|
+
// No backdrop: a press elsewhere closes the list and lands where it was aimed, focusing
|
|
2259
|
+
// another field on the first press rather than only dismissing the list, as the WAI-ARIA
|
|
2260
|
+
// combobox pattern and a native autocomplete do. Presses on the field itself stay with
|
|
2261
|
+
// the field, and presses in the list leave focus on the trigger, which drives the list
|
|
2262
|
+
// from the keyboard while its options are only pointed at.
|
|
2263
|
+
hasBackdrop: false,
|
|
2264
|
+
// The field's labels count as the field: a press on one hands its click to the
|
|
2265
|
+
// trigger, and must not first close the list the trigger then reopens.
|
|
2266
|
+
insideElements: [frameElement, ...labelsOf(triggerElement)],
|
|
2267
|
+
...(this.panelMatchesFieldWidth ? { width: fieldWidth } : { minWidth: fieldWidth }),
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
1731
2270
|
moveActiveToEdge(direction) {
|
|
1732
2271
|
const options = this.visibleOptions();
|
|
1733
2272
|
let next = direction === 1 ? 0 : options.length - 1;
|
|
@@ -1748,6 +2287,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1748
2287
|
|
|
1749
2288
|
// Form control base classes
|
|
1750
2289
|
|
|
2290
|
+
/** The BCP 47 tag `Intl` formats in: the `date-fns` locale's own, or English as `date-fns` defaults to. */
|
|
2291
|
+
const intlLocale = (locale) => (locale ? locale.code : 'en-US');
|
|
2292
|
+
/**
|
|
2293
|
+
* Formats the parts of a date named in `options` — a CLDR skeleton — in the order and form
|
|
2294
|
+
* `locale` writes them, which a fixed `date-fns` pattern cannot do: `{ month: 'short', day:
|
|
2295
|
+
* 'numeric' }` reads `Nov 21` in English, `21 нояб.` in Russian.
|
|
2296
|
+
*/
|
|
2297
|
+
const formatSkeleton = (date, options, locale) => new Intl.DateTimeFormat(intlLocale(locale), options).format(date);
|
|
2298
|
+
/**
|
|
2299
|
+
* Formats a span of dates as `locale` writes one, naming once what both ends share: a week
|
|
2300
|
+
* reads `Nov 16 – 22, 2026` in English and `16–22 нояб. 2026 г.` in Russian, and one that
|
|
2301
|
+
* crosses a month names both months.
|
|
2302
|
+
*/
|
|
2303
|
+
const formatSkeletonRange = (start, end, options, locale) => new Intl.DateTimeFormat(intlLocale(locale), options).formatRange(start, end);
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Capitalizes the first letter of `text` with `locale`'s own capitals — the Unicode CLDR
|
|
2307
|
+
* `titlecase-firstword` transform. CLDR has month and weekday names stand alone (a calendar's
|
|
2308
|
+
* title, its column headers, a list of months) title-cased on the first word while the same
|
|
2309
|
+
* names inside a date stay lowercase: Russian `ноябрь` heads a calendar as `Ноябрь`. English
|
|
2310
|
+
* names are capitalized already, so English reads as it formats. Without a locale, `date-fns`
|
|
2311
|
+
* formats in English and the default capitals apply.
|
|
2312
|
+
*/
|
|
2313
|
+
const titlecaseFirstWord = (text, locale) => {
|
|
2314
|
+
if (text.length === 0)
|
|
2315
|
+
return text;
|
|
2316
|
+
const localeCode = locale ? locale.code : undefined;
|
|
2317
|
+
return text.charAt(0).toLocaleUpperCase(localeCode) + text.slice(1);
|
|
2318
|
+
};
|
|
2319
|
+
/**
|
|
2320
|
+
* Formats a date shown on its own rather than inside a sentence or next to a day number — a
|
|
2321
|
+
* month title, a weekday header — in `locale`, capitalized as CLDR has such text stand alone.
|
|
2322
|
+
* Patterns name months with the stand-alone tokens (`LLLL`, `LLL`) and weekdays with
|
|
2323
|
+
* `cccc`/`ccc`, since languages that decline them use a different form on their own: Russian
|
|
2324
|
+
* heads a month `Ноябрь 2026`, where the date reads `21 ноября`.
|
|
2325
|
+
*/
|
|
2326
|
+
const formatStandalone = (date, pattern, locale) => titlecaseFirstWord(format(date, pattern, locale ? { locale } : undefined), locale);
|
|
2327
|
+
|
|
2328
|
+
/** Sunday to Saturday as `date-fns` numbers them, so each index names its day. */
|
|
2329
|
+
const SUNDAY_FIRST = [0, 1, 2, 3, 4, 5, 6];
|
|
2330
|
+
/**
|
|
2331
|
+
* The weekdays' names, Sunday first, in the configured `date-fns` locale — `Вс Пн Вт…` for
|
|
2332
|
+
* `ru` — as a calendar heads its columns, the way platform date pickers take them from the
|
|
2333
|
+
* locale. Each stands alone, so it is capitalized as CLDR has such names (see
|
|
2334
|
+
* `titlecaseFirstWord`). With no locale they are English, the language `date-fns` formats in
|
|
2335
|
+
* then.
|
|
2336
|
+
*/
|
|
2337
|
+
const localeWeekDays = (config, width) => {
|
|
2338
|
+
const locale = config.dateFns ?? enUS;
|
|
2339
|
+
return SUNDAY_FIRST.map(day => titlecaseFirstWord(locale.localize.day(day, { width, context: 'standalone' }), locale));
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
const DEFAULT_LOCALE_CONFIG = { hourCycle: 'locale' };
|
|
2343
|
+
|
|
2344
|
+
const LOCALE_CONFIG = new InjectionToken('LOCALE_CONFIG', {
|
|
2345
|
+
factory: () => DEFAULT_LOCALE_CONFIG,
|
|
2346
|
+
});
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* A component's weekday names, Sunday first, from the most specific source that is set: the
|
|
2350
|
+
* element's own `weekDays` input, then the component config's `weekDays`, then the configured
|
|
2351
|
+
* `date-fns` locale at `width`. Must run in an injection context — a field initializer.
|
|
2352
|
+
*/
|
|
2353
|
+
const injectWeekDays = (input, configured, width) => {
|
|
2354
|
+
const fromLocale = localeWeekDays(inject(LOCALE_CONFIG), width);
|
|
2355
|
+
return computed(() => input() ?? configured ?? fromLocale);
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* The first day of the week of the configured `date-fns` locale — Monday for `ru`, Sunday
|
|
2360
|
+
* for `enUS` — as a calendar opens on by default, the way platform date pickers follow the
|
|
2361
|
+
* locale. With no locale, or one that states no first day, it is Sunday: `date-fns` formats
|
|
2362
|
+
* as `en-US` then.
|
|
2363
|
+
*/
|
|
2364
|
+
const localeWeekStartsOn = (config) => {
|
|
2365
|
+
const locale = config.dateFns;
|
|
2366
|
+
if (!locale || !locale.options)
|
|
2367
|
+
return 0;
|
|
2368
|
+
return locale.options.weekStartsOn ?? 0;
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* The first day of the week (`date-fns` convention: 0 = Sunday) for every component that
|
|
2373
|
+
* lays days out in weeks — the calendar, the date-time picker and the activity heatmap. A
|
|
2374
|
+
* signal, so an app can hand over a value that changes while it runs (a person's own
|
|
2375
|
+
* setting) through `provideWeekStartsOn`.
|
|
2376
|
+
*
|
|
2377
|
+
* It is the least specific of the sources a component consults; each component resolves,
|
|
2378
|
+
* most specific first: its `weekStartsOn` input, its component config's `weekStartsOn`, this
|
|
2379
|
+
* token, and — this token's own default — the configured `date-fns` locale's first day.
|
|
2380
|
+
*/
|
|
2381
|
+
const WEEK_STARTS_ON = new InjectionToken('WEEK_STARTS_ON', {
|
|
2382
|
+
factory: () => signal(localeWeekStartsOn(inject(LOCALE_CONFIG))).asReadonly(),
|
|
2383
|
+
});
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* A component's effective first day of the week, from the most specific source that is set:
|
|
2387
|
+
* the element's own `weekStartsOn` input, then the component config's `weekStartsOn`, then
|
|
2388
|
+
* the app-wide `WEEK_STARTS_ON` (whose default is the locale's first day). Must run in an
|
|
2389
|
+
* injection context — a field initializer.
|
|
2390
|
+
*/
|
|
2391
|
+
const injectWeekStartsOn = (input, configured) => {
|
|
2392
|
+
const global = inject(WEEK_STARTS_ON);
|
|
2393
|
+
return computed(() => input() ?? configured ?? global());
|
|
2394
|
+
};
|
|
2395
|
+
|
|
1751
2396
|
/** Matches a quoted literal in a `date-fns` format pattern, e.g. the `'h'` in `"HH 'h' mm"`. */
|
|
1752
2397
|
const QUOTED_LITERAL = /'[^']*'/g;
|
|
1753
2398
|
/** Day-period tokens (`a`, `b`, `B`) — their presence marks a pattern as 12-hour. */
|
|
@@ -1773,11 +2418,15 @@ const isHour12 = (config) => {
|
|
|
1773
2418
|
*/
|
|
1774
2419
|
const localeFormatOptions = (config) => config.dateFns ? { locale: config.dateFns } : undefined;
|
|
1775
2420
|
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
2421
|
+
/**
|
|
2422
|
+
* Sets the app-wide first day of the week. The factory runs in an injection context, so it
|
|
2423
|
+
* can hand over a signal owned by one of the app's own services — a person's synced setting —
|
|
2424
|
+
* and every calendar, date-time picker and activity heatmap follows it as it changes.
|
|
2425
|
+
*
|
|
2426
|
+
* @example
|
|
2427
|
+
* provideWeekStartsOn(() => inject(WeekStartService).dayNumber);
|
|
2428
|
+
*/
|
|
2429
|
+
const provideWeekStartsOn = (factory) => makeEnvironmentProviders([{ provide: WEEK_STARTS_ON, useFactory: factory }]);
|
|
1781
2430
|
|
|
1782
2431
|
/** Provided by a trigger directive for the host it sits on; see {@link PopupTrigger}. */
|
|
1783
2432
|
const POPUP_TRIGGER = new InjectionToken('POPUP_TRIGGER');
|
|
@@ -3436,8 +4085,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3436
4085
|
const DAYS_PER_WEEK$1 = 7;
|
|
3437
4086
|
/** Lowest meaningful step count: an empty step plus a single activity step. */
|
|
3438
4087
|
const MIN_LEVELS = 2;
|
|
3439
|
-
/** `date-fns` format token for a month heading above the week columns, e.g. "Jul". */
|
|
3440
|
-
const MONTH_LABEL_FORMAT$1 = '
|
|
4088
|
+
/** `date-fns` format token for a month heading above the week columns, standing alone, e.g. "Jul". */
|
|
4089
|
+
const MONTH_LABEL_FORMAT$1 = 'LLL';
|
|
3441
4090
|
/** `date-fns` format token for a day's accessible name, e.g. "July 20th, 2026". */
|
|
3442
4091
|
const DAY_LABEL_FORMAT = 'PPP';
|
|
3443
4092
|
/**
|
|
@@ -3448,8 +4097,6 @@ const MIN_LEVEL_INTENSITY = 0.35;
|
|
|
3448
4097
|
|
|
3449
4098
|
const DEFAULT_ACTIVITY_HEATMAP_CONFIG = {
|
|
3450
4099
|
levels: 5,
|
|
3451
|
-
weekStartsOn: 0,
|
|
3452
|
-
weekDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
3453
4100
|
rangeMonths: 12,
|
|
3454
4101
|
weekdayLabelInterval: 2,
|
|
3455
4102
|
color: 'primary',
|
|
@@ -3587,10 +4234,18 @@ class ActivityHeatmap {
|
|
|
3587
4234
|
*/
|
|
3588
4235
|
thresholds = input(undefined, /* @ts-ignore */
|
|
3589
4236
|
...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
3590
|
-
|
|
4237
|
+
/**
|
|
4238
|
+
* First day of the week (`date-fns` convention: 0 = Sunday) for this instance alone. Unset, it
|
|
4239
|
+
* follows the component config's `weekStartsOn`, then the app-wide `WEEK_STARTS_ON`.
|
|
4240
|
+
*/
|
|
4241
|
+
weekStartsOn = input(undefined, /* @ts-ignore */
|
|
3591
4242
|
...(ngDevMode ? [{ debugName: "weekStartsOn" }] : /* istanbul ignore next */ []));
|
|
3592
|
-
/**
|
|
3593
|
-
|
|
4243
|
+
/**
|
|
4244
|
+
* Short weekday labels, Sunday-first, for this instance alone; rotated to honour
|
|
4245
|
+
* `weekStartsOn`. Unset, they follow the component config's `weekDays`, then the configured
|
|
4246
|
+
* `date-fns` locale.
|
|
4247
|
+
*/
|
|
4248
|
+
weekDays = input(undefined, /* @ts-ignore */
|
|
3594
4249
|
...(ngDevMode ? [{ debugName: "weekDays" }] : /* istanbul ignore next */ []));
|
|
3595
4250
|
/** Every nth weekday row carries a label; 1 labels all seven, 2 labels every other row. */
|
|
3596
4251
|
weekdayLabelInterval = input(this._config.weekdayLabelInterval, { ...(ngDevMode ? { debugName: "weekdayLabelInterval" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
@@ -3617,6 +4272,10 @@ class ActivityHeatmap {
|
|
|
3617
4272
|
/** Today, so the today marker moves across midnight and the grid rebuilds only then. */
|
|
3618
4273
|
_today = createDaySignal(createNowSignal(NOW_REFRESH_INTERVAL_MS));
|
|
3619
4274
|
// Computed
|
|
4275
|
+
/** The first day of the week this instance lays its days out from. */
|
|
4276
|
+
resolvedWeekStartsOn = injectWeekStartsOn(this.weekStartsOn, this._config.weekStartsOn);
|
|
4277
|
+
/** The weekday names this instance heads its days with, Sunday first. */
|
|
4278
|
+
resolvedWeekDays = injectWeekDays(this.weekDays, this._config.weekDays, 'abbreviated');
|
|
3620
4279
|
/** Steps actually rendered; a heatmap needs an empty step plus at least one active one. */
|
|
3621
4280
|
resolvedLevels = computed(() => Math.max(MIN_LEVELS, Math.floor(this.levels())), /* @ts-ignore */
|
|
3622
4281
|
...(ngDevMode ? [{ debugName: "resolvedLevels" }] : /* istanbul ignore next */ []));
|
|
@@ -3629,7 +4288,7 @@ class ActivityHeatmap {
|
|
|
3629
4288
|
/** Weekday rows, each holding one weekday's cell across every week column. */
|
|
3630
4289
|
rows = computed(() => {
|
|
3631
4290
|
const { start, end } = this._range();
|
|
3632
|
-
const weekStartsOn = this.
|
|
4291
|
+
const weekStartsOn = this.resolvedWeekStartsOn();
|
|
3633
4292
|
const totals = aggregateActivityEntries(this.entries());
|
|
3634
4293
|
const today = this._today();
|
|
3635
4294
|
const days = eachDayOfInterval({
|
|
@@ -3637,7 +4296,7 @@ class ActivityHeatmap {
|
|
|
3637
4296
|
end: endOfWeek(end, { weekStartsOn }),
|
|
3638
4297
|
});
|
|
3639
4298
|
const thresholds = this._resolveThresholds(days, totals, start, end);
|
|
3640
|
-
const weekdayLabels = rotateWeekDays(this.
|
|
4299
|
+
const weekdayLabels = rotateWeekDays(this.resolvedWeekDays(), weekStartsOn);
|
|
3641
4300
|
const interval = Math.max(1, Math.floor(this.weekdayLabelInterval()));
|
|
3642
4301
|
const rows = weekdayLabels.map((label, index) => ({
|
|
3643
4302
|
// Sparse labelling starts one row in, mirroring the offset a dense grid reads best with.
|
|
@@ -3677,7 +4336,7 @@ class ActivityHeatmap {
|
|
|
3677
4336
|
return [];
|
|
3678
4337
|
// The first row holds one day per week column, and each is that week's first day.
|
|
3679
4338
|
const weekStarts = rows[0].days.map(day => day.date);
|
|
3680
|
-
return buildActivityMonthSegments(weekStarts, date =>
|
|
4339
|
+
return buildActivityMonthSegments(weekStarts, date => formatStandalone(date, MONTH_LABEL_FORMAT$1, this._locale.dateFns));
|
|
3681
4340
|
}, /* @ts-ignore */
|
|
3682
4341
|
...(ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []));
|
|
3683
4342
|
/** Every intensity step, low to high, for the legend's sample swatches. */
|
|
@@ -4544,6 +5203,7 @@ const DEFAULT_TOGGLE_GROUP_CONFIG = {
|
|
|
4544
5203
|
orientation: 'horizontal',
|
|
4545
5204
|
multiple: false,
|
|
4546
5205
|
unselectable: false,
|
|
5206
|
+
rounded: false,
|
|
4547
5207
|
fluid: false,
|
|
4548
5208
|
};
|
|
4549
5209
|
|
|
@@ -4573,6 +5233,11 @@ class ToggleGroup extends SelectionGroup {
|
|
|
4573
5233
|
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4574
5234
|
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
4575
5235
|
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
5236
|
+
/**
|
|
5237
|
+
* Rounds the group's ends fully, into a pill. A segmented group's chosen pill
|
|
5238
|
+
* follows, since it is always drawn concentric with the track.
|
|
5239
|
+
*/
|
|
5240
|
+
rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4576
5241
|
/** Whether the group stretches to fill its container's width with equal-width options. */
|
|
4577
5242
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4578
5243
|
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
@@ -4606,6 +5271,8 @@ class ToggleGroup extends SelectionGroup {
|
|
|
4606
5271
|
];
|
|
4607
5272
|
if (this.fluid())
|
|
4608
5273
|
array.push(`${className}--fluid`);
|
|
5274
|
+
if (this.rounded())
|
|
5275
|
+
array.push(`${className}--rounded`);
|
|
4609
5276
|
return array.concat(this.controlClasses());
|
|
4610
5277
|
}, /* @ts-ignore */
|
|
4611
5278
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
@@ -4618,11 +5285,11 @@ class ToggleGroup extends SelectionGroup {
|
|
|
4618
5285
|
});
|
|
4619
5286
|
}
|
|
4620
5287
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4621
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null" }, classAttribute: "tls-toggle-group" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_optionButtons", predicate: ["optionButton"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n #optionButton\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
5288
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null" }, classAttribute: "tls-toggle-group" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_optionButtons", predicate: ["optionButton"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n #optionButton\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n <!-- A row of a list is marked chosen by a check at its end, the way a\n platform's list of choices marks it, rather than by a fill. -->\n @if (variant() === 'list' && isSelected(option.value)) {\n <tls-icon class=\"tls-toggle-group__check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n}\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
4622
5289
|
}
|
|
4623
5290
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, decorators: [{
|
|
4624
5291
|
type: Component,
|
|
4625
|
-
args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
5292
|
+
args: [{ selector: 'tls-toggle-group', imports: [Icon, NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
4626
5293
|
role: 'group',
|
|
4627
5294
|
class: 'tls-toggle-group',
|
|
4628
5295
|
'[class]': 'classes()',
|
|
@@ -4630,8 +5297,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4630
5297
|
'[attr.aria-labelledby]': 'labelledBy()',
|
|
4631
5298
|
'[attr.aria-describedby]': 'describedBy()',
|
|
4632
5299
|
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
4633
|
-
}, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n #optionButton\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
|
|
4634
|
-
}], ctorParameters: () => [], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }], _optionButtons: [{ type: i0.ViewChildren, args: ['optionButton', { isSignal: true }] }] } });
|
|
5300
|
+
}, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n #optionButton\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n <!-- A row of a list is marked chosen by a check at its end, the way a\n platform's list of choices marks it, rather than by a fill. -->\n @if (variant() === 'list' && isSelected(option.value)) {\n <tls-icon class=\"tls-toggle-group__check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n}\n" }]
|
|
5301
|
+
}], ctorParameters: () => [], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }], _optionButtons: [{ type: i0.ViewChildren, args: ['optionButton', { isSignal: true }] }] } });
|
|
4635
5302
|
|
|
4636
5303
|
/** Days in a calendar week. */
|
|
4637
5304
|
const DAYS_PER_WEEK = 7;
|
|
@@ -4647,12 +5314,30 @@ const DEFAULT_MAX_EVENTS_PER_DAY = 3;
|
|
|
4647
5314
|
* accessible summary still reports the true total.
|
|
4648
5315
|
*/
|
|
4649
5316
|
const MAX_DAY_MARKERS = 3;
|
|
4650
|
-
/**
|
|
4651
|
-
|
|
5317
|
+
/**
|
|
5318
|
+
* `date-fns` format token for the month title in the header, e.g. "July 2026". The month
|
|
5319
|
+
* stands alone, so it takes the stand-alone token: Russian titles `Июль 2026`, not the
|
|
5320
|
+
* genitive `июля` a date uses.
|
|
5321
|
+
*/
|
|
5322
|
+
const MONTH_TITLE_FORMAT = 'LLLL yyyy';
|
|
4652
5323
|
/** `date-fns` format token for a day-of-month number. */
|
|
4653
5324
|
const DAY_NUMBER_FORMAT = 'd';
|
|
4654
|
-
/**
|
|
4655
|
-
|
|
5325
|
+
/**
|
|
5326
|
+
* Parts of the single-day view title, e.g. "Monday, July 20, 2026" — a skeleton the locale
|
|
5327
|
+
* orders, so Russian reads `Понедельник, 20 июля 2026 г.`.
|
|
5328
|
+
*/
|
|
5329
|
+
const DAY_TITLE_OPTIONS = {
|
|
5330
|
+
weekday: 'long',
|
|
5331
|
+
year: 'numeric',
|
|
5332
|
+
month: 'long',
|
|
5333
|
+
day: 'numeric',
|
|
5334
|
+
};
|
|
5335
|
+
/** Parts of the week view title, a span the locale writes, e.g. "Jul 20 – 26, 2026". */
|
|
5336
|
+
const WEEK_TITLE_OPTIONS = {
|
|
5337
|
+
year: 'numeric',
|
|
5338
|
+
month: 'short',
|
|
5339
|
+
day: 'numeric',
|
|
5340
|
+
};
|
|
4656
5341
|
/** Pixel height of one hour row in the week/day time-grid; drives event positioning too. */
|
|
4657
5342
|
const HOUR_HEIGHT = 48;
|
|
4658
5343
|
/** Minimum rendered height (px) for a timed event, so brief events stay readable. */
|
|
@@ -4669,12 +5354,16 @@ const HOUR_LABEL_FORMAT_24 = 'HH:mm';
|
|
|
4669
5354
|
const EVENT_TIME_FORMAT_12 = 'h:mm a';
|
|
4670
5355
|
/** `date-fns` format token for a 24-hour event start time, e.g. "09:30". */
|
|
4671
5356
|
const EVENT_TIME_FORMAT_24 = 'HH:mm';
|
|
4672
|
-
/** `date-fns` format token for an agenda day's weekday, e.g. "Wednesday". */
|
|
4673
|
-
const AGENDA_WEEKDAY_FORMAT = '
|
|
4674
|
-
/**
|
|
4675
|
-
const
|
|
5357
|
+
/** `date-fns` format token for an agenda day's weekday standing alone, e.g. "Wednesday". */
|
|
5358
|
+
const AGENDA_WEEKDAY_FORMAT = 'cccc';
|
|
5359
|
+
/** Parts of an agenda day's date, ordered by the locale, e.g. "Jul 22" or Russian `22 июл.`. */
|
|
5360
|
+
const AGENDA_DATE_OPTIONS = { month: 'short', day: 'numeric' };
|
|
4676
5361
|
/** Pointers that may page the calendar with a swipe; with a mouse a drag means selection or a click. */
|
|
4677
5362
|
const SWIPE_POINTER_TYPES = ['touch', 'pen'];
|
|
5363
|
+
/** Custom property the month grid's travel is written to while a scroll or paging drag moves it, in px. */
|
|
5364
|
+
const MONTH_GRID_OFFSET_PROPERTY = '--tls-calendar-grid-offset';
|
|
5365
|
+
/** Custom property the resting week-row height is pinned to while the grid is widened, in px. */
|
|
5366
|
+
const MONTH_GRID_ROW_HEIGHT_PROPERTY = '--tls-calendar-scroll-row-height';
|
|
4678
5367
|
/** Views that prefix an event chip with its start time; the month grid shows the title alone. */
|
|
4679
5368
|
const TIME_AWARE_VIEWS = ['week', 'day', 'agenda'];
|
|
4680
5369
|
/** View switcher order; labels are resolved from the calendar config for localization. */
|
|
@@ -4752,8 +5441,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4752
5441
|
const DEFAULT_CALENDAR_CONFIG = {
|
|
4753
5442
|
view: 'month',
|
|
4754
5443
|
views: CALENDAR_VIEW_ORDER,
|
|
4755
|
-
weekStartsOn: 0,
|
|
4756
|
-
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
4757
5444
|
hourStart: 0,
|
|
4758
5445
|
hourEnd: 24,
|
|
4759
5446
|
showAllDayRow: true,
|
|
@@ -4821,7 +5508,6 @@ class CalendarAgendaView {
|
|
|
4821
5508
|
eventSelect = output();
|
|
4822
5509
|
// State
|
|
4823
5510
|
noEventsLabel = this._config.labels.noEvents;
|
|
4824
|
-
_dateOptions = localeFormatOptions(this._locale);
|
|
4825
5511
|
/** Today, so the today marker moves across midnight and the list rebuilds only then. */
|
|
4826
5512
|
_today = createDaySignal(createNowSignal(NOW_REFRESH_INTERVAL_MS));
|
|
4827
5513
|
// Computed
|
|
@@ -4832,8 +5518,8 @@ class CalendarAgendaView {
|
|
|
4832
5518
|
return eachDayOfInterval({ start: startOfMonth(activeDate), end: endOfMonth(activeDate) })
|
|
4833
5519
|
.map(date => ({
|
|
4834
5520
|
date,
|
|
4835
|
-
weekday:
|
|
4836
|
-
dateLabel:
|
|
5521
|
+
weekday: formatStandalone(date, AGENDA_WEEKDAY_FORMAT, this._locale.dateFns),
|
|
5522
|
+
dateLabel: formatSkeleton(date, AGENDA_DATE_OPTIONS, this._locale.dateFns),
|
|
4837
5523
|
isToday: isSameDay(date, today),
|
|
4838
5524
|
events: eventsForDay(date, events),
|
|
4839
5525
|
}))
|
|
@@ -4911,6 +5597,34 @@ const assignWeekLanes = (weekDays, events) => {
|
|
|
4911
5597
|
});
|
|
4912
5598
|
};
|
|
4913
5599
|
|
|
5600
|
+
/**
|
|
5601
|
+
* Plans the window a paging drag renders around the month holding `anchor`.
|
|
5602
|
+
*
|
|
5603
|
+
* @example
|
|
5604
|
+
* // Monday-start weeks, no peek: July's grid opens Mon Jun 29, August's Mon Jul 27,
|
|
5605
|
+
* // September's Mon Aug 31.
|
|
5606
|
+
* buildMonthDragPlan(new Date(2026, 7, 15), 1, { before: 0, after: 0 });
|
|
5607
|
+
* // → {
|
|
5608
|
+
* // window: { start: new Date(2026, 5, 29), weekCount: 15 }, // 4 + 5 + August's own 6
|
|
5609
|
+
* // previousRows: 4,
|
|
5610
|
+
* // nextRows: 5,
|
|
5611
|
+
* // }
|
|
5612
|
+
*/
|
|
5613
|
+
const buildMonthDragPlan = (anchor, weekStartsOn, peekWeeks) => {
|
|
5614
|
+
const previous = buildMonthWindow(subMonths(anchor, 1), weekStartsOn, peekWeeks);
|
|
5615
|
+
const active = buildMonthWindow(anchor, weekStartsOn, peekWeeks);
|
|
5616
|
+
const next = buildMonthWindow(addMonths(anchor, 1), weekStartsOn, peekWeeks);
|
|
5617
|
+
// Calendar days, not milliseconds: a DST shift must not break the whole-week arithmetic.
|
|
5618
|
+
const previousRows = differenceInCalendarDays(active.start, previous.start) / DAYS_PER_WEEK;
|
|
5619
|
+
const nextRows = differenceInCalendarDays(next.start, active.start) / DAYS_PER_WEEK;
|
|
5620
|
+
return {
|
|
5621
|
+
// Every window spans the same count of rows, so the next month's closes the union.
|
|
5622
|
+
window: { start: previous.start, weekCount: previousRows + nextRows + active.weekCount },
|
|
5623
|
+
previousRows,
|
|
5624
|
+
nextRows,
|
|
5625
|
+
};
|
|
5626
|
+
};
|
|
5627
|
+
|
|
4914
5628
|
/**
|
|
4915
5629
|
* Plans the scroll between two months' grid windows, or `null` when there is nothing to scroll:
|
|
4916
5630
|
* both dates render the same window, or the windows are so far apart that the weeks between
|
|
@@ -4938,12 +5652,45 @@ const buildMonthScrollPlan = (from, to, weekStartsOn, peekWeeks) => {
|
|
|
4938
5652
|
};
|
|
4939
5653
|
};
|
|
4940
5654
|
|
|
5655
|
+
/**
|
|
5656
|
+
* How many event lanes fit a day's lane space: each lane `barHeight` tall, with `gap` between
|
|
5657
|
+
* two lanes and none after the last.
|
|
5658
|
+
*
|
|
5659
|
+
* @example
|
|
5660
|
+
* fitLanes(80, 24, 4) // 3 — three lanes and two gaps make exactly 80
|
|
5661
|
+
* fitLanes(79, 24, 4) // 2
|
|
5662
|
+
* fitLanes(23, 24, 4) // 0 — not even one lane
|
|
5663
|
+
*/
|
|
5664
|
+
function fitLanes(available, barHeight, gap) {
|
|
5665
|
+
return Math.max(0, Math.floor((available + gap) / (barHeight + gap)));
|
|
5666
|
+
}
|
|
5667
|
+
|
|
5668
|
+
/**
|
|
5669
|
+
* Whether a day can be picked: on or after the earliest day allowed, and let through by the
|
|
5670
|
+
* filter. Either limit left unset allows every day.
|
|
5671
|
+
*
|
|
5672
|
+
* @example
|
|
5673
|
+
* isDayAvailable(new Date(2026, 10, 14), new Date(2026, 10, 15, 9), null) // false — before the minimum
|
|
5674
|
+
* isDayAvailable(new Date(2026, 10, 15), new Date(2026, 10, 15, 9), null) // true — the minimum's own day
|
|
5675
|
+
* isDayAvailable(new Date(2026, 10, 20), null, date => date.getDate() !== 20) // false — filtered out
|
|
5676
|
+
*/
|
|
5677
|
+
function isDayAvailable(date, minDate, dateFilter) {
|
|
5678
|
+
if (minDate !== null && isBefore(startOfDay(date), startOfDay(minDate)))
|
|
5679
|
+
return false;
|
|
5680
|
+
if (dateFilter !== null && !dateFilter(date))
|
|
5681
|
+
return false;
|
|
5682
|
+
return true;
|
|
5683
|
+
}
|
|
5684
|
+
|
|
4941
5685
|
class CalendarMonthView {
|
|
4942
5686
|
// Injections
|
|
4943
5687
|
_locale = inject(LOCALE_CONFIG);
|
|
4944
5688
|
_config = inject(CALENDAR_CONFIG);
|
|
4945
5689
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
4946
5690
|
_injector = inject(Injector);
|
|
5691
|
+
_destroyRef = inject(DestroyRef);
|
|
5692
|
+
_renderer = inject(Renderer2);
|
|
5693
|
+
_pan = inject(PanDirective);
|
|
4947
5694
|
// Inputs
|
|
4948
5695
|
activeDate = input.required(/* @ts-ignore */
|
|
4949
5696
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
@@ -4958,6 +5705,9 @@ class CalendarMonthView {
|
|
|
4958
5705
|
/** Whether day cells are held to a 1:1 ratio instead of sizing to the events they hold. */
|
|
4959
5706
|
squareCells = input(false, /* @ts-ignore */
|
|
4960
5707
|
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
5708
|
+
/** Whether the grid fills the height it is given, showing per day only the bars that fit. */
|
|
5709
|
+
fitHeight = input(false, /* @ts-ignore */
|
|
5710
|
+
...(ngDevMode ? [{ debugName: "fitHeight" }] : /* istanbul ignore next */ []));
|
|
4961
5711
|
/**
|
|
4962
5712
|
* Week rows rendered beyond the month's own window, counted for each edge of the grid,
|
|
4963
5713
|
* fading out toward that edge.
|
|
@@ -4972,42 +5722,100 @@ class CalendarMonthView {
|
|
|
4972
5722
|
/** Accessible name for the grid, announced when focus enters it. */
|
|
4973
5723
|
label = input(undefined, /* @ts-ignore */
|
|
4974
5724
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
5725
|
+
/** The selected day, drawn and exposed as selected; none while null. */
|
|
5726
|
+
selectedDate = input(null, /* @ts-ignore */
|
|
5727
|
+
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
5728
|
+
/** Replaces the dense layout's spoken event count for a day with the consumer's own sentence. */
|
|
5729
|
+
markersLabel = input(undefined, /* @ts-ignore */
|
|
5730
|
+
...(ngDevMode ? [{ debugName: "markersLabel" }] : /* istanbul ignore next */ []));
|
|
5731
|
+
/** The earliest day that can be picked; every day before it is disabled. */
|
|
5732
|
+
minDate = input(null, /* @ts-ignore */
|
|
5733
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
5734
|
+
/** Whether a day can be picked; a day it turns away is disabled. */
|
|
5735
|
+
dateFilter = input(null, /* @ts-ignore */
|
|
5736
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
5737
|
+
/**
|
|
5738
|
+
* Whether a month before the active one can be paged to. While it cannot, a paging drag
|
|
5739
|
+
* toward it only stretches under the finger and goes back on release.
|
|
5740
|
+
*/
|
|
5741
|
+
canPageBack = input(true, /* @ts-ignore */
|
|
5742
|
+
...(ngDevMode ? [{ debugName: "canPageBack" }] : /* istanbul ignore next */ []));
|
|
4975
5743
|
// Outputs
|
|
4976
5744
|
dateSelect = output();
|
|
4977
5745
|
eventSelect = output();
|
|
5746
|
+
/**
|
|
5747
|
+
* Asks to page one month forward (`1`) or back (`-1`) once a paging drag is let go past the
|
|
5748
|
+
* point of committing. The grid is already gliding to that month, and lands on it once
|
|
5749
|
+
* `activeDate` follows.
|
|
5750
|
+
*/
|
|
5751
|
+
page = output();
|
|
4978
5752
|
// State
|
|
5753
|
+
/**
|
|
5754
|
+
* Moves the widened grid under a paging drag or a navigation scroll, and settles it on the
|
|
5755
|
+
* spring a release or a navigation sends it on. The grid has no scrim, so nothing dims with it.
|
|
5756
|
+
*/
|
|
5757
|
+
motion = new DragMotion({
|
|
5758
|
+
property: MONTH_GRID_OFFSET_PROPERTY,
|
|
5759
|
+
renderer: this._renderer,
|
|
5760
|
+
injector: this._injector,
|
|
5761
|
+
});
|
|
4979
5762
|
_dateOptions = localeFormatOptions(this._locale);
|
|
4980
5763
|
/** Today, so the today highlight moves across midnight and the grid rebuilds only then. */
|
|
4981
5764
|
_today = createDaySignal(createNowSignal(NOW_REFRESH_INTERVAL_MS));
|
|
4982
|
-
/** Widened week window a navigation scroll renders
|
|
4983
|
-
|
|
4984
|
-
...(ngDevMode ? [{ debugName: "
|
|
5765
|
+
/** Widened week window a navigation scroll or a paging drag renders; unset while the grid rests. */
|
|
5766
|
+
_widenedWindow = signal(null, /* @ts-ignore */
|
|
5767
|
+
...(ngDevMode ? [{ debugName: "_widenedWindow" }] : /* istanbul ignore next */ []));
|
|
4985
5768
|
_grid = viewChild.required('grid');
|
|
4986
|
-
/**
|
|
4987
|
-
|
|
5769
|
+
/** Each week's lane overlay; its height is the room a week's rows leave for bars. */
|
|
5770
|
+
_bars = viewChildren('bars', /* @ts-ignore */
|
|
5771
|
+
...(ngDevMode ? [{ debugName: "_bars" }] : /* istanbul ignore next */ []));
|
|
5772
|
+
/**
|
|
5773
|
+
* The lanes a week row has room for, measured while the grid fits its height; null until
|
|
5774
|
+
* measured, and whenever the bars are not laid out (the dense layout hides them).
|
|
5775
|
+
*/
|
|
5776
|
+
_fittingLanes = signal(null, /* @ts-ignore */
|
|
5777
|
+
...(ngDevMode ? [{ debugName: "_fittingLanes" }] : /* istanbul ignore next */ []));
|
|
5778
|
+
/** The paging drag in progress; null while no finger holds the grid. */
|
|
5779
|
+
_drag = null;
|
|
5780
|
+
/**
|
|
5781
|
+
* Month a committed paging drag is gliding to, so its arrival as `activeDate` is recognised
|
|
5782
|
+
* as the glide's own destination rather than scrolled to a second time.
|
|
5783
|
+
*/
|
|
5784
|
+
_pageTarget = null;
|
|
4988
5785
|
/** Anchor the grid last rendered for, naming the window a navigation scrolls away from. */
|
|
4989
5786
|
_renderedDate = null;
|
|
4990
5787
|
// Computed
|
|
4991
5788
|
/** The week rows the grid holds at rest: the month's window plus its peek weeks. */
|
|
4992
5789
|
gridWindow = computed(() => buildMonthWindow(this.activeDate(), this.weekStartsOn(), this.peekWeeks()), /* @ts-ignore */
|
|
4993
5790
|
...(ngDevMode ? [{ debugName: "gridWindow" }] : /* istanbul ignore next */ []));
|
|
5791
|
+
/** Bars a day shows before counting the rest as "+N more". */
|
|
5792
|
+
lanes = computed(() => {
|
|
5793
|
+
const maxLanes = this.maxEventsPerDay();
|
|
5794
|
+
const fitting = this._fittingLanes();
|
|
5795
|
+
if (!this.fitHeight() || fitting === null)
|
|
5796
|
+
return maxLanes;
|
|
5797
|
+
return Math.min(maxLanes, fitting);
|
|
5798
|
+
}, /* @ts-ignore */
|
|
5799
|
+
...(ngDevMode ? [{ debugName: "lanes" }] : /* istanbul ignore next */ []));
|
|
4994
5800
|
weekdayHeaders = computed(() => rotateWeekDays(this.weekDays(), this.weekStartsOn()), /* @ts-ignore */
|
|
4995
5801
|
...(ngDevMode ? [{ debugName: "weekdayHeaders" }] : /* istanbul ignore next */ []));
|
|
4996
5802
|
weeks = computed(() => {
|
|
4997
5803
|
const activeDate = this.activeDate();
|
|
4998
|
-
const maxLanes = this.
|
|
5804
|
+
const maxLanes = this.lanes();
|
|
4999
5805
|
const events = this.events();
|
|
5000
5806
|
const today = this._today();
|
|
5807
|
+
const selectedDate = this.selectedDate();
|
|
5808
|
+
const markersLabel = this.markersLabel();
|
|
5809
|
+
const minDate = this.minDate();
|
|
5810
|
+
const dateFilter = this.dateFilter();
|
|
5001
5811
|
// A window of fixed length keeps the grid height from reflowing between months. While a
|
|
5002
5812
|
// navigation scroll plays, the window widens to the union of the outgoing and incoming
|
|
5003
|
-
// grids
|
|
5004
|
-
|
|
5005
|
-
const
|
|
5006
|
-
const windowStart = plan ? plan.unionStart : gridWindow.start;
|
|
5007
|
-
const weekCount = plan ? plan.weekCount : gridWindow.weekCount;
|
|
5813
|
+
// grids — and under a paging drag to the neighbouring months either side — so the rows
|
|
5814
|
+
// they share stay one element travelling between them.
|
|
5815
|
+
const { start, weekCount } = this._widenedWindow() ?? this.gridWindow();
|
|
5008
5816
|
const days = eachDayOfInterval({
|
|
5009
|
-
start
|
|
5010
|
-
end: addDays(
|
|
5817
|
+
start,
|
|
5818
|
+
end: addDays(start, weekCount * DAYS_PER_WEEK - 1),
|
|
5011
5819
|
});
|
|
5012
5820
|
const weeks = [];
|
|
5013
5821
|
for (let index = 0; index < days.length; index += DAYS_PER_WEEK) {
|
|
@@ -5041,17 +5849,32 @@ class CalendarMonthView {
|
|
|
5041
5849
|
const dayNumber = format(date, DAY_NUMBER_FORMAT, this._dateOptions);
|
|
5042
5850
|
const inCurrentMonth = isSameMonth(date, activeDate);
|
|
5043
5851
|
const isToday = isSameDay(date, today);
|
|
5852
|
+
const isSelected = selectedDate !== null && isSameDay(date, selectedDate);
|
|
5853
|
+
const isDisabled = !isDayAvailable(date, minDate, dateFilter);
|
|
5044
5854
|
return {
|
|
5045
5855
|
date,
|
|
5046
5856
|
dayNumber,
|
|
5047
5857
|
inCurrentMonth,
|
|
5048
5858
|
isToday,
|
|
5859
|
+
isSelected,
|
|
5860
|
+
isDisabled,
|
|
5049
5861
|
hiddenCount: hiddenPerColumn[column],
|
|
5050
|
-
context: {
|
|
5862
|
+
context: {
|
|
5863
|
+
$implicit: date,
|
|
5864
|
+
isDisabled,
|
|
5865
|
+
dayNumber,
|
|
5866
|
+
inCurrentMonth,
|
|
5867
|
+
isToday,
|
|
5868
|
+
isSelected,
|
|
5869
|
+
events: dayEvents,
|
|
5870
|
+
},
|
|
5051
5871
|
eventCount: dayEvents.length,
|
|
5872
|
+
markersLabel: markersLabel
|
|
5873
|
+
? markersLabel(dayEvents)
|
|
5874
|
+
: this._config.labels.eventCount(dayEvents.length),
|
|
5052
5875
|
markers: dayEvents.slice(0, MAX_DAY_MARKERS).map(event => ({
|
|
5053
5876
|
id: event.id,
|
|
5054
|
-
classes: this._markerClasses(event
|
|
5877
|
+
classes: this._markerClasses(event),
|
|
5055
5878
|
})),
|
|
5056
5879
|
};
|
|
5057
5880
|
});
|
|
@@ -5071,122 +5894,316 @@ class CalendarMonthView {
|
|
|
5071
5894
|
return;
|
|
5072
5895
|
untracked(() => this._scrollBetween(previous, activeDate));
|
|
5073
5896
|
});
|
|
5897
|
+
this._pan.panStart.subscribe(event => this._onDragStart(event));
|
|
5898
|
+
this._pan.panMove.subscribe(event => this._onDragMove(event));
|
|
5899
|
+
this._pan.panEnd.subscribe(event => this._onDragEnd(event));
|
|
5900
|
+
this._pan.panCancel.subscribe(() => this._onDragCancel());
|
|
5901
|
+
// A fitted grid's rows change height with the space it is given, and so does the number
|
|
5902
|
+
// of bars each can hold; the grid's own size is what tracks that space.
|
|
5903
|
+
afterNextRender(() => {
|
|
5904
|
+
// An environment without layout (a test DOM) has nothing to measure.
|
|
5905
|
+
if (typeof ResizeObserver === 'undefined')
|
|
5906
|
+
return;
|
|
5907
|
+
const observer = new ResizeObserver(() => this._measureLanes());
|
|
5908
|
+
observer.observe(this._grid().nativeElement);
|
|
5909
|
+
this._destroyRef.onDestroy(() => observer.disconnect());
|
|
5910
|
+
}, { injector: this._injector });
|
|
5074
5911
|
}
|
|
5075
5912
|
// Protected methods
|
|
5076
5913
|
/** Localized "+N more" label for a day cell with `count` hidden events. */
|
|
5077
5914
|
moreLabel(count) {
|
|
5078
5915
|
return this._config.labels.more(count);
|
|
5079
5916
|
}
|
|
5080
|
-
/**
|
|
5081
|
-
|
|
5082
|
-
|
|
5917
|
+
/** Picks a day by pointer or Enter; a disabled day stays focusable but picks nothing. */
|
|
5918
|
+
onDayPick(day) {
|
|
5919
|
+
if (!day.isDisabled)
|
|
5920
|
+
this.dateSelect.emit(day.date);
|
|
5083
5921
|
}
|
|
5084
|
-
/** Space would scroll the page; consume it and
|
|
5085
|
-
onDaySpace(event,
|
|
5922
|
+
/** Space would scroll the page; consume it and pick the focused day instead. */
|
|
5923
|
+
onDaySpace(event, day) {
|
|
5086
5924
|
event.preventDefault();
|
|
5087
|
-
this.
|
|
5925
|
+
this.onDayPick(day);
|
|
5088
5926
|
}
|
|
5089
5927
|
// Private methods
|
|
5090
5928
|
/**
|
|
5091
5929
|
* Slides the grid from `from`'s window to `to`'s: the union of both windows renders at once,
|
|
5092
|
-
* pinned to the resting row height, and
|
|
5093
|
-
*
|
|
5094
|
-
*
|
|
5095
|
-
*
|
|
5096
|
-
* Style writes go to the element directly: the jump to the outgoing offset must paint with
|
|
5097
|
-
* the widened render, and the cleanup must paint with the collapsed one — frame boundaries a
|
|
5098
|
-
* template binding cannot express.
|
|
5930
|
+
* pinned to the resting row height, and the grid settles from the outgoing offset to the
|
|
5931
|
+
* incoming one. Rows the windows share keep their DOM identity, so their cells cross-fade
|
|
5932
|
+
* out of the outside dimming in place rather than being rebuilt.
|
|
5099
5933
|
*/
|
|
5100
5934
|
_scrollBetween(from, to) {
|
|
5935
|
+
// A paging drag that committed to this month is already settling the grid there.
|
|
5936
|
+
const pageTarget = this._pageTarget;
|
|
5937
|
+
this._pageTarget = null;
|
|
5938
|
+
if (pageTarget && isSameMonth(pageTarget, to))
|
|
5939
|
+
return;
|
|
5940
|
+
// A navigation while a finger holds the grid (a second pointer on a header control) lets
|
|
5941
|
+
// go of the drag; the pan's remaining moves then find no drag to steer.
|
|
5942
|
+
this._drag = null;
|
|
5101
5943
|
const plan = buildMonthScrollPlan(from, to, this.weekStartsOn(), this.peekWeeks());
|
|
5944
|
+
// Settled at once whether or not this navigation scrolls, so the grid is measured at rest
|
|
5945
|
+
// and a far jump is never left showing the window of the scroll before it.
|
|
5946
|
+
if (this._widenedWindow())
|
|
5947
|
+
this._collapse();
|
|
5102
5948
|
if (!plan)
|
|
5103
5949
|
return;
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
if (this._finalizeScroll)
|
|
5107
|
-
this._finalizeScroll();
|
|
5108
|
-
const grid = this._grid().nativeElement;
|
|
5109
|
-
const restingHeight = grid.getBoundingClientRect().height;
|
|
5110
|
-
// Nothing visible to scroll (display: none, detached test DOM) — swap without ceremony.
|
|
5111
|
-
if (restingHeight === 0)
|
|
5950
|
+
const rowHeight = this._measureRowHeight();
|
|
5951
|
+
if (rowHeight === null)
|
|
5112
5952
|
return;
|
|
5113
|
-
const
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
const viewport = grid.parentElement;
|
|
5118
|
-
if (viewport)
|
|
5119
|
-
viewport.style.height = `${viewport.getBoundingClientRect().height}px`;
|
|
5120
|
-
this._scrollPlan.set(plan);
|
|
5121
|
-
grid.classList.add('tls-calendar-month-view__grid--scrolling');
|
|
5122
|
-
grid.style.setProperty('--tls-calendar-scroll-row-height', `${rowHeight}px`);
|
|
5123
|
-
// The jump to the outgoing offset must not itself transition: the measurements above
|
|
5124
|
-
// flushed a style pass holding the resting translate, so without the inline suppression
|
|
5125
|
-
// the browser reads the jump as a change to animate from rest.
|
|
5126
|
-
grid.style.transition = 'none';
|
|
5127
|
-
grid.style.translate = `0 ${-plan.fromRow * rowHeight}px`;
|
|
5128
|
-
const finalize = () => {
|
|
5129
|
-
if (this._finalizeScroll !== finalize)
|
|
5130
|
-
return;
|
|
5131
|
-
this._finalizeScroll = null;
|
|
5132
|
-
grid.removeEventListener('transitionend', onTransitionEnd);
|
|
5133
|
-
// Collapse to the resting render and clear the scroll styles within one task, so the
|
|
5134
|
-
// incoming window's rows and the reset translate paint together, pixel-identical to
|
|
5135
|
-
// the scroll's final frame.
|
|
5136
|
-
this._scrollPlan.set(null);
|
|
5137
|
-
this._changeDetectorRef.detectChanges();
|
|
5138
|
-
grid.classList.remove('tls-calendar-month-view__grid--scrolling');
|
|
5139
|
-
grid.style.transition = '';
|
|
5140
|
-
grid.style.translate = '';
|
|
5141
|
-
grid.style.removeProperty('--tls-calendar-scroll-row-height');
|
|
5142
|
-
if (viewport)
|
|
5143
|
-
viewport.style.height = '';
|
|
5144
|
-
};
|
|
5145
|
-
this._finalizeScroll = finalize;
|
|
5146
|
-
const onTransitionEnd = (event) => {
|
|
5147
|
-
if (event.target === grid && event.propertyName === 'translate')
|
|
5148
|
-
finalize();
|
|
5149
|
-
};
|
|
5150
|
-
grid.addEventListener('transitionend', onTransitionEnd);
|
|
5953
|
+
const window = { start: plan.unionStart, weekCount: plan.weekCount };
|
|
5954
|
+
this._widen(window, rowHeight);
|
|
5955
|
+
this.motion.begin(this._surface());
|
|
5956
|
+
this.motion.follow(-plan.fromRow * rowHeight);
|
|
5151
5957
|
afterNextRender(() => {
|
|
5152
|
-
// The union rows are in the DOM at the outgoing offset; give them a painted frame,
|
|
5153
|
-
//
|
|
5958
|
+
// The union rows are in the DOM at the outgoing offset; give them a painted frame, or
|
|
5959
|
+
// the settle would start from the resting grid rather than from that offset.
|
|
5154
5960
|
requestAnimationFrame(() => {
|
|
5155
|
-
|
|
5961
|
+
// A later navigation or drag has taken the grid since.
|
|
5962
|
+
if (this._widenedWindow() !== window)
|
|
5156
5963
|
return;
|
|
5157
|
-
|
|
5158
|
-
grid.style.translate = `0 ${-plan.toRow * rowHeight}px`;
|
|
5159
|
-
// With motion disabled the transition never runs, so no `transitionend` would ever
|
|
5160
|
-
// settle the scroll — resolve it as an instant swap instead.
|
|
5161
|
-
requestAnimationFrame(() => {
|
|
5162
|
-
if (this._finalizeScroll !== finalize)
|
|
5163
|
-
return;
|
|
5164
|
-
if (!parseFloat(getComputedStyle(grid).transitionDuration))
|
|
5165
|
-
finalize();
|
|
5166
|
-
});
|
|
5964
|
+
this.motion.settle(-plan.toRow * rowHeight, () => this._collapse());
|
|
5167
5965
|
});
|
|
5168
5966
|
}, { injector: this._injector });
|
|
5169
5967
|
}
|
|
5170
|
-
|
|
5968
|
+
/**
|
|
5969
|
+
* Takes the grid under the finger: the neighbouring months render either side of the active
|
|
5970
|
+
* one, so the drag reveals whichever it heads toward. A grid still settling or scrolling is
|
|
5971
|
+
* caught where it is drawn rather than snapped to its destination first.
|
|
5972
|
+
*/
|
|
5973
|
+
_onDragStart(event) {
|
|
5974
|
+
const caught = this._catchMotion();
|
|
5975
|
+
const rowHeight = this._measureRowHeight();
|
|
5976
|
+
if (rowHeight === null)
|
|
5977
|
+
return;
|
|
5978
|
+
const plan = buildMonthDragPlan(this.activeDate(), this.weekStartsOn(), this.peekWeeks());
|
|
5979
|
+
let origin = 0;
|
|
5980
|
+
if (caught) {
|
|
5981
|
+
// The caught grid rendered another window; the same rows sit this many further down in
|
|
5982
|
+
// the drag's, so the translate that keeps them on screen grows by as many rows.
|
|
5983
|
+
const shiftRows = differenceInCalendarDays(plan.window.start, caught.windowStart) / DAYS_PER_WEEK;
|
|
5984
|
+
const position = caught.translate + (shiftRows + plan.previousRows) * rowHeight;
|
|
5985
|
+
// The drag damps the travel it is handed toward a month it cannot page to, so a grid
|
|
5986
|
+
// caught already stretched that way is handed the travel that stretched it that far.
|
|
5987
|
+
origin =
|
|
5988
|
+
position > 0 && !this.canPageBack() ? position * PAGING_EDGE_RESISTANCE : position;
|
|
5989
|
+
}
|
|
5990
|
+
const drag = { plan, rowHeight, origin, lockDelta: event.deltaY };
|
|
5991
|
+
this._drag = drag;
|
|
5992
|
+
this._widen(plan.window, rowHeight);
|
|
5993
|
+
this.motion.begin(this._surface());
|
|
5994
|
+
this.motion.follow(this._dragTranslate(drag, event.deltaY));
|
|
5995
|
+
// The widened rows and the class that hands the transform to the drag must be in the DOM
|
|
5996
|
+
// before the shifted grid paints, or the frame between would show the resting rows moved.
|
|
5997
|
+
this._changeDetectorRef.detectChanges();
|
|
5998
|
+
}
|
|
5999
|
+
/**
|
|
6000
|
+
* Fired at pointer rate outside the Angular zone (see {@link PanDirective}), so the grid is
|
|
6001
|
+
* moved by a direct style write rather than through a binding.
|
|
6002
|
+
*/
|
|
6003
|
+
_onDragMove(event) {
|
|
6004
|
+
if (this._drag)
|
|
6005
|
+
this.motion.follow(this._dragTranslate(this._drag, event.deltaY));
|
|
6006
|
+
}
|
|
6007
|
+
/**
|
|
6008
|
+
* Lets the grid go: a release past the commit point, or a flick, settles on the month it was
|
|
6009
|
+
* heading for and asks to page there; anything else settles back to rest. Either way the
|
|
6010
|
+
* settle carries on at the pace the grid was moving.
|
|
6011
|
+
*/
|
|
6012
|
+
_onDragEnd(event) {
|
|
6013
|
+
const drag = this._drag;
|
|
6014
|
+
if (!drag)
|
|
6015
|
+
return;
|
|
6016
|
+
this._drag = null;
|
|
6017
|
+
const { plan, rowHeight } = drag;
|
|
6018
|
+
const offset = this._dragOffset(drag, event.deltaY);
|
|
6019
|
+
const heading = resolvePagingStep({
|
|
6020
|
+
offset,
|
|
6021
|
+
velocity: event.velocityY,
|
|
6022
|
+
extent: (offset < 0 ? plan.nextRows : plan.previousRows) * rowHeight,
|
|
6023
|
+
commitRatio: PAGING_COMMIT_RATIO,
|
|
6024
|
+
flickVelocity: PAGING_FLICK_VELOCITY,
|
|
6025
|
+
});
|
|
6026
|
+
// The grid carried up brings on the next month waiting below it, and carried down the
|
|
6027
|
+
// previous one above — where there is one to page to.
|
|
6028
|
+
let step = null;
|
|
6029
|
+
let targetRow = plan.previousRows;
|
|
6030
|
+
if (heading < 0) {
|
|
6031
|
+
step = 1;
|
|
6032
|
+
targetRow = plan.previousRows + plan.nextRows;
|
|
6033
|
+
}
|
|
6034
|
+
if (heading > 0 && this.canPageBack()) {
|
|
6035
|
+
step = -1;
|
|
6036
|
+
targetRow = 0;
|
|
6037
|
+
}
|
|
6038
|
+
this.motion.settle(-targetRow * rowHeight, () => this._collapse(), this._gridVelocity(drag, event.deltaY, event.velocityY));
|
|
6039
|
+
if (step === null)
|
|
6040
|
+
return;
|
|
6041
|
+
this._pageTarget = addMonths(this.activeDate(), step);
|
|
6042
|
+
this.page.emit(step);
|
|
6043
|
+
}
|
|
6044
|
+
/** The platform took the pointer back mid-drag; the grid settles back to rest. */
|
|
6045
|
+
_onDragCancel() {
|
|
6046
|
+
const drag = this._drag;
|
|
6047
|
+
if (!drag)
|
|
6048
|
+
return;
|
|
6049
|
+
this._drag = null;
|
|
6050
|
+
this.motion.settle(-drag.plan.previousRows * drag.rowHeight, () => this._collapse());
|
|
6051
|
+
}
|
|
6052
|
+
/**
|
|
6053
|
+
* How far from rest the drag carries the grid, in px: the finger's travel since the gesture
|
|
6054
|
+
* locked, added to where the grid stood when taken. Toward a month that cannot be paged to
|
|
6055
|
+
* it only stretches, and it never travels past the neighbouring month's grid, beyond which
|
|
6056
|
+
* the drag renders nothing.
|
|
6057
|
+
*/
|
|
6058
|
+
_dragOffset(drag, deltaY) {
|
|
6059
|
+
const { plan, rowHeight } = drag;
|
|
6060
|
+
const travel = drag.origin + deltaY - drag.lockDelta;
|
|
6061
|
+
// Positive travel pulls the month above — the previous one — into view.
|
|
6062
|
+
const resisted = resistPagingDrag(travel, travel < 0 || this.canPageBack(), PAGING_EDGE_RESISTANCE);
|
|
6063
|
+
return Math.min(Math.max(resisted, -plan.nextRows * rowHeight), plan.previousRows * rowHeight);
|
|
6064
|
+
}
|
|
6065
|
+
/** The grid's translate for a drag at `deltaY`: the drag's offset from the resting row. */
|
|
6066
|
+
_dragTranslate(drag, deltaY) {
|
|
6067
|
+
return -drag.plan.previousRows * drag.rowHeight + this._dragOffset(drag, deltaY);
|
|
6068
|
+
}
|
|
6069
|
+
/**
|
|
6070
|
+
* The grid's own speed in px/ms while the finger moves at `velocity`, which the settle
|
|
6071
|
+
* launches from: as fast as the finger where the grid follows it, damped where the drag only
|
|
6072
|
+
* stretches, and still where the drag holds it at the end of its window.
|
|
6073
|
+
*/
|
|
6074
|
+
_gridVelocity(drag, deltaY, velocity) {
|
|
6075
|
+
const { plan, rowHeight } = drag;
|
|
6076
|
+
const offset = this._dragOffset(drag, deltaY);
|
|
6077
|
+
if (offset === -plan.nextRows * rowHeight || offset === plan.previousRows * rowHeight)
|
|
6078
|
+
return 0;
|
|
6079
|
+
const stretched = drag.origin + deltaY - drag.lockDelta > 0 && !this.canPageBack();
|
|
6080
|
+
return stretched ? velocity / PAGING_EDGE_RESISTANCE : velocity;
|
|
6081
|
+
}
|
|
6082
|
+
/** One resting week row's height in px, or null where nothing is laid out to measure. */
|
|
6083
|
+
_measureRowHeight() {
|
|
6084
|
+
const restingHeight = this._grid().nativeElement.getBoundingClientRect().height;
|
|
6085
|
+
// Nothing visible to move (display: none, detached test DOM).
|
|
6086
|
+
if (restingHeight === 0)
|
|
6087
|
+
return null;
|
|
6088
|
+
return restingHeight / this.gridWindow().weekCount;
|
|
6089
|
+
}
|
|
6090
|
+
/**
|
|
6091
|
+
* Renders `window` in place of the resting grid with its rows pinned to `rowHeight`. The
|
|
6092
|
+
* viewport wraps the resting grid, so its own height (grid plus its border) is held while
|
|
6093
|
+
* the widened grid overflows it. Written to the elements directly, so they apply in the same
|
|
6094
|
+
* task as the widened render rather than a render pass later.
|
|
6095
|
+
*/
|
|
6096
|
+
_widen(window, rowHeight) {
|
|
6097
|
+
const grid = this._grid().nativeElement;
|
|
6098
|
+
const viewport = grid.parentElement;
|
|
6099
|
+
if (viewport)
|
|
6100
|
+
viewport.style.height = `${viewport.getBoundingClientRect().height}px`;
|
|
6101
|
+
this._widenedWindow.set(window);
|
|
6102
|
+
grid.style.setProperty(MONTH_GRID_ROW_HEIGHT_PROPERTY, `${rowHeight}px`);
|
|
6103
|
+
}
|
|
6104
|
+
/** The grid as the motion moves it: no scrim, and a release paging decides for itself. */
|
|
6105
|
+
_surface() {
|
|
6106
|
+
return { panel: this._grid().nativeElement, backdrop: null };
|
|
6107
|
+
}
|
|
6108
|
+
/**
|
|
6109
|
+
* Settles the widened grid at rest at once, reporting where it was drawn so a drag can take
|
|
6110
|
+
* it from there; null when the grid was already at rest.
|
|
6111
|
+
*/
|
|
6112
|
+
_catchMotion() {
|
|
6113
|
+
const window = this._widenedWindow();
|
|
6114
|
+
if (window === null)
|
|
6115
|
+
return null;
|
|
6116
|
+
// Read before the collapse: a grid mid-settle is drawn at its running value, not its target.
|
|
6117
|
+
const { y } = drawnTranslation(this._grid().nativeElement);
|
|
6118
|
+
this._collapse();
|
|
6119
|
+
return { windowStart: window.start, translate: y };
|
|
6120
|
+
}
|
|
6121
|
+
/**
|
|
6122
|
+
* Collapses to the resting render and lets go of the grid within one task, so the resting
|
|
6123
|
+
* rows and the untranslated grid paint together, pixel-identical to the motion's last frame.
|
|
6124
|
+
* Letting go supersedes a settle still running, which then never reports.
|
|
6125
|
+
*/
|
|
6126
|
+
_collapse() {
|
|
6127
|
+
const grid = this._grid().nativeElement;
|
|
6128
|
+
const viewport = grid.parentElement;
|
|
6129
|
+
// A page the consumer never followed leaves nothing to arrive.
|
|
6130
|
+
this._pageTarget = null;
|
|
6131
|
+
this.motion.rest();
|
|
6132
|
+
this._widenedWindow.set(null);
|
|
6133
|
+
this._changeDetectorRef.detectChanges();
|
|
6134
|
+
grid.style.removeProperty(MONTH_GRID_ROW_HEIGHT_PROPERTY);
|
|
6135
|
+
if (viewport)
|
|
6136
|
+
viewport.style.height = '';
|
|
6137
|
+
}
|
|
6138
|
+
/**
|
|
6139
|
+
* Reads how many lanes a week row has room for from its bar overlay, which spans exactly
|
|
6140
|
+
* the row's room for bars: below the day number, above the "+N more" line.
|
|
6141
|
+
*/
|
|
6142
|
+
_measureLanes() {
|
|
6143
|
+
const [first] = this._bars();
|
|
6144
|
+
if (!this.fitHeight() || !first)
|
|
6145
|
+
return;
|
|
6146
|
+
const bars = first.nativeElement;
|
|
6147
|
+
// The dense layout does not lay the bars out; they hold no room to measure.
|
|
6148
|
+
if (bars.clientHeight === 0) {
|
|
6149
|
+
this._fittingLanes.set(null);
|
|
6150
|
+
return;
|
|
6151
|
+
}
|
|
6152
|
+
const style = getComputedStyle(bars);
|
|
6153
|
+
this._fittingLanes.set(fitLanes(bars.clientHeight, parseFloat(style.gridAutoRows), parseFloat(style.rowGap)));
|
|
6154
|
+
}
|
|
6155
|
+
_markerClasses(event) {
|
|
5171
6156
|
const classes = ['tls-calendar-month-view__marker'];
|
|
5172
|
-
if (
|
|
5173
|
-
classes.push(`tls-calendar-month-view__marker--${
|
|
6157
|
+
if (event.marker && event.marker !== 'dot') {
|
|
6158
|
+
classes.push(`tls-calendar-month-view__marker--${event.marker}`);
|
|
6159
|
+
}
|
|
6160
|
+
if (event.color)
|
|
6161
|
+
classes.push(`tls-calendar-month-view__marker--${event.color}`);
|
|
5174
6162
|
return classes;
|
|
5175
6163
|
}
|
|
5176
6164
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5177
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarMonthView, isStandalone: true, selector: "tls-calendar-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: true, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null },
|
|
6165
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CalendarMonthView, isStandalone: true, selector: "tls-calendar-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: true, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null }, fitHeight: { classPropertyName: "fitHeight", publicName: "fitHeight", isSignal: true, isRequired: false, transformFunction: null }, peekWeeks: { classPropertyName: "peekWeeks", publicName: "peekWeeks", isSignal: true, isRequired: false, transformFunction: null }, eventTemplate: { classPropertyName: "eventTemplate", publicName: "eventTemplate", isSignal: true, isRequired: false, transformFunction: null }, dayTemplate: { classPropertyName: "dayTemplate", publicName: "dayTemplate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, markersLabel: { classPropertyName: "markersLabel", publicName: "markersLabel", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, canPageBack: { classPropertyName: "canPageBack", publicName: "canPageBack", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelect: "dateSelect", eventSelect: "eventSelect", page: "page" }, host: { properties: { "class.tls-calendar-month-view--square": "squareCells()", "class.tls-calendar-month-view--fit": "fitHeight()", "class.tls-calendar-month-view--peek": "peekWeeks().before + peekWeeks().after > 0", "style.--tls-calendar-peek-weeks-before": "peekWeeks().before", "style.--tls-calendar-peek-weeks-after": "peekWeeks().after", "style.--tls-calendar-week-rows": "gridWindow().weekCount" }, classAttribute: "tls-calendar-month-view" }, providers: [
|
|
6166
|
+
{
|
|
6167
|
+
// The gesture's shape is fixed, so it arrives through the token rather than as bindings.
|
|
6168
|
+
// Provided on this element it also overrides any ancestor gesture (a pull-to-refresh pane)
|
|
6169
|
+
// that reconfigures pans for its whole subtree, and the `touch-action` claim it keeps is
|
|
6170
|
+
// exactly what tells such an ancestor to stand aside.
|
|
6171
|
+
provide: PAN_CONFIG,
|
|
6172
|
+
useValue: {
|
|
6173
|
+
...DEFAULT_PAN_CONFIG,
|
|
6174
|
+
enabled: false,
|
|
6175
|
+
axis: 'y',
|
|
6176
|
+
pointerTypes: SWIPE_POINTER_TYPES,
|
|
6177
|
+
},
|
|
6178
|
+
},
|
|
6179
|
+
], viewQueries: [{ propertyName: "_grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }, { propertyName: "_bars", predicate: ["bars"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.PanDirective, inputs: ["tlsPan", "paging"] }], 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<!-- The viewport holds the grid's outer border and resting height, clipping the widened\n grid while a month-navigation scroll slides it through. -->\n<div class=\"tls-calendar-month-view__viewport\">\n <div\n ngGrid\n #grid\n class=\"tls-calendar-month-view__grid\"\n [class.tls-calendar-month-view__grid--selectable]=\"selectedDate() !== null\"\n [class.tls-calendar-month-view__grid--dragging]=\"motion.state() === 'dragging'\"\n [class.tls-calendar-month-view__grid--settling]=\"motion.state() === 'settling'\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n selectionMode=\"explicit\"\n [enableSelection]=\"selectedDate() !== null\"\n [attr.aria-label]=\"label() ?? null\"\n [style.--tls-calendar-max-lanes]=\"lanes()\"\n >\n <!-- Keyed by date so the rows two month windows share keep their DOM identity across a\n navigation scroll, travelling instead of being rebuilt. -->\n @for (week of weeks(); track week.days[0].date.getTime()) {\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 tlsRipple\n [class.tls-calendar-month-view__day--outside]=\"!cell.inCurrentMonth\"\n [class.tls-calendar-month-view__day--today]=\"cell.isToday\"\n [class.tls-calendar-month-view__day--selected]=\"cell.isSelected\"\n [class.tls-calendar-month-view__day--disabled]=\"cell.isDisabled\"\n [selected]=\"cell.isSelected\"\n [disabled]=\"cell.isDisabled\"\n [rippleDisabled]=\"cell.isDisabled\"\n (click)=\"onDayPick(cell)\"\n (keydown.enter)=\"onDayPick(cell)\"\n (keydown.space)=\"onDaySpace($event, cell)\"\n >\n @if (dayTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n <span class=\"tls-calendar-month-view__day-number\">{{ cell.dayNumber }}</span>\n\n <!-- Dots stand in for the event bars in the dense layout, which hides those instead. -->\n @if (cell.eventCount > 0) {\n <span class=\"tls-calendar-month-view__markers\">\n <span class=\"tls-calendar-month-view__markers-label\">\n {{ cell.markersLabel }}\n </span>\n\n @for (marker of cell.markers; track marker.id) {\n <span [class]=\"marker.classes\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n\n @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\n }\n }\n </div>\n }\n\n <!-- Event bars span day columns and stack by lane, overlaid on the cells above. -->\n <div #bars 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</div>\n", dependencies: [{ kind: "directive", type: Grid, selector: "[ngGrid]", inputs: ["enableSelection", "disabled", "softDisabled", "focusMode", "rowWrap", "colWrap", "multi", "selectionMode", "tabindex"], exportAs: ["ngGrid"] }, { kind: "directive", type: GridRow, selector: "[ngGridRow]", inputs: ["rowIndex"], exportAs: ["ngGridRow"] }, { kind: "directive", type: GridCell, selector: "[ngGridCell]", inputs: ["id", "role", "rowSpan", "colSpan", "rowIndex", "colIndex", "disabled", "selected", "selectable", "tabindex"], outputs: ["selectedChange"], exportAs: ["ngGridCell"] }, { kind: "component", type: CalendarEventItem, selector: "tls-calendar-event", inputs: ["event", "view", "template"], outputs: ["activate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RippleDirective, selector: "[tlsRipple]", inputs: ["rippleDisabled", "ripplePointerTypes", "rippleSurface"] }] });
|
|
5178
6180
|
}
|
|
5179
6181
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CalendarMonthView, decorators: [{
|
|
5180
6182
|
type: Component,
|
|
5181
|
-
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem, NgTemplateOutlet, RippleDirective],
|
|
6183
|
+
args: [{ selector: 'tls-calendar-month-view', imports: [Grid, GridRow, GridCell, CalendarEventItem, NgTemplateOutlet, RippleDirective], hostDirectives: [{ directive: PanDirective, inputs: ['tlsPan: paging'] }], providers: [
|
|
6184
|
+
{
|
|
6185
|
+
// The gesture's shape is fixed, so it arrives through the token rather than as bindings.
|
|
6186
|
+
// Provided on this element it also overrides any ancestor gesture (a pull-to-refresh pane)
|
|
6187
|
+
// that reconfigures pans for its whole subtree, and the `touch-action` claim it keeps is
|
|
6188
|
+
// exactly what tells such an ancestor to stand aside.
|
|
6189
|
+
provide: PAN_CONFIG,
|
|
6190
|
+
useValue: {
|
|
6191
|
+
...DEFAULT_PAN_CONFIG,
|
|
6192
|
+
enabled: false,
|
|
6193
|
+
axis: 'y',
|
|
6194
|
+
pointerTypes: SWIPE_POINTER_TYPES,
|
|
6195
|
+
},
|
|
6196
|
+
},
|
|
6197
|
+
], host: {
|
|
5182
6198
|
class: 'tls-calendar-month-view',
|
|
5183
6199
|
'[class.tls-calendar-month-view--square]': 'squareCells()',
|
|
6200
|
+
'[class.tls-calendar-month-view--fit]': 'fitHeight()',
|
|
5184
6201
|
'[class.tls-calendar-month-view--peek]': 'peekWeeks().before + peekWeeks().after > 0',
|
|
5185
6202
|
'[style.--tls-calendar-peek-weeks-before]': 'peekWeeks().before',
|
|
5186
6203
|
'[style.--tls-calendar-peek-weeks-after]': 'peekWeeks().after',
|
|
5187
6204
|
'[style.--tls-calendar-week-rows]': 'gridWindow().weekCount',
|
|
5188
|
-
}, 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<!-- The viewport holds the grid's outer border and resting height, clipping the widened\n grid while a month-navigation scroll slides it through. -->\n<div class=\"tls-calendar-month-view__viewport\">\n <div\n ngGrid\n #grid\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]=\"
|
|
5189
|
-
}], ctorParameters: () => [], propDecorators: { activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }], events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: true }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], peekWeeks: [{ type: i0.Input, args: [{ isSignal: true, alias: "peekWeeks", required: false }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", required: false }] }], dayTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "dayTemplate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], _grid: [{ type: i0.ViewChild, args: ['grid', { isSignal: true }] }] } });
|
|
6205
|
+
}, 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<!-- The viewport holds the grid's outer border and resting height, clipping the widened\n grid while a month-navigation scroll slides it through. -->\n<div class=\"tls-calendar-month-view__viewport\">\n <div\n ngGrid\n #grid\n class=\"tls-calendar-month-view__grid\"\n [class.tls-calendar-month-view__grid--selectable]=\"selectedDate() !== null\"\n [class.tls-calendar-month-view__grid--dragging]=\"motion.state() === 'dragging'\"\n [class.tls-calendar-month-view__grid--settling]=\"motion.state() === 'settling'\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n selectionMode=\"explicit\"\n [enableSelection]=\"selectedDate() !== null\"\n [attr.aria-label]=\"label() ?? null\"\n [style.--tls-calendar-max-lanes]=\"lanes()\"\n >\n <!-- Keyed by date so the rows two month windows share keep their DOM identity across a\n navigation scroll, travelling instead of being rebuilt. -->\n @for (week of weeks(); track week.days[0].date.getTime()) {\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 tlsRipple\n [class.tls-calendar-month-view__day--outside]=\"!cell.inCurrentMonth\"\n [class.tls-calendar-month-view__day--today]=\"cell.isToday\"\n [class.tls-calendar-month-view__day--selected]=\"cell.isSelected\"\n [class.tls-calendar-month-view__day--disabled]=\"cell.isDisabled\"\n [selected]=\"cell.isSelected\"\n [disabled]=\"cell.isDisabled\"\n [rippleDisabled]=\"cell.isDisabled\"\n (click)=\"onDayPick(cell)\"\n (keydown.enter)=\"onDayPick(cell)\"\n (keydown.space)=\"onDaySpace($event, cell)\"\n >\n @if (dayTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"cell.context\" />\n } @else {\n <span class=\"tls-calendar-month-view__day-number\">{{ cell.dayNumber }}</span>\n\n <!-- Dots stand in for the event bars in the dense layout, which hides those instead. -->\n @if (cell.eventCount > 0) {\n <span class=\"tls-calendar-month-view__markers\">\n <span class=\"tls-calendar-month-view__markers-label\">\n {{ cell.markersLabel }}\n </span>\n\n @for (marker of cell.markers; track marker.id) {\n <span [class]=\"marker.classes\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n\n @if (cell.hiddenCount > 0) {\n <span class=\"tls-calendar-month-view__more\">{{ moreLabel(cell.hiddenCount) }}</span>\n }\n }\n </div>\n }\n\n <!-- Event bars span day columns and stack by lane, overlaid on the cells above. -->\n <div #bars 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</div>\n" }]
|
|
6206
|
+
}], ctorParameters: () => [], propDecorators: { activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }], events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: true }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], fitHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "fitHeight", required: false }] }], peekWeeks: [{ type: i0.Input, args: [{ isSignal: true, alias: "peekWeeks", required: false }] }], eventTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "eventTemplate", required: false }] }], dayTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "dayTemplate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }], markersLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "markersLabel", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], canPageBack: [{ type: i0.Input, args: [{ isSignal: true, alias: "canPageBack", required: false }] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], page: [{ type: i0.Output, args: ["page"] }], _grid: [{ type: i0.ViewChild, args: ['grid', { isSignal: true }] }], _bars: [{ type: i0.ViewChildren, args: ['bars', { isSignal: true }] }] } });
|
|
5190
6207
|
|
|
5191
6208
|
const eventEnd = (event) => (event.end ?? event.start).getTime();
|
|
5192
6209
|
/**
|
|
@@ -5401,9 +6418,17 @@ class Calendar {
|
|
|
5401
6418
|
// Inputs
|
|
5402
6419
|
events = input([], /* @ts-ignore */
|
|
5403
6420
|
...(ngDevMode ? [{ debugName: "events" }] : /* istanbul ignore next */ []));
|
|
5404
|
-
|
|
6421
|
+
/**
|
|
6422
|
+
* First day of the week (`date-fns` convention: 0 = Sunday) for this instance alone. Unset, it
|
|
6423
|
+
* follows the component config's `weekStartsOn`, then the app-wide `WEEK_STARTS_ON`.
|
|
6424
|
+
*/
|
|
6425
|
+
weekStartsOn = input(undefined, /* @ts-ignore */
|
|
5405
6426
|
...(ngDevMode ? [{ debugName: "weekStartsOn" }] : /* istanbul ignore next */ []));
|
|
5406
|
-
|
|
6427
|
+
/**
|
|
6428
|
+
* Weekday names, Sunday first, for this instance alone. Unset, they follow the component
|
|
6429
|
+
* config's `weekDays`, then the configured `date-fns` locale.
|
|
6430
|
+
*/
|
|
6431
|
+
weekDays = input(undefined, /* @ts-ignore */
|
|
5407
6432
|
...(ngDevMode ? [{ debugName: "weekDays" }] : /* istanbul ignore next */ []));
|
|
5408
6433
|
hourStart = input(this._config.hourStart, /* @ts-ignore */
|
|
5409
6434
|
...(ngDevMode ? [{ debugName: "hourStart" }] : /* istanbul ignore next */ []));
|
|
@@ -5445,8 +6470,17 @@ class Calendar {
|
|
|
5445
6470
|
squareCells = input(false, /* @ts-ignore */
|
|
5446
6471
|
...(ngDevMode ? [{ debugName: "squareCells" }] : /* istanbul ignore next */ []));
|
|
5447
6472
|
/**
|
|
5448
|
-
* Whether
|
|
5449
|
-
*
|
|
6473
|
+
* Whether the month grid fills the height its host is given rather than growing to its
|
|
6474
|
+
* events: the weeks share that height, and each day shows as many event bars as fit,
|
|
6475
|
+
* counting the rest in its "+N more" — never more than `maxEventsPerDay`. Needs a host
|
|
6476
|
+
* with a definite height; without one the rows settle at their smallest.
|
|
6477
|
+
*/
|
|
6478
|
+
fitHeight = input(false, /* @ts-ignore */
|
|
6479
|
+
...(ngDevMode ? [{ debugName: "fitHeight" }] : /* istanbul ignore next */ []));
|
|
6480
|
+
/**
|
|
6481
|
+
* Whether a vertical touch drag over the month grid pages the calendar: the grid follows the
|
|
6482
|
+
* finger, with the next month waiting below and the previous one above, and settles on
|
|
6483
|
+
* whichever the release commits to. Off by default: the gesture claims vertical pans from the
|
|
5450
6484
|
* browser, so it belongs only on a grid that is not itself inside something it must scroll.
|
|
5451
6485
|
*/
|
|
5452
6486
|
swipeNavigation = input(false, /* @ts-ignore */
|
|
@@ -5463,27 +6497,58 @@ class Calendar {
|
|
|
5463
6497
|
/** Accessible name forwarded to the active view's grid. */
|
|
5464
6498
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
5465
6499
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
6500
|
+
/**
|
|
6501
|
+
* The selected day, drawn and exposed as selected in the month grid. While null — the default —
|
|
6502
|
+
* nothing is selected and the grid exposes no selection at all. Picking a day only emits
|
|
6503
|
+
* `dateSelect`; the consumer decides whether that moves the selection.
|
|
6504
|
+
*/
|
|
6505
|
+
selectedDate = input(null, /* @ts-ignore */
|
|
6506
|
+
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
6507
|
+
/**
|
|
6508
|
+
* Replaces the spoken summary of a day's markers in the dense month layout ("3 events") with the
|
|
6509
|
+
* consumer's own sentence for that day's events, so the marks can say what they mean.
|
|
6510
|
+
*/
|
|
6511
|
+
markersLabel = input(undefined, /* @ts-ignore */
|
|
6512
|
+
...(ngDevMode ? [{ debugName: "markersLabel" }] : /* istanbul ignore next */ []));
|
|
6513
|
+
/**
|
|
6514
|
+
* The earliest day that can be picked. The month grid disables every day before it, and the
|
|
6515
|
+
* previous control stops at the period that holds it, since nothing earlier can be picked.
|
|
6516
|
+
*/
|
|
6517
|
+
minDate = input(null, /* @ts-ignore */
|
|
6518
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
6519
|
+
/** Whether a day can be picked; the month grid disables a day it turns away. */
|
|
6520
|
+
dateFilter = input(null, /* @ts-ignore */
|
|
6521
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
6522
|
+
// Outputs
|
|
6523
|
+
eventSelect = output();
|
|
6524
|
+
dateSelect = output();
|
|
6525
|
+
/** Fires whenever the visible span changes, so consumers can lazy-load that window's events. */
|
|
6526
|
+
rangeChange = output();
|
|
6527
|
+
// State
|
|
5472
6528
|
view = model(this._config.view, /* @ts-ignore */
|
|
5473
6529
|
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
5474
6530
|
/** Anchor date driving the visible range; navigation shifts it by the view's unit. */
|
|
5475
6531
|
activeDate = model(new Date(), /* @ts-ignore */
|
|
5476
6532
|
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
5477
6533
|
labels = this._config.labels;
|
|
5478
|
-
swipePointerTypes = SWIPE_POINTER_TYPES;
|
|
5479
6534
|
eventTemplate = contentChild('eventTemplate', /* @ts-ignore */
|
|
5480
6535
|
...(ngDevMode ? [{ debugName: "eventTemplate" }] : /* istanbul ignore next */ []));
|
|
5481
6536
|
dayTemplate = contentChild('dayTemplate', /* @ts-ignore */
|
|
5482
6537
|
...(ngDevMode ? [{ debugName: "dayTemplate" }] : /* istanbul ignore next */ []));
|
|
5483
|
-
|
|
6538
|
+
/**
|
|
6539
|
+
* Replaces the built-in header with the consumer's own, handed the period and the navigation
|
|
6540
|
+
* through {@link CalendarHeaderContext}. Shown while `showHeader` is on; the switches for the
|
|
6541
|
+
* built-in header's parts do not apply to it.
|
|
6542
|
+
*/
|
|
6543
|
+
headerTemplate = contentChild('headerTemplate', /* @ts-ignore */
|
|
6544
|
+
...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
|
|
5484
6545
|
/** Today, so the "Today" affordance stays correct across midnight. */
|
|
5485
6546
|
_today = createDaySignal(createNowSignal(NOW_REFRESH_INTERVAL_MS));
|
|
5486
6547
|
// Computed
|
|
6548
|
+
/** The first day of the week this instance lays its days out from. */
|
|
6549
|
+
resolvedWeekStartsOn = injectWeekStartsOn(this.weekStartsOn, this._config.weekStartsOn);
|
|
6550
|
+
/** The weekday names this instance heads its days with, Sunday first. */
|
|
6551
|
+
resolvedWeekDays = injectWeekDays(this.weekDays, this._config.weekDays, 'short');
|
|
5487
6552
|
hostClasses = computed(() => {
|
|
5488
6553
|
const classes = ['tls-calendar', `tls-calendar--${this.view()}`];
|
|
5489
6554
|
// Pinned off contributes no class at all, so neither dense rule can match.
|
|
@@ -5503,13 +6568,33 @@ class Calendar {
|
|
|
5503
6568
|
/** Suppresses the header wrapper once every part it would hold is hidden. */
|
|
5504
6569
|
showsHeader = computed(() => this.showHeader() && (this.showNavigation() || this.showTitle() || this.showsViewSwitcher()), /* @ts-ignore */
|
|
5505
6570
|
...(ngDevMode ? [{ debugName: "showsHeader" }] : /* istanbul ignore next */ []));
|
|
6571
|
+
/** Whether an earlier period holds a day that can be picked; false at the one holding `minDate`. */
|
|
6572
|
+
canGoPrevious = computed(() => {
|
|
6573
|
+
const minDate = this.minDate();
|
|
6574
|
+
if (minDate === null)
|
|
6575
|
+
return true;
|
|
6576
|
+
const activeDate = this.activeDate();
|
|
6577
|
+
let periodStart;
|
|
6578
|
+
switch (this.view()) {
|
|
6579
|
+
case 'week':
|
|
6580
|
+
periodStart = startOfWeek(activeDate, { weekStartsOn: this.resolvedWeekStartsOn() });
|
|
6581
|
+
break;
|
|
6582
|
+
case 'day':
|
|
6583
|
+
periodStart = startOfDay(activeDate);
|
|
6584
|
+
break;
|
|
6585
|
+
default:
|
|
6586
|
+
periodStart = startOfMonth(activeDate);
|
|
6587
|
+
}
|
|
6588
|
+
return isAfter(periodStart, startOfDay(minDate));
|
|
6589
|
+
}, /* @ts-ignore */
|
|
6590
|
+
...(ngDevMode ? [{ debugName: "canGoPrevious" }] : /* istanbul ignore next */ []));
|
|
5506
6591
|
/** Whether the active period already includes today, so "Today" would be a no-op. */
|
|
5507
6592
|
isViewingToday = computed(() => {
|
|
5508
6593
|
const activeDate = this.activeDate();
|
|
5509
6594
|
const today = this._today();
|
|
5510
6595
|
switch (this.view()) {
|
|
5511
6596
|
case 'week':
|
|
5512
|
-
return isSameWeek(activeDate, today, { weekStartsOn: this.
|
|
6597
|
+
return isSameWeek(activeDate, today, { weekStartsOn: this.resolvedWeekStartsOn() });
|
|
5513
6598
|
case 'day':
|
|
5514
6599
|
return isSameDay(activeDate, today);
|
|
5515
6600
|
default:
|
|
@@ -5523,15 +6608,26 @@ class Calendar {
|
|
|
5523
6608
|
case 'week':
|
|
5524
6609
|
return this._weekTitle(activeDate);
|
|
5525
6610
|
case 'day':
|
|
5526
|
-
return
|
|
6611
|
+
return titlecaseFirstWord(formatSkeleton(activeDate, DAY_TITLE_OPTIONS, this._locale.dateFns), this._locale.dateFns);
|
|
5527
6612
|
default:
|
|
5528
|
-
return
|
|
6613
|
+
return formatStandalone(activeDate, MONTH_TITLE_FORMAT, this._locale.dateFns);
|
|
5529
6614
|
}
|
|
5530
6615
|
}, /* @ts-ignore */
|
|
5531
6616
|
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
6617
|
+
/** What a consumer's header template is handed; rebuilt as the period or its limits change. */
|
|
6618
|
+
headerContext = computed(() => ({
|
|
6619
|
+
$implicit: this.title(),
|
|
6620
|
+
view: this.view(),
|
|
6621
|
+
canGoPrevious: this.canGoPrevious(),
|
|
6622
|
+
isViewingToday: this.isViewingToday(),
|
|
6623
|
+
previous: () => this.previous(),
|
|
6624
|
+
next: () => this.next(),
|
|
6625
|
+
today: () => this.today(),
|
|
6626
|
+
}), /* @ts-ignore */
|
|
6627
|
+
...(ngDevMode ? [{ debugName: "headerContext" }] : /* istanbul ignore next */ []));
|
|
5532
6628
|
visibleRange = computed(() => {
|
|
5533
6629
|
const activeDate = this.activeDate();
|
|
5534
|
-
const weekStartsOn = this.
|
|
6630
|
+
const weekStartsOn = this.resolvedWeekStartsOn();
|
|
5535
6631
|
switch (this.view()) {
|
|
5536
6632
|
case 'week': {
|
|
5537
6633
|
const { start, end } = this._weekBounds(activeDate);
|
|
@@ -5543,7 +6639,10 @@ class Calendar {
|
|
|
5543
6639
|
}
|
|
5544
6640
|
case 'agenda': {
|
|
5545
6641
|
// The agenda lists the calendar month proper, not the padded grid window.
|
|
5546
|
-
return {
|
|
6642
|
+
return {
|
|
6643
|
+
start: startOfMonth(activeDate),
|
|
6644
|
+
end: startOfDay(addDays(endOfMonth(activeDate), 1)),
|
|
6645
|
+
};
|
|
5547
6646
|
}
|
|
5548
6647
|
default: {
|
|
5549
6648
|
// The month grid's whole window, peek weeks included, so every day it draws is covered.
|
|
@@ -5578,9 +6677,10 @@ class Calendar {
|
|
|
5578
6677
|
next() {
|
|
5579
6678
|
this._step(1);
|
|
5580
6679
|
}
|
|
5581
|
-
/** Moves to the previous period in the current view's unit
|
|
6680
|
+
/** Moves to the previous period in the current view's unit, never before the one holding `minDate`. */
|
|
5582
6681
|
previous() {
|
|
5583
|
-
this.
|
|
6682
|
+
if (this.canGoPrevious())
|
|
6683
|
+
this._step(-1);
|
|
5584
6684
|
}
|
|
5585
6685
|
/** Snaps the anchor date back to today. */
|
|
5586
6686
|
today() {
|
|
@@ -5592,11 +6692,11 @@ class Calendar {
|
|
|
5592
6692
|
if (selected)
|
|
5593
6693
|
this.view.set(selected);
|
|
5594
6694
|
}
|
|
5595
|
-
/**
|
|
5596
|
-
|
|
5597
|
-
if (
|
|
6695
|
+
/** A paging drag over the month grid committed to the neighbouring month. */
|
|
6696
|
+
onPage(step) {
|
|
6697
|
+
if (step === 1)
|
|
5598
6698
|
this.next();
|
|
5599
|
-
if (
|
|
6699
|
+
if (step === -1)
|
|
5600
6700
|
this.previous();
|
|
5601
6701
|
}
|
|
5602
6702
|
// Private methods
|
|
@@ -5613,7 +6713,7 @@ class Calendar {
|
|
|
5613
6713
|
}
|
|
5614
6714
|
}
|
|
5615
6715
|
_weekBounds(activeDate) {
|
|
5616
|
-
const weekStartsOn = this.
|
|
6716
|
+
const weekStartsOn = this.resolvedWeekStartsOn();
|
|
5617
6717
|
return {
|
|
5618
6718
|
start: startOfWeek(activeDate, { weekStartsOn }),
|
|
5619
6719
|
end: endOfWeek(activeDate, { weekStartsOn }),
|
|
@@ -5621,10 +6721,10 @@ class Calendar {
|
|
|
5621
6721
|
}
|
|
5622
6722
|
_weekTitle(activeDate) {
|
|
5623
6723
|
const { start, end } = this._weekBounds(activeDate);
|
|
5624
|
-
return
|
|
6724
|
+
return formatSkeletonRange(start, end, WEEK_TITLE_OPTIONS, this._locale.dateFns);
|
|
5625
6725
|
}
|
|
5626
6726
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5627
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: false, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: false, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", isSignal: true, isRequired: false, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: false, transformFunction: null }, views: { classPropertyName: "views", publicName: "views", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, showTitle: { classPropertyName: "showTitle", publicName: "showTitle", isSignal: true, isRequired: false, transformFunction: null }, showNavigation: { classPropertyName: "showNavigation", publicName: "showNavigation", isSignal: true, isRequired: false, transformFunction: null }, showViewSwitcher: { classPropertyName: "showViewSwitcher", publicName: "showViewSwitcher", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null }, swipeNavigation: { classPropertyName: "swipeNavigation", publicName: "swipeNavigation", isSignal: true, isRequired: false, transformFunction: null }, peekWeeks: { classPropertyName: "peekWeeks", publicName: "peekWeeks", 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()" }, classAttribute: "tls-calendar" }, queries: [{ propertyName: "eventTemplate", first: true, predicate: ["eventTemplate"], descendants: true, isSignal: true }, { propertyName: "dayTemplate", first: true, predicate: ["dayTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n
|
|
6727
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, hourStart: { classPropertyName: "hourStart", publicName: "hourStart", isSignal: true, isRequired: false, transformFunction: null }, hourEnd: { classPropertyName: "hourEnd", publicName: "hourEnd", isSignal: true, isRequired: false, transformFunction: null }, showAllDayRow: { classPropertyName: "showAllDayRow", publicName: "showAllDayRow", isSignal: true, isRequired: false, transformFunction: null }, maxEventsPerDay: { classPropertyName: "maxEventsPerDay", publicName: "maxEventsPerDay", isSignal: true, isRequired: false, transformFunction: null }, views: { classPropertyName: "views", publicName: "views", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, showTitle: { classPropertyName: "showTitle", publicName: "showTitle", isSignal: true, isRequired: false, transformFunction: null }, showNavigation: { classPropertyName: "showNavigation", publicName: "showNavigation", isSignal: true, isRequired: false, transformFunction: null }, showViewSwitcher: { classPropertyName: "showViewSwitcher", publicName: "showViewSwitcher", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, squareCells: { classPropertyName: "squareCells", publicName: "squareCells", isSignal: true, isRequired: false, transformFunction: null }, fitHeight: { classPropertyName: "fitHeight", publicName: "fitHeight", isSignal: true, isRequired: false, transformFunction: null }, swipeNavigation: { classPropertyName: "swipeNavigation", publicName: "swipeNavigation", isSignal: true, isRequired: false, transformFunction: null }, peekWeeks: { classPropertyName: "peekWeeks", publicName: "peekWeeks", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, markersLabel: { classPropertyName: "markersLabel", publicName: "markersLabel", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", 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()" }, classAttribute: "tls-calendar" }, queries: [{ propertyName: "eventTemplate", first: true, predicate: ["eventTemplate"], descendants: true, isSignal: true }, { propertyName: "dayTemplate", first: true, predicate: ["dayTemplate"], descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ["headerTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerTemplate(); as template) {\n @if (showHeader()) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"headerContext()\" />\n }\n} @else if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n [disabled]=\"!canGoPrevious()\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n <tls-calendar-month-view\n [paging]=\"swipeNavigation()\"\n [canPageBack]=\"canGoPrevious()\"\n (page)=\"onPage($event)\"\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [maxEventsPerDay]=\"maxEventsPerDay()\"\n [squareCells]=\"squareCells()\"\n [fitHeight]=\"fitHeight()\"\n [peekWeeks]=\"peekWeeks()\"\n [eventTemplate]=\"eventTemplate()\"\n [dayTemplate]=\"dayTemplate()\"\n [selectedDate]=\"selectedDate()\"\n [minDate]=\"minDate()\"\n [dateFilter]=\"dateFilter()\"\n [markersLabel]=\"markersLabel()\"\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: ["busy", "label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: ToggleGroup, selector: "tls-toggle-group", inputs: ["multiple", "unselectable", "size", "color", "variant", "orientation", "rounded", "fluid"] }, { kind: "component", type: CalendarMonthView, selector: "tls-calendar-month-view", inputs: ["activeDate", "events", "weekStartsOn", "weekDays", "maxEventsPerDay", "squareCells", "fitHeight", "peekWeeks", "eventTemplate", "dayTemplate", "label", "selectedDate", "markersLabel", "minDate", "dateFilter", "canPageBack"], outputs: ["dateSelect", "eventSelect", "page"] }, { 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"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
5628
6728
|
}
|
|
5629
6729
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Calendar, decorators: [{
|
|
5630
6730
|
type: Component,
|
|
@@ -5635,12 +6735,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
5635
6735
|
CalendarTimeGrid,
|
|
5636
6736
|
CalendarAgendaView,
|
|
5637
6737
|
Icon,
|
|
5638
|
-
|
|
6738
|
+
NgTemplateOutlet,
|
|
5639
6739
|
], host: {
|
|
5640
6740
|
class: 'tls-calendar',
|
|
5641
6741
|
'[class]': 'hostClasses()',
|
|
5642
|
-
}, template: "@if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n
|
|
5643
|
-
}], ctorParameters: () => [], propDecorators: { events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], hourStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStart", required: false }] }], hourEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourEnd", required: false }] }], showAllDayRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllDayRow", required: false }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: false }] }], views: [{ type: i0.Input, args: [{ isSignal: true, alias: "views", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], showTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTitle", required: false }] }], showNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "showNavigation", required: false }] }], showViewSwitcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "showViewSwitcher", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], swipeNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "swipeNavigation", required: false }] }], peekWeeks: [{ type: i0.Input, args: [{ isSignal: true, alias: "peekWeeks", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }, { type: i0.Output, args: ["viewChange"] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: false }] }, { type: i0.Output, args: ["activeDateChange"] }], eventTemplate: [{ type: i0.ContentChild, args: ['eventTemplate', { isSignal: true }] }], dayTemplate: [{ type: i0.ContentChild, args: ['dayTemplate', { isSignal: true }] }] } });
|
|
6742
|
+
}, template: "@if (headerTemplate(); as template) {\n @if (showHeader()) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"headerContext()\" />\n }\n} @else if (showsHeader()) {\n <div class=\"tls-calendar__header\">\n @if (showNavigation()) {\n <div class=\"tls-calendar__nav\">\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.previous\"\n class=\"tls-calendar__nav-button\"\n [disabled]=\"!canGoPrevious()\"\n (click)=\"previous()\"\n >\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </tls-button>\n\n <tls-button variant=\"outlined\" size=\"sm\" [disabled]=\"isViewingToday()\" (click)=\"today()\">\n {{ labels.today }}\n </tls-button>\n\n <tls-button\n variant=\"text\"\n size=\"sm\"\n [ariaLabel]=\"labels.next\"\n class=\"tls-calendar__nav-button\"\n (click)=\"next()\"\n >\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </tls-button>\n </div>\n }\n\n @if (showTitle()) {\n <h2 class=\"tls-calendar__title\">{{ title() }}</h2>\n }\n\n @if (showsViewSwitcher()) {\n <tls-toggle-group\n class=\"tls-calendar__views\"\n size=\"sm\"\n [options]=\"viewOptions()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [multiple]=\"false\"\n [unselectable]=\"false\"\n [value]=\"[view()]\"\n (valueChange)=\"onViewChange($event)\"\n />\n }\n </div>\n}\n\n@switch (view()) {\n @case ('month') {\n <tls-calendar-month-view\n [paging]=\"swipeNavigation()\"\n [canPageBack]=\"canGoPrevious()\"\n (page)=\"onPage($event)\"\n [activeDate]=\"activeDate()\"\n [events]=\"events()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [maxEventsPerDay]=\"maxEventsPerDay()\"\n [squareCells]=\"squareCells()\"\n [fitHeight]=\"fitHeight()\"\n [peekWeeks]=\"peekWeeks()\"\n [eventTemplate]=\"eventTemplate()\"\n [dayTemplate]=\"dayTemplate()\"\n [selectedDate]=\"selectedDate()\"\n [minDate]=\"minDate()\"\n [dateFilter]=\"dateFilter()\"\n [markersLabel]=\"markersLabel()\"\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" }]
|
|
6743
|
+
}], ctorParameters: () => [], propDecorators: { events: [{ type: i0.Input, args: [{ isSignal: true, alias: "events", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], hourStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStart", required: false }] }], hourEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourEnd", required: false }] }], showAllDayRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAllDayRow", required: false }] }], maxEventsPerDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxEventsPerDay", required: false }] }], views: [{ type: i0.Input, args: [{ isSignal: true, alias: "views", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], showTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTitle", required: false }] }], showNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "showNavigation", required: false }] }], showViewSwitcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "showViewSwitcher", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], squareCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "squareCells", required: false }] }], fitHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "fitHeight", required: false }] }], swipeNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "swipeNavigation", required: false }] }], peekWeeks: [{ type: i0.Input, args: [{ isSignal: true, alias: "peekWeeks", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }], markersLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "markersLabel", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], eventSelect: [{ type: i0.Output, args: ["eventSelect"] }], dateSelect: [{ type: i0.Output, args: ["dateSelect"] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }, { type: i0.Output, args: ["viewChange"] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: false }] }, { type: i0.Output, args: ["activeDateChange"] }], eventTemplate: [{ type: i0.ContentChild, args: ['eventTemplate', { isSignal: true }] }], dayTemplate: [{ type: i0.ContentChild, args: ['dayTemplate', { isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: ['headerTemplate', { isSignal: true }] }] } });
|
|
5644
6744
|
|
|
5645
6745
|
/**
|
|
5646
6746
|
* A declarative content holder: the host element itself is never rendered. `tls-carousel`
|
|
@@ -5672,15 +6772,6 @@ const CAROUSEL_DRAG_START_SLOP = 10;
|
|
|
5672
6772
|
* scroll that starts across a slide still scrolls.
|
|
5673
6773
|
*/
|
|
5674
6774
|
const CAROUSEL_DRAG_LOCK_RATIO = 1.5;
|
|
5675
|
-
/** Fraction of the viewport width a drag must cover to commit to the neighbouring slide. */
|
|
5676
|
-
const CAROUSEL_SWIPE_THRESHOLD_RATIO = 0.2;
|
|
5677
|
-
/** Release velocity in px/ms that commits to the neighbouring slide however short the travel. */
|
|
5678
|
-
const CAROUSEL_FLICK_VELOCITY = 0.4;
|
|
5679
|
-
/**
|
|
5680
|
-
* Divisor damping drag travel that has nothing to reveal — the track is already
|
|
5681
|
-
* at the edge — so the gesture resists instead of pulling empty space into view.
|
|
5682
|
-
*/
|
|
5683
|
-
const CAROUSEL_EDGE_DRAG_RESISTANCE = 4;
|
|
5684
6775
|
/**
|
|
5685
6776
|
* Window in ms after a drag within which a click is swallowed as that drag's
|
|
5686
6777
|
* tail. Self-expiring, so a drag that ends without a click (the pointer left the
|
|
@@ -5946,8 +7037,8 @@ class Carousel {
|
|
|
5946
7037
|
offset: this._resistedOffset(event.deltaX - this._lockDelta),
|
|
5947
7038
|
velocity: event.velocityX,
|
|
5948
7039
|
extent: this._viewport().nativeElement.getBoundingClientRect().width,
|
|
5949
|
-
commitRatio:
|
|
5950
|
-
flickVelocity:
|
|
7040
|
+
commitRatio: PAGING_COMMIT_RATIO,
|
|
7041
|
+
flickVelocity: PAGING_FLICK_VELOCITY,
|
|
5951
7042
|
});
|
|
5952
7043
|
this._settleDrag();
|
|
5953
7044
|
if (heading === 0)
|
|
@@ -6004,7 +7095,7 @@ class Carousel {
|
|
|
6004
7095
|
_resistedOffset(offset) {
|
|
6005
7096
|
const forward = this._isRtl() ? offset > 0 : offset < 0;
|
|
6006
7097
|
const open = forward ? this.canNext() : this.canPrevious();
|
|
6007
|
-
return resistPagingDrag(offset, open,
|
|
7098
|
+
return resistPagingDrag(offset, open, PAGING_EDGE_RESISTANCE);
|
|
6008
7099
|
}
|
|
6009
7100
|
_applyDragOffset(offset) {
|
|
6010
7101
|
// Written on the track, the element that reads it: the theme registers it as
|
|
@@ -6096,6 +7187,20 @@ class Chip {
|
|
|
6096
7187
|
rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6097
7188
|
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6098
7189
|
fluid = input(false, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7190
|
+
/**
|
|
7191
|
+
* Ends the chip with a button that removes it, for a chip standing for
|
|
7192
|
+
* something the reader can take away: an applied filter, an entered value.
|
|
7193
|
+
* The chip only asks — `remove` reports the press, and the consumer drops it.
|
|
7194
|
+
*/
|
|
7195
|
+
removable = input(false, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
7196
|
+
/**
|
|
7197
|
+
* The remove button's accessible name, naming what goes ("Remove chest"), as
|
|
7198
|
+
* the button shows only an icon. Required with `removable`.
|
|
7199
|
+
*/
|
|
7200
|
+
removeLabel = input(/* @ts-ignore */
|
|
7201
|
+
...(ngDevMode ? [undefined, { debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
7202
|
+
/** Reports a press of the remove button. */
|
|
7203
|
+
remove = output();
|
|
6099
7204
|
context = signal({
|
|
6100
7205
|
checked: false,
|
|
6101
7206
|
disabled: false,
|
|
@@ -6122,19 +7227,21 @@ class Chip {
|
|
|
6122
7227
|
array.push(`${className}--icon`);
|
|
6123
7228
|
if (this.fluid())
|
|
6124
7229
|
array.push(`${className}--fluid`);
|
|
7230
|
+
if (this.removable())
|
|
7231
|
+
array.push(`${className}--removable`);
|
|
6125
7232
|
return array;
|
|
6126
7233
|
}, /* @ts-ignore */
|
|
6127
7234
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
6128
7235
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Chip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6129
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Chip, isStandalone: true, selector: "tls-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" }, classAttribute: "tls-chip" }, queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
7236
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Chip, isStandalone: true, selector: "tls-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, removeLabel: { classPropertyName: "removeLabel", publicName: "removeLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { remove: "remove" }, host: { properties: { "class": "classes()" }, classAttribute: "tls-chip" }, queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (removable()) {\n <button\n type=\"button\"\n class=\"tls-chip__remove\"\n [attr.aria-label]=\"removeLabel() ?? null\"\n (click)=\"remove.emit()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
6130
7237
|
}
|
|
6131
7238
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Chip, decorators: [{
|
|
6132
7239
|
type: Component,
|
|
6133
|
-
args: [{ selector: 'tls-chip', imports: [NgTemplateOutlet], host: {
|
|
7240
|
+
args: [{ selector: 'tls-chip', imports: [Icon, NgTemplateOutlet], host: {
|
|
6134
7241
|
class: 'tls-chip',
|
|
6135
7242
|
'[class]': 'classes()',
|
|
6136
|
-
}, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n" }]
|
|
6137
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }] } });
|
|
7243
|
+
}, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (removable()) {\n <button\n type=\"button\"\n class=\"tls-chip__remove\"\n [attr.aria-label]=\"removeLabel() ?? null\"\n (click)=\"remove.emit()\"\n >\n <tls-icon name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n" }]
|
|
7244
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], removeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeLabel", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }] } });
|
|
6138
7245
|
|
|
6139
7246
|
const DEFAULT_CHIP_CONTROL_CONFIG = {
|
|
6140
7247
|
checkedColor: undefined,
|
|
@@ -6809,16 +7916,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6809
7916
|
* Scrolling content region of a dialog. Takes the space left between the header
|
|
6810
7917
|
* and footer and scrolls internally, so a tall dialog keeps its title and
|
|
6811
7918
|
* actions visible instead of growing past the viewport.
|
|
7919
|
+
*
|
|
7920
|
+
* Registers as a CDK scroll container: a scroll event does not bubble, so a
|
|
7921
|
+
* panel anchored to a field inside the body would otherwise never hear the body
|
|
7922
|
+
* scroll and would stay where it opened while its field moves away.
|
|
6812
7923
|
*/
|
|
6813
7924
|
class DialogBody {
|
|
6814
7925
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6815
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: DialogBody, isStandalone: true, selector: "tls-dialog-body", host: { classAttribute: "tls-dialog__body" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
7926
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: DialogBody, isStandalone: true, selector: "tls-dialog-body", host: { classAttribute: "tls-dialog__body" }, hostDirectives: [{ directive: i1$1.CdkScrollable }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
6816
7927
|
}
|
|
6817
7928
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogBody, decorators: [{
|
|
6818
7929
|
type: Component,
|
|
6819
7930
|
args: [{
|
|
6820
7931
|
selector: 'tls-dialog-body',
|
|
6821
7932
|
imports: [],
|
|
7933
|
+
hostDirectives: [CdkScrollable],
|
|
6822
7934
|
template: '<ng-content></ng-content>',
|
|
6823
7935
|
host: {
|
|
6824
7936
|
class: 'tls-dialog__body',
|
|
@@ -6857,11 +7969,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6857
7969
|
}], propDecorators: { align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } });
|
|
6858
7970
|
|
|
6859
7971
|
/**
|
|
6860
|
-
* Marks the heading that titles a dialog,
|
|
7972
|
+
* Marks the heading that titles a dialog, or a drawer laid out with the
|
|
7973
|
+
* dialog's parts: it takes the dialog type scale, and it names the surface it
|
|
7974
|
+
* sits in, which points `aria-labelledby` at it, so the surface is announced by
|
|
7975
|
+
* its title without the opener naming it again. A name the opener passed
|
|
7976
|
+
* outranks it.
|
|
6861
7977
|
*/
|
|
6862
7978
|
class DialogTitleDirective {
|
|
7979
|
+
/** Sets each title's default id apart from every other's. */
|
|
7980
|
+
static _counter = 0;
|
|
7981
|
+
/** The dialog or drawer the title sits in; none when it is rendered outside one. */
|
|
7982
|
+
_container = resolveContainer(inject(DialogRef$1, { optional: true }));
|
|
7983
|
+
/** The heading's id, which names the surface; one is generated when none is given. */
|
|
7984
|
+
id = input(`tls-dialog-title-${DialogTitleDirective._counter++}`, /* @ts-ignore */
|
|
7985
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
7986
|
+
ngOnInit() {
|
|
7987
|
+
const container = this._container;
|
|
7988
|
+
// Deferred past the check in progress: the container has already bound its
|
|
7989
|
+
// name for this pass, and naming it now would change a value just checked.
|
|
7990
|
+
if (container)
|
|
7991
|
+
queueMicrotask(() => container._addAriaLabelledBy(this.id()));
|
|
7992
|
+
}
|
|
7993
|
+
ngOnDestroy() {
|
|
7994
|
+
const container = this._container;
|
|
7995
|
+
if (container)
|
|
7996
|
+
container._removeAriaLabelledBy(this.id());
|
|
7997
|
+
}
|
|
6863
7998
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
6864
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
7999
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: DialogTitleDirective, isStandalone: true, selector: "[tlsDialogTitle]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()" }, classAttribute: "tls-dialog__title" }, ngImport: i0 });
|
|
6865
8000
|
}
|
|
6866
8001
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DialogTitleDirective, decorators: [{
|
|
6867
8002
|
type: Directive,
|
|
@@ -6869,9 +8004,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
6869
8004
|
selector: '[tlsDialogTitle]',
|
|
6870
8005
|
host: {
|
|
6871
8006
|
class: 'tls-dialog__title',
|
|
8007
|
+
'[id]': 'id()',
|
|
6872
8008
|
},
|
|
6873
8009
|
}]
|
|
6874
|
-
}] });
|
|
8010
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
|
|
8011
|
+
/** The CDK container a dialog ref's content is attached to, when it is one. */
|
|
8012
|
+
function resolveContainer(dialogRef) {
|
|
8013
|
+
if (!dialogRef)
|
|
8014
|
+
return null;
|
|
8015
|
+
const container = dialogRef.containerInstance;
|
|
8016
|
+
return container instanceof CdkDialogContainer ? container : null;
|
|
8017
|
+
}
|
|
6875
8018
|
|
|
6876
8019
|
class DialogService {
|
|
6877
8020
|
_dialog = inject(Dialog$1);
|
|
@@ -6947,376 +8090,44 @@ const DEFAULT_DIVIDER_CONFIG = {
|
|
|
6947
8090
|
position: 'center',
|
|
6948
8091
|
variant: 'solid',
|
|
6949
8092
|
flush: false,
|
|
6950
|
-
};
|
|
6951
|
-
|
|
6952
|
-
const DIVIDER_CONFIG = new InjectionToken('DIVIDER_CONFIG', {
|
|
6953
|
-
factory: () => DEFAULT_DIVIDER_CONFIG,
|
|
6954
|
-
});
|
|
6955
|
-
|
|
6956
|
-
class Divider {
|
|
6957
|
-
_config = inject(DIVIDER_CONFIG);
|
|
6958
|
-
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
6959
|
-
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
6960
|
-
position = input(this._config.position, /* @ts-ignore */
|
|
6961
|
-
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
6962
|
-
variant = input(this._config.variant, /* @ts-ignore */
|
|
6963
|
-
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
6964
|
-
flush = input(this._config.flush, { ...(ngDevMode ? { debugName: "flush" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
6965
|
-
hostClasses = computed(() => {
|
|
6966
|
-
const className = 'tls-divider';
|
|
6967
|
-
const array = [className];
|
|
6968
|
-
array.push(`${className}--${this.orientation()}`);
|
|
6969
|
-
array.push(`${className}--${this.position()}`);
|
|
6970
|
-
array.push(`${className}--${this.variant()}`);
|
|
6971
|
-
if (this.flush())
|
|
6972
|
-
array.push(`${className}--flush`);
|
|
6973
|
-
return array;
|
|
6974
|
-
}, /* @ts-ignore */
|
|
6975
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
6976
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Divider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6977
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Divider, isStandalone: true, selector: "tls-divider", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, flush: { classPropertyName: "flush", publicName: "flush", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "aria-orientation": "orientation()", "class": "hostClasses()" }, classAttribute: "tls-divider" }, ngImport: i0, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" });
|
|
6978
|
-
}
|
|
6979
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Divider, decorators: [{
|
|
6980
|
-
type: Component,
|
|
6981
|
-
args: [{ selector: 'tls-divider', imports: [], host: {
|
|
6982
|
-
role: 'separator',
|
|
6983
|
-
'[aria-orientation]': 'orientation()',
|
|
6984
|
-
class: 'tls-divider',
|
|
6985
|
-
'[class]': 'hostClasses()',
|
|
6986
|
-
}, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" }]
|
|
6987
|
-
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }] } });
|
|
6988
|
-
|
|
6989
|
-
/**
|
|
6990
|
-
* Whether a released drag commits to the state it was moving toward.
|
|
6991
|
-
*
|
|
6992
|
-
* A flick decides, whichever way it points: a short flick toward the target is
|
|
6993
|
-
* as clear an intent as a slow drag past the ratio, and a drag that reverses
|
|
6994
|
-
* into a flick reads as the flick. Only failing a flick does distance decide.
|
|
6995
|
-
* Requiring both a flick and the distance would strand each on its own.
|
|
6996
|
-
*
|
|
6997
|
-
* `velocity` is signed toward the commit direction in px/ms; `progress` is the
|
|
6998
|
-
* share of the extent travelled toward it, 0 to 1.
|
|
6999
|
-
*/
|
|
7000
|
-
function decideCommit(velocity, progress) {
|
|
7001
|
-
if (velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
7002
|
-
return true;
|
|
7003
|
-
if (-velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
7004
|
-
return false;
|
|
7005
|
-
return progress >= DRAG_DISMISS_RATIO;
|
|
7006
|
-
}
|
|
7007
|
-
|
|
7008
|
-
/**
|
|
7009
|
-
* The translation in px that `element`'s transform puts it at this frame. A
|
|
7010
|
-
* transform mid-transition reads as the running value rather than its target,
|
|
7011
|
-
* so a surface caught by a new drag while it settles is picked up where it is
|
|
7012
|
-
* drawn. An element with no transform reads as untranslated.
|
|
7013
|
-
*/
|
|
7014
|
-
function drawnTranslation(element) {
|
|
7015
|
-
const transform = getComputedStyle(element).transform;
|
|
7016
|
-
if (transform === '' || transform === 'none')
|
|
7017
|
-
return { x: 0, y: 0 };
|
|
7018
|
-
const matrix = new DOMMatrixReadOnly(transform);
|
|
7019
|
-
return { x: matrix.m41, y: matrix.m42 };
|
|
7020
|
-
}
|
|
7021
|
-
|
|
7022
|
-
/**
|
|
7023
|
-
* Which detent a released drag settles on, among `heights` (ascending, one per
|
|
7024
|
-
* detent), having started at `startIndex` and let go at `releaseHeight` with
|
|
7025
|
-
* `velocity` px/ms toward a larger height.
|
|
7026
|
-
*
|
|
7027
|
-
* A flick decides, whichever way it points, and moves one detent from where
|
|
7028
|
-
* the drag began — never skipping one, so a hard flick from the bottom of a
|
|
7029
|
-
* three-detent sheet lands on the middle. Failing a flick, distance decides:
|
|
7030
|
-
* the nearest detent beyond the start wins, except that leaving the start detent takes the
|
|
7031
|
-
* same share of the gap a drag-to-dismiss commits at, so a short slow drag
|
|
7032
|
-
* snaps back.
|
|
7033
|
-
*/
|
|
7034
|
-
function resolveDetent(heights, startIndex, releaseHeight, velocity) {
|
|
7035
|
-
const last = heights.length - 1;
|
|
7036
|
-
if (velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
7037
|
-
return Math.min(last, startIndex + 1);
|
|
7038
|
-
if (-velocity >= SWIPE_DEFAULT_MIN_VELOCITY)
|
|
7039
|
-
return Math.max(0, startIndex - 1);
|
|
7040
|
-
const start = heights[startIndex];
|
|
7041
|
-
const direction = releaseHeight > start ? 1 : releaseHeight < start ? -1 : 0;
|
|
7042
|
-
if (direction === 0)
|
|
7043
|
-
return startIndex;
|
|
7044
|
-
const neighbour = startIndex + direction;
|
|
7045
|
-
if (neighbour < 0 || neighbour > last)
|
|
7046
|
-
return startIndex;
|
|
7047
|
-
const gap = heights[neighbour] - start;
|
|
7048
|
-
if ((releaseHeight - start) / gap < DRAG_DISMISS_RATIO)
|
|
7049
|
-
return startIndex;
|
|
7050
|
-
// Past the bias: the nearest detent from the neighbour onward in this direction.
|
|
7051
|
-
// A tie goes to the farther detent, as every boundary here resolves in the drag's favour.
|
|
7052
|
-
let winner = neighbour;
|
|
7053
|
-
for (let index = neighbour; index >= 0 && index <= last; index += direction) {
|
|
7054
|
-
if (Math.abs(heights[index] - releaseHeight) > Math.abs(heights[winner] - releaseHeight))
|
|
7055
|
-
break;
|
|
7056
|
-
winner = index;
|
|
7057
|
-
}
|
|
7058
|
-
return winner;
|
|
7059
|
-
}
|
|
7060
|
-
|
|
7061
|
-
/**
|
|
7062
|
-
* Custom properties a settle writes on the surface and its scrim, for a
|
|
7063
|
-
* stylesheet's settle transition to read: the duration in `ms` and a `linear()`
|
|
7064
|
-
* easing that traces the spring's travel.
|
|
7065
|
-
*/
|
|
7066
|
-
const SETTLE_DURATION_PROPERTY = '--tls-settle-duration';
|
|
7067
|
-
const SETTLE_EASING_PROPERTY = '--tls-settle-easing';
|
|
7068
|
-
/**
|
|
7069
|
-
* Period in ms of the settle spring's undamped swing — SwiftUI's `response`.
|
|
7070
|
-
* Critically damped at this response, a settle from rest covers nine tenths of
|
|
7071
|
-
* its travel in about 200ms, on a par with an overlay's default motion.
|
|
7072
|
-
*/
|
|
7073
|
-
const SETTLE_SPRING_RESPONSE = 320;
|
|
7074
|
-
/**
|
|
7075
|
-
* Distance in px from the target at which a settle counts as arrived: the
|
|
7076
|
-
* transition ends there and the last fraction of a pixel lands in one step.
|
|
7077
|
-
*/
|
|
7078
|
-
const SETTLE_REST_DISTANCE = 0.5;
|
|
7079
|
-
/** Longest a settle may run, in ms, however far it travels. */
|
|
7080
|
-
const SETTLE_MAX_DURATION = 1000;
|
|
7081
|
-
/** Spacing in ms of the points the `linear()` easing samples: one 60Hz frame. */
|
|
7082
|
-
const SETTLE_SAMPLE_INTERVAL = 1000 / 60;
|
|
7083
|
-
/**
|
|
7084
|
-
* Share of the finger's travel a rubber band follows at its very start —
|
|
7085
|
-
* UIScrollView's constant, so a stretch reads like the platform's.
|
|
7086
|
-
*/
|
|
7087
|
-
const RUBBER_BAND_RESISTANCE = 0.55;
|
|
7088
|
-
|
|
7089
|
-
/**
|
|
7090
|
-
* How far a surface follows a pull of `overshoot` px past the end of its
|
|
7091
|
-
* travel: at first a fixed share of the finger's travel, then less and less,
|
|
7092
|
-
* approaching `limit` without reaching it. The stretch keeps giving, so the end
|
|
7093
|
-
* of the travel reads as elastic rather than as a wall the finger runs into.
|
|
7094
|
-
*
|
|
7095
|
-
* @example
|
|
7096
|
-
* rubberBand(20, 48); // 8.9 — about half the finger's travel
|
|
7097
|
-
* rubberBand(100, 48); // 25.6
|
|
7098
|
-
* rubberBand(1000, 48); // 44.1 — still short of the limit
|
|
7099
|
-
*/
|
|
7100
|
-
function rubberBand(overshoot, limit) {
|
|
7101
|
-
return limit * (1 - 1 / ((overshoot * RUBBER_BAND_RESISTANCE) / limit + 1));
|
|
7102
|
-
}
|
|
7103
|
-
/**
|
|
7104
|
-
* The overshoot `rubberBand` answers with `stretch` — its inverse, for picking
|
|
7105
|
-
* a stretched surface up where it is drawn without pulling it in a second
|
|
7106
|
-
* time. A stretch at or past the limit, which no overshoot reaches, reads as
|
|
7107
|
-
* an unbounded one.
|
|
7108
|
-
*
|
|
7109
|
-
* @example
|
|
7110
|
-
* rubberBandOvershoot(8.9, 48); // 20 (to rounding)
|
|
7111
|
-
* rubberBandOvershoot(48, 48); // Infinity
|
|
7112
|
-
*/
|
|
7113
|
-
function rubberBandOvershoot(stretch, limit) {
|
|
7114
|
-
if (stretch >= limit)
|
|
7115
|
-
return Number.POSITIVE_INFINITY;
|
|
7116
|
-
return (stretch * limit) / (RUBBER_BAND_RESISTANCE * (limit - stretch));
|
|
7117
|
-
}
|
|
7118
|
-
|
|
7119
|
-
/**
|
|
7120
|
-
* The travel of a critically damped spring over `distance` px, launched at
|
|
7121
|
-
* `velocity` px/ms, as a duration and a `linear()` easing for a CSS transition
|
|
7122
|
-
* to play. Both are signed along one axis, so a velocity that shares the
|
|
7123
|
-
* distance's sign heads for the target.
|
|
7124
|
-
*
|
|
7125
|
-
* Launched with the finger's speed, the surface leaves the release at the pace
|
|
7126
|
-
* it was moving and eases into the target, instead of starting every settle at
|
|
7127
|
-
* one fixed curve's speed whatever the hand was doing. The launch is capped at
|
|
7128
|
-
* the spring's own angular frequency, the fastest a critically damped spring
|
|
7129
|
-
* can start without passing its target — a surface that overshot its largest
|
|
7130
|
-
* detent would lift off the edge it is pinned to. A launch away from the target
|
|
7131
|
-
* carries on that way briefly before the spring turns it round, as momentum
|
|
7132
|
-
* does on the platforms.
|
|
7133
|
-
*
|
|
7134
|
-
* @example
|
|
7135
|
-
* settleCurve(0.2, 0); // { duration: 0, easing: 'linear' } — already there
|
|
7136
|
-
* settleCurve(300, 0); // { duration: 450, easing: 'linear(0, 0.0405, 0.1323, …, 1)' } — from rest, gathers speed
|
|
7137
|
-
* settleCurve(300, 1.5); // { duration: 433, easing: 'linear(0, 0.0989, 0.2174, …, 1)' } — launch capped at the frequency
|
|
7138
|
-
* settleCurve(40, -0.4); // { duration: 350, easing: 'linear(0, -0.0767, -0.0402, …, 1)' } — carries on away, then turns
|
|
7139
|
-
*/
|
|
7140
|
-
function settleCurve(distance, velocity) {
|
|
7141
|
-
const span = Math.abs(distance);
|
|
7142
|
-
if (span < SETTLE_REST_DISTANCE)
|
|
7143
|
-
return { duration: 0, easing: 'linear' };
|
|
7144
|
-
const frequency = (2 * Math.PI) / SETTLE_SPRING_RESPONSE;
|
|
7145
|
-
// Progress per ms the spring starts at, clamped both ways to the frequency.
|
|
7146
|
-
const launch = Math.max(-frequency, Math.min(frequency, velocity / distance));
|
|
7147
|
-
// Critically damped: what is left of the travel is (1 + (ω − v₀)·t)·e^(−ω·t).
|
|
7148
|
-
const progressAt = (time) => 1 - (1 + (frequency - launch) * time) * Math.exp(-frequency * time);
|
|
7149
|
-
let duration = SETTLE_SAMPLE_INTERVAL;
|
|
7150
|
-
while (duration < SETTLE_MAX_DURATION &&
|
|
7151
|
-
Math.abs(1 - progressAt(duration)) * span >= SETTLE_REST_DISTANCE) {
|
|
7152
|
-
duration += SETTLE_SAMPLE_INTERVAL;
|
|
7153
|
-
}
|
|
7154
|
-
const steps = Math.ceil(duration / SETTLE_SAMPLE_INTERVAL);
|
|
7155
|
-
const points = [];
|
|
7156
|
-
for (let step = 0; step < steps; step += 1) {
|
|
7157
|
-
points.push(`${Number(progressAt((duration * step) / steps).toFixed(4))}`);
|
|
7158
|
-
}
|
|
7159
|
-
// The residual under the rest distance lands with the final point.
|
|
7160
|
-
points.push('1');
|
|
7161
|
-
return { duration: Math.round(duration), easing: `linear(${points.join(', ')})` };
|
|
7162
|
-
}
|
|
7163
|
-
|
|
7164
|
-
/**
|
|
7165
|
-
* Moves a dragged surface along one axis: writes its displacement to the
|
|
7166
|
-
* custom property the stylesheet turns into a translate, keeps a scrim's
|
|
7167
|
-
* opacity in step with the drag, and settles the surface to where a release
|
|
7168
|
-
* sent it through the stylesheet's transition.
|
|
7169
|
-
*
|
|
7170
|
-
* The engine knows nothing of what the offsets mean — where rest is, what
|
|
7171
|
-
* range is legal, which release commits — and no pan events; the owning
|
|
7172
|
-
* component maps its gesture onto `begin`, `follow` and `settle`.
|
|
7173
|
-
*/
|
|
7174
|
-
class SheetMotion {
|
|
7175
|
-
_options;
|
|
7176
|
-
// State
|
|
7177
|
-
_state = signal('idle', /* @ts-ignore */
|
|
7178
|
-
...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
7179
|
-
/** Bound to the surface's `--dragging` / `--settling` classes. */
|
|
7180
|
-
state = this._state.asReadonly();
|
|
7181
|
-
_surface = null;
|
|
7182
|
-
/**
|
|
7183
|
-
* Incremented by begin and rest; a settle belongs to the gesture that started it.
|
|
7184
|
-
*/
|
|
7185
|
-
_gesture = 0;
|
|
7186
|
-
constructor(_options) {
|
|
7187
|
-
this._options = _options;
|
|
7188
|
-
}
|
|
7189
|
-
// Public methods
|
|
7190
|
-
/** Travel in px of the gesture in progress, from rest to fully committed; 0 outside a gesture. */
|
|
7191
|
-
get extent() {
|
|
7192
|
-
return this._surface === null ? 0 : this._surface.extent;
|
|
7193
|
-
}
|
|
7194
|
-
/** Takes hold of the surface for one gesture. */
|
|
7195
|
-
begin(surface) {
|
|
7196
|
-
this._gesture += 1;
|
|
7197
|
-
this._surface = surface;
|
|
7198
|
-
this._state.set('dragging');
|
|
7199
|
-
// Both track the finger for the drag's duration, so their transitions —
|
|
7200
|
-
// which exist to animate the settle — must not lag it. Set inline rather
|
|
7201
|
-
// than left to the `--dragging` class, which renders a frame later: the
|
|
7202
|
-
// first offset the drag writes would otherwise start a transition of its
|
|
7203
|
-
// own, from wherever a settle caught mid-flight had got to.
|
|
7204
|
-
this._options.renderer.setStyle(surface.panel, 'transition', 'none');
|
|
7205
|
-
if (surface.backdrop !== null) {
|
|
7206
|
-
this._options.renderer.setStyle(surface.backdrop, 'transition', 'none');
|
|
7207
|
-
}
|
|
7208
|
-
}
|
|
7209
|
-
/**
|
|
7210
|
-
* Moves the surface to `offset` px. The offset is written as given: what
|
|
7211
|
-
* range is legal is the caller's rule.
|
|
7212
|
-
*/
|
|
7213
|
-
follow(offset) {
|
|
7214
|
-
const surface = this._surface;
|
|
7215
|
-
if (surface === null)
|
|
7216
|
-
return;
|
|
7217
|
-
this._write(surface, offset);
|
|
7218
|
-
}
|
|
7219
|
-
/**
|
|
7220
|
-
* Animates the surface to `target` px through the stylesheet's settle
|
|
7221
|
-
* transition, then calls `done`. The state stays `settling` until `rest` is
|
|
7222
|
-
* called: a settle that ends in a dispose keeps its class on until the
|
|
7223
|
-
* overlay is gone, so the keyframe the class stands down cannot replay.
|
|
7224
|
-
*
|
|
7225
|
-
* `velocity` is the surface's speed at the start, in px/ms along the offset
|
|
7226
|
-
* (positive as the offset grows) — a released finger's. The settle's timing
|
|
7227
|
-
* goes onto the surface and its scrim as `--tls-settle-duration` and
|
|
7228
|
-
* `--tls-settle-easing` (see `settleCurve`), for a settle transition to
|
|
7229
|
-
* read, so the stylesheet keeps the motion's gating while the curve carries
|
|
7230
|
-
* the hand's momentum on.
|
|
7231
|
-
*
|
|
7232
|
-
* A `begin` or `rest` that arrives before the settle finishes supersedes it:
|
|
7233
|
-
* a superseded settle neither moves the surface nor reports `done`.
|
|
7234
|
-
*/
|
|
7235
|
-
settle(target, done, velocity = 0) {
|
|
7236
|
-
const surface = this._surface;
|
|
7237
|
-
const gesture = this._gesture;
|
|
7238
|
-
if (surface === null)
|
|
7239
|
-
return;
|
|
7240
|
-
this._state.set('settling');
|
|
7241
|
-
this._options.renderer.removeStyle(surface.panel, 'transition');
|
|
7242
|
-
if (surface.backdrop !== null)
|
|
7243
|
-
this._options.renderer.removeStyle(surface.backdrop, 'transition');
|
|
7244
|
-
// Marked by the gesture counter rather than the surface: a caller that
|
|
7245
|
-
// reuses one surface object across gestures must still be able to supersede.
|
|
7246
|
-
settleAfterRender(this._options.injector, surface.panel, () => {
|
|
7247
|
-
if (this._gesture !== gesture)
|
|
7248
|
-
return;
|
|
7249
|
-
// The curve goes on in the same style change as the target, so the
|
|
7250
|
-
// transition the target starts is timed by it.
|
|
7251
|
-
this._writeCurve(surface, target, velocity);
|
|
7252
|
-
this._write(surface, target);
|
|
7253
|
-
}, () => {
|
|
7254
|
-
if (this._gesture === gesture)
|
|
7255
|
-
done();
|
|
7256
|
-
});
|
|
7257
|
-
}
|
|
7258
|
-
/**
|
|
7259
|
-
* A settle from rest with no drag: takes hold of `surface` and settles it to
|
|
7260
|
-
* `target` in one step, for a change asked by a click, a key or code rather
|
|
7261
|
-
* than a finger. Supersedes a running settle the way a `begin` does.
|
|
7262
|
-
*/
|
|
7263
|
-
moveTo(surface, target, done) {
|
|
7264
|
-
this.begin(surface);
|
|
7265
|
-
this.settle(target, done);
|
|
7266
|
-
}
|
|
7267
|
-
/**
|
|
7268
|
-
* Lets go of the surface; the transform is the stylesheet's again. The
|
|
7269
|
-
* settle's timing comes off with it, so a transition that outlives the
|
|
7270
|
-
* gesture — a scrim's fade on close — keeps the stylesheet's own pace rather
|
|
7271
|
-
* than the curve of the last settle.
|
|
7272
|
-
*/
|
|
7273
|
-
rest() {
|
|
7274
|
-
const surface = this._surface;
|
|
7275
|
-
this._gesture += 1;
|
|
7276
|
-
this._surface = null;
|
|
7277
|
-
this._state.set('idle');
|
|
7278
|
-
if (surface === null)
|
|
7279
|
-
return;
|
|
7280
|
-
for (const element of [surface.panel, surface.backdrop]) {
|
|
7281
|
-
if (element === null)
|
|
7282
|
-
continue;
|
|
7283
|
-
this._options.renderer.removeStyle(element, SETTLE_DURATION_PROPERTY, RendererStyleFlags2.DashCase);
|
|
7284
|
-
this._options.renderer.removeStyle(element, SETTLE_EASING_PROPERTY, RendererStyleFlags2.DashCase);
|
|
7285
|
-
}
|
|
7286
|
-
}
|
|
7287
|
-
// Private methods
|
|
7288
|
-
/**
|
|
7289
|
-
* Writes the timing of a settle to `target` onto the surface and its scrim.
|
|
7290
|
-
* The travel starts from the offset last written inline, which is where a
|
|
7291
|
-
* released drag left the surface; a settle that supersedes another starts
|
|
7292
|
-
* from the other's target, and the browser's own retargeting of the running
|
|
7293
|
-
* transition covers the difference.
|
|
7294
|
-
*/
|
|
7295
|
-
_writeCurve(surface, target, velocity) {
|
|
7296
|
-
const { property, renderer } = this._options;
|
|
7297
|
-
const written = Number.parseFloat(surface.panel.style.getPropertyValue(property));
|
|
7298
|
-
const from = Number.isNaN(written) ? target : written;
|
|
7299
|
-
const { duration, easing } = settleCurve(target - from, velocity);
|
|
7300
|
-
for (const element of [surface.panel, surface.backdrop]) {
|
|
7301
|
-
if (element === null)
|
|
7302
|
-
continue;
|
|
7303
|
-
renderer.setStyle(element, SETTLE_DURATION_PROPERTY, `${duration}ms`, RendererStyleFlags2.DashCase);
|
|
7304
|
-
renderer.setStyle(element, SETTLE_EASING_PROPERTY, easing, RendererStyleFlags2.DashCase);
|
|
7305
|
-
}
|
|
7306
|
-
}
|
|
7307
|
-
/**
|
|
7308
|
-
* Only the backdrop's progress is clamped to the extent; the offset itself
|
|
7309
|
-
* is written unclamped.
|
|
7310
|
-
*/
|
|
7311
|
-
_write(surface, offset) {
|
|
7312
|
-
const { property, backdropOpacity, renderer } = this._options;
|
|
7313
|
-
renderer.setStyle(surface.panel, property, `${offset}px`, RendererStyleFlags2.DashCase);
|
|
7314
|
-
if (surface.backdrop === null)
|
|
7315
|
-
return;
|
|
7316
|
-
const progress = surface.extent > 0 ? Math.min(1, Math.max(0, offset / surface.extent)) : 0;
|
|
7317
|
-
renderer.setStyle(surface.backdrop, 'opacity', `${backdropOpacity(progress)}`);
|
|
7318
|
-
}
|
|
8093
|
+
};
|
|
8094
|
+
|
|
8095
|
+
const DIVIDER_CONFIG = new InjectionToken('DIVIDER_CONFIG', {
|
|
8096
|
+
factory: () => DEFAULT_DIVIDER_CONFIG,
|
|
8097
|
+
});
|
|
8098
|
+
|
|
8099
|
+
class Divider {
|
|
8100
|
+
_config = inject(DIVIDER_CONFIG);
|
|
8101
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
8102
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
8103
|
+
position = input(this._config.position, /* @ts-ignore */
|
|
8104
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
8105
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
8106
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
8107
|
+
flush = input(this._config.flush, { ...(ngDevMode ? { debugName: "flush" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
8108
|
+
hostClasses = computed(() => {
|
|
8109
|
+
const className = 'tls-divider';
|
|
8110
|
+
const array = [className];
|
|
8111
|
+
array.push(`${className}--${this.orientation()}`);
|
|
8112
|
+
array.push(`${className}--${this.position()}`);
|
|
8113
|
+
array.push(`${className}--${this.variant()}`);
|
|
8114
|
+
if (this.flush())
|
|
8115
|
+
array.push(`${className}--flush`);
|
|
8116
|
+
return array;
|
|
8117
|
+
}, /* @ts-ignore */
|
|
8118
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
8119
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Divider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8120
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Divider, isStandalone: true, selector: "tls-divider", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, flush: { classPropertyName: "flush", publicName: "flush", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "aria-orientation": "orientation()", "class": "hostClasses()" }, classAttribute: "tls-divider" }, ngImport: i0, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" });
|
|
7319
8121
|
}
|
|
8122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Divider, decorators: [{
|
|
8123
|
+
type: Component,
|
|
8124
|
+
args: [{ selector: 'tls-divider', imports: [], host: {
|
|
8125
|
+
role: 'separator',
|
|
8126
|
+
'[aria-orientation]': 'orientation()',
|
|
8127
|
+
class: 'tls-divider',
|
|
8128
|
+
'[class]': 'hostClasses()',
|
|
8129
|
+
}, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n" }]
|
|
8130
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }] } });
|
|
7320
8131
|
|
|
7321
8132
|
/**
|
|
7322
8133
|
* Named size tokens, used to tell a preset apart from a custom CSS-length string.
|
|
@@ -7672,7 +8483,7 @@ class Drawer extends CdkDialogContainer {
|
|
|
7672
8483
|
* The dismissal drag: the finger's hold on the panel, its travel toward the
|
|
7673
8484
|
* pinned edge and the settle after release. The scrim thins as the panel leaves.
|
|
7674
8485
|
*/
|
|
7675
|
-
_motion = new
|
|
8486
|
+
_motion = new DragMotion({
|
|
7676
8487
|
property: '--tls-drawer-drag',
|
|
7677
8488
|
backdropOpacity: progress => 1 - progress,
|
|
7678
8489
|
renderer: this._dragRenderer,
|
|
@@ -7693,6 +8504,8 @@ class Drawer extends CdkDialogContainer {
|
|
|
7693
8504
|
];
|
|
7694
8505
|
if (this._tlsConfig.rounded)
|
|
7695
8506
|
classes.push('tls-drawer--rounded');
|
|
8507
|
+
if (this._tlsConfig.closeable)
|
|
8508
|
+
classes.push('tls-drawer--closeable');
|
|
7696
8509
|
if (this._tlsConfig.grabber)
|
|
7697
8510
|
classes.push('tls-drawer--grabber');
|
|
7698
8511
|
// The component, not the stylesheet, moves a panel that slides from its
|
|
@@ -8182,6 +8995,7 @@ class DrawerService {
|
|
|
8182
8995
|
disableClose: true,
|
|
8183
8996
|
role: config?.role ?? 'dialog',
|
|
8184
8997
|
restoreFocus: config?.restoreFocus ?? true,
|
|
8998
|
+
autoFocus: config?.autoFocus ?? 'first-tabbable',
|
|
8185
8999
|
ariaLabel: config?.ariaLabel ?? null,
|
|
8186
9000
|
ariaLabelledBy: config?.ariaLabelledBy ?? null,
|
|
8187
9001
|
ariaDescribedBy: config?.ariaDescribedBy ?? null,
|
|
@@ -8772,8 +9586,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
8772
9586
|
/**
|
|
8773
9587
|
* Marks content a form item draws at the far end of its label's row — an action that concerns
|
|
8774
9588
|
* the field, such as a "Forgot password?" link beside a password's label. It sits beside the
|
|
8775
|
-
*
|
|
8776
|
-
* and a press on it never reaches the control. It follows the control in the document, so focus
|
|
9589
|
+
* label element rather than inside it, so it takes no part in the name the label gives a control
|
|
9590
|
+
* or a group, and a press on it never reaches the control. It follows the control in the document, so focus
|
|
8777
9591
|
* reaches the field before the action beside its label. Meant for a label placed above its
|
|
8778
9592
|
* control.
|
|
8779
9593
|
*/
|
|
@@ -8866,13 +9680,39 @@ function injectFormSkeleton() {
|
|
|
8866
9680
|
return formSkeleton.active;
|
|
8867
9681
|
}
|
|
8868
9682
|
|
|
9683
|
+
/**
|
|
9684
|
+
* Reads the `group` input of a form item: the bare attribute or `true` asks for a plain group,
|
|
9685
|
+
* a role names itself, and anything else leaves the item naming a single control.
|
|
9686
|
+
*
|
|
9687
|
+
* @example
|
|
9688
|
+
* toFormItemGroup('') // 'group' — <tls-form-item group>
|
|
9689
|
+
* toFormItemGroup(true) // 'group'
|
|
9690
|
+
* toFormItemGroup('radiogroup') // 'radiogroup'
|
|
9691
|
+
* toFormItemGroup(false) // null
|
|
9692
|
+
* toFormItemGroup(undefined) // null
|
|
9693
|
+
*/
|
|
9694
|
+
function toFormItemGroup(value) {
|
|
9695
|
+
if (value === '' || value === true)
|
|
9696
|
+
return 'group';
|
|
9697
|
+
if (value === 'group' || value === 'radiogroup')
|
|
9698
|
+
return value;
|
|
9699
|
+
return null;
|
|
9700
|
+
}
|
|
9701
|
+
|
|
8869
9702
|
class FormItem {
|
|
8870
9703
|
// Injections
|
|
8871
9704
|
/** Whether a `tlsFormSkeleton` above the item says its form is still being read. */
|
|
8872
9705
|
_isFormSkeleton = injectFormSkeleton();
|
|
8873
9706
|
static _counter = 0;
|
|
8874
9707
|
_config = inject(FORM_ITEM_CONFIG);
|
|
8875
|
-
|
|
9708
|
+
/**
|
|
9709
|
+
* The first control among the projected content. An item labelling a group adopts none of
|
|
9710
|
+
* them: each control inside a group is labelled by its own item.
|
|
9711
|
+
*/
|
|
9712
|
+
_projectedControl = contentChild(FORM_CONTROL, /* @ts-ignore */
|
|
9713
|
+
...(ngDevMode ? [{ debugName: "_projectedControl" }] : /* istanbul ignore next */ []));
|
|
9714
|
+
/** The one control the item labels, describes and validates; none for a group. */
|
|
9715
|
+
control = computed(() => this.group() ? undefined : this._projectedControl(), /* @ts-ignore */
|
|
8876
9716
|
...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
8877
9717
|
/**
|
|
8878
9718
|
* The signal-forms bindings among the projected content. A group can seat bound and unbound
|
|
@@ -8881,7 +9721,7 @@ class FormItem {
|
|
|
8881
9721
|
*/
|
|
8882
9722
|
_formFields = contentChildren(FORM_FIELD, { ...(ngDevMode ? { debugName: "_formFields" } : /* istanbul ignore next */ {}), descendants: true });
|
|
8883
9723
|
/**
|
|
8884
|
-
* Content of the label, rendered inside the item's own
|
|
9724
|
+
* Content of the label, rendered inside the item's own label element so the `for` /
|
|
8885
9725
|
* `aria-labelledby` wiring is kept. Replaces the label text and the required / optional markers.
|
|
8886
9726
|
*/
|
|
8887
9727
|
labelTemplate = contentChild('labelTemplate', /* @ts-ignore */
|
|
@@ -8900,6 +9740,22 @@ class FormItem {
|
|
|
8900
9740
|
// Inputs
|
|
8901
9741
|
label = input(/* @ts-ignore */
|
|
8902
9742
|
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
9743
|
+
/**
|
|
9744
|
+
* Names a group of controls instead of a single one — a set of options, or several fields
|
|
9745
|
+
* answering one question. The label is drawn exactly as a field's, above the controls, and the
|
|
9746
|
+
* item takes the group's role (`group`, or `radiogroup` for the options of one choice) with
|
|
9747
|
+
* the label as its name. The controls inside keep their own items, which label each one; the
|
|
9748
|
+
* group adopts none of them, so its markers come from `required` rather than from a control.
|
|
9749
|
+
*/
|
|
9750
|
+
group = input(null, { ...(ngDevMode ? { debugName: "group" } : /* istanbul ignore next */ {}), transform: toFormItemGroup });
|
|
9751
|
+
/**
|
|
9752
|
+
* Whether a group must be answered: `true` draws the required marker where markers are shown,
|
|
9753
|
+
* and states it to assistive technology on a `radiogroup`; `false` draws the optional text; unset
|
|
9754
|
+
* draws neither. An item around a single control reads this from the control instead, and
|
|
9755
|
+
* ignores it.
|
|
9756
|
+
*/
|
|
9757
|
+
required = input(undefined, /* @ts-ignore */
|
|
9758
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
8903
9759
|
/**
|
|
8904
9760
|
* Placement of the label relative to the control. `top` stacks the label above the control;
|
|
8905
9761
|
* `start` / `end` place it inline before / after the control (typical for a checkbox or switch).
|
|
@@ -8962,6 +9818,8 @@ class FormItem {
|
|
|
8962
9818
|
showHint = computed(() => Boolean(this.hint()) && !this.showError(), /* @ts-ignore */
|
|
8963
9819
|
...(ngDevMode ? [{ debugName: "showHint" }] : /* istanbul ignore next */ []));
|
|
8964
9820
|
showRequired = computed(() => {
|
|
9821
|
+
if (this.group())
|
|
9822
|
+
return this.showRequiredMarker() && this.required() === true;
|
|
8965
9823
|
const control = this.control();
|
|
8966
9824
|
if (!control)
|
|
8967
9825
|
return false;
|
|
@@ -8970,9 +9828,12 @@ class FormItem {
|
|
|
8970
9828
|
...(ngDevMode ? [{ debugName: "showRequired" }] : /* istanbul ignore next */ []));
|
|
8971
9829
|
/**
|
|
8972
9830
|
* Whether the label carries the optional marker: only for a control that edits a form's field,
|
|
8973
|
-
* can be left unanswered, and is not required — a setting or a toggle has nothing to skip.
|
|
9831
|
+
* can be left unanswered, and is not required — a setting or a toggle has nothing to skip. A
|
|
9832
|
+
* group carries it when `required` says it may be left unanswered.
|
|
8974
9833
|
*/
|
|
8975
9834
|
showOptional = computed(() => {
|
|
9835
|
+
if (this.group())
|
|
9836
|
+
return Boolean(this.optionalText()) && this.required() === false;
|
|
8976
9837
|
const control = this.control();
|
|
8977
9838
|
if (!control || !this.optionalText() || control.alwaysAnswered)
|
|
8978
9839
|
return false;
|
|
@@ -9016,6 +9877,8 @@ class FormItem {
|
|
|
9016
9877
|
const array = [className];
|
|
9017
9878
|
if (this.isInvalid())
|
|
9018
9879
|
array.push(`${className}--invalid`);
|
|
9880
|
+
if (this.group())
|
|
9881
|
+
array.push(`${className}--group`);
|
|
9019
9882
|
if (this.labelPosition() !== 'top') {
|
|
9020
9883
|
array.push(`${className}--label-${this.labelPosition()}`);
|
|
9021
9884
|
if (this.spread())
|
|
@@ -9110,12 +9973,21 @@ class FormItem {
|
|
|
9110
9973
|
return array;
|
|
9111
9974
|
}
|
|
9112
9975
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9113
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FormItem, isStandalone: true, selector: "tls-form-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, spread: { classPropertyName: "spread", publicName: "spread", isSignal: true, isRequired: false, transformFunction: null }, skeleton: { classPropertyName: "skeleton", publicName: "skeleton", isSignal: true, isRequired: false, transformFunction: null }, reserveErrorSpace: { classPropertyName: "reserveErrorSpace", publicName: "reserveErrorSpace", isSignal: true, isRequired: false, transformFunction: null }, reserveLabelSpace: { classPropertyName: "reserveLabelSpace", publicName: "reserveLabelSpace", isSignal: true, isRequired: false, transformFunction: null }, displayErrors: { classPropertyName: "displayErrors", publicName: "displayErrors", isSignal: true, isRequired: false, transformFunction: null }, showRequiredMarker: { classPropertyName: "showRequiredMarker", publicName: "showRequiredMarker", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-form-item" }, queries: [{ propertyName: "
|
|
9976
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: FormItem, isStandalone: true, selector: "tls-form-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, spread: { classPropertyName: "spread", publicName: "spread", isSignal: true, isRequired: false, transformFunction: null }, skeleton: { classPropertyName: "skeleton", publicName: "skeleton", isSignal: true, isRequired: false, transformFunction: null }, reserveErrorSpace: { classPropertyName: "reserveErrorSpace", publicName: "reserveErrorSpace", isSignal: true, isRequired: false, transformFunction: null }, reserveLabelSpace: { classPropertyName: "reserveLabelSpace", publicName: "reserveLabelSpace", isSignal: true, isRequired: false, transformFunction: null }, displayErrors: { classPropertyName: "displayErrors", publicName: "displayErrors", isSignal: true, isRequired: false, transformFunction: null }, showRequiredMarker: { classPropertyName: "showRequiredMarker", publicName: "showRequiredMarker", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "group()", "attr.aria-labelledby": "group() && hasLabel() ? labelId : null", "attr.aria-required": "group() === 'radiogroup' && required() === true ? 'true' : null" }, classAttribute: "tls-form-item" }, queries: [{ propertyName: "_projectedControl", first: true, predicate: FORM_CONTROL, descendants: true, isSignal: true }, { propertyName: "_formFields", predicate: FORM_FIELD, descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }, { propertyName: "labelAction", first: true, predicate: FormItemLabelAction, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"form-item-main\" [class.form-item-main--label-action]=\"hasLabelActionRow()\">\n @if (hasLabel() || reserveLabelSpace()) {\n <!-- A group's label names the item's own role rather than a control, so it is no <label>:\n the host points at it through aria-labelledby. -->\n @if (group()) {\n <div class=\"form-item-label\" [id]=\"labelId\">\n <ng-container [ngTemplateOutlet]=\"labelContent\" />\n </div>\n } @else {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n <ng-container [ngTemplateOutlet]=\"labelContent\" />\n </label>\n }\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n <!-- After the control in the document, so focus reaches the field before the action beside\n its label; the layout lifts it into the label's row. -->\n @if (labelAction()) {\n <div class=\"form-item-label-action\">\n <ng-content select=\"[tlsFormItemLabelAction]\"></ng-content>\n </div>\n }\n</div>\n@if (reservesErrorLine() || showError() || showHint() || hasCounter()) {\n <small class=\"form-item-footer\">\n @if (showError()) {\n <span class=\"form-item-error\">\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n </span>\n } @else if (showHint()) {\n <span class=\"form-item-hint\" [id]=\"hintId\">{{ hint() }}</span>\n }\n @if (hasCounter()) {\n <span\n class=\"form-item-counter\"\n [class.form-item-counter--over]=\"overLimit()\"\n >{{ characterCount() }}/{{ maxLength() }}</span>\n }\n </small>\n}\n<ng-template #labelContent>\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"labelContext()\" />\n } @else {\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
9114
9977
|
}
|
|
9115
9978
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormItem, decorators: [{
|
|
9116
9979
|
type: Component,
|
|
9117
|
-
args: [{ selector: 'tls-form-item', imports: [NgTemplateOutlet], host: {
|
|
9118
|
-
|
|
9980
|
+
args: [{ selector: 'tls-form-item', imports: [NgTemplateOutlet], host: {
|
|
9981
|
+
class: 'tls-form-item',
|
|
9982
|
+
'[class]': 'hostClasses()',
|
|
9983
|
+
// A group is named by its label as a field is: the host carries the group's role, so the
|
|
9984
|
+
// controls within it are announced under the question they answer.
|
|
9985
|
+
'[attr.role]': 'group()',
|
|
9986
|
+
'[attr.aria-labelledby]': 'group() && hasLabel() ? labelId : null',
|
|
9987
|
+
// Only a radiogroup can state that an answer is required; a plain group has no such state.
|
|
9988
|
+
'[attr.aria-required]': "group() === 'radiogroup' && required() === true ? 'true' : null",
|
|
9989
|
+
}, template: "<div class=\"form-item-main\" [class.form-item-main--label-action]=\"hasLabelActionRow()\">\n @if (hasLabel() || reserveLabelSpace()) {\n <!-- A group's label names the item's own role rather than a control, so it is no <label>:\n the host points at it through aria-labelledby. -->\n @if (group()) {\n <div class=\"form-item-label\" [id]=\"labelId\">\n <ng-container [ngTemplateOutlet]=\"labelContent\" />\n </div>\n } @else {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n <ng-container [ngTemplateOutlet]=\"labelContent\" />\n </label>\n }\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n <!-- After the control in the document, so focus reaches the field before the action beside\n its label; the layout lifts it into the label's row. -->\n @if (labelAction()) {\n <div class=\"form-item-label-action\">\n <ng-content select=\"[tlsFormItemLabelAction]\"></ng-content>\n </div>\n }\n</div>\n@if (reservesErrorLine() || showError() || showHint() || hasCounter()) {\n <small class=\"form-item-footer\">\n @if (showError()) {\n <span class=\"form-item-error\">\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n </span>\n } @else if (showHint()) {\n <span class=\"form-item-hint\" [id]=\"hintId\">{{ hint() }}</span>\n }\n @if (hasCounter()) {\n <span\n class=\"form-item-counter\"\n [class.form-item-counter--over]=\"overLimit()\"\n >{{ characterCount() }}/{{ maxLength() }}</span>\n }\n </small>\n}\n<ng-template #labelContent>\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"labelContext()\" />\n } @else {\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n }\n</ng-template>\n" }]
|
|
9990
|
+
}], ctorParameters: () => [], propDecorators: { _projectedControl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FORM_CONTROL), { isSignal: true }] }], _formFields: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => FORM_FIELD), { ...{ descendants: true }, isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['labelTemplate', { isSignal: true }] }], labelAction: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FormItemLabelAction), { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], spread: [{ type: i0.Input, args: [{ isSignal: true, alias: "spread", required: false }] }], skeleton: [{ type: i0.Input, args: [{ isSignal: true, alias: "skeleton", required: false }] }], reserveErrorSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveErrorSpace", required: false }] }], reserveLabelSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveLabelSpace", required: false }] }], displayErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayErrors", required: false }] }], showRequiredMarker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRequiredMarker", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }] } });
|
|
9119
9991
|
|
|
9120
9992
|
/**
|
|
9121
9993
|
* Overrides the form item config for one part of the view tree: listed in a component's or a
|
|
@@ -9331,7 +10203,7 @@ class Autocomplete extends AbstractSelect {
|
|
|
9331
10203
|
}
|
|
9332
10204
|
return options.filter(option => option.label.toLowerCase().includes(query));
|
|
9333
10205
|
}
|
|
9334
|
-
|
|
10206
|
+
hostModifierClasses() {
|
|
9335
10207
|
if (!this.loading())
|
|
9336
10208
|
return [];
|
|
9337
10209
|
return [`${this.hostClassBase}--loading`];
|
|
@@ -9451,6 +10323,13 @@ class Popover {
|
|
|
9451
10323
|
static _counter = 0;
|
|
9452
10324
|
_config = inject(POPOVER_CONFIG);
|
|
9453
10325
|
_overlay = createOverlayManager();
|
|
10326
|
+
_focusTrapFactory = inject(FocusTrapFactory);
|
|
10327
|
+
_document = inject(DOCUMENT$1);
|
|
10328
|
+
_injector = inject(Injector);
|
|
10329
|
+
/** What held focus when the panel opened, handed focus back as it closes. */
|
|
10330
|
+
_returnFocusTo = null;
|
|
10331
|
+
/** Keeps Tab within the panel while it holds focus. */
|
|
10332
|
+
_focusTrap = null;
|
|
9454
10333
|
_templateRef = viewChild.required('content');
|
|
9455
10334
|
id = `tls-popover-${++Popover._counter}`;
|
|
9456
10335
|
isOpen = this._overlay.isOpen;
|
|
@@ -9495,6 +10374,11 @@ class Popover {
|
|
|
9495
10374
|
* Leave focus where it is when the panel is pressed, for a panel that is only pointed at
|
|
9496
10375
|
* while its owner keeps focus: picking from it then never blurs the field it belongs to.
|
|
9497
10376
|
* Leave it off for a panel holding a text field, which a press has to be able to focus.
|
|
10377
|
+
*
|
|
10378
|
+
* Such a panel also leaves focus with its owner as it opens. Any other panel takes focus
|
|
10379
|
+
* itself, on its first control, and holds Tab while it is open: it is drawn at the end of
|
|
10380
|
+
* the page, so focus left behind could never reach it, and focus tabbing on past it would
|
|
10381
|
+
* fall off the page.
|
|
9498
10382
|
*/
|
|
9499
10383
|
keepFocusOnPress = input(false, { ...(ngDevMode ? { debugName: "keepFocusOnPress" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
9500
10384
|
/** Emits after the panel closes, with what closed it. */
|
|
@@ -9512,10 +10396,15 @@ class Popover {
|
|
|
9512
10396
|
shrinkToFit: this.shrinkToFit(),
|
|
9513
10397
|
panelClass: this.panelClass(),
|
|
9514
10398
|
hasBackdrop: this.backdrop(),
|
|
9515
|
-
|
|
10399
|
+
insideElements: [originElement],
|
|
9516
10400
|
keepFocusOnPanePress: this.keepFocusOnPress(),
|
|
9517
|
-
onClose: cause =>
|
|
10401
|
+
onClose: cause => {
|
|
10402
|
+
this._returnFocus(cause);
|
|
10403
|
+
this.closed.emit(cause);
|
|
10404
|
+
},
|
|
9518
10405
|
});
|
|
10406
|
+
if (!this.keepFocusOnPress())
|
|
10407
|
+
this._takeFocusOnceShown();
|
|
9519
10408
|
}
|
|
9520
10409
|
close() {
|
|
9521
10410
|
this._overlay.close();
|
|
@@ -9528,6 +10417,45 @@ class Popover {
|
|
|
9528
10417
|
this.open(trigger);
|
|
9529
10418
|
}
|
|
9530
10419
|
}
|
|
10420
|
+
// Private methods
|
|
10421
|
+
/**
|
|
10422
|
+
* Moves focus into the panel once it is drawn — to the control marked `cdkFocusInitial`,
|
|
10423
|
+
* or else the first one — and holds Tab within it. A panel with nothing to focus takes
|
|
10424
|
+
* focus itself, so focus never stays behind on a page the panel covers.
|
|
10425
|
+
*/
|
|
10426
|
+
_takeFocusOnceShown() {
|
|
10427
|
+
const focused = this._document.activeElement;
|
|
10428
|
+
this._returnFocusTo = focused instanceof HTMLElement ? focused : null;
|
|
10429
|
+
afterNextRender(() => {
|
|
10430
|
+
const panel = this._document.getElementById(this.id);
|
|
10431
|
+
if (!panel)
|
|
10432
|
+
return;
|
|
10433
|
+
this._focusTrap = this._focusTrapFactory.create(panel);
|
|
10434
|
+
if (!this._focusTrap.focusInitialElement())
|
|
10435
|
+
panel.focus();
|
|
10436
|
+
}, { injector: this._injector });
|
|
10437
|
+
}
|
|
10438
|
+
/**
|
|
10439
|
+
* Hands focus back to where it was when the panel opened: after Escape, or the owner
|
|
10440
|
+
* closing it. Not after a press outside, where focus already belongs to whatever was
|
|
10441
|
+
* pressed; nor once focus has left the panel for somewhere else, which keeps it.
|
|
10442
|
+
*/
|
|
10443
|
+
_returnFocus(cause) {
|
|
10444
|
+
if (this._focusTrap) {
|
|
10445
|
+
this._focusTrap.destroy();
|
|
10446
|
+
this._focusTrap = null;
|
|
10447
|
+
}
|
|
10448
|
+
const target = this._returnFocusTo;
|
|
10449
|
+
this._returnFocusTo = null;
|
|
10450
|
+
if (cause === 'outside-pointer' || !target)
|
|
10451
|
+
return;
|
|
10452
|
+
const focused = this._document.activeElement;
|
|
10453
|
+
const panel = this._document.getElementById(this.id);
|
|
10454
|
+
const focusInPanel = panel !== null && panel.contains(focused);
|
|
10455
|
+
if (!focusInPanel && focused !== this._document.body)
|
|
10456
|
+
return;
|
|
10457
|
+
target.focus();
|
|
10458
|
+
}
|
|
9531
10459
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9532
10460
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Popover, isStandalone: true, selector: "tls-popover", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, viewportMargin: { classPropertyName: "viewportMargin", publicName: "viewportMargin", isSignal: true, isRequired: false, transformFunction: null }, shrinkToFit: { classPropertyName: "shrinkToFit", publicName: "shrinkToFit", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, keepFocusOnPress: { classPropertyName: "keepFocusOnPress", publicName: "keepFocusOnPress", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, host: { styleAttribute: "display: none" }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
9533
10461
|
<ng-template #content>
|
|
@@ -9538,6 +10466,7 @@ class Popover {
|
|
|
9538
10466
|
[id]="id"
|
|
9539
10467
|
role="dialog"
|
|
9540
10468
|
aria-modal="false"
|
|
10469
|
+
tabindex="-1"
|
|
9541
10470
|
[attr.aria-label]="ariaLabel() ?? null"
|
|
9542
10471
|
>
|
|
9543
10472
|
<ng-content></ng-content>
|
|
@@ -9564,6 +10493,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
9564
10493
|
[id]="id"
|
|
9565
10494
|
role="dialog"
|
|
9566
10495
|
aria-modal="false"
|
|
10496
|
+
tabindex="-1"
|
|
9567
10497
|
[attr.aria-label]="ariaLabel() ?? null"
|
|
9568
10498
|
>
|
|
9569
10499
|
<ng-content></ng-content>
|
|
@@ -10537,6 +11467,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
10537
11467
|
args: [{ selector: 'tls-color-input', imports: [ColorPicker, ColorSwatch, InputDirective, Popover], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ColorInput) }], template: "<button\n type=\"button\"\n class=\"tls-color-input__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"labels.openPicker\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"onTriggerClick()\"\n (blur)=\"markTouched()\"\n>\n <tls-color-swatch [value]=\"swatchColor()\" size=\"xs\" aria-hidden=\"true\" />\n</button>\n<input\n type=\"text\"\n tlsInput\n class=\"tls-color-input__input tls-form-control\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [name]=\"name()\"\n [size]=\"size()\"\n [fluid]=\"fluid()\"\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() || pickerOnly()\"\n [class.tls-color-input__input--picker-only]=\"pickerOnly()\"\n [attr.aria-haspopup]=\"pickerOnly() ? 'dialog' : null\"\n [attr.aria-expanded]=\"pickerOnly() ? popoverRef.isOpen() : null\"\n [value]=\"displayValue()\"\n (click)=\"onFieldClick()\"\n (keydown)=\"onFieldKeydown($event)\"\n (blur)=\"onFieldBlur($event)\"\n/>\n<tls-popover\n #popoverRef\n position=\"bottom-start\"\n panelClass=\"tls-field-popover\"\n [backdrop]=\"false\"\n [ariaLabel]=\"labels.panel\"\n (closed)=\"restoreFocusAfterPanel($event)\"\n>\n <tls-color-picker\n [value]=\"pickerValue()\"\n (valueChange)=\"onPickerValueChange($event)\"\n [alpha]=\"alpha()\"\n [formats]=\"formats()\"\n [hexCase]=\"hexCase()\"\n [presets]=\"presets()\"\n [size]=\"size()\"\n [readonly]=\"readonly()\"\n />\n</tls-popover>\n", styles: [":host{--tls-color-input-width: 200px;--tls-color-input-trigger-width: 32px;position:relative;width:var(--tls-color-input-width);display:inline-block}:host:has(.tls-form-control--fluid){--tls-color-input-width: 100%}:host .tls-color-input__input{width:100%;padding-inline-start:calc(var(--tls-color-input-trigger-width) + var(--spacing-1))}:host .tls-color-input__input--picker-only{cursor:pointer}:host .tls-color-input__trigger{position:absolute;inset-block:1px;inset-inline-start:1px;z-index:1;width:var(--tls-color-input-trigger-width);padding:0;display:inline-flex;align-items:center;justify-content:center;border:none;background-color:transparent;cursor:pointer}\n"] }]
|
|
10538
11468
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], alpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "alpha", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], formats: [{ type: i0.Input, args: [{ isSignal: true, alias: "formats", required: false }] }], hexCase: [{ type: i0.Input, args: [{ isSignal: true, alias: "hexCase", required: false }] }], pickerOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "pickerOnly", required: false }] }], 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 }] }], _popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }] } });
|
|
10539
11469
|
|
|
11470
|
+
/**
|
|
11471
|
+
* Parts of the trigger label's date, e.g. "Jul 20, 2026" — a skeleton the locale orders, so
|
|
11472
|
+
* Russian reads `20 июл. 2026 г.`.
|
|
11473
|
+
*/
|
|
11474
|
+
const DATE_LABEL_OPTIONS = {
|
|
11475
|
+
year: 'numeric',
|
|
11476
|
+
month: 'short',
|
|
11477
|
+
day: 'numeric',
|
|
11478
|
+
};
|
|
11479
|
+
/**
|
|
11480
|
+
* `date-fns` format token for a month standing alone — the trigger label in `month-picker`
|
|
11481
|
+
* mode and the day grid's heading — e.g. "July 2026".
|
|
11482
|
+
*/
|
|
11483
|
+
const MONTH_LABEL_FORMAT = 'LLLL yyyy';
|
|
11484
|
+
/** `date-fns` format token for a month's name in the month list, standing alone, e.g. "Jul". */
|
|
11485
|
+
const MONTH_OPTION_FORMAT = 'LLL';
|
|
11486
|
+
/** `date-fns` format token for the trigger label in `year-picker` mode, e.g. "2026". */
|
|
11487
|
+
const YEAR_LABEL_FORMAT = 'yyyy';
|
|
11488
|
+
/** `date-fns` format token for a 12-hour time, e.g. "9:30 AM". */
|
|
11489
|
+
const TIME_LABEL_FORMAT_12 = 'h:mm a';
|
|
11490
|
+
/** `date-fns` format token for a 24-hour time, e.g. "09:30". */
|
|
11491
|
+
const TIME_LABEL_FORMAT_24 = 'HH:mm';
|
|
11492
|
+
/** `date-fns` format token for the day-period segment of the time picker, e.g. "AM". */
|
|
11493
|
+
const DAY_PERIOD_FORMAT = 'a';
|
|
11494
|
+
/** Hours in a half-day, the wrap point of the 12-hour clock. */
|
|
11495
|
+
const HOURS_PER_HALF_DAY = 12;
|
|
11496
|
+
|
|
10540
11497
|
class DatePickerCalendar {
|
|
10541
11498
|
// Injections
|
|
10542
11499
|
_locale = inject(LOCALE_CONFIG);
|
|
@@ -10565,7 +11522,7 @@ class DatePickerCalendar {
|
|
|
10565
11522
|
// Computed
|
|
10566
11523
|
displayedWeekDays = computed(() => rotateWeekDays(this.weekDays(), this.weekStartsOn()), /* @ts-ignore */
|
|
10567
11524
|
...(ngDevMode ? [{ debugName: "displayedWeekDays" }] : /* istanbul ignore next */ []));
|
|
10568
|
-
headerLabel = computed(() =>
|
|
11525
|
+
headerLabel = computed(() => formatStandalone(this.viewDate(), MONTH_LABEL_FORMAT, this._locale.dateFns), /* @ts-ignore */
|
|
10569
11526
|
...(ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []));
|
|
10570
11527
|
/**
|
|
10571
11528
|
* The grid's cells, resolved once per change of what they depend on rather than through
|
|
@@ -10605,29 +11562,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
10605
11562
|
args: [{ selector: 'tls-date-picker-calendar', imports: [Icon, RippleDirective], host: { class: 'tls-date-picker-calendar' }, template: "<div class=\"tls-date-picker-calendar__header\">\n <button type=\"button\" class=\"tls-date-picker-calendar__nav\" tlsRipple (click)=\"prevMonth()\">\n <tls-icon name=\"chevron-left\" aria-hidden=\"true\" />\n </button>\n <button type=\"button\" class=\"tls-date-picker-calendar__header-button\" tlsRipple (click)=\"navigateUp.emit()\">\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"tls-date-picker-calendar__nav\" tlsRipple (click)=\"nextMonth()\">\n <tls-icon name=\"chevron-right\" aria-hidden=\"true\" />\n </button>\n</div>\n\n<div class=\"tls-date-picker-calendar__grid\">\n @for (day of displayedWeekDays(); track day) {\n <span class=\"tls-date-picker-calendar__weekday\">{{ day }}</span>\n }\n @for (day of days(); track day.date.getTime()) {\n <button\n type=\"button\"\n class=\"tls-date-picker-calendar__day\"\n [class.tls-date-picker-calendar__day--outside]=\"!day.inCurrentMonth\"\n [class.tls-date-picker-calendar__day--today]=\"day.isToday\"\n [class.tls-date-picker-calendar__day--selected]=\"day.isSelected\"\n [disabled]=\"day.isDisabled\"\n (click)=\"daySelect.emit(day.date)\"\n >\n {{ day.label }}\n </button>\n }\n</div>\n" }]
|
|
10606
11563
|
}], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }], navigateUp: [{ type: i0.Output, args: ["navigateUp"] }] } });
|
|
10607
11564
|
|
|
10608
|
-
/** `date-fns` format token for the trigger label in `calendar` mode, e.g. "Jul 20, 2026". */
|
|
10609
|
-
const DATE_LABEL_FORMAT = 'MMM d, yyyy';
|
|
10610
|
-
/** `date-fns` format token for the trigger label in `month-picker` mode, e.g. "July 2026". */
|
|
10611
|
-
const MONTH_LABEL_FORMAT = 'MMMM yyyy';
|
|
10612
|
-
/** `date-fns` format token for the trigger label in `year-picker` mode, e.g. "2026". */
|
|
10613
|
-
const YEAR_LABEL_FORMAT = 'yyyy';
|
|
10614
|
-
/** `date-fns` format token for a 12-hour time, e.g. "9:30 AM". */
|
|
10615
|
-
const TIME_LABEL_FORMAT_12 = 'h:mm a';
|
|
10616
|
-
/** `date-fns` format token for a 24-hour time, e.g. "09:30". */
|
|
10617
|
-
const TIME_LABEL_FORMAT_24 = 'HH:mm';
|
|
10618
|
-
/** `date-fns` format token for the day-period segment of the time picker, e.g. "AM". */
|
|
10619
|
-
const DAY_PERIOD_FORMAT = 'a';
|
|
10620
|
-
/** Hours in a half-day, the wrap point of the 12-hour clock. */
|
|
10621
|
-
const HOURS_PER_HALF_DAY = 12;
|
|
10622
|
-
|
|
10623
11565
|
const DEFAULT_DATE_TIME_PICKER_CONFIG = {
|
|
10624
11566
|
mode: 'calendar',
|
|
10625
11567
|
inline: false,
|
|
10626
11568
|
placeholder: '',
|
|
10627
11569
|
size: 'md',
|
|
10628
11570
|
yearsPerPage: 12,
|
|
10629
|
-
weekStartsOn: 0,
|
|
10630
|
-
weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
10631
11571
|
};
|
|
10632
11572
|
|
|
10633
11573
|
const DATE_TIME_PICKER_CONFIG = new InjectionToken('DATE_TIME_PICKER_CONFIG', { factory: () => DEFAULT_DATE_TIME_PICKER_CONFIG });
|
|
@@ -10652,7 +11592,7 @@ class MonthPicker {
|
|
|
10652
11592
|
...(ngDevMode ? [{ debugName: "yearLabel" }] : /* istanbul ignore next */ []));
|
|
10653
11593
|
// Protected methods
|
|
10654
11594
|
getMonthLabel(monthIndex) {
|
|
10655
|
-
return
|
|
11595
|
+
return formatStandalone(setMonth(new Date(2000, 0, 1), monthIndex), MONTH_OPTION_FORMAT, this._locale.dateFns);
|
|
10656
11596
|
}
|
|
10657
11597
|
prevYear() {
|
|
10658
11598
|
this.viewDateChange.emit(subYears(this.viewDate(), 1));
|
|
@@ -10823,9 +11763,17 @@ class DateTimePicker extends ValueFormControl {
|
|
|
10823
11763
|
fluid = input(false, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
10824
11764
|
yearsPerPage = input(this.config.yearsPerPage, /* @ts-ignore */
|
|
10825
11765
|
...(ngDevMode ? [{ debugName: "yearsPerPage" }] : /* istanbul ignore next */ []));
|
|
10826
|
-
|
|
11766
|
+
/**
|
|
11767
|
+
* First day of the week (`date-fns` convention: 0 = Sunday) for this instance alone. Unset, it
|
|
11768
|
+
* follows the component config's `weekStartsOn`, then the app-wide `WEEK_STARTS_ON`.
|
|
11769
|
+
*/
|
|
11770
|
+
weekStartsOn = input(undefined, /* @ts-ignore */
|
|
10827
11771
|
...(ngDevMode ? [{ debugName: "weekStartsOn" }] : /* istanbul ignore next */ []));
|
|
10828
|
-
|
|
11772
|
+
/**
|
|
11773
|
+
* Weekday names, Sunday first, for this instance alone. Unset, they follow the component
|
|
11774
|
+
* config's `weekDays`, then the configured `date-fns` locale.
|
|
11775
|
+
*/
|
|
11776
|
+
weekDays = input(undefined, /* @ts-ignore */
|
|
10829
11777
|
...(ngDevMode ? [{ debugName: "weekDays" }] : /* istanbul ignore next */ []));
|
|
10830
11778
|
/** Earliest selectable day, inclusive; the calendar disables earlier days. */
|
|
10831
11779
|
minDate = input(null, /* @ts-ignore */
|
|
@@ -10845,6 +11793,10 @@ class DateTimePicker extends ValueFormControl {
|
|
|
10845
11793
|
activeView = linkedSignal(() => this.mode(), /* @ts-ignore */
|
|
10846
11794
|
...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
|
|
10847
11795
|
// Computed
|
|
11796
|
+
/** The first day of the week this instance lays its days out from. */
|
|
11797
|
+
resolvedWeekStartsOn = injectWeekStartsOn(this.weekStartsOn, this.config.weekStartsOn);
|
|
11798
|
+
/** The weekday names this instance heads its days with, Sunday first. */
|
|
11799
|
+
resolvedWeekDays = injectWeekDays(this.weekDays, this.config.weekDays, 'short');
|
|
10848
11800
|
hostClasses = computed(() => {
|
|
10849
11801
|
const classes = ['tls-date-time-picker'];
|
|
10850
11802
|
if (!this.inline()) {
|
|
@@ -10861,15 +11813,17 @@ class DateTimePicker extends ValueFormControl {
|
|
|
10861
11813
|
if (!value)
|
|
10862
11814
|
return this.placeholder();
|
|
10863
11815
|
const mode = this.mode();
|
|
11816
|
+
const dateLabel = formatSkeleton(value, DATE_LABEL_OPTIONS, this._locale.dateFns);
|
|
10864
11817
|
if (mode === 'calendar')
|
|
10865
|
-
return
|
|
10866
|
-
if (mode === 'month-picker')
|
|
10867
|
-
return
|
|
11818
|
+
return dateLabel;
|
|
11819
|
+
if (mode === 'month-picker') {
|
|
11820
|
+
return formatStandalone(value, MONTH_LABEL_FORMAT, this._locale.dateFns);
|
|
11821
|
+
}
|
|
10868
11822
|
if (mode === 'year-picker')
|
|
10869
11823
|
return format(value, YEAR_LABEL_FORMAT, this._dateOptions);
|
|
10870
11824
|
if (mode === 'time-picker')
|
|
10871
11825
|
return format(value, this._timeFormat, this._dateOptions);
|
|
10872
|
-
return
|
|
11826
|
+
return `${dateLabel} ${format(value, this._timeFormat, this._dateOptions)}`;
|
|
10873
11827
|
}, /* @ts-ignore */
|
|
10874
11828
|
...(ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []));
|
|
10875
11829
|
/**
|
|
@@ -10977,7 +11931,7 @@ class DateTimePicker extends ValueFormControl {
|
|
|
10977
11931
|
return today;
|
|
10978
11932
|
}
|
|
10979
11933
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DateTimePicker, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
10980
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DateTimePicker, isStandalone: true, selector: "tls-date-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", 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 }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", 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 }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-date-time-picker" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], viewQueries: [{ propertyName: "popoverComponent", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"
|
|
11934
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DateTimePicker, isStandalone: true, selector: "tls-date-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", 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 }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", 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 }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-date-time-picker" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], viewQueries: [{ propertyName: "popoverComponent", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\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 [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"onTriggerClick()\"\n (blur)=\"markTouched()\"\n >\n <span class=\"tls-date-time-picker__value\" [class.tls-form-control__placeholder]=\"!value()\">\n {{ triggerLabel() }}\n </span>\n @if (pending()) {\n <tls-loader class=\"tls-date-time-picker__spinner\" size=\"xs\" aria-hidden=\"true\" />\n } @else {\n <span class=\"tls-date-time-picker__icon\" aria-hidden=\"true\">\n <tls-icon class=\"tls-date-time-picker__glyph\" [name]=\"triggerIcon()\" aria-hidden=\"true\" />\n </span>\n }\n </button>\n <tls-popover\n #popoverRef\n position=\"bottom-start\"\n panelClass=\"tls-field-popover\"\n [backdrop]=\"false\"\n keepFocusOnPress\n (closed)=\"restoreFocusAfterPanel($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n", dependencies: [{ kind: "component", type: DatePickerCalendar, selector: "tls-date-picker-calendar", inputs: ["viewDate", "selectedDate", "weekStartsOn", "weekDays", "minDate", "maxDate"], outputs: ["daySelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: MonthPicker, selector: "tls-month-picker", inputs: ["viewDate", "selectedDate"], outputs: ["monthSelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: YearPicker, selector: "tls-year-picker", inputs: ["viewDate", "selectedDate", "yearsPerPage"], outputs: ["yearSelect", "viewDateChange"] }, { kind: "component", type: TimePicker, selector: "tls-time-picker", inputs: ["value"], outputs: ["timeChange"] }, { kind: "component", type: Popover, selector: "tls-popover", inputs: ["position", "offset", "viewportMargin", "shrinkToFit", "ariaLabel", "panelClass", "backdrop", "keepFocusOnPress"], outputs: ["closed"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
10981
11935
|
}
|
|
10982
11936
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DateTimePicker, decorators: [{
|
|
10983
11937
|
type: Component,
|
|
@@ -10990,7 +11944,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
10990
11944
|
NgTemplateOutlet,
|
|
10991
11945
|
Icon,
|
|
10992
11946
|
Loader,
|
|
10993
|
-
], host: { class: 'tls-date-time-picker', '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"
|
|
11947
|
+
], host: { class: 'tls-date-time-picker', '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-date-picker-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"resolvedWeekStartsOn()\"\n [weekDays]=\"resolvedWeekDays()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\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 [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"onTriggerClick()\"\n (blur)=\"markTouched()\"\n >\n <span class=\"tls-date-time-picker__value\" [class.tls-form-control__placeholder]=\"!value()\">\n {{ triggerLabel() }}\n </span>\n @if (pending()) {\n <tls-loader class=\"tls-date-time-picker__spinner\" size=\"xs\" aria-hidden=\"true\" />\n } @else {\n <span class=\"tls-date-time-picker__icon\" aria-hidden=\"true\">\n <tls-icon class=\"tls-date-time-picker__glyph\" [name]=\"triggerIcon()\" aria-hidden=\"true\" />\n </span>\n }\n </button>\n <tls-popover\n #popoverRef\n position=\"bottom-start\"\n panelClass=\"tls-field-popover\"\n [backdrop]=\"false\"\n keepFocusOnPress\n (closed)=\"restoreFocusAfterPanel($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n" }]
|
|
10994
11948
|
}], propDecorators: { popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], 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 }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }] } });
|
|
10995
11949
|
|
|
10996
11950
|
const DEFAULT_CHIP_GROUP_CONFIG = {
|
|
@@ -11066,7 +12020,7 @@ class ChipGroup extends SelectionGroup {
|
|
|
11066
12020
|
return classes;
|
|
11067
12021
|
}
|
|
11068
12022
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ChipGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
11069
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ChipGroup, isStandalone: true, selector: "tls-chip-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checkedVariant: { classPropertyName: "checkedVariant", publicName: "checkedVariant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null" }, classAttribute: "tls-chip-group" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipGroup) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["label"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <tls-chip\n [color]=\"color()\"\n [variant]=\"variant()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [fluid]=\"fluid()\"\n class=\"tls-chip--control\"\n [class]=\"optionClasses(option)\"\n role=\"checkbox\"\n [attr.aria-checked]=\"isSelected(option.value)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n [tabindex]=\"isDisabled(option) ? -1 : 0\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n (keydown.space)=\"onKeyboardSelect($event, option)\"\n (keydown.enter)=\"onKeyboardSelect($event, option)\"\n >\n @if (startIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n } @else {\n {{ option.label }}\n }\n\n @if (endIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n </tls-chip>\n}\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon", "fluid"] }] });
|
|
12023
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ChipGroup, isStandalone: true, selector: "tls-chip-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checkedVariant: { classPropertyName: "checkedVariant", publicName: "checkedVariant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null" }, classAttribute: "tls-chip-group" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipGroup) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["label"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <tls-chip\n [color]=\"color()\"\n [variant]=\"variant()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [fluid]=\"fluid()\"\n class=\"tls-chip--control\"\n [class]=\"optionClasses(option)\"\n role=\"checkbox\"\n [attr.aria-checked]=\"isSelected(option.value)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n [tabindex]=\"isDisabled(option) ? -1 : 0\"\n (click)=\"select(option)\"\n (blur)=\"markTouched()\"\n (keydown.space)=\"onKeyboardSelect($event, option)\"\n (keydown.enter)=\"onKeyboardSelect($event, option)\"\n >\n @if (startIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n } @else {\n {{ option.label }}\n }\n\n @if (endIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n </tls-chip>\n}\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon", "fluid", "removable", "removeLabel"], outputs: ["remove"] }] });
|
|
11070
12024
|
}
|
|
11071
12025
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ChipGroup, decorators: [{
|
|
11072
12026
|
type: Component,
|
|
@@ -11086,6 +12040,9 @@ const DEFAULT_CHIP_INPUT_CONFIG = {
|
|
|
11086
12040
|
placeholder: '',
|
|
11087
12041
|
fluid: false,
|
|
11088
12042
|
separator: ['Enter'],
|
|
12043
|
+
labels: {
|
|
12044
|
+
remove: value => `Remove ${value}`,
|
|
12045
|
+
},
|
|
11089
12046
|
};
|
|
11090
12047
|
|
|
11091
12048
|
const CHIP_INPUT_CONFIG = new InjectionToken('CHIP_INPUT_CONFIG', {
|
|
@@ -11103,6 +12060,7 @@ class ChipInput extends ValueFormControl {
|
|
|
11103
12060
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
11104
12061
|
separator = input(this._config.separator, /* @ts-ignore */
|
|
11105
12062
|
...(ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []));
|
|
12063
|
+
labels = this._config.labels;
|
|
11106
12064
|
inputValue = signal('', /* @ts-ignore */
|
|
11107
12065
|
...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
11108
12066
|
classes = computed(() => {
|
|
@@ -11142,11 +12100,11 @@ class ChipInput extends ValueFormControl {
|
|
|
11142
12100
|
this.inputValue.set('');
|
|
11143
12101
|
}
|
|
11144
12102
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ChipInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
11145
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ChipInput, isStandalone: true, selector: "tls-chip-input", 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 }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" }, classAttribute: "tls-form-control" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], usesInheritance: true, ngImport: i0, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip
|
|
12103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ChipInput, isStandalone: true, selector: "tls-chip-input", 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 }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" }, classAttribute: "tls-form-control" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], usesInheritance: true, ngImport: i0, template: "@for (chip of value(); track $index; let index = $index) {\n <!-- A field that cannot be changed draws its chips without a way to remove\n them, rather than with one that refuses. -->\n <tls-chip\n size=\"sm\"\n variant=\"filled\"\n color=\"primary\"\n [label]=\"chip\"\n [removable]=\"!notInteractive()\"\n [removeLabel]=\"labels.remove(chip)\"\n (remove)=\"removeChip(index)\"\n />\n}\n<input\n class=\"tls-chip-input__field\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"markTouched()\"\n/>\n", dependencies: [{ kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon", "fluid", "removable", "removeLabel"], outputs: ["remove"] }] });
|
|
11146
12104
|
}
|
|
11147
12105
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ChipInput, decorators: [{
|
|
11148
12106
|
type: Component,
|
|
11149
|
-
args: [{ selector: 'tls-chip-input', imports: [Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], host: { class: 'tls-form-control', '[class]': 'classes()' }, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip
|
|
12107
|
+
args: [{ selector: 'tls-chip-input', imports: [Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], host: { class: 'tls-form-control', '[class]': 'classes()' }, template: "@for (chip of value(); track $index; let index = $index) {\n <!-- A field that cannot be changed draws its chips without a way to remove\n them, rather than with one that refuses. -->\n <tls-chip\n size=\"sm\"\n variant=\"filled\"\n color=\"primary\"\n [label]=\"chip\"\n [removable]=\"!notInteractive()\"\n [removeLabel]=\"labels.remove(chip)\"\n (remove)=\"removeChip(index)\"\n />\n}\n<input\n class=\"tls-chip-input__field\"\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 [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"markTouched()\"\n/>\n" }]
|
|
11150
12108
|
}], 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 }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }] } });
|
|
11151
12109
|
|
|
11152
12110
|
/** Joins the parts of an `accept` rule set into the attribute's own format. */
|
|
@@ -11952,6 +12910,22 @@ class PickerField {
|
|
|
11952
12910
|
/** Accessible name for the trigger, for a value face that is not self-describing. */
|
|
11953
12911
|
ariaLabel = input(/* @ts-ignore */
|
|
11954
12912
|
...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
12913
|
+
/**
|
|
12914
|
+
* The id put on the trigger, so a `<label for>` names it as it names a native control. A
|
|
12915
|
+
* form control built on the field forwards its own resolved id here.
|
|
12916
|
+
*/
|
|
12917
|
+
inputId = input(null, /* @ts-ignore */
|
|
12918
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
12919
|
+
/** Ids of the elements naming the trigger, forwarded as a form control forwards its label. */
|
|
12920
|
+
ariaLabelledby = input(null, /* @ts-ignore */
|
|
12921
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
12922
|
+
/** Ids of the elements describing the trigger: a hint, an error. */
|
|
12923
|
+
ariaDescribedby = input(null, /* @ts-ignore */
|
|
12924
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
12925
|
+
/** Whether the value is refused: the field takes its error ring and the trigger reports it. */
|
|
12926
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12927
|
+
/** The button that takes focus and opens the consumer's panel. */
|
|
12928
|
+
_trigger = viewChild.required('trigger');
|
|
11955
12929
|
hostClasses = computed(() => {
|
|
11956
12930
|
const array = [
|
|
11957
12931
|
'tls-picker-field',
|
|
@@ -11964,19 +12938,28 @@ class PickerField {
|
|
|
11964
12938
|
array.push('tls-form-control--fluid');
|
|
11965
12939
|
if (this.disabled())
|
|
11966
12940
|
array.push('tls-form-control--disabled');
|
|
12941
|
+
if (this.invalid() && !this.disabled())
|
|
12942
|
+
array.push('tls-form-control--show-error');
|
|
11967
12943
|
return array;
|
|
11968
12944
|
}, /* @ts-ignore */
|
|
11969
12945
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
12946
|
+
/**
|
|
12947
|
+
* Moves focus to the trigger, as a form control's `focus` does: the host is
|
|
12948
|
+
* only a frame. For a consumer handing focus back once its panel has gone.
|
|
12949
|
+
*/
|
|
12950
|
+
focus() {
|
|
12951
|
+
this._trigger().nativeElement.focus();
|
|
12952
|
+
}
|
|
11970
12953
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PickerField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
11971
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
12954
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: PickerField, isStandalone: true, selector: "tls-picker-field", inputs: { open: { classPropertyName: "open", publicName: "open", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-picker-field tls-form-control" }, providers: [{ provide: POPUP_TRIGGER_FORWARDED, useValue: true }], viewQueries: [{ propertyName: "_trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-picker-field__trigger\"\n [disabled]=\"disabled()\"\n [attr.id]=\"inputId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-haspopup]=\"popup.kind\"\n [attr.aria-expanded]=\"popup.expanded()\"\n [attr.aria-controls]=\"popup.id()\"\n>\n <span class=\"tls-picker-field__value\">\n <ng-content />\n </span>\n <tls-icon class=\"tls-picker-field__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n</button>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
11972
12955
|
}
|
|
11973
12956
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PickerField, decorators: [{
|
|
11974
12957
|
type: Component,
|
|
11975
12958
|
args: [{ selector: 'tls-picker-field', imports: [Icon], providers: [{ provide: POPUP_TRIGGER_FORWARDED, useValue: true }], host: {
|
|
11976
12959
|
class: 'tls-picker-field tls-form-control',
|
|
11977
12960
|
'[class]': 'hostClasses()',
|
|
11978
|
-
}, template: "<button\n type=\"button\"\n class=\"tls-picker-field__trigger\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-haspopup]=\"popup.kind\"\n [attr.aria-expanded]=\"popup.expanded()\"\n [attr.aria-controls]=\"popup.id()\"\n>\n <span class=\"tls-picker-field__value\">\n <ng-content />\n </span>\n <tls-icon class=\"tls-picker-field__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n</button>\n" }]
|
|
11979
|
-
}], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
12961
|
+
}, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-picker-field__trigger\"\n [disabled]=\"disabled()\"\n [attr.id]=\"inputId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-haspopup]=\"popup.kind\"\n [attr.aria-expanded]=\"popup.expanded()\"\n [attr.aria-controls]=\"popup.id()\"\n>\n <span class=\"tls-picker-field__value\">\n <ng-content />\n </span>\n <tls-icon class=\"tls-picker-field__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n</button>\n" }]
|
|
12962
|
+
}], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], _trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }] } });
|
|
11980
12963
|
|
|
11981
12964
|
/**
|
|
11982
12965
|
* Matches strings containing only numeric digits (0–9).
|
|
@@ -12421,6 +13404,9 @@ const DEFAULT_MULTI_SELECT_CONFIG = {
|
|
|
12421
13404
|
* The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
12422
13405
|
*/
|
|
12423
13406
|
virtualScrollItemSize: 39,
|
|
13407
|
+
sheet: false,
|
|
13408
|
+
sheetBelow: null,
|
|
13409
|
+
doneLabel: 'Done',
|
|
12424
13410
|
};
|
|
12425
13411
|
|
|
12426
13412
|
const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
|
|
@@ -12449,6 +13435,15 @@ class MultiSelect extends AbstractSelect {
|
|
|
12449
13435
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
12450
13436
|
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12451
13437
|
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
13438
|
+
/**
|
|
13439
|
+
* Opens the list as a bottom sheet on a small screen — at or below the configured
|
|
13440
|
+
* `sheetBelow` breakpoint, and never where the config names none. For a list too long to
|
|
13441
|
+
* read comfortably in a panel beside the field on a phone; a short list stays beside it.
|
|
13442
|
+
*/
|
|
13443
|
+
sheet = input(this._config.sheet, { ...(ngDevMode ? { debugName: "sheet" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
13444
|
+
/** Label of the button that closes the list when it is shown as a sheet. */
|
|
13445
|
+
doneLabel = input(this._config.doneLabel, /* @ts-ignore */
|
|
13446
|
+
...(ngDevMode ? [{ debugName: "doneLabel" }] : /* istanbul ignore next */ []));
|
|
12452
13447
|
hasValue = computed(() => this.value().length > 0, /* @ts-ignore */
|
|
12453
13448
|
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
12454
13449
|
selectedValues = computed(() => new Set(this.value()), /* @ts-ignore */
|
|
@@ -12480,6 +13475,11 @@ class MultiSelect extends AbstractSelect {
|
|
|
12480
13475
|
this.value.update(current => [...current, option.value]);
|
|
12481
13476
|
}
|
|
12482
13477
|
}
|
|
13478
|
+
sheetBreakpoint() {
|
|
13479
|
+
if (!this.sheet())
|
|
13480
|
+
return null;
|
|
13481
|
+
return this._config.sheetBelow;
|
|
13482
|
+
}
|
|
12483
13483
|
clear() {
|
|
12484
13484
|
this.value.set([]);
|
|
12485
13485
|
}
|
|
@@ -12495,18 +13495,19 @@ class MultiSelect extends AbstractSelect {
|
|
|
12495
13495
|
this.toggleOption(option);
|
|
12496
13496
|
}
|
|
12497
13497
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
12498
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-multi-select tls-form-control" }, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(entry.option)\"\n [class.tls-multi-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-multi-select__panel tls-multi-select__panel--virtual\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [ariaMultiselectable]=\"true\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (group of optionGroups(); track group.label; let groupIndex = $index) {\n @if (group.label === null) {\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n } @else {\n <li class=\"tls-multi-select__group\" role=\"presentation\">\n <ul class=\"tls-multi-select__group-options\" role=\"group\" [attr.aria-labelledby]=\"groupLabelId(groupIndex)\">\n <li class=\"tls-multi-select__group-label\" role=\"presentation\" [id]=\"groupLabelId(groupIndex)\">\n {{ group.label }}\n </li>\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </ul>\n </li>\n }\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
13498
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, sheet: { classPropertyName: "sheet", publicName: "sheet", isSignal: true, isRequired: false, transformFunction: null }, doneLabel: { classPropertyName: "doneLabel", publicName: "doneLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-multi-select tls-form-control" }, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(entry.option)\"\n [class.tls-multi-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n <ng-template #list>\n @if (virtualScroll()) {\n <div\n class=\"tls-multi-select__panel tls-multi-select__panel--virtual\"\n [class.tls-multi-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [ariaMultiselectable]=\"true\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-multi-select__panel\"\n [class.tls-multi-select__panel--sheet]=\"presentsAsSheet()\"\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 (group of optionGroups(); track group.label; let groupIndex = $index) {\n @if (group.label === null) {\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n } @else {\n <li class=\"tls-multi-select__group\" role=\"presentation\">\n <ul class=\"tls-multi-select__group-options\" role=\"group\" [attr.aria-labelledby]=\"groupLabelId(groupIndex)\">\n <li class=\"tls-multi-select__group-label\" role=\"presentation\" [id]=\"groupLabelId(groupIndex)\">\n {{ group.label }}\n </li>\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </ul>\n </li>\n }\n }\n </ul>\n }\n </ng-template>\n\n @if (presentsAsSheet()) {\n <div\n #sheetPane\n class=\"tls-option-sheet\"\n [class.tls-option-sheet--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-option-sheet--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-option-sheet--enter\"\n animate.leave=\"tls-option-sheet--leave\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"sheetDragPointerTypes\"\n [manageTouchAction]=\"false\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n <div class=\"tls-option-sheet__grabber\" aria-hidden=\"true\"></div>\n <ng-container [ngTemplateOutlet]=\"list\" />\n <!-- Choosing an option leaves the list open for the next, so the sheet carries its own way out. -->\n <div class=\"tls-option-sheet__footer\">\n <button tlsButton type=\"button\" fluid (click)=\"close()\">{{ doneLabel() }}</button>\n </div>\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"list\" />\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "[tlsButton]" }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PanDirective, selector: "[tlsPan]", inputs: ["tlsPan", "axis", "manageTouchAction", "threshold", "lockRatio", "edge", "edgeSize", "pointerTypes"], outputs: ["panStart", "panMove", "panEnd", "panCancel"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
12499
13499
|
}
|
|
12500
13500
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
12501
13501
|
type: Component,
|
|
12502
|
-
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
13502
|
+
args: [{ selector: 'tls-multi-select', imports: [ButtonDirective, Loader, Icon, NgTemplateOutlet, PanDirective, VirtualScroll], host: {
|
|
12503
13503
|
class: 'tls-multi-select tls-form-control',
|
|
12504
13504
|
'[class]': 'hostClasses()',
|
|
12505
|
-
}, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(entry.option)\"\n [class.tls-multi-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n @if (virtualScroll()) {\n
|
|
12506
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
|
|
13505
|
+
}, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"toggleOption(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(entry.option)\"\n [class.tls-multi-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n <ng-template #list>\n @if (virtualScroll()) {\n <div\n class=\"tls-multi-select__panel tls-multi-select__panel--virtual\"\n [class.tls-multi-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [ariaMultiselectable]=\"true\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-multi-select__option\"\n role=\"presentation\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-multi-select__panel\"\n [class.tls-multi-select__panel--sheet]=\"presentsAsSheet()\"\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 (group of optionGroups(); track group.label; let groupIndex = $index) {\n @if (group.label === null) {\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n } @else {\n <li class=\"tls-multi-select__group\" role=\"presentation\">\n <ul class=\"tls-multi-select__group-options\" role=\"group\" [attr.aria-labelledby]=\"groupLabelId(groupIndex)\">\n <li class=\"tls-multi-select__group-label\" role=\"presentation\" [id]=\"groupLabelId(groupIndex)\">\n {{ group.label }}\n </li>\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </ul>\n </li>\n }\n }\n </ul>\n }\n </ng-template>\n\n @if (presentsAsSheet()) {\n <div\n #sheetPane\n class=\"tls-option-sheet\"\n [class.tls-option-sheet--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-option-sheet--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-option-sheet--enter\"\n animate.leave=\"tls-option-sheet--leave\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"sheetDragPointerTypes\"\n [manageTouchAction]=\"false\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n <div class=\"tls-option-sheet__grabber\" aria-hidden=\"true\"></div>\n <ng-container [ngTemplateOutlet]=\"list\" />\n <!-- Choosing an option leaves the list open for the next, so the sheet carries its own way out. -->\n <div class=\"tls-option-sheet__footer\">\n <button tlsButton type=\"button\" fluid (click)=\"close()\">{{ doneLabel() }}</button>\n </div>\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"list\" />\n }\n</ng-template>\n" }]
|
|
13506
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], sheet: [{ type: i0.Input, args: [{ isSignal: true, alias: "sheet", required: false }] }], doneLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "doneLabel", required: false }] }] } });
|
|
12507
13507
|
|
|
12508
13508
|
const DEFAULT_SELECT_CONFIG = {
|
|
12509
13509
|
size: 'md',
|
|
13510
|
+
variant: 'outlined',
|
|
12510
13511
|
placeholder: '',
|
|
12511
13512
|
fluid: false,
|
|
12512
13513
|
clearable: false,
|
|
@@ -12516,6 +13517,8 @@ const DEFAULT_SELECT_CONFIG = {
|
|
|
12516
13517
|
* The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
|
|
12517
13518
|
*/
|
|
12518
13519
|
virtualScrollItemSize: 39,
|
|
13520
|
+
sheet: false,
|
|
13521
|
+
sheetBelow: null,
|
|
12519
13522
|
};
|
|
12520
13523
|
|
|
12521
13524
|
const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
@@ -12536,12 +13539,25 @@ class Select extends AbstractSelect {
|
|
|
12536
13539
|
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
12537
13540
|
size = input(this._config.size, /* @ts-ignore */
|
|
12538
13541
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
13542
|
+
/**
|
|
13543
|
+
* How the field presents itself at rest, as a text field's does: `plain` draws no fill until
|
|
13544
|
+
* it is hovered or focused and takes its type from the text around it, so a choice can sit
|
|
13545
|
+
* among plain fields and read as part of the line.
|
|
13546
|
+
*/
|
|
13547
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
13548
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
12539
13549
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12540
13550
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12541
13551
|
clearLabel = input(this._config.clearLabel, /* @ts-ignore */
|
|
12542
13552
|
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
12543
13553
|
virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12544
13554
|
virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
13555
|
+
/**
|
|
13556
|
+
* Opens the list as a bottom sheet on a small screen — at or below the configured
|
|
13557
|
+
* `sheetBelow` breakpoint, and never where the config names none. For a list too long to
|
|
13558
|
+
* read comfortably in a panel beside the field on a phone; a short list stays beside it.
|
|
13559
|
+
*/
|
|
13560
|
+
sheet = input(this._config.sheet, { ...(ngDevMode ? { debugName: "sheet" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12545
13561
|
hasValue = computed(() => {
|
|
12546
13562
|
const value = this.value();
|
|
12547
13563
|
return value !== null && value !== undefined && value !== '';
|
|
@@ -12565,6 +13581,14 @@ class Select extends AbstractSelect {
|
|
|
12565
13581
|
isOptionSelected(option) {
|
|
12566
13582
|
return option.value === this.value();
|
|
12567
13583
|
}
|
|
13584
|
+
hostModifierClasses() {
|
|
13585
|
+
return [`${this.CLASS_NAME}--${this.variant()}`];
|
|
13586
|
+
}
|
|
13587
|
+
sheetBreakpoint() {
|
|
13588
|
+
if (!this.sheet())
|
|
13589
|
+
return null;
|
|
13590
|
+
return this._config.sheetBelow;
|
|
13591
|
+
}
|
|
12568
13592
|
clear() {
|
|
12569
13593
|
this.value.set(null);
|
|
12570
13594
|
}
|
|
@@ -12581,15 +13605,15 @@ class Select extends AbstractSelect {
|
|
|
12581
13605
|
this.select(option);
|
|
12582
13606
|
}
|
|
12583
13607
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
12584
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-select tls-form-control" }, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-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 (option.value === value()) {\n <tls-icon class=\"tls-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"entry.option.value === value()\"\n [class.tls-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n @if (virtualScroll()) {\n
|
|
13608
|
+
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 }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, sheet: { classPropertyName: "sheet", publicName: "sheet", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-select tls-form-control" }, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-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 (option.value === value()) {\n <tls-icon class=\"tls-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"entry.option.value === value()\"\n [class.tls-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n <ng-template #list>\n @if (virtualScroll()) {\n <div\n class=\"tls-select__panel tls-select__panel--virtual\"\n [class.tls-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-select__panel\"\n [class.tls-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (group of optionGroups(); track group.label; let groupIndex = $index) {\n @if (group.label === null) {\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n } @else {\n <li class=\"tls-select__group\" role=\"presentation\">\n <ul class=\"tls-select__group-options\" role=\"group\" [attr.aria-labelledby]=\"groupLabelId(groupIndex)\">\n <li class=\"tls-select__group-label\" role=\"presentation\" [id]=\"groupLabelId(groupIndex)\">\n {{ group.label }}\n </li>\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </ul>\n </li>\n }\n }\n </ul>\n }\n </ng-template>\n\n @if (presentsAsSheet()) {\n <div\n #sheetPane\n class=\"tls-option-sheet\"\n [class.tls-option-sheet--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-option-sheet--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-option-sheet--enter\"\n animate.leave=\"tls-option-sheet--leave\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"sheetDragPointerTypes\"\n [manageTouchAction]=\"false\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n <div class=\"tls-option-sheet__grabber\" aria-hidden=\"true\"></div>\n <ng-container [ngTemplateOutlet]=\"list\" />\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"list\" />\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PanDirective, selector: "[tlsPan]", inputs: ["tlsPan", "axis", "manageTouchAction", "threshold", "lockRatio", "edge", "edgeSize", "pointerTypes"], outputs: ["panStart", "panMove", "panEnd", "panCancel"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
|
|
12585
13609
|
}
|
|
12586
13610
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
12587
13611
|
type: Component,
|
|
12588
|
-
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
|
|
13612
|
+
args: [{ selector: 'tls-select', imports: [Loader, Icon, NgTemplateOutlet, PanDirective, VirtualScroll], host: {
|
|
12589
13613
|
class: 'tls-select tls-form-control',
|
|
12590
13614
|
'[class]': 'hostClasses()',
|
|
12591
|
-
}, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-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 (option.value === value()) {\n <tls-icon class=\"tls-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"entry.option.value === value()\"\n [class.tls-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n @if (virtualScroll()) {\n
|
|
12592
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
|
|
13615
|
+
}, 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)=\"markTouched()\"\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() && !notInteractive()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n <span class=\"tls-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 (option.value === value()) {\n <tls-icon class=\"tls-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </ng-template>\n\n <ng-template #optionItem let-entry>\n <li\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"entry.option.value === value()\"\n [class.tls-select__option--active]=\"entry.index === activeIndex()\"\n [class.tls-select__option--disabled]=\"entry.option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.option, index: entry.index, setsize: null }\"\n />\n </li>\n </ng-template>\n\n <ng-template #list>\n @if (virtualScroll()) {\n <div\n class=\"tls-select__panel tls-select__panel--virtual\"\n [class.tls-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-select__option\"\n role=\"presentation\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n </div>\n } @else {\n <ul\n class=\"tls-select__panel\"\n [class.tls-select__panel--sheet]=\"presentsAsSheet()\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (group of optionGroups(); track group.label; let groupIndex = $index) {\n @if (group.label === null) {\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n } @else {\n <li class=\"tls-select__group\" role=\"presentation\">\n <ul class=\"tls-select__group-options\" role=\"group\" [attr.aria-labelledby]=\"groupLabelId(groupIndex)\">\n <li class=\"tls-select__group-label\" role=\"presentation\" [id]=\"groupLabelId(groupIndex)\">\n {{ group.label }}\n </li>\n @for (entry of group.options; track entry.option.value) {\n <ng-container [ngTemplateOutlet]=\"optionItem\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </ul>\n </li>\n }\n }\n </ul>\n }\n </ng-template>\n\n @if (presentsAsSheet()) {\n <div\n #sheetPane\n class=\"tls-option-sheet\"\n [class.tls-option-sheet--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-option-sheet--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-option-sheet--enter\"\n animate.leave=\"tls-option-sheet--leave\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"sheetDragPointerTypes\"\n [manageTouchAction]=\"false\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n <div class=\"tls-option-sheet__grabber\" aria-hidden=\"true\"></div>\n <ng-container [ngTemplateOutlet]=\"list\" />\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"list\" />\n }\n</ng-template>\n" }]
|
|
13616
|
+
}], 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 }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], sheet: [{ type: i0.Input, args: [{ isSignal: true, alias: "sheet", required: false }] }] } });
|
|
12593
13617
|
|
|
12594
13618
|
const DEFAULT_SLIDER_CONFIG = {
|
|
12595
13619
|
color: 'primary',
|
|
@@ -14546,21 +15570,15 @@ class Menu {
|
|
|
14546
15570
|
...(ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []));
|
|
14547
15571
|
/**
|
|
14548
15572
|
* The sheet's dismissal drag: the finger's hold on the pane, its travel out
|
|
14549
|
-
* past the bottom edge and the settle after release.
|
|
14550
|
-
* sheet leaves.
|
|
15573
|
+
* past the bottom edge and the settle after release.
|
|
14551
15574
|
*/
|
|
14552
|
-
|
|
15575
|
+
sheetDismissal = new SheetDragDismissal({
|
|
14553
15576
|
property: '--tls-menu-drag',
|
|
14554
|
-
|
|
15577
|
+
backdrop: () => this._overlay.backdropElement,
|
|
15578
|
+
close: () => this._overlay.close(),
|
|
14555
15579
|
renderer: this._renderer,
|
|
14556
15580
|
injector: this._injector,
|
|
14557
15581
|
});
|
|
14558
|
-
_sheetClosing = false;
|
|
14559
|
-
/**
|
|
14560
|
-
* How far below its rest the pane was drawn when the drag began: 0 from
|
|
14561
|
-
* rest, the settle's position when caught mid-flight.
|
|
14562
|
-
*/
|
|
14563
|
-
_sheetDragLead = 0;
|
|
14564
15582
|
constructor() {
|
|
14565
15583
|
if (isDevMode()) {
|
|
14566
15584
|
effect(() => {
|
|
@@ -14665,52 +15683,6 @@ class Menu {
|
|
|
14665
15683
|
}
|
|
14666
15684
|
return this.itemTemplate();
|
|
14667
15685
|
}
|
|
14668
|
-
onSheetPanStart(pane, event) {
|
|
14669
|
-
if (this._sheetClosing)
|
|
14670
|
-
return;
|
|
14671
|
-
// Caught mid-settle, the pane is picked up where it is drawn: the drag
|
|
14672
|
-
// stops the settle's transition, which would otherwise leave it at the
|
|
14673
|
-
// settle's end.
|
|
14674
|
-
this._sheetDragLead = this.sheetMotion.state() === 'settling' ? drawnTranslation(pane).y : 0;
|
|
14675
|
-
// The pane is sized by its content, so only the rendered box is authoritative.
|
|
14676
|
-
this.sheetMotion.begin({
|
|
14677
|
-
panel: pane,
|
|
14678
|
-
backdrop: this._overlay.backdropElement,
|
|
14679
|
-
extent: pane.getBoundingClientRect().height,
|
|
14680
|
-
});
|
|
14681
|
-
this.sheetMotion.follow(Math.max(0, this._sheetTravel(event)));
|
|
14682
|
-
}
|
|
14683
|
-
/**
|
|
14684
|
-
* Fired outside the Angular zone (see `PanDirective.panMove`), so it writes
|
|
14685
|
-
* to the DOM directly and never touches a signal. The sheet does not
|
|
14686
|
-
* overshoot open, so upward travel is clamped away.
|
|
14687
|
-
*/
|
|
14688
|
-
onSheetPanMove(event) {
|
|
14689
|
-
if (this._sheetClosing)
|
|
14690
|
-
return;
|
|
14691
|
-
this.sheetMotion.follow(Math.max(0, this._sheetTravel(event)));
|
|
14692
|
-
}
|
|
14693
|
-
onSheetPanEnd(event) {
|
|
14694
|
-
if (this._sheetClosing)
|
|
14695
|
-
return;
|
|
14696
|
-
const extent = this.sheetMotion.extent;
|
|
14697
|
-
const travel = Math.max(0, this._sheetTravel(event));
|
|
14698
|
-
const progress = extent > 0 ? travel / extent : 0;
|
|
14699
|
-
if (decideCommit(event.velocityY, progress)) {
|
|
14700
|
-
// A finger that carried the pane past the edge has already hidden it: it
|
|
14701
|
-
// leaves from there rather than travelling back to the edge unseen.
|
|
14702
|
-
this._sheetDragClose(Math.max(extent, travel), event.velocityY);
|
|
14703
|
-
return;
|
|
14704
|
-
}
|
|
14705
|
-
// The drag runs down the offset's own axis, so the finger's velocity is
|
|
14706
|
-
// already signed along it.
|
|
14707
|
-
this.sheetMotion.settle(0, () => this.sheetMotion.rest(), event.velocityY);
|
|
14708
|
-
}
|
|
14709
|
-
onSheetPanCancel() {
|
|
14710
|
-
if (this._sheetClosing)
|
|
14711
|
-
return;
|
|
14712
|
-
this.sheetMotion.settle(0, () => this.sheetMotion.rest());
|
|
14713
|
-
}
|
|
14714
15686
|
// Private methods
|
|
14715
15687
|
/** Whether the viewport sits at or below the configured sheet breakpoint. */
|
|
14716
15688
|
_prefersSheet() {
|
|
@@ -14719,11 +15691,6 @@ class Menu {
|
|
|
14719
15691
|
return false;
|
|
14720
15692
|
return this._viewportService.isBelow(sheetBelow)();
|
|
14721
15693
|
}
|
|
14722
|
-
/**
|
|
14723
|
-
* Resets the per-open presentation state; the pane itself is stamped fresh
|
|
14724
|
-
* from the template on every open, so only the component-held state carries
|
|
14725
|
-
* over.
|
|
14726
|
-
*/
|
|
14727
15694
|
/**
|
|
14728
15695
|
* Moves focus into the menu once its panel is drawn, as the menu-button pattern has it: to the
|
|
14729
15696
|
* checked item of a choice, so the current answer is where the person starts, otherwise to the
|
|
@@ -14758,31 +15725,16 @@ class Menu {
|
|
|
14758
15725
|
return;
|
|
14759
15726
|
target.focus();
|
|
14760
15727
|
}
|
|
15728
|
+
/**
|
|
15729
|
+
* Resets the per-open presentation state; the pane itself is stamped fresh
|
|
15730
|
+
* from the template on every open, so only the component-held state carries
|
|
15731
|
+
* over.
|
|
15732
|
+
*/
|
|
14761
15733
|
_prepareOpen(sheet) {
|
|
14762
15734
|
const focused = this._document.activeElement;
|
|
14763
15735
|
this._returnFocusTo = focused instanceof HTMLElement ? focused : null;
|
|
14764
15736
|
this.sheet.set(sheet);
|
|
14765
|
-
this.
|
|
14766
|
-
this._sheetClosing = false;
|
|
14767
|
-
}
|
|
14768
|
-
/**
|
|
14769
|
-
* Travel toward the bottom edge in px: where the drag picked the pane up,
|
|
14770
|
-
* plus the finger's travel since.
|
|
14771
|
-
*/
|
|
14772
|
-
_sheetTravel(event) {
|
|
14773
|
-
return this._sheetDragLead + event.deltaY;
|
|
14774
|
-
}
|
|
14775
|
-
/**
|
|
14776
|
-
* Continues the drag out to `target` px — past the bottom edge, or further
|
|
14777
|
-
* where the finger already went — at the finger's `velocity`, and closes on
|
|
14778
|
-
* arrival. A dismissal that began as a drag must not route through the
|
|
14779
|
-
* leave keyframe: that starts from the fully open position, so the pane
|
|
14780
|
-
* would snap back for a frame before leaving — the stylesheet stands the
|
|
14781
|
-
* keyframe down while the drag state classes are on.
|
|
14782
|
-
*/
|
|
14783
|
-
_sheetDragClose(target, velocity) {
|
|
14784
|
-
this._sheetClosing = true;
|
|
14785
|
-
this.sheetMotion.settle(target, () => this._overlay.close(), velocity);
|
|
15737
|
+
this.sheetDismissal.reset();
|
|
14786
15738
|
}
|
|
14787
15739
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Menu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14788
15740
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Menu, isStandalone: true, selector: "tls-menu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "inline() ? null : 'none'" } }, providers: [
|
|
@@ -14799,7 +15751,7 @@ class Menu {
|
|
|
14799
15751
|
pointerTypes: DRAG_DISMISS_POINTER_TYPES,
|
|
14800
15752
|
},
|
|
14801
15753
|
},
|
|
14802
|
-
], queries: [{ propertyName: "_customItems", predicate: MenuItemComponent, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }, { propertyName: "dividerTemplate", first: true, predicate: ["dividerTemplate"], descendants: true, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ["iconTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "_items", predicate: MenuItem, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panel>\n <div\n #sheetPane\n class=\"tls-menu\"\n [class.tls-menu--sheet]=\"sheet()\"\n [class.tls-menu--dragging]=\"
|
|
15754
|
+
], queries: [{ propertyName: "_customItems", predicate: MenuItemComponent, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }, { propertyName: "dividerTemplate", first: true, predicate: ["dividerTemplate"], descendants: true, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ["iconTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "_items", predicate: MenuItem, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panel>\n <div\n #sheetPane\n class=\"tls-menu\"\n [class.tls-menu--sheet]=\"sheet()\"\n [class.tls-menu--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-menu--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-menu--enter\"\n animate.leave=\"tls-menu--leave\"\n [id]=\"id\"\n ngMenu\n tabindex=\"-1\"\n [softDisabled]=\"false\"\n (itemSelected)=\"onItemClick($event)\"\n (keydown.escape)=\"close()\"\n (keydown.tab)=\"onTabOut()\"\n (keydown.shift.tab)=\"onTabOut()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [tlsPan]=\"sheet()\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n @if (sheet()) {\n <div class=\"tls-menu__grabber\" aria-hidden=\"true\"></div>\n } @for (block of blocks(); track $index) { @if (block.kind === 'group') {\n <div class=\"tls-menu__group\" role=\"group\" [attr.aria-label]=\"block.label.label\">\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: block.label }\"\n />\n } @else {\n <!-- The group carries the section name via aria-label; the visible header stays hidden to avoid double announcement. -->\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ block.label.label }}</span>\n } @for (entry of block.entries; track entry.index) {\n <ng-container\n [ngTemplateOutlet]=\"entryTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: entry }\"\n />\n }\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"entryTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: block.entry }\"\n />\n } }\n\n <ng-template #entryTemplate let-entry>\n @switch (entry.item.type) { @case ('item') { @let actionItem = entry.item; @let itemIndex =\n entry.index; @if (actionItem.link) {\n <a\n ngMenuItem\n [value]=\"actionItem\"\n [disabled]=\"actionItem.disabled ?? false\"\n class=\"tls-menu__item\"\n [routerLink]=\"actionItem.link\"\n [class.tls-menu__item--disabled]=\"actionItem.disabled ?? false\"\n [role]=\"actionItem.role ?? 'menuitem'\"\n [attr.aria-checked]=\"isCheckable(actionItem) ? (actionItem.checked ?? false) : null\"\n [attr.aria-labelledby]=\"itemContentTemplate(actionItem) ? null : itemLabelId(itemIndex)\"\n [attr.aria-describedby]=\"!itemContentTemplate(actionItem) && actionItem.description ? itemDescriptionId(itemIndex) : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"actionItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: itemIndex }\"\n />\n </a>\n } @else {\n <button\n ngMenuItem\n [value]=\"actionItem\"\n [disabled]=\"actionItem.disabled ?? false\"\n class=\"tls-menu__item\"\n [attr.disabled]=\"actionItem.disabled ? '' : null\"\n [role]=\"actionItem.role ?? 'menuitem'\"\n [attr.aria-checked]=\"isCheckable(actionItem) ? (actionItem.checked ?? false) : null\"\n [attr.aria-labelledby]=\"itemContentTemplate(actionItem) ? null : itemLabelId(itemIndex)\"\n [attr.aria-describedby]=\"!itemContentTemplate(actionItem) && actionItem.description ? itemDescriptionId(itemIndex) : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"actionItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: itemIndex }\"\n />\n </button>\n }\n\n <ng-template #actionItemContent let-actionItem let-index=\"index\">\n @if (itemContentTemplate(actionItem); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem }\"\n />\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"defaultItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: index }\"\n />\n }\n </ng-template>\n\n <ng-template #defaultItemContent let-actionItem let-index=\"index\">\n @if (isCheckable(actionItem)) {\n <span class=\"tls-menu__item-check\" aria-hidden=\"true\">\n @if (actionItem.checked) {\n <tls-icon name=\"check\" />\n }\n </span>\n } @if (actionItem.icon) { @if (iconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\"\n />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n } }\n <span class=\"tls-menu__item-text\">\n <span class=\"tls-menu__item-label\" [id]=\"itemLabelId(index)\">{{ actionItem.label }}</span>\n @if (actionItem.description) {\n <span class=\"tls-menu__item-description\" [id]=\"itemDescriptionId(index)\"\n >{{ actionItem.description }}</span\n >\n }\n </span>\n @if (actionItem.shortcut && actionItem.shortcut.length) {\n <kbd class=\"tls-menu__item-shortcut\">\n @for (key of actionItem.shortcut; track $index) {\n <kbd tlsKbd size=\"sm\">{{ key }}</kbd>\n }\n </kbd>\n }\n </ng-template>\n } @case ('divider') { @if (dividerTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" />\n } } @case ('custom') { @if (customTemplates().get(entry.item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n } } }\n </ng-template>\n </div>\n</ng-template>\n\n@if (inline()) {\n<ng-container [ngTemplateOutlet]=\"panel\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: Kbd, selector: "kbd[tlsKbd]", inputs: ["size"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: Menu$1, selector: "[ngMenu]", inputs: ["id", "wrap", "typeaheadDelay", "disabled", "softDisabled", "expansionDelay"], outputs: ["itemSelected"], exportAs: ["ngMenu"] }, { kind: "directive", type: MenuItem, selector: "[ngMenuItem]", inputs: ["id", "value", "disabled", "searchTerm", "role", "submenu"], outputs: ["searchTermChange"], exportAs: ["ngMenuItem"] }, { kind: "directive", type: PanDirective, selector: "[tlsPan]", inputs: ["tlsPan", "axis", "manageTouchAction", "threshold", "lockRatio", "edge", "edgeSize", "pointerTypes"], outputs: ["panStart", "panMove", "panEnd", "panCancel"] }] });
|
|
14803
15755
|
}
|
|
14804
15756
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Menu, decorators: [{
|
|
14805
15757
|
type: Component,
|
|
@@ -14830,7 +15782,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
14830
15782
|
// an overlay — so the host leaves the flow rather than claiming a slot (and
|
|
14831
15783
|
// a flex/grid gap) as an invisible empty box.
|
|
14832
15784
|
'[style.display]': "inline() ? null : 'none'",
|
|
14833
|
-
}, template: "<ng-template #panel>\n <div\n #sheetPane\n class=\"tls-menu\"\n [class.tls-menu--sheet]=\"sheet()\"\n [class.tls-menu--dragging]=\"
|
|
15785
|
+
}, template: "<ng-template #panel>\n <div\n #sheetPane\n class=\"tls-menu\"\n [class.tls-menu--sheet]=\"sheet()\"\n [class.tls-menu--dragging]=\"sheetDismissal.motion.state() === 'dragging'\"\n [class.tls-menu--settling]=\"sheetDismissal.motion.state() === 'settling'\"\n animate.enter=\"tls-menu--enter\"\n animate.leave=\"tls-menu--leave\"\n [id]=\"id\"\n ngMenu\n tabindex=\"-1\"\n [softDisabled]=\"false\"\n (itemSelected)=\"onItemClick($event)\"\n (keydown.escape)=\"close()\"\n (keydown.tab)=\"onTabOut()\"\n (keydown.shift.tab)=\"onTabOut()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [tlsPan]=\"sheet()\"\n (panStart)=\"sheetDismissal.onPanStart(sheetPane, $event)\"\n (panMove)=\"sheetDismissal.onPanMove($event)\"\n (panEnd)=\"sheetDismissal.onPanEnd($event)\"\n (panCancel)=\"sheetDismissal.onPanCancel()\"\n >\n @if (sheet()) {\n <div class=\"tls-menu__grabber\" aria-hidden=\"true\"></div>\n } @for (block of blocks(); track $index) { @if (block.kind === 'group') {\n <div class=\"tls-menu__group\" role=\"group\" [attr.aria-label]=\"block.label.label\">\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: block.label }\"\n />\n } @else {\n <!-- The group carries the section name via aria-label; the visible header stays hidden to avoid double announcement. -->\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ block.label.label }}</span>\n } @for (entry of block.entries; track entry.index) {\n <ng-container\n [ngTemplateOutlet]=\"entryTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: entry }\"\n />\n }\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"entryTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: block.entry }\"\n />\n } }\n\n <ng-template #entryTemplate let-entry>\n @switch (entry.item.type) { @case ('item') { @let actionItem = entry.item; @let itemIndex =\n entry.index; @if (actionItem.link) {\n <a\n ngMenuItem\n [value]=\"actionItem\"\n [disabled]=\"actionItem.disabled ?? false\"\n class=\"tls-menu__item\"\n [routerLink]=\"actionItem.link\"\n [class.tls-menu__item--disabled]=\"actionItem.disabled ?? false\"\n [role]=\"actionItem.role ?? 'menuitem'\"\n [attr.aria-checked]=\"isCheckable(actionItem) ? (actionItem.checked ?? false) : null\"\n [attr.aria-labelledby]=\"itemContentTemplate(actionItem) ? null : itemLabelId(itemIndex)\"\n [attr.aria-describedby]=\"!itemContentTemplate(actionItem) && actionItem.description ? itemDescriptionId(itemIndex) : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"actionItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: itemIndex }\"\n />\n </a>\n } @else {\n <button\n ngMenuItem\n [value]=\"actionItem\"\n [disabled]=\"actionItem.disabled ?? false\"\n class=\"tls-menu__item\"\n [attr.disabled]=\"actionItem.disabled ? '' : null\"\n [role]=\"actionItem.role ?? 'menuitem'\"\n [attr.aria-checked]=\"isCheckable(actionItem) ? (actionItem.checked ?? false) : null\"\n [attr.aria-labelledby]=\"itemContentTemplate(actionItem) ? null : itemLabelId(itemIndex)\"\n [attr.aria-describedby]=\"!itemContentTemplate(actionItem) && actionItem.description ? itemDescriptionId(itemIndex) : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"actionItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: itemIndex }\"\n />\n </button>\n }\n\n <ng-template #actionItemContent let-actionItem let-index=\"index\">\n @if (itemContentTemplate(actionItem); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem }\"\n />\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"defaultItemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem, index: index }\"\n />\n }\n </ng-template>\n\n <ng-template #defaultItemContent let-actionItem let-index=\"index\">\n @if (isCheckable(actionItem)) {\n <span class=\"tls-menu__item-check\" aria-hidden=\"true\">\n @if (actionItem.checked) {\n <tls-icon name=\"check\" />\n }\n </span>\n } @if (actionItem.icon) { @if (iconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\"\n />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n } }\n <span class=\"tls-menu__item-text\">\n <span class=\"tls-menu__item-label\" [id]=\"itemLabelId(index)\">{{ actionItem.label }}</span>\n @if (actionItem.description) {\n <span class=\"tls-menu__item-description\" [id]=\"itemDescriptionId(index)\"\n >{{ actionItem.description }}</span\n >\n }\n </span>\n @if (actionItem.shortcut && actionItem.shortcut.length) {\n <kbd class=\"tls-menu__item-shortcut\">\n @for (key of actionItem.shortcut; track $index) {\n <kbd tlsKbd size=\"sm\">{{ key }}</kbd>\n }\n </kbd>\n }\n </ng-template>\n } @case ('divider') { @if (dividerTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.item }\"\n />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" />\n } } @case ('custom') { @if (customTemplates().get(entry.item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n } } }\n </ng-template>\n </div>\n</ng-template>\n\n@if (inline()) {\n<ng-container [ngTemplateOutlet]=\"panel\" />\n}\n" }]
|
|
14834
15786
|
}], ctorParameters: () => [], propDecorators: { _panelRef: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], _items: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => MenuItem), { isSignal: true }] }], _customItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MenuItemComponent), { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['itemTemplate', { isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['labelTemplate', { isSignal: true }] }], dividerTemplate: [{ type: i0.ContentChild, args: ['dividerTemplate', { isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: ['iconTemplate', { isSignal: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], 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 }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }] } });
|
|
14835
15787
|
|
|
14836
15788
|
/**
|
|
@@ -15783,7 +16735,7 @@ class Sheet {
|
|
|
15783
16735
|
_heights = signal([], /* @ts-ignore */
|
|
15784
16736
|
...(ngDevMode ? [{ debugName: "_heights" }] : /* istanbul ignore next */ []));
|
|
15785
16737
|
/** Annotated because its own callback reads it back for the travel. */
|
|
15786
|
-
_motion = new
|
|
16738
|
+
_motion = new DragMotion({
|
|
15787
16739
|
property: SHEET_OFFSET_PROPERTY,
|
|
15788
16740
|
backdropOpacity: progress => this._backdropOpacityAt(progress * this._motion.extent),
|
|
15789
16741
|
renderer: this._renderer,
|
|
@@ -16331,16 +17283,16 @@ class Sheet {
|
|
|
16331
17283
|
void whenAnimationsFinish(this._root().nativeElement, { subtree: true }).then(() => overlayRef.dispose());
|
|
16332
17284
|
}
|
|
16333
17285
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Sheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16334
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Sheet, isStandalone: true, selector: "tls-sheet", inputs: { detents: { classPropertyName: "detents", publicName: "detents", isSignal: true, isRequired: true, transformFunction: null }, detent: { classPropertyName: "detent", publicName: "detent", isSignal: true, isRequired: false, transformFunction: null }, modalFrom: { classPropertyName: "modalFrom", publicName: "modalFrom", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, detentLabels: { classPropertyName: "detentLabels", publicName: "detentLabels", isSignal: true, isRequired: false, transformFunction: null }, grabber: { classPropertyName: "grabber", publicName: "grabber", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { detent: "detentChange" }, host: { listeners: { "document:keydown.escape": "onEscape($event)" }, styleAttribute: "display: none" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: SheetHeaderDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_root", first: true, predicate: ["root"], descendants: true, isSignal: true }, { propertyName: "_backdrop", first: true, predicate: ["backdrop"], descendants: true, isSignal: true }, { propertyName: "_panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "_header", first: true, predicate: ["header"], descendants: true, isSignal: true }, { propertyName: "_body", first: true, predicate: ["body"], descendants: true, isSignal: true }, { propertyName: "_content", first: true, predicate: ["content"], descendants: true, isSignal: true }, { propertyName: "_probe", first: true, predicate: ["probe"], descendants: true, isSignal: true }], exportAs: ["tlsSheet"], ngImport: i0, template: "<div\n class=\"tls-sheet\"\n #root\n [class.tls-sheet--dragging]=\"motionState() === 'dragging'\"\n [class.tls-sheet--settling]=\"motionState() === 'settling'\"\n [class.tls-sheet--modal]=\"isModal()\"\n [class.tls-sheet--top]=\"isTop()\"\n [class.tls-sheet--collapsed]=\"currentIndex() === 0\"\n [class.tls-sheet--lip]=\"isBoundForLip()\"\n>\n <div class=\"tls-sheet__backdrop\" #backdrop aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n <div\n class=\"tls-sheet__panel\"\n #panel\n [attr.role]=\"isModal() ? 'dialog' : 'region'\"\n [attr.aria-modal]=\"isModal() ? 'true' : null\"\n [attr.aria-label]=\"label()\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"pointerTypes\"\n [manageTouchAction]=\"!isTop()\"\n (panStart)=\"onPanStart($event)\"\n (panMove)=\"onPanMove($event)\"\n (panEnd)=\"onPanEnd($event)\"\n (panCancel)=\"onPanCancel()\"\n >\n @if (grabber()) {\n <div class=\"tls-sheet__grabber\" aria-hidden=\"true\"></div>\n }\n <button\n type=\"button\"\n class=\"tls-sheet__header\"\n #header\n [attr.aria-expanded]=\"isExpanded()\"\n [attr.aria-controls]=\"bodyId\"\n [attr.aria-description]=\"description()\"\n (click)=\"onHeaderClick()\"\n (keydown.arrowUp)=\"onArrowUp($event)\"\n (keydown.arrowDown)=\"onArrowDown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"headerTemplate().templateRef\" />\n </button>\n <div class=\"tls-sheet__body\" #body [id]=\"bodyId\">\n <div class=\"tls-sheet__content\" #content>\n <ng-content />\n </div>\n </div>\n <div class=\"tls-sheet__probe\" #probe aria-hidden=\"true\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PanDirective, selector: "[tlsPan]", inputs: ["tlsPan", "axis", "manageTouchAction", "threshold", "lockRatio", "edge", "edgeSize", "pointerTypes"], outputs: ["panStart", "panMove", "panEnd", "panCancel"] }] });
|
|
17286
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Sheet, isStandalone: true, selector: "tls-sheet", inputs: { detents: { classPropertyName: "detents", publicName: "detents", isSignal: true, isRequired: true, transformFunction: null }, detent: { classPropertyName: "detent", publicName: "detent", isSignal: true, isRequired: false, transformFunction: null }, modalFrom: { classPropertyName: "modalFrom", publicName: "modalFrom", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, detentLabels: { classPropertyName: "detentLabels", publicName: "detentLabels", isSignal: true, isRequired: false, transformFunction: null }, grabber: { classPropertyName: "grabber", publicName: "grabber", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { detent: "detentChange" }, host: { listeners: { "document:keydown.escape": "onEscape($event)" }, styleAttribute: "display: none" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: SheetHeaderDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_root", first: true, predicate: ["root"], descendants: true, isSignal: true }, { propertyName: "_backdrop", first: true, predicate: ["backdrop"], descendants: true, isSignal: true }, { propertyName: "_panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "_header", first: true, predicate: ["header"], descendants: true, isSignal: true }, { propertyName: "_body", first: true, predicate: ["body"], descendants: true, isSignal: true }, { propertyName: "_content", first: true, predicate: ["content"], descendants: true, isSignal: true }, { propertyName: "_probe", first: true, predicate: ["probe"], descendants: true, isSignal: true }], exportAs: ["tlsSheet"], ngImport: i0, template: "<div\n class=\"tls-sheet\"\n #root\n [class.tls-sheet--dragging]=\"motionState() === 'dragging'\"\n [class.tls-sheet--settling]=\"motionState() === 'settling'\"\n [class.tls-sheet--modal]=\"isModal()\"\n [class.tls-sheet--top]=\"isTop()\"\n [class.tls-sheet--collapsed]=\"currentIndex() === 0\"\n [class.tls-sheet--lip]=\"isBoundForLip()\"\n>\n <div class=\"tls-sheet__backdrop\" #backdrop aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n <div\n class=\"tls-sheet__panel\"\n #panel\n [attr.role]=\"isModal() ? 'dialog' : 'region'\"\n [attr.aria-modal]=\"isModal() ? 'true' : null\"\n [attr.aria-label]=\"label()\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"pointerTypes\"\n [manageTouchAction]=\"!isTop()\"\n (panStart)=\"onPanStart($event)\"\n (panMove)=\"onPanMove($event)\"\n (panEnd)=\"onPanEnd($event)\"\n (panCancel)=\"onPanCancel()\"\n >\n @if (grabber()) {\n <div class=\"tls-sheet__grabber\" aria-hidden=\"true\"></div>\n }\n <button\n type=\"button\"\n class=\"tls-sheet__header\"\n #header\n [attr.aria-expanded]=\"isExpanded()\"\n [attr.aria-controls]=\"bodyId\"\n [attr.aria-description]=\"description()\"\n (click)=\"onHeaderClick()\"\n (keydown.arrowUp)=\"onArrowUp($event)\"\n (keydown.arrowDown)=\"onArrowDown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"headerTemplate().templateRef\" />\n </button>\n <!-- A CDK scroll container, so a panel anchored to a field inside the body\n follows the field when the body scrolls. -->\n <div class=\"tls-sheet__body\" #body cdkScrollable [id]=\"bodyId\">\n <div class=\"tls-sheet__content\" #content>\n <ng-content />\n </div>\n </div>\n <div class=\"tls-sheet__probe\" #probe aria-hidden=\"true\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PanDirective, selector: "[tlsPan]", inputs: ["tlsPan", "axis", "manageTouchAction", "threshold", "lockRatio", "edge", "edgeSize", "pointerTypes"], outputs: ["panStart", "panMove", "panEnd", "panCancel"] }, { kind: "directive", type: CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }] });
|
|
16335
17287
|
}
|
|
16336
17288
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Sheet, decorators: [{
|
|
16337
17289
|
type: Component,
|
|
16338
|
-
args: [{ selector: 'tls-sheet', exportAs: 'tlsSheet', imports: [NgTemplateOutlet, PanDirective], host: {
|
|
17290
|
+
args: [{ selector: 'tls-sheet', exportAs: 'tlsSheet', imports: [NgTemplateOutlet, PanDirective, CdkScrollable], host: {
|
|
16339
17291
|
// Nothing renders in place — the panel lives in the overlay — so the host
|
|
16340
17292
|
// claims no slot in the page's flow.
|
|
16341
17293
|
style: 'display: none',
|
|
16342
17294
|
'(document:keydown.escape)': 'onEscape($event)',
|
|
16343
|
-
}, template: "<div\n class=\"tls-sheet\"\n #root\n [class.tls-sheet--dragging]=\"motionState() === 'dragging'\"\n [class.tls-sheet--settling]=\"motionState() === 'settling'\"\n [class.tls-sheet--modal]=\"isModal()\"\n [class.tls-sheet--top]=\"isTop()\"\n [class.tls-sheet--collapsed]=\"currentIndex() === 0\"\n [class.tls-sheet--lip]=\"isBoundForLip()\"\n>\n <div class=\"tls-sheet__backdrop\" #backdrop aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n <div\n class=\"tls-sheet__panel\"\n #panel\n [attr.role]=\"isModal() ? 'dialog' : 'region'\"\n [attr.aria-modal]=\"isModal() ? 'true' : null\"\n [attr.aria-label]=\"label()\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"pointerTypes\"\n [manageTouchAction]=\"!isTop()\"\n (panStart)=\"onPanStart($event)\"\n (panMove)=\"onPanMove($event)\"\n (panEnd)=\"onPanEnd($event)\"\n (panCancel)=\"onPanCancel()\"\n >\n @if (grabber()) {\n <div class=\"tls-sheet__grabber\" aria-hidden=\"true\"></div>\n }\n <button\n type=\"button\"\n class=\"tls-sheet__header\"\n #header\n [attr.aria-expanded]=\"isExpanded()\"\n [attr.aria-controls]=\"bodyId\"\n [attr.aria-description]=\"description()\"\n (click)=\"onHeaderClick()\"\n (keydown.arrowUp)=\"onArrowUp($event)\"\n (keydown.arrowDown)=\"onArrowDown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"headerTemplate().templateRef\" />\n </button>\n <div class=\"tls-sheet__body\" #body [id]=\"bodyId\">\n <div class=\"tls-sheet__content\" #content>\n <ng-content />\n </div>\n </div>\n <div class=\"tls-sheet__probe\" #probe aria-hidden=\"true\"></div>\n </div>\n</div>\n" }]
|
|
17295
|
+
}, template: "<div\n class=\"tls-sheet\"\n #root\n [class.tls-sheet--dragging]=\"motionState() === 'dragging'\"\n [class.tls-sheet--settling]=\"motionState() === 'settling'\"\n [class.tls-sheet--modal]=\"isModal()\"\n [class.tls-sheet--top]=\"isTop()\"\n [class.tls-sheet--collapsed]=\"currentIndex() === 0\"\n [class.tls-sheet--lip]=\"isBoundForLip()\"\n>\n <div class=\"tls-sheet__backdrop\" #backdrop aria-hidden=\"true\" (click)=\"onBackdropClick()\"></div>\n <div\n class=\"tls-sheet__panel\"\n #panel\n [attr.role]=\"isModal() ? 'dialog' : 'region'\"\n [attr.aria-modal]=\"isModal() ? 'true' : null\"\n [attr.aria-label]=\"label()\"\n tlsPan\n axis=\"y\"\n [pointerTypes]=\"pointerTypes\"\n [manageTouchAction]=\"!isTop()\"\n (panStart)=\"onPanStart($event)\"\n (panMove)=\"onPanMove($event)\"\n (panEnd)=\"onPanEnd($event)\"\n (panCancel)=\"onPanCancel()\"\n >\n @if (grabber()) {\n <div class=\"tls-sheet__grabber\" aria-hidden=\"true\"></div>\n }\n <button\n type=\"button\"\n class=\"tls-sheet__header\"\n #header\n [attr.aria-expanded]=\"isExpanded()\"\n [attr.aria-controls]=\"bodyId\"\n [attr.aria-description]=\"description()\"\n (click)=\"onHeaderClick()\"\n (keydown.arrowUp)=\"onArrowUp($event)\"\n (keydown.arrowDown)=\"onArrowDown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"headerTemplate().templateRef\" />\n </button>\n <!-- A CDK scroll container, so a panel anchored to a field inside the body\n follows the field when the body scrolls. -->\n <div class=\"tls-sheet__body\" #body cdkScrollable [id]=\"bodyId\">\n <div class=\"tls-sheet__content\" #content>\n <ng-content />\n </div>\n </div>\n <div class=\"tls-sheet__probe\" #probe aria-hidden=\"true\"></div>\n </div>\n</div>\n" }]
|
|
16344
17296
|
}], ctorParameters: () => [], propDecorators: { detents: [{ type: i0.Input, args: [{ isSignal: true, alias: "detents", required: true }] }], detent: [{ type: i0.Input, args: [{ isSignal: true, alias: "detent", required: false }] }, { type: i0.Output, args: ["detentChange"] }], modalFrom: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalFrom", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], detentLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "detentLabels", required: false }] }], grabber: [{ type: i0.Input, args: [{ isSignal: true, alias: "grabber", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SheetHeaderDirective), { isSignal: true }] }], _root: [{ type: i0.ViewChild, args: ['root', { isSignal: true }] }], _backdrop: [{ type: i0.ViewChild, args: ['backdrop', { isSignal: true }] }], _panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], _header: [{ type: i0.ViewChild, args: ['header', { isSignal: true }] }], _body: [{ type: i0.ViewChild, args: ['body', { isSignal: true }] }], _content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], _probe: [{ type: i0.ViewChild, args: ['probe', { isSignal: true }] }] } });
|
|
16345
17297
|
|
|
16346
17298
|
const DEFAULT_SKELETON_CONFIG = {
|
|
@@ -16357,6 +17309,117 @@ const SKELETON_CONFIG = new InjectionToken('SKELETON_CONFIG', {
|
|
|
16357
17309
|
factory: () => DEFAULT_SKELETON_CONFIG,
|
|
16358
17310
|
});
|
|
16359
17311
|
|
|
17312
|
+
/**
|
|
17313
|
+
* Draws a skeleton in an image's own box while its picture is on its way, and
|
|
17314
|
+
* clears it once the picture is decoded and ready to paint, so an image coming
|
|
17315
|
+
* in over the network reads as content still to come rather than as an empty
|
|
17316
|
+
* hole. An image the browser already holds is ready at once and never shows the
|
|
17317
|
+
* placeholder.
|
|
17318
|
+
*
|
|
17319
|
+
* ```html
|
|
17320
|
+
* <img tlsImageSkeleton src="beach.jpg" alt="Beach" width="320" height="200" />
|
|
17321
|
+
* ```
|
|
17322
|
+
*
|
|
17323
|
+
* The placeholder is the image's own background, as the framework's optimized
|
|
17324
|
+
* image draws its blurred placeholder, so it takes the image's size, shape and
|
|
17325
|
+
* radius with no element of its own. The image therefore needs a size before
|
|
17326
|
+
* its picture arrives — width and height attributes, or a size given by its
|
|
17327
|
+
* layout; a box that waits for the picture to size it has nothing to draw on.
|
|
17328
|
+
*
|
|
17329
|
+
* A picture that fails to load clears the placeholder too and leaves the
|
|
17330
|
+
* browser's own broken-image rendering; listen to the image's native `error`
|
|
17331
|
+
* event to show a fallback in its place. A new source shows the placeholder
|
|
17332
|
+
* again until that picture is ready.
|
|
17333
|
+
*
|
|
17334
|
+
* The fill and its sweep follow the skeleton's: the same colours, the sweep
|
|
17335
|
+
* only at the `full` motion level, and no sweep where the skeleton config turns
|
|
17336
|
+
* `animate` off.
|
|
17337
|
+
*/
|
|
17338
|
+
class ImageSkeletonDirective {
|
|
17339
|
+
// Injections
|
|
17340
|
+
_elementRef = inject(ElementRef);
|
|
17341
|
+
_destroyRef = inject(DestroyRef);
|
|
17342
|
+
_config = inject(SKELETON_CONFIG);
|
|
17343
|
+
// State
|
|
17344
|
+
/**
|
|
17345
|
+
* Whether the picture is still on its way. True until the first render
|
|
17346
|
+
* reads the image, so a page rendered ahead of the browser (on a server)
|
|
17347
|
+
* shows the placeholder rather than a blank box.
|
|
17348
|
+
*/
|
|
17349
|
+
loading = signal(true, /* @ts-ignore */
|
|
17350
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
17351
|
+
/** Whether the placeholder sweeps, read once from the skeleton config. */
|
|
17352
|
+
animate = this._config.animate;
|
|
17353
|
+
/**
|
|
17354
|
+
* Counts the sources the image has been given, so a picture decoded after
|
|
17355
|
+
* the source changed again does not clear the placeholder of its successor.
|
|
17356
|
+
*/
|
|
17357
|
+
_sourceGeneration = 0;
|
|
17358
|
+
// Constructor
|
|
17359
|
+
constructor() {
|
|
17360
|
+
afterNextRender(() => {
|
|
17361
|
+
// Read once every binding has set the source, which the image's own
|
|
17362
|
+
// events cannot report when the picture was ready before they were
|
|
17363
|
+
// listened to.
|
|
17364
|
+
this.loading.set(!this._elementRef.nativeElement.complete);
|
|
17365
|
+
this._observeSource();
|
|
17366
|
+
});
|
|
17367
|
+
}
|
|
17368
|
+
// Protected methods
|
|
17369
|
+
/**
|
|
17370
|
+
* Waits for the picture to be decoded before clearing the placeholder: an
|
|
17371
|
+
* image decoded off the main thread can fire `load` a frame before it paints,
|
|
17372
|
+
* and clearing on `load` would show a blank box for that frame.
|
|
17373
|
+
*/
|
|
17374
|
+
onLoad() {
|
|
17375
|
+
const generation = this._sourceGeneration;
|
|
17376
|
+
const settle = () => {
|
|
17377
|
+
if (generation === this._sourceGeneration)
|
|
17378
|
+
this.loading.set(false);
|
|
17379
|
+
};
|
|
17380
|
+
// A picture that loaded but cannot be decoded is the browser's to render
|
|
17381
|
+
// as it will; the placeholder clears either way.
|
|
17382
|
+
this._elementRef.nativeElement.decode().then(settle, settle);
|
|
17383
|
+
}
|
|
17384
|
+
onError() {
|
|
17385
|
+
this.loading.set(false);
|
|
17386
|
+
}
|
|
17387
|
+
// Private methods
|
|
17388
|
+
/**
|
|
17389
|
+
* Shows the placeholder again whenever the image is given a source it does
|
|
17390
|
+
* not yet hold. A source can be set by any binding — a plain `src`, a
|
|
17391
|
+
* `srcset`, or a directive that writes them — so the attributes themselves
|
|
17392
|
+
* are watched rather than an input of this directive's.
|
|
17393
|
+
*/
|
|
17394
|
+
_observeSource() {
|
|
17395
|
+
const image = this._elementRef.nativeElement;
|
|
17396
|
+
const observer = new MutationObserver(() => {
|
|
17397
|
+
this._sourceGeneration += 1;
|
|
17398
|
+
// A picture the browser already holds is complete at once; its `load`
|
|
17399
|
+
// still follows and settles it.
|
|
17400
|
+
if (!image.complete)
|
|
17401
|
+
this.loading.set(true);
|
|
17402
|
+
});
|
|
17403
|
+
observer.observe(image, { attributeFilter: ['src', 'srcset'] });
|
|
17404
|
+
this._destroyRef.onDestroy(() => observer.disconnect());
|
|
17405
|
+
}
|
|
17406
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ImageSkeletonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
17407
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: ImageSkeletonDirective, isStandalone: true, selector: "img[tlsImageSkeleton]", host: { listeners: { "load": "onLoad()", "error": "onError()" }, properties: { "class.tls-image-skeleton--loading": "loading()", "class.tls-image-skeleton--no-animate": "!animate" }, classAttribute: "tls-image-skeleton" }, ngImport: i0 });
|
|
17408
|
+
}
|
|
17409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ImageSkeletonDirective, decorators: [{
|
|
17410
|
+
type: Directive,
|
|
17411
|
+
args: [{
|
|
17412
|
+
selector: 'img[tlsImageSkeleton]',
|
|
17413
|
+
host: {
|
|
17414
|
+
class: 'tls-image-skeleton',
|
|
17415
|
+
'[class.tls-image-skeleton--loading]': 'loading()',
|
|
17416
|
+
'[class.tls-image-skeleton--no-animate]': '!animate',
|
|
17417
|
+
'(load)': 'onLoad()',
|
|
17418
|
+
'(error)': 'onError()',
|
|
17419
|
+
},
|
|
17420
|
+
}]
|
|
17421
|
+
}], ctorParameters: () => [] });
|
|
17422
|
+
|
|
16360
17423
|
/**
|
|
16361
17424
|
* A placeholder drawn where content is still on its way. By default it is a
|
|
16362
17425
|
* box of the given size; as `text` it is one line of the text it stands in
|
|
@@ -16378,6 +17441,11 @@ class Skeleton {
|
|
|
16378
17441
|
duration = input(this._config.duration, /* @ts-ignore */
|
|
16379
17442
|
...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
16380
17443
|
rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
17444
|
+
/**
|
|
17445
|
+
* Whether the fill sweeps while it waits. The sweep is decorative, so it plays
|
|
17446
|
+
* only at the `full` motion level; below it the fill holds still whatever this
|
|
17447
|
+
* is set to.
|
|
17448
|
+
*/
|
|
16381
17449
|
animate = input(this._config.animate, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
16382
17450
|
/**
|
|
16383
17451
|
* Whether there is still something to wait for. Turned off, the skeleton
|
|
@@ -16916,7 +17984,7 @@ class Step {
|
|
|
16916
17984
|
}, /* @ts-ignore */
|
|
16917
17985
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
16918
17986
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16919
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Step, isStandalone: true, selector: "tls-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-step" }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$
|
|
17987
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: Step, isStandalone: true, selector: "tls-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-step" }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$2.TabPanel, inputs: ["value", "value"] }], ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
16920
17988
|
}
|
|
16921
17989
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Step, decorators: [{
|
|
16922
17990
|
type: Component,
|
|
@@ -16973,7 +18041,7 @@ class Stepper {
|
|
|
16973
18041
|
this.stepSelect.emit({ index, value });
|
|
16974
18042
|
}
|
|
16975
18043
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
16976
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-stepper" }, queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$
|
|
18044
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "tls-stepper" }, queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$2.Tabs }], ngImport: i0, template: "<ul\n class=\"tls-stepper-header\"\n ngTabList\n [orientation]=\"orientation()\"\n [wrap]=\"false\"\n [softDisabled]=\"false\"\n [selectedTab]=\"active()\"\n (selectedTabChange)=\"onSelectedTabChange($event)\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n>\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n @let isCompleted = activeIndex() > index || completed();\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header__item--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"ariaTab.selected()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--invalid]=\"step.invalid()\"\n [class.tls-stepper-header__item--completed]=\"isCompleted\">\n <button\n #ariaTab=\"ngTab\"\n ngTab\n class=\"tls-stepper-header-button\"\n type=\"button\"\n [value]=\"step.value()\"\n [disabled]=\"step.disabled() || (linear() && index > activeIndex() + 1)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n\n @if (step.invalid()) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.invalid }}</span>\n } @else if (isCompleted) {\n <span class=\"tls-stepper-header-button__state\">{{ labels.completed }}</span>\n }\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TabList, selector: "[ngTabList]", inputs: ["orientation", "wrap", "softDisabled", "focusMode", "selectionMode", "selectedTab", "disabled"], outputs: ["selectedTabChange"], exportAs: ["ngTabList"] }, { kind: "directive", type: Tab$1, selector: "[ngTab]", inputs: ["id", "disabled", "value"], exportAs: ["ngTab"] }] });
|
|
16977
18045
|
}
|
|
16978
18046
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Stepper, decorators: [{
|
|
16979
18047
|
type: Component,
|
|
@@ -17378,7 +18446,7 @@ class Tabs {
|
|
|
17378
18446
|
control.nativeElement.focus();
|
|
17379
18447
|
}
|
|
17380
18448
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17381
|
-
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 }, headerAlign: { classPropertyName: "headerAlign", publicName: "headerAlign", isSignal: true, isRequired: false, transformFunction: null }, itemsAlign: { classPropertyName: "itemsAlign", publicName: "itemsAlign", 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()" }, classAttribute: "tls-tabs" }, queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], viewQueries: [{ propertyName: "_tabControls", predicate: ["tabControl"], descendants: true, isSignal: true }, { propertyName: "_tabList", first: true, predicate: ["tabList"], descendants: true, isSignal: true }, { propertyName: "_tabItems", predicate: ["tabItem"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$
|
|
18449
|
+
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 }, headerAlign: { classPropertyName: "headerAlign", publicName: "headerAlign", isSignal: true, isRequired: false, transformFunction: null }, itemsAlign: { classPropertyName: "itemsAlign", publicName: "itemsAlign", 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()" }, classAttribute: "tls-tabs" }, queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], viewQueries: [{ propertyName: "_tabControls", predicate: ["tabControl"], descendants: true, isSignal: true }, { propertyName: "_tabList", first: true, predicate: ["tabList"], descendants: true, isSignal: true }, { propertyName: "_tabItems", predicate: ["tabItem"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$2.Tabs }], ngImport: i0, template: "<ul\n #tabList\n ngTabList\n class=\"tls-tab-header\"\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 #tabItem\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 #tabControl\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"] }] });
|
|
17382
18450
|
}
|
|
17383
18451
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Tabs, decorators: [{
|
|
17384
18452
|
type: Component,
|
|
@@ -17885,7 +18953,7 @@ class Toast {
|
|
|
17885
18953
|
this.dismissed.emit();
|
|
17886
18954
|
}
|
|
17887
18955
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Toast, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17888
|
-
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" }, classAttribute: "tls-toast" }, 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 [
|
|
18956
|
+
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" }, classAttribute: "tls-toast" }, 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 [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: ["busy", "label", "ariaLabel", "ariaLabelledby", "type", "href", "tabindex"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
17889
18957
|
}
|
|
17890
18958
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Toast, decorators: [{
|
|
17891
18959
|
type: Component,
|
|
@@ -17896,7 +18964,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
17896
18964
|
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
17897
18965
|
'animate.enter': 'tls-toast--enter',
|
|
17898
18966
|
'animate.leave': 'tls-toast--leave',
|
|
17899
|
-
}, 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 [
|
|
18967
|
+
}, 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 [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" }]
|
|
17900
18968
|
}], 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"] }] } });
|
|
17901
18969
|
|
|
17902
18970
|
/**
|
|
@@ -17936,6 +19004,11 @@ class ToastOutlet {
|
|
|
17936
19004
|
_service = inject(ToastService);
|
|
17937
19005
|
_destroyRef = inject(DestroyRef);
|
|
17938
19006
|
_elementRef = inject(ElementRef);
|
|
19007
|
+
/**
|
|
19008
|
+
* Optional: only apps that call `provideViewport()` register it, and without
|
|
19009
|
+
* it the stack keeps the configured `position` at every width.
|
|
19010
|
+
*/
|
|
19011
|
+
_viewportService = inject(ViewportService, { optional: true });
|
|
17939
19012
|
// State
|
|
17940
19013
|
toasts = this._service.toasts;
|
|
17941
19014
|
_pointerInside = signal(false, /* @ts-ignore */
|
|
@@ -17952,7 +19025,16 @@ class ToastOutlet {
|
|
|
17952
19025
|
_toastElements = viewChildren('toastEl', { ...(ngDevMode ? { debugName: "_toastElements" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
17953
19026
|
_resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this._measure());
|
|
17954
19027
|
// Computed
|
|
17955
|
-
|
|
19028
|
+
/**
|
|
19029
|
+
* The corner the stack is anchored to: `compactPosition` while the viewport
|
|
19030
|
+
* sits at or below `compactBelow`, `position` otherwise.
|
|
19031
|
+
*/
|
|
19032
|
+
position = computed(() => {
|
|
19033
|
+
const { position, compactPosition, compactBelow } = this._service.config;
|
|
19034
|
+
if (compactPosition === null || compactBelow === null || !this._viewportService)
|
|
19035
|
+
return position;
|
|
19036
|
+
return this._viewportService.isBelow(compactBelow)() ? compactPosition : position;
|
|
19037
|
+
}, /* @ts-ignore */
|
|
17956
19038
|
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
17957
19039
|
regionLabel = computed(() => this._service.config.regionLabel, /* @ts-ignore */
|
|
17958
19040
|
...(ngDevMode ? [{ debugName: "regionLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -18007,13 +19089,23 @@ class ToastOutlet {
|
|
|
18007
19089
|
for (let ahead = 0; ahead < frontIndex; ahead++) {
|
|
18008
19090
|
offset += (heights[ahead] ?? 0) + TOAST_EXPANDED_GAP;
|
|
18009
19091
|
}
|
|
18010
|
-
return {
|
|
19092
|
+
return {
|
|
19093
|
+
transform: `translateY(${sign * offset}px)`,
|
|
19094
|
+
depthOpacity: '1',
|
|
19095
|
+
zIndex,
|
|
19096
|
+
behind: false,
|
|
19097
|
+
};
|
|
18011
19098
|
}
|
|
18012
19099
|
const depth = Math.min(frontIndex, TOAST_COLLAPSED_VISIBLE_DEPTH);
|
|
18013
19100
|
const translate = sign * depth * TOAST_COLLAPSED_PEEK;
|
|
18014
19101
|
const scale = Math.max(1 - depth * TOAST_COLLAPSED_SCALE_STEP, TOAST_COLLAPSED_MIN_SCALE);
|
|
18015
19102
|
const depthOpacity = frontIndex > TOAST_COLLAPSED_VISIBLE_DEPTH ? '0' : '1';
|
|
18016
|
-
return {
|
|
19103
|
+
return {
|
|
19104
|
+
transform: `translateY(${translate}px) scale(${scale})`,
|
|
19105
|
+
depthOpacity,
|
|
19106
|
+
zIndex,
|
|
19107
|
+
behind: frontIndex > 0,
|
|
19108
|
+
};
|
|
18017
19109
|
});
|
|
18018
19110
|
}, /* @ts-ignore */
|
|
18019
19111
|
...(ngDevMode ? [{ debugName: "layouts" }] : /* istanbul ignore next */ []));
|
|
@@ -18098,7 +19190,7 @@ class ToastOutlet {
|
|
|
18098
19190
|
this._heights.set(this._toastElements().map(element => element.nativeElement.offsetHeight));
|
|
18099
19191
|
}
|
|
18100
19192
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToastOutlet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
18101
|
-
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=\"tls-toast-region\"\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"] }] });
|
|
19193
|
+
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=\"tls-toast-region\"\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 [class.tls-toast--behind]=\"layouts()[index].behind\"\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"] }] });
|
|
18102
19194
|
}
|
|
18103
19195
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToastOutlet, decorators: [{
|
|
18104
19196
|
type: Component,
|
|
@@ -18107,13 +19199,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
18107
19199
|
// Touch has no hover-out; a tap outside the stack is what collapses a
|
|
18108
19200
|
// touch-expanded pile (and resumes the auto-dismiss timers).
|
|
18109
19201
|
'(document:pointerdown)': 'onDocumentPointerDown($event)',
|
|
18110
|
-
}, template: "<div\n class=\"tls-toast-region\"\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" }]
|
|
19202
|
+
}, template: "<div\n class=\"tls-toast-region\"\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 [class.tls-toast--behind]=\"layouts()[index].behind\"\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" }]
|
|
18111
19203
|
}], ctorParameters: () => [], propDecorators: { _toastElements: [{ type: i0.ViewChildren, args: ['toastEl', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
18112
19204
|
|
|
18113
19205
|
const DEFAULT_TOAST_CONFIG = {
|
|
18114
19206
|
position: 'top-end',
|
|
19207
|
+
compactPosition: null,
|
|
19208
|
+
compactBelow: null,
|
|
18115
19209
|
stacking: 'collapsed',
|
|
18116
19210
|
duration: 5000,
|
|
19211
|
+
actionDuration: null,
|
|
18117
19212
|
max: 5,
|
|
18118
19213
|
color: 'primary',
|
|
18119
19214
|
severityColors: {
|
|
@@ -18161,7 +19256,7 @@ class ToastService {
|
|
|
18161
19256
|
// Public methods
|
|
18162
19257
|
show(options) {
|
|
18163
19258
|
this._ensureOutlet();
|
|
18164
|
-
const duration = options.duration ?? this.
|
|
19259
|
+
const duration = options.duration ?? this._defaultDuration(options);
|
|
18165
19260
|
const toast = {
|
|
18166
19261
|
id: ++this._counter,
|
|
18167
19262
|
message: options.message,
|
|
@@ -18228,6 +19323,11 @@ class ToastService {
|
|
|
18228
19323
|
}
|
|
18229
19324
|
}
|
|
18230
19325
|
// Private methods
|
|
19326
|
+
/** The configured delay for a toast that names none of its own. */
|
|
19327
|
+
_defaultDuration(options) {
|
|
19328
|
+
const { actionDuration, duration } = this._config;
|
|
19329
|
+
return options.action && actionDuration !== null ? actionDuration : duration;
|
|
19330
|
+
}
|
|
18231
19331
|
_startTimer(id, remaining) {
|
|
18232
19332
|
if (this._paused) {
|
|
18233
19333
|
this._timers.set(id, { remaining, startedAt: Date.now(), handle: null });
|
|
@@ -18321,6 +19421,26 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
18321
19421
|
return;
|
|
18322
19422
|
inject(DOCUMENT).documentElement.setAttribute('data-touch-controls', 'large');
|
|
18323
19423
|
}),
|
|
19424
|
+
// Reflect how focus arrived — by keyboard, mouse or touch — onto the document
|
|
19425
|
+
// root, so a style can mark keyboard focus alone. The browser's own
|
|
19426
|
+
// `:focus-visible` cannot: a text field matches it on a click too, since it
|
|
19427
|
+
// takes typing. Read at the moment focus moves rather than kept up to date,
|
|
19428
|
+
// so typing into a field that was clicked does not turn it into keyboard
|
|
19429
|
+
// focus. Absent until focus first moves, which styles read as keyboard, so
|
|
19430
|
+
// nothing loses its focus mark before the origin is known.
|
|
19431
|
+
provideEnvironmentInitializer(() => {
|
|
19432
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
19433
|
+
return;
|
|
19434
|
+
const document = inject(DOCUMENT);
|
|
19435
|
+
const inputModalityDetector = inject(InputModalityDetector);
|
|
19436
|
+
const onFocusIn = () => {
|
|
19437
|
+
const modality = inputModalityDetector.mostRecentModality;
|
|
19438
|
+
if (modality)
|
|
19439
|
+
document.documentElement.setAttribute('data-focus-origin', modality);
|
|
19440
|
+
};
|
|
19441
|
+
document.addEventListener('focusin', onFocusIn, true);
|
|
19442
|
+
inject(DestroyRef).onDestroy(() => document.removeEventListener('focusin', onFocusIn, true));
|
|
19443
|
+
}),
|
|
18324
19444
|
// Cross-cutting form defaults
|
|
18325
19445
|
{
|
|
18326
19446
|
provide: FORM_CONTROL_CONFIG,
|
|
@@ -18554,5 +19674,5 @@ const provideThalassicUIConfig = (config = {}) => {
|
|
|
18554
19674
|
* Generated bundle index. Do not edit.
|
|
18555
19675
|
*/
|
|
18556
19676
|
|
|
18557
|
-
export { ACCORDION_CONFIG, ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, ALPHA_MAX, AUTOCOMPLETE_CONFIG, Accordion, AccordionItem, ActivityHeatmap, Alert, AlertIcon, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CAROUSEL_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, COLOR_INPUT_CONFIG, COLOR_PICKER_CONFIG, COLOR_PICKER_DEFAULT_VALUE, COLOR_RANGE_CONFIG, COLOR_SWATCH_PICKER_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Carousel, CarouselSlide, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, ColorInput, ColorPicker, ColorRange, ColorSwatch, ColorSwatchPicker, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACCORDION_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CAROUSEL_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_COLOR_INPUT_CONFIG, DEFAULT_COLOR_PICKER_CONFIG, DEFAULT_COLOR_RANGE_CONFIG, DEFAULT_COLOR_SWATCH_PICKER_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_IMAGE_PREVIEW_CONFIG, DEFAULT_INFINITE_SCROLL_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_PROGRESS_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_RATING_CONFIG, DEFAULT_RIPPLE_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SLIDING_INDICATOR_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEPPER_LABELS, DEFAULT_STEP_CONFIG, DEFAULT_SWIPE_ACTIONS_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DEFAULT_VIRTUAL_SCROLL_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DRAWER_OPENING, DRAWER_PANEL_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogRef, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, DrawerSharedDirective, DrawerTriggerDirective, FILE_INPUT_CONFIG, FORMAT_CYCLE, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FabMenu, FileDropTargetDirective, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, FormItemLabelAction, FormSkeleton, HIGHLIGHT_CONFIG, HUE_MAX, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, IMAGE_PREVIEW_CONFIG, INFINITE_SCROLL_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, ImagePreview, ImagePreviewDirective, ImagePreviewGroupDirective, ImagePreviewRef, ImagePreviewService, InfiniteScroll, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, POSITIONED_VALUES, PRESS_SCALE_PROPERTY, PROGRESS_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PickerField, PinInput, Popover, Progress, RADIO_BUTTON_CONFIG, RATING_CONFIG, RIPPLE_ACTIVE_CLASS, RIPPLE_CONFIG, RIPPLE_DIAMETER_PROPERTY, RIPPLE_MINIMUM_HOLD_MS, RIPPLE_MOVE_SLOP_PX, RIPPLE_RELEASED_CLASS, RIPPLE_TOUCH_DELAY_MS, RIPPLE_X_PROPERTY, RIPPLE_Y_PROPERTY, RadioButton, Rating, RippleDirective, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SLIDING_INDICATOR_ATTRIBUTE, SLIDING_INDICATOR_BOX_PROPERTIES, SLIDING_INDICATOR_CONFIG, SLIDING_INDICATOR_HEIGHT_PROPERTY, SLIDING_INDICATOR_PLACED, SLIDING_INDICATOR_TRAVELLING, SLIDING_INDICATOR_WIDTH_PROPERTY, SLIDING_INDICATOR_X_PROPERTY, SLIDING_INDICATOR_Y_PROPERTY, SLIDING_TABS_VARIANTS, SPLITTER_CONFIG, STEPPER_CONFIG, SV_KEYBOARD_STEP, SV_KEYBOARD_STEP_LARGE, SWIPE_ACTIONS_CONFIG, SWITCH_CONFIG, Select, Sheet, SheetHeaderDirective, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, SwipeActions, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, TOUCH_HANDOVER_WINDOW_MS, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, VIRTUAL_SCROLL_CONFIG, ValueFormControl, VirtualScroll, acceptsFile, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, canonicalHex, contrastForeground, formatHsl, formatRgb, hslToHsv, hsvToHsl, hsvToRgb, injectFormSkeleton, isTypeRejected, normalizeAccept, parseColor, provideFormItemConfig, provideThalassicIcons, provideThalassicUIConfig, relativeLuminance, resolveActivityLevel, rgbToHsv, rgbaToHex, slidingIndicator, toImagePreviewImage };
|
|
19677
|
+
export { ACCORDION_CONFIG, ACTIVITY_HEATMAP_CONFIG, ALERT_CONFIG, ALPHA_MAX, AUTOCOMPLETE_CONFIG, Accordion, AccordionItem, ActivityHeatmap, Alert, AlertIcon, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, Button, ButtonDirective, CALENDAR_CONFIG, CAROUSEL_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, COLOR_INPUT_CONFIG, COLOR_PICKER_CONFIG, COLOR_PICKER_DEFAULT_VALUE, COLOR_RANGE_CONFIG, COLOR_SWATCH_PICKER_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Carousel, CarouselSlide, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, ColorInput, ColorPicker, ColorRange, ColorSwatch, ColorSwatchPicker, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ACCORDION_CONFIG, DEFAULT_ACTIVITY_HEATMAP_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BREADCRUMBS_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CAROUSEL_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_COLOR_INPUT_CONFIG, DEFAULT_COLOR_PICKER_CONFIG, DEFAULT_COLOR_RANGE_CONFIG, DEFAULT_COLOR_SWATCH_PICKER_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_HIGHLIGHT_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_IMAGE_PREVIEW_CONFIG, DEFAULT_INFINITE_SCROLL_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MARK_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_PROGRESS_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_RATING_CONFIG, DEFAULT_RIPPLE_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SLIDER_CONFIG, DEFAULT_SLIDING_INDICATOR_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEPPER_LABELS, DEFAULT_STEP_CONFIG, DEFAULT_SWIPE_ACTIONS_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TAB_NAV_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DEFAULT_TOOLTIP_CONTENT_ATTRIBUTE, DEFAULT_VIRTUAL_SCROLL_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DRAWER_OPENING, DRAWER_PANEL_CONFIG, DateTimePicker, Dialog, DialogBody, DialogFooter, DialogHeader, DialogRef, DialogService, DialogTitleDirective, Divider, Drawer, DrawerRef, DrawerService, DrawerSharedDirective, DrawerTriggerDirective, FILE_INPUT_CONFIG, FORMAT_CYCLE, FORM_CONTROL, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FabMenu, FileDropTargetDirective, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, FormItemLabelAction, FormSkeleton, HIGHLIGHT_CONFIG, HUE_MAX, Highlight, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, IMAGE_PREVIEW_CONFIG, INFINITE_SCROLL_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, ImagePreview, ImagePreviewDirective, ImagePreviewGroupDirective, ImagePreviewRef, ImagePreviewService, ImageSkeletonDirective, InfiniteScroll, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MARK_CONFIG, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, Mark, MaskDirective, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, POSITIONED_VALUES, PRESS_SCALE_PROPERTY, PROGRESS_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PickerField, PinInput, Popover, Progress, RADIO_BUTTON_CONFIG, RATING_CONFIG, RIPPLE_ACTIVE_CLASS, RIPPLE_CONFIG, RIPPLE_DIAMETER_PROPERTY, RIPPLE_MINIMUM_HOLD_MS, RIPPLE_MOVE_SLOP_PX, RIPPLE_RELEASED_CLASS, RIPPLE_TOUCH_DELAY_MS, RIPPLE_X_PROPERTY, RIPPLE_Y_PROPERTY, RadioButton, Rating, RippleDirective, SELECT_CONFIG, SKELETON_CONFIG, SLIDER_CONFIG, SLIDING_INDICATOR_ATTRIBUTE, SLIDING_INDICATOR_BOX_PROPERTIES, SLIDING_INDICATOR_CONFIG, SLIDING_INDICATOR_HEIGHT_PROPERTY, SLIDING_INDICATOR_PLACED, SLIDING_INDICATOR_TRAVELLING, SLIDING_INDICATOR_WIDTH_PROPERTY, SLIDING_INDICATOR_X_PROPERTY, SLIDING_INDICATOR_Y_PROPERTY, SLIDING_TABS_VARIANTS, SPLITTER_CONFIG, STEPPER_CONFIG, SV_KEYBOARD_STEP, SV_KEYBOARD_STEP_LARGE, SWIPE_ACTIONS_CONFIG, SWITCH_CONFIG, Select, Sheet, SheetHeaderDirective, Skeleton, Slider, Splitter, SplitterPanel, Step, Stepper, SwipeActions, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TAB_NAV_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, TOUCH_HANDOVER_WINDOW_MS, Tab, TabLinkDirective, TabNavDirective, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastService, ToggleButton, ToggleGroup, TooltipDelegateDirective, TooltipDirective, TooltipTrigger, VIRTUAL_SCROLL_CONFIG, ValueFormControl, VirtualScroll, WEEK_STARTS_ON, acceptsFile, aggregateActivityEntries, applyMask, buildActivityMonthSegments, buildActivityThresholds, canonicalHex, contrastForeground, formatHsl, formatRgb, formatSkeleton, formatSkeletonRange, formatStandalone, hslToHsv, hsvToHsl, hsvToRgb, injectFormSkeleton, isTypeRejected, normalizeAccept, parseColor, provideFormItemConfig, provideThalassicIcons, provideThalassicUIConfig, provideWeekStartsOn, relativeLuminance, resolveActivityLevel, rgbToHsv, rgbaToHex, settleCurve, slidingIndicator, titlecaseFirstWord, toImagePreviewImage };
|
|
18558
19678
|
//# sourceMappingURL=thalassic-ui.mjs.map
|