@thalassic/ui 0.8.2 → 0.9.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 +335 -83
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +124 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, Injectable, model, contentChild, ViewContainerRef, DestroyRef,
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, Injectable, model, contentChild, ViewContainerRef, DestroyRef, signal, viewChild, output, effect, forwardRef, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
5
|
import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
|
|
@@ -7,9 +7,9 @@ import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/p
|
|
|
7
7
|
import { format, startOfMonth, endOfMonth, eachDayOfInterval, endOfWeek, startOfWeek, subMonths, addMonths, isSameDay, isSameMonth, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, startOfDay, setHours, setMinutes, setYear } from 'date-fns';
|
|
8
8
|
import { Overlay } from '@angular/cdk/overlay';
|
|
9
9
|
import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
|
|
10
|
+
import { filter, throwError, map, shareReplay } from 'rxjs';
|
|
10
11
|
import { HttpClient } from '@angular/common/http';
|
|
11
12
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
12
|
-
import { throwError, map, shareReplay } from 'rxjs';
|
|
13
13
|
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
14
14
|
import { deepMerge } from '@thalassic/core';
|
|
15
15
|
|
|
@@ -448,6 +448,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
448
448
|
}, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<div class=\"tls-checkbox-icon\">\n @if (indeterminate()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M288-444v-72h384v72H288Z\" />\n </svg>\n } @else {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M400-301 240-461l51-51 109 109 269-269 51 51-320 320Z\" />\n </svg>\n }\n</div>\n" }]
|
|
449
449
|
}], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
450
450
|
|
|
451
|
+
const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
|
|
452
|
+
/**
|
|
453
|
+
* Owns the CDK-Overlay lifecycle shared by the library's connected overlay
|
|
454
|
+
* components (popover, menu, select): create/attach, dismissal wiring
|
|
455
|
+
* (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
|
|
456
|
+
* positional and dismissal differences between components are expressed through
|
|
457
|
+
* {@link ConnectedOverlayConfig} rather than duplicated per component.
|
|
458
|
+
*
|
|
459
|
+
* Create one via {@link createOverlayManager} from a component field initializer
|
|
460
|
+
* so it is bound to the host's injection context.
|
|
461
|
+
*/
|
|
462
|
+
class OverlayManager {
|
|
463
|
+
_overlay = inject(Overlay);
|
|
464
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
465
|
+
_destroyRef = inject(DestroyRef);
|
|
466
|
+
_overlayRef = null;
|
|
467
|
+
_config = null;
|
|
468
|
+
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
469
|
+
isOpen = this._isOpen.asReadonly();
|
|
470
|
+
// Dispose the overlay with the host. Registered in a field initializer so no
|
|
471
|
+
// constructor is needed.
|
|
472
|
+
_teardown = this._destroyRef.onDestroy(() => this._dispose());
|
|
473
|
+
open(config) {
|
|
474
|
+
if (this._isOpen())
|
|
475
|
+
return;
|
|
476
|
+
this._config = config;
|
|
477
|
+
if (!this._overlayRef) {
|
|
478
|
+
this._overlayRef = this._overlay.create({
|
|
479
|
+
positionStrategy: this._buildPositionStrategy(config),
|
|
480
|
+
scrollStrategy: config.scrollStrategy === 'close'
|
|
481
|
+
? this._overlay.scrollStrategies.close()
|
|
482
|
+
: this._overlay.scrollStrategies.reposition(),
|
|
483
|
+
hasBackdrop: config.hasBackdrop ?? true,
|
|
484
|
+
backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
|
|
485
|
+
...(config.panelClass != null && { panelClass: config.panelClass }),
|
|
486
|
+
});
|
|
487
|
+
this._wireDismissal(this._overlayRef, config);
|
|
488
|
+
}
|
|
489
|
+
if (config.minWidth != null) {
|
|
490
|
+
this._overlayRef.updateSize({ minWidth: config.minWidth });
|
|
491
|
+
}
|
|
492
|
+
this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
|
|
493
|
+
this._isOpen.set(true);
|
|
494
|
+
}
|
|
495
|
+
close() {
|
|
496
|
+
if (!this._isOpen())
|
|
497
|
+
return;
|
|
498
|
+
if (this._config?.reuse) {
|
|
499
|
+
this._overlayRef?.detach();
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
this._overlayRef?.dispose();
|
|
503
|
+
this._overlayRef = null;
|
|
504
|
+
}
|
|
505
|
+
this._isOpen.set(false);
|
|
506
|
+
this._config?.onClose?.();
|
|
507
|
+
}
|
|
508
|
+
// Private
|
|
509
|
+
_buildPositionStrategy(config) {
|
|
510
|
+
let strategy = this._overlay
|
|
511
|
+
.position()
|
|
512
|
+
.flexibleConnectedTo(config.origin)
|
|
513
|
+
.withPositions(config.positions);
|
|
514
|
+
if (config.flexibleDimensions === false)
|
|
515
|
+
strategy = strategy.withFlexibleDimensions(false);
|
|
516
|
+
if (config.push === false)
|
|
517
|
+
strategy = strategy.withPush(false);
|
|
518
|
+
return strategy;
|
|
519
|
+
}
|
|
520
|
+
_wireDismissal(overlayRef, config) {
|
|
521
|
+
const hasBackdrop = config.hasBackdrop ?? true;
|
|
522
|
+
if (config.closeOnBackdropClick ?? hasBackdrop) {
|
|
523
|
+
overlayRef
|
|
524
|
+
.backdropClick()
|
|
525
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
526
|
+
.subscribe(() => this.close());
|
|
527
|
+
}
|
|
528
|
+
if (config.closeOnOutsidePointer ?? !hasBackdrop) {
|
|
529
|
+
overlayRef
|
|
530
|
+
.outsidePointerEvents()
|
|
531
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'))
|
|
532
|
+
.subscribe(() => this.close());
|
|
533
|
+
}
|
|
534
|
+
if (config.closeOnEscape ?? true) {
|
|
535
|
+
overlayRef
|
|
536
|
+
.keydownEvents()
|
|
537
|
+
.pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
|
|
538
|
+
.subscribe(() => this.close());
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
_dispose() {
|
|
542
|
+
this._overlayRef?.dispose();
|
|
543
|
+
this._overlayRef = null;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Creates an {@link OverlayManager} bound to the current injection context.
|
|
548
|
+
* Call from a component/directive field initializer or constructor.
|
|
549
|
+
*/
|
|
550
|
+
function createOverlayManager() {
|
|
551
|
+
return new OverlayManager();
|
|
552
|
+
}
|
|
553
|
+
|
|
451
554
|
const OVERLAY_POSITION_MAP = {
|
|
452
555
|
top: {
|
|
453
556
|
originX: 'center',
|
|
@@ -601,61 +704,35 @@ const POPOVER_CONFIG = new InjectionToken('POPOVER_CONFIG', {
|
|
|
601
704
|
|
|
602
705
|
class Popover {
|
|
603
706
|
static _counter = 0;
|
|
604
|
-
_overlay = inject(Overlay);
|
|
605
|
-
_viewContainerRef = inject(ViewContainerRef);
|
|
606
707
|
_config = inject(POPOVER_CONFIG);
|
|
607
|
-
|
|
708
|
+
_overlay = createOverlayManager();
|
|
608
709
|
_templateRef = viewChild.required('content');
|
|
609
|
-
_overlayRef = null;
|
|
610
|
-
_isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
|
|
611
710
|
id = `tls-popover-${++Popover._counter}`;
|
|
612
|
-
isOpen = this.
|
|
711
|
+
isOpen = this._overlay.isOpen;
|
|
613
712
|
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
614
713
|
offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
615
714
|
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
616
715
|
_positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
617
716
|
// Public methods
|
|
618
717
|
open(trigger) {
|
|
619
|
-
if (this._overlayRef)
|
|
620
|
-
return;
|
|
621
718
|
const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
|
|
622
|
-
|
|
623
|
-
.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
this._overlayRef = this._overlay.create({
|
|
627
|
-
positionStrategy,
|
|
628
|
-
scrollStrategy: this._overlay.scrollStrategies.reposition(),
|
|
629
|
-
hasBackdrop: true,
|
|
630
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
719
|
+
this._overlay.open({
|
|
720
|
+
content: this._templateRef(),
|
|
721
|
+
origin,
|
|
722
|
+
positions: this._positions(),
|
|
631
723
|
});
|
|
632
|
-
this._overlayRef
|
|
633
|
-
.backdropClick()
|
|
634
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
635
|
-
.subscribe(() => this.close());
|
|
636
|
-
this._overlayRef.attach(new TemplatePortal(this._templateRef(), this._viewContainerRef));
|
|
637
|
-
this._isOpen.set(true);
|
|
638
724
|
}
|
|
639
725
|
close() {
|
|
640
|
-
|
|
641
|
-
return;
|
|
642
|
-
this._overlayRef.dispose();
|
|
643
|
-
this._overlayRef = null;
|
|
644
|
-
this._isOpen.set(false);
|
|
726
|
+
this._overlay.close();
|
|
645
727
|
}
|
|
646
728
|
toggle(trigger) {
|
|
647
|
-
if (this.
|
|
729
|
+
if (this.isOpen()) {
|
|
648
730
|
this.close();
|
|
649
731
|
}
|
|
650
732
|
else {
|
|
651
733
|
this.open(trigger);
|
|
652
734
|
}
|
|
653
735
|
}
|
|
654
|
-
// Lifecycle
|
|
655
|
-
ngOnDestroy() {
|
|
656
|
-
if (this._overlayRef)
|
|
657
|
-
this._overlayRef.dispose();
|
|
658
|
-
}
|
|
659
736
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
660
737
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", 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 }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
661
738
|
<ng-template #content>
|
|
@@ -1288,13 +1365,9 @@ const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
|
|
|
1288
1365
|
|
|
1289
1366
|
class Select extends ValueFormControl {
|
|
1290
1367
|
_config = inject(SELECT_CONFIG);
|
|
1291
|
-
_overlay =
|
|
1292
|
-
_viewContainerRef = inject(ViewContainerRef);
|
|
1293
|
-
_destroyRef = inject(DestroyRef);
|
|
1368
|
+
_overlay = createOverlayManager();
|
|
1294
1369
|
_triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
|
|
1295
1370
|
_panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
|
|
1296
|
-
_overlayRef = null;
|
|
1297
|
-
_portal = null;
|
|
1298
1371
|
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1299
1372
|
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1300
1373
|
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
@@ -1306,7 +1379,7 @@ class Select extends ValueFormControl {
|
|
|
1306
1379
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1307
1380
|
tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
1308
1381
|
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
|
|
1309
|
-
isOpen =
|
|
1382
|
+
isOpen = this._overlay.isOpen;
|
|
1310
1383
|
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
|
|
1311
1384
|
normalizedOptions = computed(() => {
|
|
1312
1385
|
const options = this.options();
|
|
@@ -1350,44 +1423,29 @@ class Select extends ValueFormControl {
|
|
|
1350
1423
|
const panelTemplate = this._panelTemplate();
|
|
1351
1424
|
if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
|
|
1352
1425
|
return;
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
panelClass: 'tls-select-panel',
|
|
1373
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
1374
|
-
});
|
|
1375
|
-
this._overlayRef
|
|
1376
|
-
.backdropClick()
|
|
1377
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
1378
|
-
.subscribe(() => this.close());
|
|
1379
|
-
}
|
|
1380
|
-
this._portal ??= new TemplatePortal(panelTemplate, this._viewContainerRef);
|
|
1381
|
-
this._overlayRef.updateSize({ minWidth: triggerElement.nativeElement.offsetWidth });
|
|
1382
|
-
this._overlayRef.attach(this._portal);
|
|
1383
|
-
this.isOpen.set(true);
|
|
1426
|
+
this._overlay.open({
|
|
1427
|
+
content: panelTemplate,
|
|
1428
|
+
origin: triggerElement,
|
|
1429
|
+
positions: [
|
|
1430
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
1431
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
1432
|
+
],
|
|
1433
|
+
flexibleDimensions: false,
|
|
1434
|
+
push: false,
|
|
1435
|
+
panelClass: 'tls-select-panel',
|
|
1436
|
+
// Select handles Escape itself via the trigger's keydown handler.
|
|
1437
|
+
closeOnEscape: false,
|
|
1438
|
+
minWidth: triggerElement.nativeElement.offsetWidth,
|
|
1439
|
+
reuse: true,
|
|
1440
|
+
onClose: () => {
|
|
1441
|
+
this.activeIndex.set(-1);
|
|
1442
|
+
this._triggerElement()?.nativeElement.focus();
|
|
1443
|
+
},
|
|
1444
|
+
});
|
|
1384
1445
|
this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
|
|
1385
1446
|
}
|
|
1386
1447
|
close() {
|
|
1387
|
-
this.
|
|
1388
|
-
this.isOpen.set(false);
|
|
1389
|
-
this.activeIndex.set(-1);
|
|
1390
|
-
this._triggerElement()?.nativeElement.focus();
|
|
1448
|
+
this._overlay.close();
|
|
1391
1449
|
}
|
|
1392
1450
|
toggle() {
|
|
1393
1451
|
if (this.isOpen()) {
|
|
@@ -1467,11 +1525,6 @@ class Select extends ValueFormControl {
|
|
|
1467
1525
|
next += direction;
|
|
1468
1526
|
}
|
|
1469
1527
|
}
|
|
1470
|
-
// Lifecycle
|
|
1471
|
-
ngOnDestroy() {
|
|
1472
|
-
if (this._overlayRef)
|
|
1473
|
-
this._overlayRef.dispose();
|
|
1474
|
-
}
|
|
1475
1528
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1476
1529
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, 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 }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], viewQueries: [{ propertyName: "_triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "_panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-select__chevron\" viewBox=\"0 0 10 6\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L5 5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-select__clear-icon\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n<ng-template #panel>\n <ul class=\"tls-select__panel\" role=\"listbox\">\n @for (option of normalizedOptions(); track option.value; let i = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"i === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(i, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
|
|
1477
1530
|
}
|
|
@@ -1532,6 +1585,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1532
1585
|
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], template: "<input\n type=\"checkbox\"\n class=\"tls-switch-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" }]
|
|
1533
1586
|
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1534
1587
|
|
|
1588
|
+
const DEFAULT_TEXTAREA_CONFIG = {
|
|
1589
|
+
size: 'md',
|
|
1590
|
+
placeholder: '',
|
|
1591
|
+
fluid: false,
|
|
1592
|
+
rows: 3,
|
|
1593
|
+
resize: 'vertical',
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
const TEXTAREA_CONFIG = new InjectionToken('TEXTAREA_CONFIG', {
|
|
1597
|
+
factory: () => DEFAULT_TEXTAREA_CONFIG,
|
|
1598
|
+
});
|
|
1599
|
+
|
|
1600
|
+
class Textarea extends ValueFormControl {
|
|
1601
|
+
_config = inject(TEXTAREA_CONFIG);
|
|
1602
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
1603
|
+
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
1604
|
+
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1605
|
+
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
1606
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
1607
|
+
rows = input(this._config.rows, { ...(ngDevMode ? { debugName: "rows" } : {}), transform: numberAttribute });
|
|
1608
|
+
resize = input(this._config.resize, ...(ngDevMode ? [{ debugName: "resize" }] : []));
|
|
1609
|
+
classes = computed(() => {
|
|
1610
|
+
const array = [this.CLASS_NAME];
|
|
1611
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
1612
|
+
if (this.fluid())
|
|
1613
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
1614
|
+
return array.concat(this.controlClasses());
|
|
1615
|
+
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
1616
|
+
// Protected methods
|
|
1617
|
+
onInput(event) {
|
|
1618
|
+
const target = event.target;
|
|
1619
|
+
this.value.set(target.value);
|
|
1620
|
+
}
|
|
1621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1622
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Textarea, isStandalone: true, selector: "tls-textarea", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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 }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { classAttribute: "tls-textarea" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], usesInheritance: true, ngImport: i0, template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] });
|
|
1623
|
+
}
|
|
1624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, decorators: [{
|
|
1625
|
+
type: Component,
|
|
1626
|
+
args: [{ selector: 'tls-textarea', host: { class: 'tls-textarea' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] }]
|
|
1627
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", 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 }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }] } });
|
|
1628
|
+
|
|
1535
1629
|
class IconService {
|
|
1536
1630
|
_http = inject(HttpClient);
|
|
1537
1631
|
_sanitizer = inject(DomSanitizer);
|
|
@@ -1702,6 +1796,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
1702
1796
|
}]
|
|
1703
1797
|
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], widthRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "widthRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
1704
1798
|
|
|
1799
|
+
class MenuItemComponent {
|
|
1800
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
1801
|
+
templateRef = viewChild.required('template');
|
|
1802
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1803
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: MenuItemComponent, isStandalone: true, selector: "tls-menu-item", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null } }, host: { styleAttribute: "display: none" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["template"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #template><ng-content /></ng-template>`, isInline: true });
|
|
1804
|
+
}
|
|
1805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, decorators: [{
|
|
1806
|
+
type: Component,
|
|
1807
|
+
args: [{
|
|
1808
|
+
selector: 'tls-menu-item',
|
|
1809
|
+
template: `<ng-template #template><ng-content /></ng-template>`,
|
|
1810
|
+
host: { style: 'display: none' },
|
|
1811
|
+
}]
|
|
1812
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], templateRef: [{ type: i0.ViewChild, args: ['template', { isSignal: true }] }] } });
|
|
1813
|
+
|
|
1814
|
+
const DEFAULT_MENU_CONFIG = {
|
|
1815
|
+
position: 'bottom-start',
|
|
1816
|
+
offset: { x: 0, y: 4 },
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
const MENU_CONFIG = new InjectionToken('MENU_CONFIG', {
|
|
1820
|
+
factory: () => DEFAULT_MENU_CONFIG,
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
class Menu {
|
|
1824
|
+
static _counter = 0;
|
|
1825
|
+
_config = inject(MENU_CONFIG);
|
|
1826
|
+
_overlay = createOverlayManager();
|
|
1827
|
+
_panelRef = viewChild.required('panel');
|
|
1828
|
+
_customItems = contentChildren(MenuItemComponent, ...(ngDevMode ? [{ debugName: "_customItems" }] : []));
|
|
1829
|
+
customTemplates = computed(() => {
|
|
1830
|
+
const map = new Map();
|
|
1831
|
+
for (const item of this._customItems()) {
|
|
1832
|
+
map.set(item.key(), item.templateRef());
|
|
1833
|
+
}
|
|
1834
|
+
return map;
|
|
1835
|
+
}, ...(ngDevMode ? [{ debugName: "customTemplates" }] : []));
|
|
1836
|
+
itemTemplate = contentChild('itemTemplate', ...(ngDevMode ? [{ debugName: "itemTemplate" }] : []));
|
|
1837
|
+
labelTemplate = contentChild('labelTemplate', ...(ngDevMode ? [{ debugName: "labelTemplate" }] : []));
|
|
1838
|
+
dividerTemplate = contentChild('dividerTemplate', ...(ngDevMode ? [{ debugName: "dividerTemplate" }] : []));
|
|
1839
|
+
iconTemplate = contentChild('iconTemplate', ...(ngDevMode ? [{ debugName: "iconTemplate" }] : []));
|
|
1840
|
+
id = `tls-menu-${++Menu._counter}`;
|
|
1841
|
+
// Inputs
|
|
1842
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
1843
|
+
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
1844
|
+
offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
1845
|
+
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
1846
|
+
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : {}), transform: booleanAttribute });
|
|
1847
|
+
_positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
|
|
1848
|
+
// An inline menu is always "open" (rendered in place); otherwise reflect the overlay.
|
|
1849
|
+
isOpen = computed(() => this.inline() || this._overlay.isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1850
|
+
constructor() {
|
|
1851
|
+
if (isDevMode()) {
|
|
1852
|
+
effect(() => {
|
|
1853
|
+
const templates = this.customTemplates();
|
|
1854
|
+
for (const item of this.items()) {
|
|
1855
|
+
if (item.type === 'custom' && !templates.has(item.key)) {
|
|
1856
|
+
console.warn(`[tls-menu] No <tls-menu-item key="${item.key}"> found for custom item. The slot will be skipped.`);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
// Public methods
|
|
1863
|
+
open(trigger) {
|
|
1864
|
+
if (this.inline())
|
|
1865
|
+
return;
|
|
1866
|
+
const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
|
|
1867
|
+
this._overlay.open({
|
|
1868
|
+
content: this._panelRef(),
|
|
1869
|
+
origin,
|
|
1870
|
+
positions: this._positions(),
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
openAtPoint(x, y) {
|
|
1874
|
+
if (this.inline())
|
|
1875
|
+
return;
|
|
1876
|
+
this._overlay.open({
|
|
1877
|
+
content: this._panelRef(),
|
|
1878
|
+
origin: { x, y },
|
|
1879
|
+
positions: this._positions(),
|
|
1880
|
+
scrollStrategy: 'close',
|
|
1881
|
+
hasBackdrop: false,
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
close() {
|
|
1885
|
+
this._overlay.close();
|
|
1886
|
+
}
|
|
1887
|
+
toggle(trigger) {
|
|
1888
|
+
if (this._overlay.isOpen()) {
|
|
1889
|
+
this.close();
|
|
1890
|
+
}
|
|
1891
|
+
else {
|
|
1892
|
+
this.open(trigger);
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
// Protected
|
|
1896
|
+
onItemClick(item) {
|
|
1897
|
+
item.action?.();
|
|
1898
|
+
this.close();
|
|
1899
|
+
}
|
|
1900
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1901
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", 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 } }, 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 }], ngImport: i0, template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\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: ["iconSrc", "alt", "allowedSources"] }] });
|
|
1902
|
+
}
|
|
1903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, decorators: [{
|
|
1904
|
+
type: Component,
|
|
1905
|
+
args: [{ selector: 'tls-menu', imports: [NgTemplateOutlet, Icon], template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n}\n" }]
|
|
1906
|
+
}], ctorParameters: () => [], propDecorators: { _panelRef: [{ type: i0.ViewChild, args: ['panel', { 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 }] }] } });
|
|
1907
|
+
|
|
1908
|
+
class MenuTriggerDirective {
|
|
1909
|
+
menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsMenuTrigger' });
|
|
1910
|
+
isOpen = computed(() => this.menu().isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1911
|
+
menuId = computed(() => this.menu().id, ...(ngDevMode ? [{ debugName: "menuId" }] : []));
|
|
1912
|
+
// Protected methods
|
|
1913
|
+
onClick(event) {
|
|
1914
|
+
this.menu().toggle(event);
|
|
1915
|
+
}
|
|
1916
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1917
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: MenuTriggerDirective, isStandalone: true, selector: "[tlsMenuTrigger]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsMenuTrigger", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.aria-haspopup": "\"menu\"", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "menuId()" } }, ngImport: i0 });
|
|
1918
|
+
}
|
|
1919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, decorators: [{
|
|
1920
|
+
type: Directive,
|
|
1921
|
+
args: [{
|
|
1922
|
+
selector: '[tlsMenuTrigger]',
|
|
1923
|
+
host: {
|
|
1924
|
+
'(click)': 'onClick($event)',
|
|
1925
|
+
'[attr.aria-haspopup]': '"menu"',
|
|
1926
|
+
'[attr.aria-expanded]': 'isOpen()',
|
|
1927
|
+
'[attr.aria-controls]': 'menuId()',
|
|
1928
|
+
},
|
|
1929
|
+
}]
|
|
1930
|
+
}], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsMenuTrigger", required: true }] }] } });
|
|
1931
|
+
|
|
1932
|
+
class ContextMenuDirective {
|
|
1933
|
+
menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsContextMenu' });
|
|
1934
|
+
// Protected methods
|
|
1935
|
+
onContextMenu(event) {
|
|
1936
|
+
event.preventDefault();
|
|
1937
|
+
this.menu().close();
|
|
1938
|
+
this.menu().openAtPoint(event.clientX, event.clientY);
|
|
1939
|
+
}
|
|
1940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1941
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ContextMenuDirective, isStandalone: true, selector: "[tlsContextMenu]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsContextMenu", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "contextmenu": "onContextMenu($event)" } }, ngImport: i0 });
|
|
1942
|
+
}
|
|
1943
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, decorators: [{
|
|
1944
|
+
type: Directive,
|
|
1945
|
+
args: [{
|
|
1946
|
+
selector: '[tlsContextMenu]',
|
|
1947
|
+
host: {
|
|
1948
|
+
'(contextmenu)': 'onContextMenu($event)',
|
|
1949
|
+
},
|
|
1950
|
+
}]
|
|
1951
|
+
}], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsContextMenu", required: true }] }] } });
|
|
1952
|
+
|
|
1705
1953
|
const DEFAULT_PAGINATION_CONFIG = {
|
|
1706
1954
|
size: 'md',
|
|
1707
1955
|
pageSize: 10,
|
|
@@ -2433,6 +2681,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2433
2681
|
},
|
|
2434
2682
|
{ provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
|
|
2435
2683
|
{ provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
|
|
2684
|
+
{
|
|
2685
|
+
provide: TEXTAREA_CONFIG,
|
|
2686
|
+
useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, config.components.textarea),
|
|
2687
|
+
},
|
|
2436
2688
|
{
|
|
2437
2689
|
provide: TOOLTIP_CONFIG,
|
|
2438
2690
|
useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
|
|
@@ -2444,5 +2696,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
2444
2696
|
* Generated bundle index. Do not edit.
|
|
2445
2697
|
*/
|
|
2446
2698
|
|
|
2447
|
-
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TooltipDirective, provideThalassicUIConfig };
|
|
2699
|
+
export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, TooltipDirective, provideThalassicUIConfig };
|
|
2448
2700
|
//# sourceMappingURL=thalassic-ui.mjs.map
|