@telcomdev/ui 0.0.4 → 0.0.5
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/README.md +58 -0
- package/fesm2022/telcomdev-ui.mjs +1307 -4
- package/fesm2022/telcomdev-ui.mjs.map +1 -1
- package/package.json +6 -2
- package/types/telcomdev-ui.d.ts +236 -4
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, HostListener, signal } from '@angular/core';
|
|
2
|
+
import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, HostListener, Directive, ChangeDetectorRef, forwardRef, DestroyRef, signal } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/cdk/scrolling';
|
|
4
4
|
import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
|
-
import { FormsModule } from '@angular/forms';
|
|
7
|
-
import {
|
|
6
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import { DIALOG_DATA, Dialog } from '@angular/cdk/dialog';
|
|
8
|
+
import { NgComponentOutlet, DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
9
|
+
import { ScrollStrategyOptions, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
8
10
|
import { RouterLink, RouterLinkActive } from '@angular/router';
|
|
9
11
|
|
|
10
12
|
class TelcomdevUi {
|
|
@@ -429,6 +431,12 @@ const TD_ICONOS = {
|
|
|
429
431
|
search: {
|
|
430
432
|
path: 'M10.5 3a7.5 7.5 0 1 0 4.73 13.32L20.91 22 22 20.91l-5.68-5.68A7.5 7.5 0 0 0 10.5 3Zm0 2a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Z',
|
|
431
433
|
},
|
|
434
|
+
visibility: {
|
|
435
|
+
path: 'M12 4.5C6.5 4.5 2.1 8 1 12c1.1 4 5.5 7.5 11 7.5S21.9 16 23 12c-1.1-4-5.5-7.5-11-7.5Zm0 12a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9Zm0-2a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z',
|
|
436
|
+
},
|
|
437
|
+
visibility_off: {
|
|
438
|
+
path: 'm3.3 2 18.7 18.7-1.3 1.3-3.15-3.15A12.2 12.2 0 0 1 12 20C6.5 20 2.1 16.5 1 12a11.6 11.6 0 0 1 3.4-5.2L2 4.3 3.3 2Zm4.42 7.02A4.5 4.5 0 0 0 14.98 16l-1.55-1.55a2.5 2.5 0 0 1-3.88-3.88L7.72 9.02ZM12 4c5.5 0 9.9 3.5 11 8a11.2 11.2 0 0 1-2.53 4.35l-3.3-3.3A5.5 5.5 0 0 0 10.95 6.83L8.58 4.46A13.4 13.4 0 0 1 12 4Z',
|
|
439
|
+
},
|
|
432
440
|
notifications: {
|
|
433
441
|
path: 'M12 22a2.5 2.5 0 0 0 2.45-2h-4.9A2.5 2.5 0 0 0 12 22Zm7-6v-5a7 7 0 0 0-5.5-6.84V3a1.5 1.5 0 0 0-3 0v1.16A7 7 0 0 0 5 11v5l-2 2v1h18v-1l-2-2Z',
|
|
434
442
|
},
|
|
@@ -710,6 +718,240 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
710
718
|
type: Output
|
|
711
719
|
}] } });
|
|
712
720
|
|
|
721
|
+
const TD_DIALOG_DATA = new InjectionToken('TD_DIALOG_DATA');
|
|
722
|
+
const TD_DIALOG_CONFIG = new InjectionToken('TD_DIALOG_CONFIG');
|
|
723
|
+
|
|
724
|
+
class TdDialogRef {
|
|
725
|
+
ref;
|
|
726
|
+
closed;
|
|
727
|
+
id;
|
|
728
|
+
constructor(ref) {
|
|
729
|
+
this.ref = ref;
|
|
730
|
+
this.closed = ref.closed;
|
|
731
|
+
this.id = ref.id;
|
|
732
|
+
}
|
|
733
|
+
close(result) {
|
|
734
|
+
this.ref.close(result);
|
|
735
|
+
}
|
|
736
|
+
updateSize(width, height) {
|
|
737
|
+
this.ref.updateSize(width, height);
|
|
738
|
+
return this;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
class TdDialogPanel {
|
|
743
|
+
payload = inject(DIALOG_DATA);
|
|
744
|
+
dialogRef = inject(TdDialogRef);
|
|
745
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
746
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdDialogPanel, isStandalone: true, selector: "td-dialog-panel", ngImport: i0, template: `
|
|
747
|
+
<section
|
|
748
|
+
class="td-dialog"
|
|
749
|
+
[class.td-dialog--oscuro]="payload.config.oscuro"
|
|
750
|
+
[class.td-dialog--pantalla]="payload.fullscreen"
|
|
751
|
+
[attr.aria-label]="payload.config.ariaLabel || payload.config.titulo || 'Diálogo'"
|
|
752
|
+
>
|
|
753
|
+
@if (
|
|
754
|
+
payload.config.titulo ||
|
|
755
|
+
payload.config.subtitulo ||
|
|
756
|
+
payload.config.icono ||
|
|
757
|
+
payload.config.mostrarCerrar !== false
|
|
758
|
+
) {
|
|
759
|
+
<header class="td-dialog__header">
|
|
760
|
+
@if (payload.config.icono) {
|
|
761
|
+
<span class="td-dialog__icono">
|
|
762
|
+
<td-icon [nombre]="payload.config.icono" tamano="1.25rem" />
|
|
763
|
+
</span>
|
|
764
|
+
}
|
|
765
|
+
<div class="td-dialog__titulos">
|
|
766
|
+
@if (payload.config.titulo) {
|
|
767
|
+
<h2>{{ payload.config.titulo }}</h2>
|
|
768
|
+
}
|
|
769
|
+
@if (payload.config.subtitulo) {
|
|
770
|
+
<p>{{ payload.config.subtitulo }}</p>
|
|
771
|
+
}
|
|
772
|
+
</div>
|
|
773
|
+
@if (payload.config.mostrarCerrar !== false) {
|
|
774
|
+
<button
|
|
775
|
+
type="button"
|
|
776
|
+
class="td-dialog__cerrar"
|
|
777
|
+
aria-label="Cerrar diálogo"
|
|
778
|
+
title="Cerrar"
|
|
779
|
+
(click)="dialogRef.close()"
|
|
780
|
+
>
|
|
781
|
+
<td-icon nombre="close" />
|
|
782
|
+
</button>
|
|
783
|
+
}
|
|
784
|
+
</header>
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
<div class="td-dialog__contenido">
|
|
788
|
+
<ng-container *ngComponentOutlet="payload.component" />
|
|
789
|
+
</div>
|
|
790
|
+
</section>
|
|
791
|
+
`, isInline: true, styles: [":host{display:block;width:100%;max-width:100%;max-height:inherit;overflow:hidden;border-radius:1rem;outline:none;box-shadow:0 28px 75px #0f172a3d,0 8px 24px #0f172a1f;animation:td-dialog-enter .18s cubic-bezier(.2,.8,.2,1)}:host-context(.td-dialog-overlay--fullscreen){height:100%;max-height:100%;border-radius:0}*{box-sizing:border-box}.td-dialog{--td-dialog-surface: #fff;--td-dialog-footer: #fafbfc;--td-dialog-border: #e6e9f0;--td-dialog-text: #263147;--td-dialog-muted: #748096;display:flex;width:100%;max-height:inherit;flex-direction:column;overflow:hidden;color:var(--td-dialog-text);background:var(--td-dialog-surface);font-family:Inter,ui-sans-serif,system-ui,sans-serif}.td-dialog--oscuro{--td-dialog-surface: #19191f;--td-dialog-footer: #202028;--td-dialog-border: #303039;--td-dialog-text: #ededf0;--td-dialog-muted: #a1a1aa}.td-dialog__header{display:flex;min-height:4.4rem;flex:0 0 auto;align-items:center;gap:.85rem;border-bottom:1px solid var(--td-dialog-border);padding:1rem 1.25rem 1rem 1.5rem;background:var(--td-dialog-surface)}.td-dialog__icono{display:grid;width:2.6rem;height:2.6rem;flex:0 0 auto;place-items:center;border-radius:.75rem;color:#5746d8;background:#eeecff}.td-dialog--oscuro .td-dialog__icono{color:#b9b0fa;background:#292540}.td-dialog__titulos{min-width:0;flex:1}.td-dialog__titulos h2{margin:0;font-size:1rem;line-height:1.3;letter-spacing:-.015em}.td-dialog__titulos p{margin:.2rem 0 0;color:var(--td-dialog-muted);font-size:.73rem;line-height:1.45}.td-dialog__cerrar{display:grid;width:2.35rem;height:2.35rem;flex:0 0 auto;place-items:center;border:0;border-radius:.65rem;color:var(--td-dialog-muted);background:transparent;cursor:pointer}.td-dialog__cerrar:hover{color:#5746d8;background:#f2f0ff}.td-dialog--oscuro .td-dialog__cerrar:hover{color:#b9b0fa;background:#292931}.td-dialog__contenido{display:flex;min-height:0;flex:1 1 auto;overflow-x:hidden;overflow-y:auto;padding:1.5rem;overscroll-behavior:contain;scrollbar-color:color-mix(in srgb,var(--td-dialog-muted) 38%,transparent) transparent;scrollbar-width:thin}.td-dialog__contenido ::ng-deep>*{display:flex;width:100%;min-height:100%;flex:1 1 auto;flex-direction:column}.td-dialog__contenido ::ng-deep :has(>td-dialog-actions){display:flex;width:100%;min-height:100%;flex:1 1 auto;flex-direction:column}.td-dialog__contenido::-webkit-scrollbar{width:.42rem}.td-dialog__contenido::-webkit-scrollbar-track{background:transparent}.td-dialog__contenido::-webkit-scrollbar-thumb{border-radius:999px;background:color-mix(in srgb,var(--td-dialog-muted) 38%,transparent)}.td-dialog__contenido::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--td-dialog-muted) 58%,transparent)}.td-dialog--pantalla{height:100%}@keyframes td-dialog-enter{0%{opacity:0;transform:translateY(.6rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){:host{animation:none}}@media(max-width:600px){:host{border-radius:1rem}:host-context(.td-dialog-overlay--fullscreen){border-radius:0}.td-dialog__contenido{padding:1.1rem}.td-dialog__header{padding-left:1.1rem}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
792
|
+
}
|
|
793
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogPanel, decorators: [{
|
|
794
|
+
type: Component,
|
|
795
|
+
args: [{ selector: 'td-dialog-panel', imports: [NgComponentOutlet, TdIcon], template: `
|
|
796
|
+
<section
|
|
797
|
+
class="td-dialog"
|
|
798
|
+
[class.td-dialog--oscuro]="payload.config.oscuro"
|
|
799
|
+
[class.td-dialog--pantalla]="payload.fullscreen"
|
|
800
|
+
[attr.aria-label]="payload.config.ariaLabel || payload.config.titulo || 'Diálogo'"
|
|
801
|
+
>
|
|
802
|
+
@if (
|
|
803
|
+
payload.config.titulo ||
|
|
804
|
+
payload.config.subtitulo ||
|
|
805
|
+
payload.config.icono ||
|
|
806
|
+
payload.config.mostrarCerrar !== false
|
|
807
|
+
) {
|
|
808
|
+
<header class="td-dialog__header">
|
|
809
|
+
@if (payload.config.icono) {
|
|
810
|
+
<span class="td-dialog__icono">
|
|
811
|
+
<td-icon [nombre]="payload.config.icono" tamano="1.25rem" />
|
|
812
|
+
</span>
|
|
813
|
+
}
|
|
814
|
+
<div class="td-dialog__titulos">
|
|
815
|
+
@if (payload.config.titulo) {
|
|
816
|
+
<h2>{{ payload.config.titulo }}</h2>
|
|
817
|
+
}
|
|
818
|
+
@if (payload.config.subtitulo) {
|
|
819
|
+
<p>{{ payload.config.subtitulo }}</p>
|
|
820
|
+
}
|
|
821
|
+
</div>
|
|
822
|
+
@if (payload.config.mostrarCerrar !== false) {
|
|
823
|
+
<button
|
|
824
|
+
type="button"
|
|
825
|
+
class="td-dialog__cerrar"
|
|
826
|
+
aria-label="Cerrar diálogo"
|
|
827
|
+
title="Cerrar"
|
|
828
|
+
(click)="dialogRef.close()"
|
|
829
|
+
>
|
|
830
|
+
<td-icon nombre="close" />
|
|
831
|
+
</button>
|
|
832
|
+
}
|
|
833
|
+
</header>
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
<div class="td-dialog__contenido">
|
|
837
|
+
<ng-container *ngComponentOutlet="payload.component" />
|
|
838
|
+
</div>
|
|
839
|
+
</section>
|
|
840
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;width:100%;max-width:100%;max-height:inherit;overflow:hidden;border-radius:1rem;outline:none;box-shadow:0 28px 75px #0f172a3d,0 8px 24px #0f172a1f;animation:td-dialog-enter .18s cubic-bezier(.2,.8,.2,1)}:host-context(.td-dialog-overlay--fullscreen){height:100%;max-height:100%;border-radius:0}*{box-sizing:border-box}.td-dialog{--td-dialog-surface: #fff;--td-dialog-footer: #fafbfc;--td-dialog-border: #e6e9f0;--td-dialog-text: #263147;--td-dialog-muted: #748096;display:flex;width:100%;max-height:inherit;flex-direction:column;overflow:hidden;color:var(--td-dialog-text);background:var(--td-dialog-surface);font-family:Inter,ui-sans-serif,system-ui,sans-serif}.td-dialog--oscuro{--td-dialog-surface: #19191f;--td-dialog-footer: #202028;--td-dialog-border: #303039;--td-dialog-text: #ededf0;--td-dialog-muted: #a1a1aa}.td-dialog__header{display:flex;min-height:4.4rem;flex:0 0 auto;align-items:center;gap:.85rem;border-bottom:1px solid var(--td-dialog-border);padding:1rem 1.25rem 1rem 1.5rem;background:var(--td-dialog-surface)}.td-dialog__icono{display:grid;width:2.6rem;height:2.6rem;flex:0 0 auto;place-items:center;border-radius:.75rem;color:#5746d8;background:#eeecff}.td-dialog--oscuro .td-dialog__icono{color:#b9b0fa;background:#292540}.td-dialog__titulos{min-width:0;flex:1}.td-dialog__titulos h2{margin:0;font-size:1rem;line-height:1.3;letter-spacing:-.015em}.td-dialog__titulos p{margin:.2rem 0 0;color:var(--td-dialog-muted);font-size:.73rem;line-height:1.45}.td-dialog__cerrar{display:grid;width:2.35rem;height:2.35rem;flex:0 0 auto;place-items:center;border:0;border-radius:.65rem;color:var(--td-dialog-muted);background:transparent;cursor:pointer}.td-dialog__cerrar:hover{color:#5746d8;background:#f2f0ff}.td-dialog--oscuro .td-dialog__cerrar:hover{color:#b9b0fa;background:#292931}.td-dialog__contenido{display:flex;min-height:0;flex:1 1 auto;overflow-x:hidden;overflow-y:auto;padding:1.5rem;overscroll-behavior:contain;scrollbar-color:color-mix(in srgb,var(--td-dialog-muted) 38%,transparent) transparent;scrollbar-width:thin}.td-dialog__contenido ::ng-deep>*{display:flex;width:100%;min-height:100%;flex:1 1 auto;flex-direction:column}.td-dialog__contenido ::ng-deep :has(>td-dialog-actions){display:flex;width:100%;min-height:100%;flex:1 1 auto;flex-direction:column}.td-dialog__contenido::-webkit-scrollbar{width:.42rem}.td-dialog__contenido::-webkit-scrollbar-track{background:transparent}.td-dialog__contenido::-webkit-scrollbar-thumb{border-radius:999px;background:color-mix(in srgb,var(--td-dialog-muted) 38%,transparent)}.td-dialog__contenido::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--td-dialog-muted) 58%,transparent)}.td-dialog--pantalla{height:100%}@keyframes td-dialog-enter{0%{opacity:0;transform:translateY(.6rem) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){:host{animation:none}}@media(max-width:600px){:host{border-radius:1rem}:host-context(.td-dialog-overlay--fullscreen){border-radius:0}.td-dialog__contenido{padding:1.1rem}.td-dialog__header{padding-left:1.1rem}}\n"] }]
|
|
841
|
+
}] });
|
|
842
|
+
|
|
843
|
+
class TdDialog {
|
|
844
|
+
dialog = inject(Dialog);
|
|
845
|
+
open(component, config = {}) {
|
|
846
|
+
const size = config.tamano ?? 'mediano';
|
|
847
|
+
const mobile = typeof window !== 'undefined' &&
|
|
848
|
+
typeof window.matchMedia === 'function' &&
|
|
849
|
+
window.matchMedia('(max-width: 600px)').matches;
|
|
850
|
+
const fullscreen = size === 'pantalla' || (mobile && size !== 'pequeno');
|
|
851
|
+
const width = fullscreen ? '100%' : config.ancho ?? this.widthFor(size);
|
|
852
|
+
const maxWidth = fullscreen ? '100%' : config.maxAncho ?? 'calc(100vw - 2rem)';
|
|
853
|
+
const maxHeight = fullscreen ? '100dvh' : config.maxAlto ?? 'calc(100dvh - 2rem)';
|
|
854
|
+
let publicRef;
|
|
855
|
+
const cdkRef = this.dialog.open(TdDialogPanel, {
|
|
856
|
+
data: { component, config, fullscreen },
|
|
857
|
+
width,
|
|
858
|
+
height: fullscreen ? '100dvh' : config.alto,
|
|
859
|
+
maxWidth,
|
|
860
|
+
maxHeight,
|
|
861
|
+
hasBackdrop: true,
|
|
862
|
+
backdropClass: 'cdk-overlay-dark-backdrop',
|
|
863
|
+
panelClass: this.panelClasses(config, fullscreen),
|
|
864
|
+
disableClose: config.deshabilitarCierre ?? false,
|
|
865
|
+
closeOnNavigation: config.cerrarAlNavegar ?? true,
|
|
866
|
+
autoFocus: config.autoFocus ?? 'first-tabbable',
|
|
867
|
+
restoreFocus: config.restaurarFoco ?? true,
|
|
868
|
+
ariaLabel: config.ariaLabel ?? config.titulo,
|
|
869
|
+
ariaModal: true,
|
|
870
|
+
providers: (ref) => {
|
|
871
|
+
publicRef = new TdDialogRef(ref);
|
|
872
|
+
return [
|
|
873
|
+
{ provide: TD_DIALOG_DATA, useValue: config.data },
|
|
874
|
+
{ provide: TD_DIALOG_CONFIG, useValue: config },
|
|
875
|
+
{ provide: TdDialogRef, useValue: publicRef },
|
|
876
|
+
];
|
|
877
|
+
},
|
|
878
|
+
});
|
|
879
|
+
return publicRef ?? new TdDialogRef(cdkRef);
|
|
880
|
+
}
|
|
881
|
+
closeAll() {
|
|
882
|
+
this.dialog.closeAll();
|
|
883
|
+
}
|
|
884
|
+
widthFor(size) {
|
|
885
|
+
const widths = {
|
|
886
|
+
pequeno: 'min(28rem, calc(100vw - 2rem))',
|
|
887
|
+
mediano: 'min(40rem, calc(100vw - 2rem))',
|
|
888
|
+
grande: 'min(64rem, calc(100vw - 2rem))',
|
|
889
|
+
pantalla: '100%',
|
|
890
|
+
};
|
|
891
|
+
return widths[size ?? 'mediano'];
|
|
892
|
+
}
|
|
893
|
+
panelClasses(config, fullscreen) {
|
|
894
|
+
const extra = Array.isArray(config.panelClass)
|
|
895
|
+
? config.panelClass
|
|
896
|
+
: config.panelClass
|
|
897
|
+
? [config.panelClass]
|
|
898
|
+
: [];
|
|
899
|
+
return [
|
|
900
|
+
'td-dialog-overlay',
|
|
901
|
+
`td-dialog-overlay--${config.tamano ?? 'mediano'}`,
|
|
902
|
+
...(fullscreen ? ['td-dialog-overlay--fullscreen'] : []),
|
|
903
|
+
...extra,
|
|
904
|
+
];
|
|
905
|
+
}
|
|
906
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialog, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
907
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialog, providedIn: 'root' });
|
|
908
|
+
}
|
|
909
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialog, decorators: [{
|
|
910
|
+
type: Injectable,
|
|
911
|
+
args: [{ providedIn: 'root' }]
|
|
912
|
+
}] });
|
|
913
|
+
|
|
914
|
+
class TdDialogActions {
|
|
915
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
916
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: TdDialogActions, isStandalone: true, selector: "td-dialog-actions", ngImport: i0, template: `<ng-content />`, isInline: true, styles: [":host{display:flex;min-height:3.7rem;flex:0 0 auto;align-items:center;justify-content:flex-end;gap:.5rem;margin:auto -1.5rem -1.5rem;margin-top:auto;border-top:1px solid var(--td-dialog-border, #e6e9f0);padding:.65rem 1.25rem;background:var(--td-dialog-footer, #fafbfc);box-shadow:0 -8px 22px #0f172a09}:host ::ng-deep button{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:.45rem;border:1px solid var(--td-dialog-border, #dfe3eb);border-radius:.6rem;padding:.5rem .85rem;color:var(--td-dialog-text, #263147);background:var(--td-dialog-surface, #fff);font:750 .75rem/1 system-ui,sans-serif;cursor:pointer}:host ::ng-deep button:hover{border-color:#9b91e3;background:#f7f5ff}:host ::ng-deep button[tdDialogPrimary]{border-color:transparent;color:#fff;background:linear-gradient(135deg,#5746d8,#7657df);box-shadow:0 7px 16px #5746d833}:host ::ng-deep button:disabled{opacity:.5;cursor:not-allowed}@media(max-width:520px){:host{min-height:auto;align-items:stretch;flex-direction:column-reverse;margin-right:-1.1rem;margin-bottom:-1.1rem;margin-left:-1.1rem;padding:.7rem 1.1rem}:host ::ng-deep button{width:100%}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
917
|
+
}
|
|
918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogActions, decorators: [{
|
|
919
|
+
type: Component,
|
|
920
|
+
args: [{ selector: 'td-dialog-actions', template: `<ng-content />`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;min-height:3.7rem;flex:0 0 auto;align-items:center;justify-content:flex-end;gap:.5rem;margin:auto -1.5rem -1.5rem;margin-top:auto;border-top:1px solid var(--td-dialog-border, #e6e9f0);padding:.65rem 1.25rem;background:var(--td-dialog-footer, #fafbfc);box-shadow:0 -8px 22px #0f172a09}:host ::ng-deep button{display:inline-flex;min-height:2.25rem;align-items:center;justify-content:center;gap:.45rem;border:1px solid var(--td-dialog-border, #dfe3eb);border-radius:.6rem;padding:.5rem .85rem;color:var(--td-dialog-text, #263147);background:var(--td-dialog-surface, #fff);font:750 .75rem/1 system-ui,sans-serif;cursor:pointer}:host ::ng-deep button:hover{border-color:#9b91e3;background:#f7f5ff}:host ::ng-deep button[tdDialogPrimary]{border-color:transparent;color:#fff;background:linear-gradient(135deg,#5746d8,#7657df);box-shadow:0 7px 16px #5746d833}:host ::ng-deep button:disabled{opacity:.5;cursor:not-allowed}@media(max-width:520px){:host{min-height:auto;align-items:stretch;flex-direction:column-reverse;margin-right:-1.1rem;margin-bottom:-1.1rem;margin-left:-1.1rem;padding:.7rem 1.1rem}:host ::ng-deep button{width:100%}}\n"] }]
|
|
921
|
+
}] });
|
|
922
|
+
|
|
923
|
+
class TdDialogClose {
|
|
924
|
+
dialogRef = inject(TdDialogRef);
|
|
925
|
+
result;
|
|
926
|
+
close() {
|
|
927
|
+
this.dialogRef.close(this.result);
|
|
928
|
+
}
|
|
929
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogClose, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
930
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: TdDialogClose, isStandalone: true, selector: "[tdDialogClose]", inputs: { result: ["tdDialogClose", "result"] }, host: { listeners: { "click": "close()" } }, ngImport: i0 });
|
|
931
|
+
}
|
|
932
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogClose, decorators: [{
|
|
933
|
+
type: Directive,
|
|
934
|
+
args: [{
|
|
935
|
+
selector: '[tdDialogClose]',
|
|
936
|
+
}]
|
|
937
|
+
}], propDecorators: { result: [{
|
|
938
|
+
type: Input,
|
|
939
|
+
args: ['tdDialogClose']
|
|
940
|
+
}], close: [{
|
|
941
|
+
type: HostListener,
|
|
942
|
+
args: ['click']
|
|
943
|
+
}] } });
|
|
944
|
+
class TdDialogPrimary {
|
|
945
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogPrimary, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
946
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: TdDialogPrimary, isStandalone: true, selector: "[tdDialogPrimary]", ngImport: i0 });
|
|
947
|
+
}
|
|
948
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDialogPrimary, decorators: [{
|
|
949
|
+
type: Directive,
|
|
950
|
+
args: [{
|
|
951
|
+
selector: '[tdDialogPrimary]',
|
|
952
|
+
}]
|
|
953
|
+
}] });
|
|
954
|
+
|
|
713
955
|
class TdFooter {
|
|
714
956
|
empresa = 'TelcomDev';
|
|
715
957
|
texto = 'Todos los derechos reservados.';
|
|
@@ -820,6 +1062,1067 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
820
1062
|
args: ['document:keydown.escape']
|
|
821
1063
|
}] } });
|
|
822
1064
|
|
|
1065
|
+
let inputSequence = 0;
|
|
1066
|
+
class TdInput {
|
|
1067
|
+
cdr = inject(ChangeDetectorRef);
|
|
1068
|
+
generatedId = `td-input-${++inputSequence}`;
|
|
1069
|
+
id = '';
|
|
1070
|
+
name = '';
|
|
1071
|
+
label = 'Campo';
|
|
1072
|
+
type = 'text';
|
|
1073
|
+
placeholder = '';
|
|
1074
|
+
autocomplete = 'off';
|
|
1075
|
+
icon = '';
|
|
1076
|
+
hint = '';
|
|
1077
|
+
error = '';
|
|
1078
|
+
readonly = false;
|
|
1079
|
+
disabled = false;
|
|
1080
|
+
required = false;
|
|
1081
|
+
clearable = false;
|
|
1082
|
+
dark = false;
|
|
1083
|
+
min = null;
|
|
1084
|
+
max = null;
|
|
1085
|
+
step = null;
|
|
1086
|
+
minlength = null;
|
|
1087
|
+
maxlength = null;
|
|
1088
|
+
valueChange = new EventEmitter();
|
|
1089
|
+
value = '';
|
|
1090
|
+
focused = false;
|
|
1091
|
+
passwordVisible = false;
|
|
1092
|
+
get inputId() {
|
|
1093
|
+
return this.id || this.generatedId;
|
|
1094
|
+
}
|
|
1095
|
+
get descriptionId() {
|
|
1096
|
+
return this.error || this.hint ? `${this.inputId}-description` : null;
|
|
1097
|
+
}
|
|
1098
|
+
get resolvedType() {
|
|
1099
|
+
return this.type === 'password' && this.passwordVisible ? 'text' : this.type;
|
|
1100
|
+
}
|
|
1101
|
+
onChange = () => undefined;
|
|
1102
|
+
onTouched = () => undefined;
|
|
1103
|
+
writeValue(value) {
|
|
1104
|
+
this.value = value === null || value === undefined ? '' : String(value);
|
|
1105
|
+
this.cdr.markForCheck();
|
|
1106
|
+
}
|
|
1107
|
+
registerOnChange(fn) {
|
|
1108
|
+
this.onChange = fn;
|
|
1109
|
+
}
|
|
1110
|
+
registerOnTouched(fn) {
|
|
1111
|
+
this.onTouched = fn;
|
|
1112
|
+
}
|
|
1113
|
+
setDisabledState(disabled) {
|
|
1114
|
+
this.disabled = disabled;
|
|
1115
|
+
this.cdr.markForCheck();
|
|
1116
|
+
}
|
|
1117
|
+
handleInput(event) {
|
|
1118
|
+
this.setValue(event.target.value);
|
|
1119
|
+
}
|
|
1120
|
+
handleBlur() {
|
|
1121
|
+
this.focused = false;
|
|
1122
|
+
this.onTouched();
|
|
1123
|
+
}
|
|
1124
|
+
clear() {
|
|
1125
|
+
this.setValue('');
|
|
1126
|
+
}
|
|
1127
|
+
setValue(value) {
|
|
1128
|
+
this.value = value;
|
|
1129
|
+
this.onChange(value);
|
|
1130
|
+
this.valueChange.emit(value);
|
|
1131
|
+
}
|
|
1132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1133
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdInput, isStandalone: true, selector: "td-input", inputs: { id: "id", name: "name", label: "label", type: "type", placeholder: "placeholder", autocomplete: "autocomplete", icon: "icon", hint: "hint", error: "error", readonly: "readonly", disabled: "disabled", required: "required", clearable: "clearable", dark: "dark", min: "min", max: "max", step: "step", minlength: "minlength", maxlength: "maxlength", value: "value" }, outputs: { valueChange: "valueChange" }, providers: [
|
|
1134
|
+
{
|
|
1135
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1136
|
+
useExisting: forwardRef(() => TdInput),
|
|
1137
|
+
multi: true,
|
|
1138
|
+
},
|
|
1139
|
+
], ngImport: i0, template: `
|
|
1140
|
+
<div
|
|
1141
|
+
class="td-input"
|
|
1142
|
+
[class.td-input--focused]="focused"
|
|
1143
|
+
[class.td-input--error]="!!error"
|
|
1144
|
+
[class.td-input--disabled]="disabled"
|
|
1145
|
+
[class.td-input--dark]="dark"
|
|
1146
|
+
>
|
|
1147
|
+
<label [for]="inputId">{{ label }}</label>
|
|
1148
|
+
|
|
1149
|
+
<div class="td-input__control">
|
|
1150
|
+
@if (icon) {
|
|
1151
|
+
<td-icon class="td-input__icon" [nombre]="icon" />
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
<input
|
|
1155
|
+
[id]="inputId"
|
|
1156
|
+
[name]="name"
|
|
1157
|
+
[type]="resolvedType"
|
|
1158
|
+
[value]="value"
|
|
1159
|
+
[placeholder]="placeholder"
|
|
1160
|
+
[autocomplete]="autocomplete"
|
|
1161
|
+
[disabled]="disabled"
|
|
1162
|
+
[readonly]="readonly"
|
|
1163
|
+
[required]="required"
|
|
1164
|
+
[min]="min"
|
|
1165
|
+
[max]="max"
|
|
1166
|
+
[step]="step"
|
|
1167
|
+
[attr.minlength]="minlength"
|
|
1168
|
+
[attr.maxlength]="maxlength"
|
|
1169
|
+
[attr.aria-describedby]="descriptionId"
|
|
1170
|
+
[attr.aria-invalid]="!!error"
|
|
1171
|
+
(input)="handleInput($event)"
|
|
1172
|
+
(focus)="focused = true"
|
|
1173
|
+
(blur)="handleBlur()"
|
|
1174
|
+
/>
|
|
1175
|
+
|
|
1176
|
+
@if (clearable && value && !disabled && !readonly) {
|
|
1177
|
+
<button type="button" class="td-input__action" title="Limpiar" (click)="clear()">
|
|
1178
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
1179
|
+
</button>
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
@if (type === 'password') {
|
|
1183
|
+
<button
|
|
1184
|
+
type="button"
|
|
1185
|
+
class="td-input__action"
|
|
1186
|
+
[title]="passwordVisible ? 'Ocultar contraseña' : 'Mostrar contraseña'"
|
|
1187
|
+
(click)="passwordVisible = !passwordVisible"
|
|
1188
|
+
>
|
|
1189
|
+
<td-icon [nombre]="passwordVisible ? 'visibility_off' : 'visibility'" />
|
|
1190
|
+
</button>
|
|
1191
|
+
}
|
|
1192
|
+
</div>
|
|
1193
|
+
</div>
|
|
1194
|
+
|
|
1195
|
+
@if (error || hint) {
|
|
1196
|
+
<p
|
|
1197
|
+
class="td-input__message"
|
|
1198
|
+
[class.td-input__message--error]="!!error"
|
|
1199
|
+
[id]="descriptionId"
|
|
1200
|
+
>
|
|
1201
|
+
{{ error || hint }}
|
|
1202
|
+
</p>
|
|
1203
|
+
}
|
|
1204
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-input{--td-input-bg: #fff;--td-input-border: #dfe3eb;--td-input-text: #263147;--td-input-muted: #748096;position:relative;display:flex;min-height:3.15rem;align-items:center;border:1px solid var(--td-input-border);border-radius:.78rem;background:var(--td-input-bg);transition:border-color .14s ease,box-shadow .14s ease,background .14s ease}.td-input--dark{--td-input-bg: #19191f;--td-input-border: #34343e;--td-input-text: #ededf0;--td-input-muted: #a1a1aa;color-scheme:dark}.td-input:hover:not(.td-input--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-input-border))}.td-input--focused{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-input--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-input--disabled{opacity:.58;background:#f5f6f8;cursor:not-allowed}.td-input label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-input-muted);background:var(--td-input-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-input--focused label{color:#5746d8}.td-input--error label{color:#d33f3f}.td-input__control{display:flex;width:100%;min-width:0;align-items:center;gap:.55rem;padding:.25rem .7rem}.td-input__icon{flex:0 0 auto;color:var(--td-input-muted)}input{width:100%;min-width:0;height:2.55rem;border:0;outline:0;color:var(--td-input-text);background:transparent;font:550 .78rem/1 system-ui,sans-serif}input::placeholder{color:color-mix(in srgb,var(--td-input-muted) 72%,transparent)}input:disabled{cursor:not-allowed}input[type=search]::-webkit-search-cancel-button{display:none}.td-input__action{display:grid;width:2rem;height:2rem;flex:0 0 auto;place-items:center;border:0;border-radius:.5rem;color:var(--td-input-muted);background:transparent;cursor:pointer}.td-input__action:hover{color:#5746d8;background:#f2f0ff}.td-input--dark .td-input__action:hover{color:#b9b0fa;background:#292931}.td-input__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-input__message--error{color:#c43636}\n"], dependencies: [{ kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1205
|
+
}
|
|
1206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdInput, decorators: [{
|
|
1207
|
+
type: Component,
|
|
1208
|
+
args: [{ selector: 'td-input', imports: [TdIcon], template: `
|
|
1209
|
+
<div
|
|
1210
|
+
class="td-input"
|
|
1211
|
+
[class.td-input--focused]="focused"
|
|
1212
|
+
[class.td-input--error]="!!error"
|
|
1213
|
+
[class.td-input--disabled]="disabled"
|
|
1214
|
+
[class.td-input--dark]="dark"
|
|
1215
|
+
>
|
|
1216
|
+
<label [for]="inputId">{{ label }}</label>
|
|
1217
|
+
|
|
1218
|
+
<div class="td-input__control">
|
|
1219
|
+
@if (icon) {
|
|
1220
|
+
<td-icon class="td-input__icon" [nombre]="icon" />
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
<input
|
|
1224
|
+
[id]="inputId"
|
|
1225
|
+
[name]="name"
|
|
1226
|
+
[type]="resolvedType"
|
|
1227
|
+
[value]="value"
|
|
1228
|
+
[placeholder]="placeholder"
|
|
1229
|
+
[autocomplete]="autocomplete"
|
|
1230
|
+
[disabled]="disabled"
|
|
1231
|
+
[readonly]="readonly"
|
|
1232
|
+
[required]="required"
|
|
1233
|
+
[min]="min"
|
|
1234
|
+
[max]="max"
|
|
1235
|
+
[step]="step"
|
|
1236
|
+
[attr.minlength]="minlength"
|
|
1237
|
+
[attr.maxlength]="maxlength"
|
|
1238
|
+
[attr.aria-describedby]="descriptionId"
|
|
1239
|
+
[attr.aria-invalid]="!!error"
|
|
1240
|
+
(input)="handleInput($event)"
|
|
1241
|
+
(focus)="focused = true"
|
|
1242
|
+
(blur)="handleBlur()"
|
|
1243
|
+
/>
|
|
1244
|
+
|
|
1245
|
+
@if (clearable && value && !disabled && !readonly) {
|
|
1246
|
+
<button type="button" class="td-input__action" title="Limpiar" (click)="clear()">
|
|
1247
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
1248
|
+
</button>
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
@if (type === 'password') {
|
|
1252
|
+
<button
|
|
1253
|
+
type="button"
|
|
1254
|
+
class="td-input__action"
|
|
1255
|
+
[title]="passwordVisible ? 'Ocultar contraseña' : 'Mostrar contraseña'"
|
|
1256
|
+
(click)="passwordVisible = !passwordVisible"
|
|
1257
|
+
>
|
|
1258
|
+
<td-icon [nombre]="passwordVisible ? 'visibility_off' : 'visibility'" />
|
|
1259
|
+
</button>
|
|
1260
|
+
}
|
|
1261
|
+
</div>
|
|
1262
|
+
</div>
|
|
1263
|
+
|
|
1264
|
+
@if (error || hint) {
|
|
1265
|
+
<p
|
|
1266
|
+
class="td-input__message"
|
|
1267
|
+
[class.td-input__message--error]="!!error"
|
|
1268
|
+
[id]="descriptionId"
|
|
1269
|
+
>
|
|
1270
|
+
{{ error || hint }}
|
|
1271
|
+
</p>
|
|
1272
|
+
}
|
|
1273
|
+
`, providers: [
|
|
1274
|
+
{
|
|
1275
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1276
|
+
useExisting: forwardRef(() => TdInput),
|
|
1277
|
+
multi: true,
|
|
1278
|
+
},
|
|
1279
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-input{--td-input-bg: #fff;--td-input-border: #dfe3eb;--td-input-text: #263147;--td-input-muted: #748096;position:relative;display:flex;min-height:3.15rem;align-items:center;border:1px solid var(--td-input-border);border-radius:.78rem;background:var(--td-input-bg);transition:border-color .14s ease,box-shadow .14s ease,background .14s ease}.td-input--dark{--td-input-bg: #19191f;--td-input-border: #34343e;--td-input-text: #ededf0;--td-input-muted: #a1a1aa;color-scheme:dark}.td-input:hover:not(.td-input--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-input-border))}.td-input--focused{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-input--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-input--disabled{opacity:.58;background:#f5f6f8;cursor:not-allowed}.td-input label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-input-muted);background:var(--td-input-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-input--focused label{color:#5746d8}.td-input--error label{color:#d33f3f}.td-input__control{display:flex;width:100%;min-width:0;align-items:center;gap:.55rem;padding:.25rem .7rem}.td-input__icon{flex:0 0 auto;color:var(--td-input-muted)}input{width:100%;min-width:0;height:2.55rem;border:0;outline:0;color:var(--td-input-text);background:transparent;font:550 .78rem/1 system-ui,sans-serif}input::placeholder{color:color-mix(in srgb,var(--td-input-muted) 72%,transparent)}input:disabled{cursor:not-allowed}input[type=search]::-webkit-search-cancel-button{display:none}.td-input__action{display:grid;width:2rem;height:2rem;flex:0 0 auto;place-items:center;border:0;border-radius:.5rem;color:var(--td-input-muted);background:transparent;cursor:pointer}.td-input__action:hover{color:#5746d8;background:#f2f0ff}.td-input--dark .td-input__action:hover{color:#b9b0fa;background:#292931}.td-input__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-input__message--error{color:#c43636}\n"] }]
|
|
1280
|
+
}], propDecorators: { id: [{
|
|
1281
|
+
type: Input
|
|
1282
|
+
}], name: [{
|
|
1283
|
+
type: Input
|
|
1284
|
+
}], label: [{
|
|
1285
|
+
type: Input
|
|
1286
|
+
}], type: [{
|
|
1287
|
+
type: Input
|
|
1288
|
+
}], placeholder: [{
|
|
1289
|
+
type: Input
|
|
1290
|
+
}], autocomplete: [{
|
|
1291
|
+
type: Input
|
|
1292
|
+
}], icon: [{
|
|
1293
|
+
type: Input
|
|
1294
|
+
}], hint: [{
|
|
1295
|
+
type: Input
|
|
1296
|
+
}], error: [{
|
|
1297
|
+
type: Input
|
|
1298
|
+
}], readonly: [{
|
|
1299
|
+
type: Input
|
|
1300
|
+
}], disabled: [{
|
|
1301
|
+
type: Input
|
|
1302
|
+
}], required: [{
|
|
1303
|
+
type: Input
|
|
1304
|
+
}], clearable: [{
|
|
1305
|
+
type: Input
|
|
1306
|
+
}], dark: [{
|
|
1307
|
+
type: Input
|
|
1308
|
+
}], min: [{
|
|
1309
|
+
type: Input
|
|
1310
|
+
}], max: [{
|
|
1311
|
+
type: Input
|
|
1312
|
+
}], step: [{
|
|
1313
|
+
type: Input
|
|
1314
|
+
}], minlength: [{
|
|
1315
|
+
type: Input
|
|
1316
|
+
}], maxlength: [{
|
|
1317
|
+
type: Input
|
|
1318
|
+
}], valueChange: [{
|
|
1319
|
+
type: Output
|
|
1320
|
+
}], value: [{
|
|
1321
|
+
type: Input
|
|
1322
|
+
}] } });
|
|
1323
|
+
|
|
1324
|
+
let autocompleteSequence = 0;
|
|
1325
|
+
class TdAutocompleteSelect {
|
|
1326
|
+
cdr = inject(ChangeDetectorRef);
|
|
1327
|
+
document = inject(DOCUMENT);
|
|
1328
|
+
destroyRef = inject(DestroyRef);
|
|
1329
|
+
scrollStrategies = inject(ScrollStrategyOptions);
|
|
1330
|
+
generatedId = `td-autocomplete-${++autocompleteSequence}`;
|
|
1331
|
+
searchInput;
|
|
1332
|
+
connectedOverlay;
|
|
1333
|
+
label = 'Buscar y seleccionar';
|
|
1334
|
+
placeholder = 'Escribe para buscar...';
|
|
1335
|
+
options = [];
|
|
1336
|
+
hint = '';
|
|
1337
|
+
error = '';
|
|
1338
|
+
emptyText = 'No se encontraron resultados';
|
|
1339
|
+
clearable = true;
|
|
1340
|
+
dark = false;
|
|
1341
|
+
disabled = false;
|
|
1342
|
+
scrollBehavior = 'reposition';
|
|
1343
|
+
minimumCharacters = 0;
|
|
1344
|
+
filterWith = (option, search) => `${option.label} ${option.description ?? ''}`.toLocaleLowerCase().includes(search);
|
|
1345
|
+
compareWith = (first, second) => Object.is(first, second);
|
|
1346
|
+
selectionChange = new EventEmitter();
|
|
1347
|
+
searchChange = new EventEmitter();
|
|
1348
|
+
value = null;
|
|
1349
|
+
search = '';
|
|
1350
|
+
open = false;
|
|
1351
|
+
activeIndex = -1;
|
|
1352
|
+
scrollStrategy = this.scrollStrategies.reposition();
|
|
1353
|
+
get inputId() {
|
|
1354
|
+
return `${this.generatedId}-input`;
|
|
1355
|
+
}
|
|
1356
|
+
get listId() {
|
|
1357
|
+
return `${this.generatedId}-list`;
|
|
1358
|
+
}
|
|
1359
|
+
get filteredOptions() {
|
|
1360
|
+
const normalized = this.search.trim().toLocaleLowerCase();
|
|
1361
|
+
if (normalized.length < this.minimumCharacters)
|
|
1362
|
+
return [];
|
|
1363
|
+
return this.options.filter((option) => this.filterWith(option, normalized));
|
|
1364
|
+
}
|
|
1365
|
+
onTouched = () => {
|
|
1366
|
+
this.touched();
|
|
1367
|
+
};
|
|
1368
|
+
changed = () => undefined;
|
|
1369
|
+
touched = () => undefined;
|
|
1370
|
+
constructor() {
|
|
1371
|
+
const scrollListener = (event) => {
|
|
1372
|
+
const target = event.target;
|
|
1373
|
+
if (target instanceof Element && target.closest('.td-select-panel'))
|
|
1374
|
+
return;
|
|
1375
|
+
if (this.open) {
|
|
1376
|
+
if (this.scrollBehavior === 'close') {
|
|
1377
|
+
this.close();
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
this.connectedOverlay?.overlayRef.updatePosition();
|
|
1381
|
+
}
|
|
1382
|
+
this.cdr.markForCheck();
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
this.document.addEventListener('scroll', scrollListener, true);
|
|
1386
|
+
this.destroyRef.onDestroy(() => this.document.removeEventListener('scroll', scrollListener, true));
|
|
1387
|
+
}
|
|
1388
|
+
writeValue(value) {
|
|
1389
|
+
this.value = value ?? null;
|
|
1390
|
+
this.search = this.options.find((option) => this.compare(option.value, this.value))?.label ?? '';
|
|
1391
|
+
this.cdr.markForCheck();
|
|
1392
|
+
}
|
|
1393
|
+
registerOnChange(fn) {
|
|
1394
|
+
this.changed = fn;
|
|
1395
|
+
}
|
|
1396
|
+
registerOnTouched(fn) {
|
|
1397
|
+
this.touched = fn;
|
|
1398
|
+
}
|
|
1399
|
+
setDisabledState(disabled) {
|
|
1400
|
+
this.disabled = disabled;
|
|
1401
|
+
this.cdr.markForCheck();
|
|
1402
|
+
}
|
|
1403
|
+
compare(first, second) {
|
|
1404
|
+
return this.compareWith(first, second);
|
|
1405
|
+
}
|
|
1406
|
+
openPanel() {
|
|
1407
|
+
if (this.disabled)
|
|
1408
|
+
return;
|
|
1409
|
+
this.open = true;
|
|
1410
|
+
this.activeIndex = this.firstEnabledIndex();
|
|
1411
|
+
}
|
|
1412
|
+
close() {
|
|
1413
|
+
this.open = false;
|
|
1414
|
+
const selected = this.options.find((option) => this.compare(option.value, this.value));
|
|
1415
|
+
if (selected)
|
|
1416
|
+
this.search = selected.label;
|
|
1417
|
+
this.touched();
|
|
1418
|
+
}
|
|
1419
|
+
handleInput(event) {
|
|
1420
|
+
this.search = event.target.value;
|
|
1421
|
+
this.value = null;
|
|
1422
|
+
this.changed(null);
|
|
1423
|
+
this.searchChange.emit(this.search);
|
|
1424
|
+
this.openPanel();
|
|
1425
|
+
this.activeIndex = this.firstEnabledIndex();
|
|
1426
|
+
}
|
|
1427
|
+
select(option) {
|
|
1428
|
+
if (option.disabled)
|
|
1429
|
+
return;
|
|
1430
|
+
this.value = option.value;
|
|
1431
|
+
this.search = option.label;
|
|
1432
|
+
this.changed(option.value);
|
|
1433
|
+
this.selectionChange.emit(option.value);
|
|
1434
|
+
this.close();
|
|
1435
|
+
}
|
|
1436
|
+
clear(event) {
|
|
1437
|
+
event.stopPropagation();
|
|
1438
|
+
this.value = null;
|
|
1439
|
+
this.search = '';
|
|
1440
|
+
this.changed(null);
|
|
1441
|
+
this.selectionChange.emit(null);
|
|
1442
|
+
this.searchChange.emit('');
|
|
1443
|
+
this.openPanel();
|
|
1444
|
+
queueMicrotask(() => this.searchInput?.nativeElement.focus());
|
|
1445
|
+
}
|
|
1446
|
+
handleKeydown(event) {
|
|
1447
|
+
if (event.key === 'Escape') {
|
|
1448
|
+
event.preventDefault();
|
|
1449
|
+
this.close();
|
|
1450
|
+
}
|
|
1451
|
+
else if (event.key === 'ArrowDown') {
|
|
1452
|
+
event.preventDefault();
|
|
1453
|
+
this.openPanel();
|
|
1454
|
+
this.moveActive(1);
|
|
1455
|
+
}
|
|
1456
|
+
else if (event.key === 'ArrowUp') {
|
|
1457
|
+
event.preventDefault();
|
|
1458
|
+
this.openPanel();
|
|
1459
|
+
this.moveActive(-1);
|
|
1460
|
+
}
|
|
1461
|
+
else if (event.key === 'Enter' && this.open && this.activeIndex >= 0) {
|
|
1462
|
+
event.preventDefault();
|
|
1463
|
+
const option = this.filteredOptions[this.activeIndex];
|
|
1464
|
+
if (option)
|
|
1465
|
+
this.select(option);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
moveActive(direction) {
|
|
1469
|
+
const options = this.filteredOptions;
|
|
1470
|
+
if (!options.length)
|
|
1471
|
+
return;
|
|
1472
|
+
let next = this.activeIndex;
|
|
1473
|
+
for (let index = 0; index < options.length; index++) {
|
|
1474
|
+
next = (next + direction + options.length) % options.length;
|
|
1475
|
+
if (!options[next]?.disabled) {
|
|
1476
|
+
this.activeIndex = next;
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
firstEnabledIndex() {
|
|
1482
|
+
return this.filteredOptions.findIndex((option) => !option.disabled);
|
|
1483
|
+
}
|
|
1484
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdAutocompleteSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1485
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdAutocompleteSelect, isStandalone: true, selector: "td-autocomplete-select", inputs: { label: "label", placeholder: "placeholder", options: "options", hint: "hint", error: "error", emptyText: "emptyText", clearable: "clearable", dark: "dark", disabled: "disabled", scrollBehavior: "scrollBehavior", minimumCharacters: "minimumCharacters", filterWith: "filterWith", compareWith: "compareWith" }, outputs: { selectionChange: "selectionChange", searchChange: "searchChange" }, providers: [
|
|
1486
|
+
{
|
|
1487
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1488
|
+
useExisting: forwardRef(() => TdAutocompleteSelect),
|
|
1489
|
+
multi: true,
|
|
1490
|
+
},
|
|
1491
|
+
], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }], ngImport: i0, template: `
|
|
1492
|
+
<div
|
|
1493
|
+
cdkOverlayOrigin
|
|
1494
|
+
#origin="cdkOverlayOrigin"
|
|
1495
|
+
class="td-select td-select--autocomplete"
|
|
1496
|
+
[class.td-select--open]="open"
|
|
1497
|
+
[class.td-select--error]="!!error"
|
|
1498
|
+
[class.td-select--disabled]="disabled"
|
|
1499
|
+
[class.td-select--dark]="dark"
|
|
1500
|
+
>
|
|
1501
|
+
<label [for]="inputId">{{ label }}</label>
|
|
1502
|
+
<div class="td-select__trigger">
|
|
1503
|
+
<td-icon class="td-select__leading" nombre="search" />
|
|
1504
|
+
<input
|
|
1505
|
+
#searchInput
|
|
1506
|
+
[id]="inputId"
|
|
1507
|
+
type="search"
|
|
1508
|
+
autocomplete="off"
|
|
1509
|
+
role="combobox"
|
|
1510
|
+
[value]="search"
|
|
1511
|
+
[placeholder]="placeholder"
|
|
1512
|
+
[disabled]="disabled"
|
|
1513
|
+
[attr.aria-expanded]="open"
|
|
1514
|
+
[attr.aria-controls]="listId"
|
|
1515
|
+
(focus)="openPanel()"
|
|
1516
|
+
(input)="handleInput($event)"
|
|
1517
|
+
(keydown)="handleKeydown($event)"
|
|
1518
|
+
(blur)="onTouched()"
|
|
1519
|
+
/>
|
|
1520
|
+
@if (clearable && (value !== null || search) && !disabled) {
|
|
1521
|
+
<button type="button" class="td-select__clear" title="Limpiar" (click)="clear($event)">
|
|
1522
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
1523
|
+
</button>
|
|
1524
|
+
}
|
|
1525
|
+
<td-icon
|
|
1526
|
+
class="td-select__chevron"
|
|
1527
|
+
[class.td-select__chevron--open]="open"
|
|
1528
|
+
nombre="chevron_down"
|
|
1529
|
+
/>
|
|
1530
|
+
</div>
|
|
1531
|
+
</div>
|
|
1532
|
+
|
|
1533
|
+
@if (error || hint) {
|
|
1534
|
+
<p class="td-select__message" [class.td-select__message--error]="!!error">
|
|
1535
|
+
{{ error || hint }}
|
|
1536
|
+
</p>
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
<ng-template
|
|
1540
|
+
cdkConnectedOverlay
|
|
1541
|
+
#connectedOverlay="cdkConnectedOverlay"
|
|
1542
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
1543
|
+
[cdkConnectedOverlayOpen]="open"
|
|
1544
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
1545
|
+
[cdkConnectedOverlayMatchWidth]="true"
|
|
1546
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
1547
|
+
[cdkConnectedOverlayPush]="true"
|
|
1548
|
+
(overlayOutsideClick)="close()"
|
|
1549
|
+
(overlayKeydown)="handleKeydown($event)"
|
|
1550
|
+
(detach)="close()"
|
|
1551
|
+
>
|
|
1552
|
+
<div
|
|
1553
|
+
class="td-select-panel"
|
|
1554
|
+
[class.td-select-panel--dark]="dark"
|
|
1555
|
+
[id]="listId"
|
|
1556
|
+
role="listbox"
|
|
1557
|
+
>
|
|
1558
|
+
@if (!filteredOptions.length) {
|
|
1559
|
+
<p class="td-select-panel__empty">{{ emptyText }}</p>
|
|
1560
|
+
}
|
|
1561
|
+
@for (option of filteredOptions; track option.value; let index = $index) {
|
|
1562
|
+
<button
|
|
1563
|
+
type="button"
|
|
1564
|
+
role="option"
|
|
1565
|
+
[class.td-select-panel__option--active]="index === activeIndex"
|
|
1566
|
+
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
1567
|
+
[disabled]="option.disabled"
|
|
1568
|
+
(mousedown)="$event.preventDefault()"
|
|
1569
|
+
(mouseenter)="activeIndex = index"
|
|
1570
|
+
(click)="select(option)"
|
|
1571
|
+
>
|
|
1572
|
+
@if (option.icon) {
|
|
1573
|
+
<td-icon [nombre]="option.icon" />
|
|
1574
|
+
}
|
|
1575
|
+
<span>
|
|
1576
|
+
<strong>{{ option.label }}</strong>
|
|
1577
|
+
@if (option.description) {
|
|
1578
|
+
<small>{{ option.description }}</small>
|
|
1579
|
+
}
|
|
1580
|
+
</span>
|
|
1581
|
+
@if (compare(option.value, value)) {
|
|
1582
|
+
<td-icon class="td-select-panel__check" nombre="check" />
|
|
1583
|
+
}
|
|
1584
|
+
</button>
|
|
1585
|
+
}
|
|
1586
|
+
</div>
|
|
1587
|
+
</ng-template>
|
|
1588
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-select{--td-select-bg: #fff;--td-select-border: #dfe3eb;--td-select-text: #263147;--td-select-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-select-border);border-radius:.78rem;background:var(--td-select-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-select--dark{--td-select-bg: #19191f;--td-select-border: #34343e;--td-select-text: #ededf0;--td-select-muted: #a1a1aa;color-scheme:dark}.td-select:hover:not(.td-select--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-select-border))}.td-select--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-select--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-select--disabled{opacity:.58;background:#f5f6f8}.td-select>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-select-muted);background:var(--td-select-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-select--open>label{color:#5746d8}.td-select--error>label{color:#d33f3f}.td-select__trigger{display:flex;width:100%;min-width:0;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-select-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-select__trigger:disabled{cursor:not-allowed}.td-select__trigger>span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select__placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__leading{flex:0 0 auto;color:var(--td-select-muted)}.td-select__chevron{flex:0 0 auto;color:var(--td-select-muted);transition:transform .14s ease}.td-select__chevron--open{transform:rotate(180deg)}.td-select__trigger input{width:100%;min-width:0;height:2.4rem;border:0;outline:0;color:var(--td-select-text);background:transparent;font:inherit}.td-select__trigger input::placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__trigger input::-webkit-search-cancel-button{display:none}.td-select__clear{display:grid;width:1.9rem;height:1.9rem;flex:0 0 auto;place-items:center;border:0;border-radius:.45rem;color:var(--td-select-muted);background:transparent;cursor:pointer}.td-select__clear:hover{color:#5746d8;background:#f2f0ff}.td-select__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-select__message--error{color:#c43636}.td-select-panel{width:100%;min-width:100%;max-height:min(20rem,100dvh - 2rem);overflow-y:auto;border:1px solid #e1e5ee;border-radius:.78rem;padding:.35rem;color:#263147;background:#fff;box-shadow:0 18px 46px #0f172a2e;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-select-panel-in .13s ease-out;scrollbar-width:thin}.td-select-panel--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-select-panel button{display:flex;width:100%;min-height:2.7rem;align-items:center;gap:.65rem;border:0;border-radius:.58rem;padding:.55rem .65rem;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.td-select-panel button>span{min-width:0;overflow:hidden}.td-select-panel strong,.td-select-panel small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select-panel button:hover,.td-select-panel__option--active{background:#f4f2ff!important}.td-select-panel--dark button:hover,.td-select-panel--dark .td-select-panel__option--active{background:#2a2934!important}.td-select-panel__option--selected{color:#5746d8!important;background:#eeecff!important}.td-select-panel--dark .td-select-panel__option--selected{color:#b9b0fa!important;background:#292540!important}.td-select-panel button:disabled{opacity:.45;cursor:not-allowed}.td-select-panel button>span{min-width:0;flex:1}.td-select-panel strong,.td-select-panel small{display:block}.td-select-panel strong{font-size:.75rem}.td-select-panel small{margin-top:.18rem;color:#748096;font-size:.65rem}.td-select-panel__check{margin-left:auto}.td-select-panel__empty{margin:0;padding:1rem;color:#748096;font-size:.72rem;text-align:center}@keyframes td-select-panel-in{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1589
|
+
}
|
|
1590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdAutocompleteSelect, decorators: [{
|
|
1591
|
+
type: Component,
|
|
1592
|
+
args: [{ selector: 'td-autocomplete-select', imports: [CdkConnectedOverlay, CdkOverlayOrigin, TdIcon], template: `
|
|
1593
|
+
<div
|
|
1594
|
+
cdkOverlayOrigin
|
|
1595
|
+
#origin="cdkOverlayOrigin"
|
|
1596
|
+
class="td-select td-select--autocomplete"
|
|
1597
|
+
[class.td-select--open]="open"
|
|
1598
|
+
[class.td-select--error]="!!error"
|
|
1599
|
+
[class.td-select--disabled]="disabled"
|
|
1600
|
+
[class.td-select--dark]="dark"
|
|
1601
|
+
>
|
|
1602
|
+
<label [for]="inputId">{{ label }}</label>
|
|
1603
|
+
<div class="td-select__trigger">
|
|
1604
|
+
<td-icon class="td-select__leading" nombre="search" />
|
|
1605
|
+
<input
|
|
1606
|
+
#searchInput
|
|
1607
|
+
[id]="inputId"
|
|
1608
|
+
type="search"
|
|
1609
|
+
autocomplete="off"
|
|
1610
|
+
role="combobox"
|
|
1611
|
+
[value]="search"
|
|
1612
|
+
[placeholder]="placeholder"
|
|
1613
|
+
[disabled]="disabled"
|
|
1614
|
+
[attr.aria-expanded]="open"
|
|
1615
|
+
[attr.aria-controls]="listId"
|
|
1616
|
+
(focus)="openPanel()"
|
|
1617
|
+
(input)="handleInput($event)"
|
|
1618
|
+
(keydown)="handleKeydown($event)"
|
|
1619
|
+
(blur)="onTouched()"
|
|
1620
|
+
/>
|
|
1621
|
+
@if (clearable && (value !== null || search) && !disabled) {
|
|
1622
|
+
<button type="button" class="td-select__clear" title="Limpiar" (click)="clear($event)">
|
|
1623
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
1624
|
+
</button>
|
|
1625
|
+
}
|
|
1626
|
+
<td-icon
|
|
1627
|
+
class="td-select__chevron"
|
|
1628
|
+
[class.td-select__chevron--open]="open"
|
|
1629
|
+
nombre="chevron_down"
|
|
1630
|
+
/>
|
|
1631
|
+
</div>
|
|
1632
|
+
</div>
|
|
1633
|
+
|
|
1634
|
+
@if (error || hint) {
|
|
1635
|
+
<p class="td-select__message" [class.td-select__message--error]="!!error">
|
|
1636
|
+
{{ error || hint }}
|
|
1637
|
+
</p>
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
<ng-template
|
|
1641
|
+
cdkConnectedOverlay
|
|
1642
|
+
#connectedOverlay="cdkConnectedOverlay"
|
|
1643
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
1644
|
+
[cdkConnectedOverlayOpen]="open"
|
|
1645
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
1646
|
+
[cdkConnectedOverlayMatchWidth]="true"
|
|
1647
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
1648
|
+
[cdkConnectedOverlayPush]="true"
|
|
1649
|
+
(overlayOutsideClick)="close()"
|
|
1650
|
+
(overlayKeydown)="handleKeydown($event)"
|
|
1651
|
+
(detach)="close()"
|
|
1652
|
+
>
|
|
1653
|
+
<div
|
|
1654
|
+
class="td-select-panel"
|
|
1655
|
+
[class.td-select-panel--dark]="dark"
|
|
1656
|
+
[id]="listId"
|
|
1657
|
+
role="listbox"
|
|
1658
|
+
>
|
|
1659
|
+
@if (!filteredOptions.length) {
|
|
1660
|
+
<p class="td-select-panel__empty">{{ emptyText }}</p>
|
|
1661
|
+
}
|
|
1662
|
+
@for (option of filteredOptions; track option.value; let index = $index) {
|
|
1663
|
+
<button
|
|
1664
|
+
type="button"
|
|
1665
|
+
role="option"
|
|
1666
|
+
[class.td-select-panel__option--active]="index === activeIndex"
|
|
1667
|
+
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
1668
|
+
[disabled]="option.disabled"
|
|
1669
|
+
(mousedown)="$event.preventDefault()"
|
|
1670
|
+
(mouseenter)="activeIndex = index"
|
|
1671
|
+
(click)="select(option)"
|
|
1672
|
+
>
|
|
1673
|
+
@if (option.icon) {
|
|
1674
|
+
<td-icon [nombre]="option.icon" />
|
|
1675
|
+
}
|
|
1676
|
+
<span>
|
|
1677
|
+
<strong>{{ option.label }}</strong>
|
|
1678
|
+
@if (option.description) {
|
|
1679
|
+
<small>{{ option.description }}</small>
|
|
1680
|
+
}
|
|
1681
|
+
</span>
|
|
1682
|
+
@if (compare(option.value, value)) {
|
|
1683
|
+
<td-icon class="td-select-panel__check" nombre="check" />
|
|
1684
|
+
}
|
|
1685
|
+
</button>
|
|
1686
|
+
}
|
|
1687
|
+
</div>
|
|
1688
|
+
</ng-template>
|
|
1689
|
+
`, providers: [
|
|
1690
|
+
{
|
|
1691
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1692
|
+
useExisting: forwardRef(() => TdAutocompleteSelect),
|
|
1693
|
+
multi: true,
|
|
1694
|
+
},
|
|
1695
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-select{--td-select-bg: #fff;--td-select-border: #dfe3eb;--td-select-text: #263147;--td-select-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-select-border);border-radius:.78rem;background:var(--td-select-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-select--dark{--td-select-bg: #19191f;--td-select-border: #34343e;--td-select-text: #ededf0;--td-select-muted: #a1a1aa;color-scheme:dark}.td-select:hover:not(.td-select--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-select-border))}.td-select--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-select--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-select--disabled{opacity:.58;background:#f5f6f8}.td-select>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-select-muted);background:var(--td-select-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-select--open>label{color:#5746d8}.td-select--error>label{color:#d33f3f}.td-select__trigger{display:flex;width:100%;min-width:0;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-select-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-select__trigger:disabled{cursor:not-allowed}.td-select__trigger>span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select__placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__leading{flex:0 0 auto;color:var(--td-select-muted)}.td-select__chevron{flex:0 0 auto;color:var(--td-select-muted);transition:transform .14s ease}.td-select__chevron--open{transform:rotate(180deg)}.td-select__trigger input{width:100%;min-width:0;height:2.4rem;border:0;outline:0;color:var(--td-select-text);background:transparent;font:inherit}.td-select__trigger input::placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__trigger input::-webkit-search-cancel-button{display:none}.td-select__clear{display:grid;width:1.9rem;height:1.9rem;flex:0 0 auto;place-items:center;border:0;border-radius:.45rem;color:var(--td-select-muted);background:transparent;cursor:pointer}.td-select__clear:hover{color:#5746d8;background:#f2f0ff}.td-select__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-select__message--error{color:#c43636}.td-select-panel{width:100%;min-width:100%;max-height:min(20rem,100dvh - 2rem);overflow-y:auto;border:1px solid #e1e5ee;border-radius:.78rem;padding:.35rem;color:#263147;background:#fff;box-shadow:0 18px 46px #0f172a2e;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-select-panel-in .13s ease-out;scrollbar-width:thin}.td-select-panel--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-select-panel button{display:flex;width:100%;min-height:2.7rem;align-items:center;gap:.65rem;border:0;border-radius:.58rem;padding:.55rem .65rem;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.td-select-panel button>span{min-width:0;overflow:hidden}.td-select-panel strong,.td-select-panel small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select-panel button:hover,.td-select-panel__option--active{background:#f4f2ff!important}.td-select-panel--dark button:hover,.td-select-panel--dark .td-select-panel__option--active{background:#2a2934!important}.td-select-panel__option--selected{color:#5746d8!important;background:#eeecff!important}.td-select-panel--dark .td-select-panel__option--selected{color:#b9b0fa!important;background:#292540!important}.td-select-panel button:disabled{opacity:.45;cursor:not-allowed}.td-select-panel button>span{min-width:0;flex:1}.td-select-panel strong,.td-select-panel small{display:block}.td-select-panel strong{font-size:.75rem}.td-select-panel small{margin-top:.18rem;color:#748096;font-size:.65rem}.td-select-panel__check{margin-left:auto}.td-select-panel__empty{margin:0;padding:1rem;color:#748096;font-size:.72rem;text-align:center}@keyframes td-select-panel-in{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
1696
|
+
}], ctorParameters: () => [], propDecorators: { searchInput: [{
|
|
1697
|
+
type: ViewChild,
|
|
1698
|
+
args: ['searchInput']
|
|
1699
|
+
}], connectedOverlay: [{
|
|
1700
|
+
type: ViewChild,
|
|
1701
|
+
args: [CdkConnectedOverlay]
|
|
1702
|
+
}], label: [{
|
|
1703
|
+
type: Input
|
|
1704
|
+
}], placeholder: [{
|
|
1705
|
+
type: Input
|
|
1706
|
+
}], options: [{
|
|
1707
|
+
type: Input
|
|
1708
|
+
}], hint: [{
|
|
1709
|
+
type: Input
|
|
1710
|
+
}], error: [{
|
|
1711
|
+
type: Input
|
|
1712
|
+
}], emptyText: [{
|
|
1713
|
+
type: Input
|
|
1714
|
+
}], clearable: [{
|
|
1715
|
+
type: Input
|
|
1716
|
+
}], dark: [{
|
|
1717
|
+
type: Input
|
|
1718
|
+
}], disabled: [{
|
|
1719
|
+
type: Input
|
|
1720
|
+
}], scrollBehavior: [{
|
|
1721
|
+
type: Input
|
|
1722
|
+
}], minimumCharacters: [{
|
|
1723
|
+
type: Input
|
|
1724
|
+
}], filterWith: [{
|
|
1725
|
+
type: Input
|
|
1726
|
+
}], compareWith: [{
|
|
1727
|
+
type: Input
|
|
1728
|
+
}], selectionChange: [{
|
|
1729
|
+
type: Output
|
|
1730
|
+
}], searchChange: [{
|
|
1731
|
+
type: Output
|
|
1732
|
+
}] } });
|
|
1733
|
+
|
|
1734
|
+
let selectSequence = 0;
|
|
1735
|
+
class TdSelect {
|
|
1736
|
+
cdr = inject(ChangeDetectorRef);
|
|
1737
|
+
document = inject(DOCUMENT);
|
|
1738
|
+
destroyRef = inject(DestroyRef);
|
|
1739
|
+
scrollStrategies = inject(ScrollStrategyOptions);
|
|
1740
|
+
generatedId = `td-select-${++selectSequence}`;
|
|
1741
|
+
connectedOverlay;
|
|
1742
|
+
label = 'Seleccionar';
|
|
1743
|
+
placeholder = 'Selecciona una opción';
|
|
1744
|
+
options = [];
|
|
1745
|
+
hint = '';
|
|
1746
|
+
error = '';
|
|
1747
|
+
emptyText = 'No hay opciones disponibles';
|
|
1748
|
+
clearable = false;
|
|
1749
|
+
dark = false;
|
|
1750
|
+
disabled = false;
|
|
1751
|
+
scrollBehavior = 'reposition';
|
|
1752
|
+
compareWith = (first, second) => Object.is(first, second);
|
|
1753
|
+
selectionChange = new EventEmitter();
|
|
1754
|
+
value = null;
|
|
1755
|
+
open = false;
|
|
1756
|
+
activeIndex = -1;
|
|
1757
|
+
scrollStrategy = this.scrollStrategies.reposition();
|
|
1758
|
+
get labelId() {
|
|
1759
|
+
return `${this.generatedId}-label`;
|
|
1760
|
+
}
|
|
1761
|
+
get listId() {
|
|
1762
|
+
return `${this.generatedId}-list`;
|
|
1763
|
+
}
|
|
1764
|
+
get selectedOption() {
|
|
1765
|
+
return this.options.find((option) => this.compare(option.value, this.value));
|
|
1766
|
+
}
|
|
1767
|
+
onChange = () => undefined;
|
|
1768
|
+
onTouched = () => undefined;
|
|
1769
|
+
constructor() {
|
|
1770
|
+
const scrollListener = (event) => {
|
|
1771
|
+
const target = event.target;
|
|
1772
|
+
if (target instanceof Element && target.closest('.td-select-panel'))
|
|
1773
|
+
return;
|
|
1774
|
+
if (this.open) {
|
|
1775
|
+
if (this.scrollBehavior === 'close') {
|
|
1776
|
+
this.close();
|
|
1777
|
+
}
|
|
1778
|
+
else {
|
|
1779
|
+
this.connectedOverlay?.overlayRef.updatePosition();
|
|
1780
|
+
}
|
|
1781
|
+
this.cdr.markForCheck();
|
|
1782
|
+
}
|
|
1783
|
+
};
|
|
1784
|
+
this.document.addEventListener('scroll', scrollListener, true);
|
|
1785
|
+
this.destroyRef.onDestroy(() => this.document.removeEventListener('scroll', scrollListener, true));
|
|
1786
|
+
}
|
|
1787
|
+
writeValue(value) {
|
|
1788
|
+
this.value = value ?? null;
|
|
1789
|
+
this.cdr.markForCheck();
|
|
1790
|
+
}
|
|
1791
|
+
registerOnChange(fn) {
|
|
1792
|
+
this.onChange = fn;
|
|
1793
|
+
}
|
|
1794
|
+
registerOnTouched(fn) {
|
|
1795
|
+
this.onTouched = fn;
|
|
1796
|
+
}
|
|
1797
|
+
setDisabledState(disabled) {
|
|
1798
|
+
this.disabled = disabled;
|
|
1799
|
+
this.cdr.markForCheck();
|
|
1800
|
+
}
|
|
1801
|
+
compare(first, second) {
|
|
1802
|
+
return this.compareWith(first, second);
|
|
1803
|
+
}
|
|
1804
|
+
toggle() {
|
|
1805
|
+
if (this.disabled)
|
|
1806
|
+
return;
|
|
1807
|
+
this.open ? this.close() : this.openPanel();
|
|
1808
|
+
}
|
|
1809
|
+
close() {
|
|
1810
|
+
if (!this.open)
|
|
1811
|
+
return;
|
|
1812
|
+
this.open = false;
|
|
1813
|
+
this.onTouched();
|
|
1814
|
+
}
|
|
1815
|
+
select(option) {
|
|
1816
|
+
if (option.disabled)
|
|
1817
|
+
return;
|
|
1818
|
+
this.setValue(option.value);
|
|
1819
|
+
this.close();
|
|
1820
|
+
}
|
|
1821
|
+
clear(event) {
|
|
1822
|
+
event.stopPropagation();
|
|
1823
|
+
this.setValue(null);
|
|
1824
|
+
}
|
|
1825
|
+
handleKeydown(event) {
|
|
1826
|
+
if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {
|
|
1827
|
+
event.preventDefault();
|
|
1828
|
+
this.openPanel();
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
handleOverlayKeydown(event) {
|
|
1832
|
+
if (event.key === 'Escape') {
|
|
1833
|
+
event.preventDefault();
|
|
1834
|
+
this.close();
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
if (event.key === 'ArrowDown') {
|
|
1838
|
+
event.preventDefault();
|
|
1839
|
+
this.moveActive(1);
|
|
1840
|
+
}
|
|
1841
|
+
else if (event.key === 'ArrowUp') {
|
|
1842
|
+
event.preventDefault();
|
|
1843
|
+
this.moveActive(-1);
|
|
1844
|
+
}
|
|
1845
|
+
else if (event.key === 'Enter' && this.activeIndex >= 0) {
|
|
1846
|
+
event.preventDefault();
|
|
1847
|
+
const option = this.options[this.activeIndex];
|
|
1848
|
+
if (option)
|
|
1849
|
+
this.select(option);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
openPanel() {
|
|
1853
|
+
this.open = true;
|
|
1854
|
+
const selectedIndex = this.options.findIndex((option) => this.compare(option.value, this.value));
|
|
1855
|
+
this.activeIndex = selectedIndex >= 0 ? selectedIndex : this.firstEnabledIndex();
|
|
1856
|
+
}
|
|
1857
|
+
moveActive(direction) {
|
|
1858
|
+
if (!this.options.length)
|
|
1859
|
+
return;
|
|
1860
|
+
let next = this.activeIndex;
|
|
1861
|
+
for (let index = 0; index < this.options.length; index++) {
|
|
1862
|
+
next = (next + direction + this.options.length) % this.options.length;
|
|
1863
|
+
if (!this.options[next]?.disabled) {
|
|
1864
|
+
this.activeIndex = next;
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
firstEnabledIndex() {
|
|
1870
|
+
return this.options.findIndex((option) => !option.disabled);
|
|
1871
|
+
}
|
|
1872
|
+
setValue(value) {
|
|
1873
|
+
this.value = value;
|
|
1874
|
+
this.onChange(value);
|
|
1875
|
+
this.selectionChange.emit(value);
|
|
1876
|
+
}
|
|
1877
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1878
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdSelect, isStandalone: true, selector: "td-select", inputs: { label: "label", placeholder: "placeholder", options: "options", hint: "hint", error: "error", emptyText: "emptyText", clearable: "clearable", dark: "dark", disabled: "disabled", scrollBehavior: "scrollBehavior", compareWith: "compareWith" }, outputs: { selectionChange: "selectionChange" }, providers: [
|
|
1879
|
+
{
|
|
1880
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1881
|
+
useExisting: forwardRef(() => TdSelect),
|
|
1882
|
+
multi: true,
|
|
1883
|
+
},
|
|
1884
|
+
], viewQueries: [{ propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }], ngImport: i0, template: `
|
|
1885
|
+
<div
|
|
1886
|
+
cdkOverlayOrigin
|
|
1887
|
+
#origin="cdkOverlayOrigin"
|
|
1888
|
+
class="td-select"
|
|
1889
|
+
[class.td-select--open]="open"
|
|
1890
|
+
[class.td-select--error]="!!error"
|
|
1891
|
+
[class.td-select--disabled]="disabled"
|
|
1892
|
+
[class.td-select--dark]="dark"
|
|
1893
|
+
>
|
|
1894
|
+
<label [id]="labelId">{{ label }}</label>
|
|
1895
|
+
<div
|
|
1896
|
+
class="td-select__trigger"
|
|
1897
|
+
role="combobox"
|
|
1898
|
+
[attr.tabindex]="disabled ? -1 : 0"
|
|
1899
|
+
[attr.aria-disabled]="disabled"
|
|
1900
|
+
[attr.aria-labelledby]="labelId"
|
|
1901
|
+
[attr.aria-expanded]="open"
|
|
1902
|
+
[attr.aria-controls]="listId"
|
|
1903
|
+
(click)="toggle()"
|
|
1904
|
+
(keydown)="handleKeydown($event)"
|
|
1905
|
+
>
|
|
1906
|
+
@if (selectedOption?.icon) {
|
|
1907
|
+
<td-icon class="td-select__leading" [nombre]="selectedOption!.icon!" />
|
|
1908
|
+
}
|
|
1909
|
+
<span [class.td-select__placeholder]="!selectedOption">
|
|
1910
|
+
{{ selectedOption?.label || placeholder }}
|
|
1911
|
+
</span>
|
|
1912
|
+
@if (clearable && selectedOption && !disabled) {
|
|
1913
|
+
<button
|
|
1914
|
+
type="button"
|
|
1915
|
+
class="td-select__clear"
|
|
1916
|
+
title="Limpiar selección"
|
|
1917
|
+
(click)="clear($event)"
|
|
1918
|
+
>
|
|
1919
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
1920
|
+
</button>
|
|
1921
|
+
}
|
|
1922
|
+
<td-icon
|
|
1923
|
+
class="td-select__chevron"
|
|
1924
|
+
[class.td-select__chevron--open]="open"
|
|
1925
|
+
nombre="chevron_down"
|
|
1926
|
+
/>
|
|
1927
|
+
</div>
|
|
1928
|
+
</div>
|
|
1929
|
+
|
|
1930
|
+
@if (error || hint) {
|
|
1931
|
+
<p class="td-select__message" [class.td-select__message--error]="!!error">
|
|
1932
|
+
{{ error || hint }}
|
|
1933
|
+
</p>
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
<ng-template
|
|
1937
|
+
cdkConnectedOverlay
|
|
1938
|
+
#connectedOverlay="cdkConnectedOverlay"
|
|
1939
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
1940
|
+
[cdkConnectedOverlayOpen]="open"
|
|
1941
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
1942
|
+
[cdkConnectedOverlayMatchWidth]="true"
|
|
1943
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
1944
|
+
[cdkConnectedOverlayPush]="true"
|
|
1945
|
+
(overlayOutsideClick)="close()"
|
|
1946
|
+
(overlayKeydown)="handleOverlayKeydown($event)"
|
|
1947
|
+
(detach)="close()"
|
|
1948
|
+
>
|
|
1949
|
+
<div
|
|
1950
|
+
class="td-select-panel"
|
|
1951
|
+
[class.td-select-panel--dark]="dark"
|
|
1952
|
+
[id]="listId"
|
|
1953
|
+
role="listbox"
|
|
1954
|
+
>
|
|
1955
|
+
@if (!options.length) {
|
|
1956
|
+
<p class="td-select-panel__empty">{{ emptyText }}</p>
|
|
1957
|
+
}
|
|
1958
|
+
@for (option of options; track option.value; let index = $index) {
|
|
1959
|
+
<button
|
|
1960
|
+
type="button"
|
|
1961
|
+
role="option"
|
|
1962
|
+
[class.td-select-panel__option--active]="index === activeIndex"
|
|
1963
|
+
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
1964
|
+
[attr.aria-selected]="compare(option.value, value)"
|
|
1965
|
+
[disabled]="option.disabled"
|
|
1966
|
+
(mouseenter)="activeIndex = index"
|
|
1967
|
+
(click)="select(option)"
|
|
1968
|
+
>
|
|
1969
|
+
@if (option.icon) {
|
|
1970
|
+
<td-icon [nombre]="option.icon" />
|
|
1971
|
+
}
|
|
1972
|
+
<span>
|
|
1973
|
+
<strong>{{ option.label }}</strong>
|
|
1974
|
+
@if (option.description) {
|
|
1975
|
+
<small>{{ option.description }}</small>
|
|
1976
|
+
}
|
|
1977
|
+
</span>
|
|
1978
|
+
@if (compare(option.value, value)) {
|
|
1979
|
+
<td-icon class="td-select-panel__check" nombre="check" />
|
|
1980
|
+
}
|
|
1981
|
+
</button>
|
|
1982
|
+
}
|
|
1983
|
+
</div>
|
|
1984
|
+
</ng-template>
|
|
1985
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-select{--td-select-bg: #fff;--td-select-border: #dfe3eb;--td-select-text: #263147;--td-select-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-select-border);border-radius:.78rem;background:var(--td-select-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-select--dark{--td-select-bg: #19191f;--td-select-border: #34343e;--td-select-text: #ededf0;--td-select-muted: #a1a1aa;color-scheme:dark}.td-select:hover:not(.td-select--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-select-border))}.td-select--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-select--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-select--disabled{opacity:.58;background:#f5f6f8}.td-select>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-select-muted);background:var(--td-select-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-select--open>label{color:#5746d8}.td-select--error>label{color:#d33f3f}.td-select__trigger{display:flex;width:100%;min-width:0;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-select-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-select__trigger:disabled{cursor:not-allowed}.td-select__trigger>span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select__placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__leading{flex:0 0 auto;color:var(--td-select-muted)}.td-select__chevron{flex:0 0 auto;color:var(--td-select-muted);transition:transform .14s ease}.td-select__chevron--open{transform:rotate(180deg)}.td-select__trigger input{width:100%;min-width:0;height:2.4rem;border:0;outline:0;color:var(--td-select-text);background:transparent;font:inherit}.td-select__trigger input::placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__trigger input::-webkit-search-cancel-button{display:none}.td-select__clear{display:grid;width:1.9rem;height:1.9rem;flex:0 0 auto;place-items:center;border:0;border-radius:.45rem;color:var(--td-select-muted);background:transparent;cursor:pointer}.td-select__clear:hover{color:#5746d8;background:#f2f0ff}.td-select__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-select__message--error{color:#c43636}.td-select-panel{width:100%;min-width:100%;max-height:min(20rem,100dvh - 2rem);overflow-y:auto;border:1px solid #e1e5ee;border-radius:.78rem;padding:.35rem;color:#263147;background:#fff;box-shadow:0 18px 46px #0f172a2e;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-select-panel-in .13s ease-out;scrollbar-width:thin}.td-select-panel--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-select-panel button{display:flex;width:100%;min-height:2.7rem;align-items:center;gap:.65rem;border:0;border-radius:.58rem;padding:.55rem .65rem;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.td-select-panel button>span{min-width:0;overflow:hidden}.td-select-panel strong,.td-select-panel small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select-panel button:hover,.td-select-panel__option--active{background:#f4f2ff!important}.td-select-panel--dark button:hover,.td-select-panel--dark .td-select-panel__option--active{background:#2a2934!important}.td-select-panel__option--selected{color:#5746d8!important;background:#eeecff!important}.td-select-panel--dark .td-select-panel__option--selected{color:#b9b0fa!important;background:#292540!important}.td-select-panel button:disabled{opacity:.45;cursor:not-allowed}.td-select-panel button>span{min-width:0;flex:1}.td-select-panel strong,.td-select-panel small{display:block}.td-select-panel strong{font-size:.75rem}.td-select-panel small{margin-top:.18rem;color:#748096;font-size:.65rem}.td-select-panel__check{margin-left:auto}.td-select-panel__empty{margin:0;padding:1rem;color:#748096;font-size:.72rem;text-align:center}@keyframes td-select-panel-in{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1986
|
+
}
|
|
1987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdSelect, decorators: [{
|
|
1988
|
+
type: Component,
|
|
1989
|
+
args: [{ selector: 'td-select', imports: [CdkConnectedOverlay, CdkOverlayOrigin, TdIcon], template: `
|
|
1990
|
+
<div
|
|
1991
|
+
cdkOverlayOrigin
|
|
1992
|
+
#origin="cdkOverlayOrigin"
|
|
1993
|
+
class="td-select"
|
|
1994
|
+
[class.td-select--open]="open"
|
|
1995
|
+
[class.td-select--error]="!!error"
|
|
1996
|
+
[class.td-select--disabled]="disabled"
|
|
1997
|
+
[class.td-select--dark]="dark"
|
|
1998
|
+
>
|
|
1999
|
+
<label [id]="labelId">{{ label }}</label>
|
|
2000
|
+
<div
|
|
2001
|
+
class="td-select__trigger"
|
|
2002
|
+
role="combobox"
|
|
2003
|
+
[attr.tabindex]="disabled ? -1 : 0"
|
|
2004
|
+
[attr.aria-disabled]="disabled"
|
|
2005
|
+
[attr.aria-labelledby]="labelId"
|
|
2006
|
+
[attr.aria-expanded]="open"
|
|
2007
|
+
[attr.aria-controls]="listId"
|
|
2008
|
+
(click)="toggle()"
|
|
2009
|
+
(keydown)="handleKeydown($event)"
|
|
2010
|
+
>
|
|
2011
|
+
@if (selectedOption?.icon) {
|
|
2012
|
+
<td-icon class="td-select__leading" [nombre]="selectedOption!.icon!" />
|
|
2013
|
+
}
|
|
2014
|
+
<span [class.td-select__placeholder]="!selectedOption">
|
|
2015
|
+
{{ selectedOption?.label || placeholder }}
|
|
2016
|
+
</span>
|
|
2017
|
+
@if (clearable && selectedOption && !disabled) {
|
|
2018
|
+
<button
|
|
2019
|
+
type="button"
|
|
2020
|
+
class="td-select__clear"
|
|
2021
|
+
title="Limpiar selección"
|
|
2022
|
+
(click)="clear($event)"
|
|
2023
|
+
>
|
|
2024
|
+
<td-icon nombre="close" tamano=".95rem" />
|
|
2025
|
+
</button>
|
|
2026
|
+
}
|
|
2027
|
+
<td-icon
|
|
2028
|
+
class="td-select__chevron"
|
|
2029
|
+
[class.td-select__chevron--open]="open"
|
|
2030
|
+
nombre="chevron_down"
|
|
2031
|
+
/>
|
|
2032
|
+
</div>
|
|
2033
|
+
</div>
|
|
2034
|
+
|
|
2035
|
+
@if (error || hint) {
|
|
2036
|
+
<p class="td-select__message" [class.td-select__message--error]="!!error">
|
|
2037
|
+
{{ error || hint }}
|
|
2038
|
+
</p>
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
<ng-template
|
|
2042
|
+
cdkConnectedOverlay
|
|
2043
|
+
#connectedOverlay="cdkConnectedOverlay"
|
|
2044
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
2045
|
+
[cdkConnectedOverlayOpen]="open"
|
|
2046
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
2047
|
+
[cdkConnectedOverlayMatchWidth]="true"
|
|
2048
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
2049
|
+
[cdkConnectedOverlayPush]="true"
|
|
2050
|
+
(overlayOutsideClick)="close()"
|
|
2051
|
+
(overlayKeydown)="handleOverlayKeydown($event)"
|
|
2052
|
+
(detach)="close()"
|
|
2053
|
+
>
|
|
2054
|
+
<div
|
|
2055
|
+
class="td-select-panel"
|
|
2056
|
+
[class.td-select-panel--dark]="dark"
|
|
2057
|
+
[id]="listId"
|
|
2058
|
+
role="listbox"
|
|
2059
|
+
>
|
|
2060
|
+
@if (!options.length) {
|
|
2061
|
+
<p class="td-select-panel__empty">{{ emptyText }}</p>
|
|
2062
|
+
}
|
|
2063
|
+
@for (option of options; track option.value; let index = $index) {
|
|
2064
|
+
<button
|
|
2065
|
+
type="button"
|
|
2066
|
+
role="option"
|
|
2067
|
+
[class.td-select-panel__option--active]="index === activeIndex"
|
|
2068
|
+
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
2069
|
+
[attr.aria-selected]="compare(option.value, value)"
|
|
2070
|
+
[disabled]="option.disabled"
|
|
2071
|
+
(mouseenter)="activeIndex = index"
|
|
2072
|
+
(click)="select(option)"
|
|
2073
|
+
>
|
|
2074
|
+
@if (option.icon) {
|
|
2075
|
+
<td-icon [nombre]="option.icon" />
|
|
2076
|
+
}
|
|
2077
|
+
<span>
|
|
2078
|
+
<strong>{{ option.label }}</strong>
|
|
2079
|
+
@if (option.description) {
|
|
2080
|
+
<small>{{ option.description }}</small>
|
|
2081
|
+
}
|
|
2082
|
+
</span>
|
|
2083
|
+
@if (compare(option.value, value)) {
|
|
2084
|
+
<td-icon class="td-select-panel__check" nombre="check" />
|
|
2085
|
+
}
|
|
2086
|
+
</button>
|
|
2087
|
+
}
|
|
2088
|
+
</div>
|
|
2089
|
+
</ng-template>
|
|
2090
|
+
`, providers: [
|
|
2091
|
+
{
|
|
2092
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2093
|
+
useExisting: forwardRef(() => TdSelect),
|
|
2094
|
+
multi: true,
|
|
2095
|
+
},
|
|
2096
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-select{--td-select-bg: #fff;--td-select-border: #dfe3eb;--td-select-text: #263147;--td-select-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-select-border);border-radius:.78rem;background:var(--td-select-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-select--dark{--td-select-bg: #19191f;--td-select-border: #34343e;--td-select-text: #ededf0;--td-select-muted: #a1a1aa;color-scheme:dark}.td-select:hover:not(.td-select--disabled){border-color:color-mix(in srgb,#5746d8 42%,var(--td-select-border))}.td-select--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-select--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-select--disabled{opacity:.58;background:#f5f6f8}.td-select>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;max-width:calc(100% - 1.4rem);overflow:hidden;padding:0 .35rem;color:var(--td-select-muted);background:var(--td-select-bg);font-size:.65rem;font-weight:750;line-height:1;text-overflow:ellipsis;white-space:nowrap}.td-select--open>label{color:#5746d8}.td-select--error>label{color:#d33f3f}.td-select__trigger{display:flex;width:100%;min-width:0;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-select-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-select__trigger:disabled{cursor:not-allowed}.td-select__trigger>span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select__placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__leading{flex:0 0 auto;color:var(--td-select-muted)}.td-select__chevron{flex:0 0 auto;color:var(--td-select-muted);transition:transform .14s ease}.td-select__chevron--open{transform:rotate(180deg)}.td-select__trigger input{width:100%;min-width:0;height:2.4rem;border:0;outline:0;color:var(--td-select-text);background:transparent;font:inherit}.td-select__trigger input::placeholder{color:color-mix(in srgb,var(--td-select-muted) 72%,transparent)}.td-select__trigger input::-webkit-search-cancel-button{display:none}.td-select__clear{display:grid;width:1.9rem;height:1.9rem;flex:0 0 auto;place-items:center;border:0;border-radius:.45rem;color:var(--td-select-muted);background:transparent;cursor:pointer}.td-select__clear:hover{color:#5746d8;background:#f2f0ff}.td-select__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem;line-height:1.4}.td-select__message--error{color:#c43636}.td-select-panel{width:100%;min-width:100%;max-height:min(20rem,100dvh - 2rem);overflow-y:auto;border:1px solid #e1e5ee;border-radius:.78rem;padding:.35rem;color:#263147;background:#fff;box-shadow:0 18px 46px #0f172a2e;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-select-panel-in .13s ease-out;scrollbar-width:thin}.td-select-panel--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-select-panel button{display:flex;width:100%;min-height:2.7rem;align-items:center;gap:.65rem;border:0;border-radius:.58rem;padding:.55rem .65rem;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.td-select-panel button>span{min-width:0;overflow:hidden}.td-select-panel strong,.td-select-panel small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-select-panel button:hover,.td-select-panel__option--active{background:#f4f2ff!important}.td-select-panel--dark button:hover,.td-select-panel--dark .td-select-panel__option--active{background:#2a2934!important}.td-select-panel__option--selected{color:#5746d8!important;background:#eeecff!important}.td-select-panel--dark .td-select-panel__option--selected{color:#b9b0fa!important;background:#292540!important}.td-select-panel button:disabled{opacity:.45;cursor:not-allowed}.td-select-panel button>span{min-width:0;flex:1}.td-select-panel strong,.td-select-panel small{display:block}.td-select-panel strong{font-size:.75rem}.td-select-panel small{margin-top:.18rem;color:#748096;font-size:.65rem}.td-select-panel__check{margin-left:auto}.td-select-panel__empty{margin:0;padding:1rem;color:#748096;font-size:.72rem;text-align:center}@keyframes td-select-panel-in{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
2097
|
+
}], ctorParameters: () => [], propDecorators: { connectedOverlay: [{
|
|
2098
|
+
type: ViewChild,
|
|
2099
|
+
args: [CdkConnectedOverlay]
|
|
2100
|
+
}], label: [{
|
|
2101
|
+
type: Input
|
|
2102
|
+
}], placeholder: [{
|
|
2103
|
+
type: Input
|
|
2104
|
+
}], options: [{
|
|
2105
|
+
type: Input
|
|
2106
|
+
}], hint: [{
|
|
2107
|
+
type: Input
|
|
2108
|
+
}], error: [{
|
|
2109
|
+
type: Input
|
|
2110
|
+
}], emptyText: [{
|
|
2111
|
+
type: Input
|
|
2112
|
+
}], clearable: [{
|
|
2113
|
+
type: Input
|
|
2114
|
+
}], dark: [{
|
|
2115
|
+
type: Input
|
|
2116
|
+
}], disabled: [{
|
|
2117
|
+
type: Input
|
|
2118
|
+
}], scrollBehavior: [{
|
|
2119
|
+
type: Input
|
|
2120
|
+
}], compareWith: [{
|
|
2121
|
+
type: Input
|
|
2122
|
+
}], selectionChange: [{
|
|
2123
|
+
type: Output
|
|
2124
|
+
}] } });
|
|
2125
|
+
|
|
823
2126
|
class TdSidebar {
|
|
824
2127
|
titulo = 'Gestión Corporativa';
|
|
825
2128
|
subtitulo = 'Central Platform';
|
|
@@ -927,5 +2230,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
927
2230
|
* Generated bundle index. Do not edit.
|
|
928
2231
|
*/
|
|
929
2232
|
|
|
930
|
-
export { TD_ICONOS, TD_ICONOS_NOMBRES, TdAlerta, TdDataTable, TdFooter, TdHeader, TdIcon, TdIconoRegistry, TdSidebar, TelcomdevUi };
|
|
2233
|
+
export { TD_DIALOG_CONFIG, TD_DIALOG_DATA, TD_ICONOS, TD_ICONOS_NOMBRES, TdAlerta, TdAutocompleteSelect, TdDataTable, TdDialog, TdDialogActions, TdDialogClose, TdDialogPrimary, TdDialogRef, TdFooter, TdHeader, TdIcon, TdIconoRegistry, TdInput, TdSelect, TdSidebar, TelcomdevUi };
|
|
931
2234
|
//# sourceMappingURL=telcomdev-ui.mjs.map
|