@telcomdev/ui 0.0.6 → 0.0.8
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 +75 -0
- package/fesm2022/telcomdev-ui.mjs +1095 -172
- package/fesm2022/telcomdev-ui.mjs.map +1 -1
- package/package.json +4 -1
- package/types/telcomdev-ui.d.ts +256 -65
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild,
|
|
2
|
+
import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, Injector, ChangeDetectorRef, signal, input, model, output, computed, forwardRef, InjectionToken, HostListener, Directive, DestroyRef, TemplateRef, ViewChildren, ContentChildren } 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
6
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import { ScrollStrategyOptions, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
8
|
+
import { FORM_FIELD } from '@angular/forms/signals';
|
|
7
9
|
import { DIALOG_DATA, Dialog } from '@angular/cdk/dialog';
|
|
8
10
|
import { NgComponentOutlet, DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
9
|
-
import { ScrollStrategyOptions, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
10
11
|
import { RouterLink, RouterLinkActive } from '@angular/router';
|
|
11
12
|
|
|
12
13
|
class TelcomdevUi {
|
|
@@ -863,6 +864,791 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
863
864
|
type: Output
|
|
864
865
|
}] } });
|
|
865
866
|
|
|
867
|
+
/**
|
|
868
|
+
* Puente reutilizable entre Signal Forms y ControlValueAccessor.
|
|
869
|
+
*
|
|
870
|
+
* Los inputs del contrato se declaran en cada componente porque el compilador
|
|
871
|
+
* de Signal Forms de Angular 21 necesita encontrarlos directamente allí.
|
|
872
|
+
*/
|
|
873
|
+
function createTdFormControlBridge() {
|
|
874
|
+
const injector = inject(Injector);
|
|
875
|
+
const cdr = inject(ChangeDetectorRef);
|
|
876
|
+
const cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
877
|
+
let onCvaTouched = () => undefined;
|
|
878
|
+
const usesSignalForms = () => !!injector.get(FORM_FIELD, null, { self: true, optional: true });
|
|
879
|
+
return {
|
|
880
|
+
get usesSignalForms() {
|
|
881
|
+
return usesSignalForms();
|
|
882
|
+
},
|
|
883
|
+
isDisabled(fieldDisabled) {
|
|
884
|
+
return usesSignalForms() ? fieldDisabled : fieldDisabled || cvaDisabled();
|
|
885
|
+
},
|
|
886
|
+
registerOnTouched(fn) {
|
|
887
|
+
onCvaTouched = fn;
|
|
888
|
+
},
|
|
889
|
+
setDisabledState(disabled) {
|
|
890
|
+
if (!usesSignalForms())
|
|
891
|
+
cvaDisabled.set(disabled);
|
|
892
|
+
cdr.markForCheck();
|
|
893
|
+
},
|
|
894
|
+
markTouched(touched, touch) {
|
|
895
|
+
// Angular prioriza el CVA cuando el control también publica NG_VALUE_ACCESSOR,
|
|
896
|
+
// incluso si está enlazado mediante [formField]. Mantener esta llamada permite
|
|
897
|
+
// que Signal Forms marque el field como touched sin perder compatibilidad clásica.
|
|
898
|
+
onCvaTouched();
|
|
899
|
+
touched.set(true);
|
|
900
|
+
touch.emit();
|
|
901
|
+
},
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
let datePickerSequence = 0;
|
|
906
|
+
class TdDatePicker {
|
|
907
|
+
cdr = inject(ChangeDetectorRef);
|
|
908
|
+
formBridge = createTdFormControlBridge();
|
|
909
|
+
scrollStrategies = inject(ScrollStrategyOptions);
|
|
910
|
+
generatedId = `td-date-picker-${++datePickerSequence}`;
|
|
911
|
+
formatter = new Intl.DateTimeFormat('es-PE', {
|
|
912
|
+
day: '2-digit',
|
|
913
|
+
month: 'short',
|
|
914
|
+
year: 'numeric',
|
|
915
|
+
});
|
|
916
|
+
monthFormatter = new Intl.DateTimeFormat('es-PE', {
|
|
917
|
+
month: 'long',
|
|
918
|
+
year: 'numeric',
|
|
919
|
+
});
|
|
920
|
+
longFormatter = new Intl.DateTimeFormat('es-PE', {
|
|
921
|
+
weekday: 'long',
|
|
922
|
+
day: 'numeric',
|
|
923
|
+
month: 'long',
|
|
924
|
+
year: 'numeric',
|
|
925
|
+
});
|
|
926
|
+
label = 'Fecha';
|
|
927
|
+
placeholder = 'Selecciona una fecha';
|
|
928
|
+
mode = 'fecha';
|
|
929
|
+
hint = '';
|
|
930
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
931
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
932
|
+
disabledReasons = input([], ...(ngDevMode ? [{ debugName: "disabledReasons" }] : /* istanbul ignore next */ []));
|
|
933
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
934
|
+
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
935
|
+
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
936
|
+
pending = input(false, ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
937
|
+
dirty = input(false, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
938
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
939
|
+
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
940
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
941
|
+
touch = output();
|
|
942
|
+
error = input('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
943
|
+
minDate = null;
|
|
944
|
+
maxDate = null;
|
|
945
|
+
clearable = true;
|
|
946
|
+
dark = false;
|
|
947
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
948
|
+
isDisabled = computed(() => this.formBridge.isDisabled(this.disabled()), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
949
|
+
displayError = computed(() => this.error() || this.errors()[0]?.message || '', ...(ngDevMode ? [{ debugName: "displayError" }] : /* istanbul ignore next */ []));
|
|
950
|
+
hasError = computed(() => this.invalid() || !!this.displayError(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
951
|
+
selectionChange = new EventEmitter();
|
|
952
|
+
openedChange = new EventEmitter();
|
|
953
|
+
open = false;
|
|
954
|
+
hoveredDate = null;
|
|
955
|
+
viewDate = this.startOfMonth(new Date());
|
|
956
|
+
calendarView = 'dias';
|
|
957
|
+
currentYear = new Date().getFullYear();
|
|
958
|
+
scrollStrategy = this.scrollStrategies.reposition();
|
|
959
|
+
get labelId() {
|
|
960
|
+
return `${this.generatedId}-label`;
|
|
961
|
+
}
|
|
962
|
+
get calendarId() {
|
|
963
|
+
return `${this.generatedId}-calendar`;
|
|
964
|
+
}
|
|
965
|
+
get weekdays() {
|
|
966
|
+
return ['L', 'M', 'X', 'J', 'V', 'S', 'D'];
|
|
967
|
+
}
|
|
968
|
+
get monthLabel() {
|
|
969
|
+
const label = this.monthFormatter.format(this.viewDate);
|
|
970
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
971
|
+
}
|
|
972
|
+
get periodLabel() {
|
|
973
|
+
if (this.calendarView === 'dias')
|
|
974
|
+
return this.monthLabel;
|
|
975
|
+
if (this.calendarView === 'meses')
|
|
976
|
+
return String(this.viewDate.getFullYear());
|
|
977
|
+
return `${this.yearPageStart} – ${this.yearPageStart + 11}`;
|
|
978
|
+
}
|
|
979
|
+
get periodButtonLabel() {
|
|
980
|
+
if (this.calendarView === 'dias')
|
|
981
|
+
return 'Elegir mes y año';
|
|
982
|
+
if (this.calendarView === 'meses')
|
|
983
|
+
return 'Elegir año';
|
|
984
|
+
return 'Periodo de años';
|
|
985
|
+
}
|
|
986
|
+
get previousLabel() {
|
|
987
|
+
return this.calendarView === 'dias'
|
|
988
|
+
? 'Mes anterior'
|
|
989
|
+
: this.calendarView === 'meses'
|
|
990
|
+
? 'Año anterior'
|
|
991
|
+
: 'Años anteriores';
|
|
992
|
+
}
|
|
993
|
+
get nextLabel() {
|
|
994
|
+
return this.calendarView === 'dias'
|
|
995
|
+
? 'Mes siguiente'
|
|
996
|
+
: this.calendarView === 'meses'
|
|
997
|
+
? 'Año siguiente'
|
|
998
|
+
: 'Años siguientes';
|
|
999
|
+
}
|
|
1000
|
+
get months() {
|
|
1001
|
+
const formatter = new Intl.DateTimeFormat('es-PE', { month: 'short' });
|
|
1002
|
+
const year = this.viewDate.getFullYear();
|
|
1003
|
+
return Array.from({ length: 12 }, (_, index) => {
|
|
1004
|
+
const label = formatter.format(new Date(year, index, 1)).replace('.', '');
|
|
1005
|
+
return {
|
|
1006
|
+
index,
|
|
1007
|
+
label: label.charAt(0).toUpperCase() + label.slice(1),
|
|
1008
|
+
disabled: !this.monthIntersectsLimits(year, index),
|
|
1009
|
+
};
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
get years() {
|
|
1013
|
+
return Array.from({ length: 12 }, (_, index) => {
|
|
1014
|
+
const value = this.yearPageStart + index;
|
|
1015
|
+
return { value, disabled: !this.yearIntersectsLimits(value) };
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
get yearPageStart() {
|
|
1019
|
+
return Math.floor(this.viewDate.getFullYear() / 12) * 12;
|
|
1020
|
+
}
|
|
1021
|
+
get days() {
|
|
1022
|
+
const first = this.startOfMonth(this.viewDate);
|
|
1023
|
+
const mondayOffset = (first.getDay() + 6) % 7;
|
|
1024
|
+
const start = new Date(first.getFullYear(), first.getMonth(), 1 - mondayOffset);
|
|
1025
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
1026
|
+
const date = new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);
|
|
1027
|
+
const iso = this.toIso(date);
|
|
1028
|
+
return {
|
|
1029
|
+
iso,
|
|
1030
|
+
day: date.getDate(),
|
|
1031
|
+
currentMonth: date.getMonth() === this.viewDate.getMonth(),
|
|
1032
|
+
today: iso === this.toIso(new Date()),
|
|
1033
|
+
disabled: (typeof this.minDate === 'string' && iso < this.minDate) ||
|
|
1034
|
+
(typeof this.maxDate === 'string' && iso > this.maxDate),
|
|
1035
|
+
};
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
get displayValue() {
|
|
1039
|
+
const current = this.value();
|
|
1040
|
+
if (typeof current === 'string')
|
|
1041
|
+
return this.format(current);
|
|
1042
|
+
if (current && typeof current === 'object') {
|
|
1043
|
+
return current.fin
|
|
1044
|
+
? `${this.format(current.inicio)} — ${this.format(current.fin)}`
|
|
1045
|
+
: this.format(current.inicio);
|
|
1046
|
+
}
|
|
1047
|
+
return '';
|
|
1048
|
+
}
|
|
1049
|
+
get rangeStartLabel() {
|
|
1050
|
+
return this.currentRange()?.inicio ? this.format(this.currentRange().inicio) : 'Sin elegir';
|
|
1051
|
+
}
|
|
1052
|
+
get rangeEndLabel() {
|
|
1053
|
+
return this.currentRange()?.fin ? this.format(this.currentRange().fin) : 'Sin elegir';
|
|
1054
|
+
}
|
|
1055
|
+
changed = () => undefined;
|
|
1056
|
+
writeValue(value) {
|
|
1057
|
+
this.value.set(this.normalizeValue(value));
|
|
1058
|
+
this.syncViewToValue();
|
|
1059
|
+
this.cdr.markForCheck();
|
|
1060
|
+
}
|
|
1061
|
+
registerOnChange(fn) {
|
|
1062
|
+
this.changed = fn;
|
|
1063
|
+
}
|
|
1064
|
+
registerOnTouched(fn) {
|
|
1065
|
+
this.formBridge.registerOnTouched(fn);
|
|
1066
|
+
}
|
|
1067
|
+
setDisabledState(disabled) {
|
|
1068
|
+
this.formBridge.setDisabledState(disabled);
|
|
1069
|
+
}
|
|
1070
|
+
focus() {
|
|
1071
|
+
document.getElementById(this.labelId)?.parentElement?.querySelector('button')?.focus();
|
|
1072
|
+
}
|
|
1073
|
+
toggle() {
|
|
1074
|
+
if (this.isDisabled() || this.readonly())
|
|
1075
|
+
return;
|
|
1076
|
+
this.open ? this.close() : this.openPanel();
|
|
1077
|
+
}
|
|
1078
|
+
openPanel() {
|
|
1079
|
+
if (this.isDisabled() || this.readonly())
|
|
1080
|
+
return;
|
|
1081
|
+
this.syncViewToValue();
|
|
1082
|
+
this.calendarView = 'dias';
|
|
1083
|
+
this.open = true;
|
|
1084
|
+
this.openedChange.emit(true);
|
|
1085
|
+
}
|
|
1086
|
+
close() {
|
|
1087
|
+
if (!this.open)
|
|
1088
|
+
return;
|
|
1089
|
+
this.open = false;
|
|
1090
|
+
this.hoveredDate = null;
|
|
1091
|
+
this.formBridge.markTouched(this.touched, this.touch);
|
|
1092
|
+
this.openedChange.emit(false);
|
|
1093
|
+
}
|
|
1094
|
+
previousPage() {
|
|
1095
|
+
if (this.calendarView === 'dias') {
|
|
1096
|
+
this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() - 1, 1);
|
|
1097
|
+
}
|
|
1098
|
+
else if (this.calendarView === 'meses') {
|
|
1099
|
+
this.viewDate = new Date(this.viewDate.getFullYear() - 1, this.viewDate.getMonth(), 1);
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
this.viewDate = new Date(this.viewDate.getFullYear() - 12, this.viewDate.getMonth(), 1);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
nextPage() {
|
|
1106
|
+
if (this.calendarView === 'dias') {
|
|
1107
|
+
this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() + 1, 1);
|
|
1108
|
+
}
|
|
1109
|
+
else if (this.calendarView === 'meses') {
|
|
1110
|
+
this.viewDate = new Date(this.viewDate.getFullYear() + 1, this.viewDate.getMonth(), 1);
|
|
1111
|
+
}
|
|
1112
|
+
else {
|
|
1113
|
+
this.viewDate = new Date(this.viewDate.getFullYear() + 12, this.viewDate.getMonth(), 1);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
changeCalendarView() {
|
|
1117
|
+
if (this.calendarView === 'dias') {
|
|
1118
|
+
this.calendarView = 'meses';
|
|
1119
|
+
}
|
|
1120
|
+
else if (this.calendarView === 'meses') {
|
|
1121
|
+
this.calendarView = 'anios';
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
selectMonth(month) {
|
|
1125
|
+
this.viewDate = new Date(this.viewDate.getFullYear(), month, 1);
|
|
1126
|
+
this.calendarView = 'dias';
|
|
1127
|
+
}
|
|
1128
|
+
selectYear(year) {
|
|
1129
|
+
this.viewDate = new Date(year, this.viewDate.getMonth(), 1);
|
|
1130
|
+
this.calendarView = 'meses';
|
|
1131
|
+
}
|
|
1132
|
+
goToday() {
|
|
1133
|
+
const today = this.toIso(new Date());
|
|
1134
|
+
if ((typeof this.minDate === 'string' && today < this.minDate) ||
|
|
1135
|
+
(typeof this.maxDate === 'string' && today > this.maxDate))
|
|
1136
|
+
return;
|
|
1137
|
+
this.viewDate = this.startOfMonth(new Date());
|
|
1138
|
+
this.calendarView = 'dias';
|
|
1139
|
+
this.selectDate(this.days.find((day) => day.iso === today) ?? {
|
|
1140
|
+
iso: today,
|
|
1141
|
+
day: new Date().getDate(),
|
|
1142
|
+
currentMonth: true,
|
|
1143
|
+
today: true,
|
|
1144
|
+
disabled: false,
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
selectDate(date) {
|
|
1148
|
+
if (date.disabled)
|
|
1149
|
+
return;
|
|
1150
|
+
if (!date.currentMonth) {
|
|
1151
|
+
const parsed = this.fromIso(date.iso);
|
|
1152
|
+
this.viewDate = this.startOfMonth(parsed);
|
|
1153
|
+
}
|
|
1154
|
+
if (this.mode === 'fecha') {
|
|
1155
|
+
this.setValue(date.iso);
|
|
1156
|
+
this.close();
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
const range = this.currentRange();
|
|
1160
|
+
if (!range || range.fin) {
|
|
1161
|
+
this.setValue({ inicio: date.iso, fin: null });
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
this.setValue(date.iso < range.inicio
|
|
1165
|
+
? { inicio: date.iso, fin: range.inicio }
|
|
1166
|
+
: { inicio: range.inicio, fin: date.iso });
|
|
1167
|
+
this.close();
|
|
1168
|
+
}
|
|
1169
|
+
clear(event) {
|
|
1170
|
+
event.stopPropagation();
|
|
1171
|
+
this.setValue(null);
|
|
1172
|
+
}
|
|
1173
|
+
isSelected(iso) {
|
|
1174
|
+
const current = this.value();
|
|
1175
|
+
if (typeof current === 'string')
|
|
1176
|
+
return current === iso;
|
|
1177
|
+
return !!current && (current.inicio === iso || current.fin === iso);
|
|
1178
|
+
}
|
|
1179
|
+
isRangeStart(iso) {
|
|
1180
|
+
return this.currentRange()?.inicio === iso;
|
|
1181
|
+
}
|
|
1182
|
+
isRangeEnd(iso) {
|
|
1183
|
+
return this.currentRange()?.fin === iso;
|
|
1184
|
+
}
|
|
1185
|
+
isInRange(iso) {
|
|
1186
|
+
const range = this.currentRange();
|
|
1187
|
+
if (!range)
|
|
1188
|
+
return false;
|
|
1189
|
+
const end = range.fin ?? this.hoveredDate;
|
|
1190
|
+
if (!end)
|
|
1191
|
+
return false;
|
|
1192
|
+
const start = end < range.inicio ? end : range.inicio;
|
|
1193
|
+
const finish = end < range.inicio ? range.inicio : end;
|
|
1194
|
+
return iso > start && iso < finish;
|
|
1195
|
+
}
|
|
1196
|
+
formatLong(iso) {
|
|
1197
|
+
return this.longFormatter.format(this.fromIso(iso));
|
|
1198
|
+
}
|
|
1199
|
+
handleTriggerKeydown(event) {
|
|
1200
|
+
if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {
|
|
1201
|
+
event.preventDefault();
|
|
1202
|
+
this.openPanel();
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
handleOverlayKeydown(event) {
|
|
1206
|
+
if (event.key === 'Escape') {
|
|
1207
|
+
event.preventDefault();
|
|
1208
|
+
this.close();
|
|
1209
|
+
}
|
|
1210
|
+
else if (event.key === 'PageUp') {
|
|
1211
|
+
event.preventDefault();
|
|
1212
|
+
this.previousPage();
|
|
1213
|
+
}
|
|
1214
|
+
else if (event.key === 'PageDown') {
|
|
1215
|
+
event.preventDefault();
|
|
1216
|
+
this.nextPage();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
currentRange() {
|
|
1220
|
+
const current = this.value();
|
|
1221
|
+
return current && typeof current === 'object' ? current : null;
|
|
1222
|
+
}
|
|
1223
|
+
setValue(value) {
|
|
1224
|
+
this.value.set(value);
|
|
1225
|
+
this.changed(value);
|
|
1226
|
+
this.selectionChange.emit(value);
|
|
1227
|
+
}
|
|
1228
|
+
syncViewToValue() {
|
|
1229
|
+
const current = this.value();
|
|
1230
|
+
const iso = typeof current === 'string' ? current : current?.inicio;
|
|
1231
|
+
if (iso)
|
|
1232
|
+
this.viewDate = this.startOfMonth(this.fromIso(iso));
|
|
1233
|
+
}
|
|
1234
|
+
normalizeValue(value) {
|
|
1235
|
+
if (!value)
|
|
1236
|
+
return null;
|
|
1237
|
+
if (typeof value === 'string')
|
|
1238
|
+
return value;
|
|
1239
|
+
return { inicio: value.inicio, fin: value.fin ?? null };
|
|
1240
|
+
}
|
|
1241
|
+
format(iso) {
|
|
1242
|
+
return this.formatter.format(this.fromIso(iso)).replace('.', '');
|
|
1243
|
+
}
|
|
1244
|
+
fromIso(iso) {
|
|
1245
|
+
const [year, month, day] = iso.split('-').map(Number);
|
|
1246
|
+
return new Date(year, month - 1, day);
|
|
1247
|
+
}
|
|
1248
|
+
toIso(date) {
|
|
1249
|
+
const year = date.getFullYear();
|
|
1250
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
1251
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
1252
|
+
return `${year}-${month}-${day}`;
|
|
1253
|
+
}
|
|
1254
|
+
startOfMonth(date) {
|
|
1255
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
1256
|
+
}
|
|
1257
|
+
monthIntersectsLimits(year, month) {
|
|
1258
|
+
const first = this.toIso(new Date(year, month, 1));
|
|
1259
|
+
const last = this.toIso(new Date(year, month + 1, 0));
|
|
1260
|
+
return !((typeof this.minDate === 'string' && last < this.minDate) ||
|
|
1261
|
+
(typeof this.maxDate === 'string' && first > this.maxDate));
|
|
1262
|
+
}
|
|
1263
|
+
yearIntersectsLimits(year) {
|
|
1264
|
+
const first = `${year}-01-01`;
|
|
1265
|
+
const last = `${year}-12-31`;
|
|
1266
|
+
return !((typeof this.minDate === 'string' && last < this.minDate) ||
|
|
1267
|
+
(typeof this.maxDate === 'string' && first > this.maxDate));
|
|
1268
|
+
}
|
|
1269
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1270
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdDatePicker, isStandalone: true, selector: "td-date-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReasons: { classPropertyName: "disabledReasons", publicName: "disabledReasons", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "min", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "max", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, dark: { classPropertyName: "dark", publicName: "dark", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange", touch: "touch", value: "valueChange", selectionChange: "selectionChange", openedChange: "openedChange" }, host: { properties: { "hidden": "hidden()", "attr.aria-busy": "pending() ? \"true\" : null" } }, providers: [
|
|
1271
|
+
{
|
|
1272
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1273
|
+
useExisting: forwardRef(() => TdDatePicker),
|
|
1274
|
+
multi: true,
|
|
1275
|
+
},
|
|
1276
|
+
], ngImport: i0, template: `
|
|
1277
|
+
<div
|
|
1278
|
+
cdkOverlayOrigin
|
|
1279
|
+
#origin="cdkOverlayOrigin"
|
|
1280
|
+
class="td-date-picker"
|
|
1281
|
+
[class.td-date-picker--open]="open"
|
|
1282
|
+
[class.td-date-picker--error]="hasError()"
|
|
1283
|
+
[class.td-date-picker--disabled]="isDisabled()"
|
|
1284
|
+
[class.td-date-picker--dark]="dark"
|
|
1285
|
+
>
|
|
1286
|
+
<label [id]="labelId">{{ label }}</label>
|
|
1287
|
+
<button
|
|
1288
|
+
type="button"
|
|
1289
|
+
class="td-date-picker__trigger"
|
|
1290
|
+
[disabled]="isDisabled()"
|
|
1291
|
+
[attr.aria-readonly]="readonly()"
|
|
1292
|
+
[attr.aria-required]="required()"
|
|
1293
|
+
[attr.aria-invalid]="hasError()"
|
|
1294
|
+
[attr.aria-labelledby]="labelId"
|
|
1295
|
+
[attr.aria-expanded]="open"
|
|
1296
|
+
[attr.aria-controls]="calendarId"
|
|
1297
|
+
(click)="toggle()"
|
|
1298
|
+
(keydown)="handleTriggerKeydown($event)"
|
|
1299
|
+
>
|
|
1300
|
+
<td-icon nombre="calendar" />
|
|
1301
|
+
<span [class.td-date-picker__placeholder]="!displayValue">
|
|
1302
|
+
{{ displayValue || placeholder }}
|
|
1303
|
+
</span>
|
|
1304
|
+
@if (clearable && value() && !isDisabled() && !readonly()) {
|
|
1305
|
+
<span
|
|
1306
|
+
class="td-date-picker__clear"
|
|
1307
|
+
role="button"
|
|
1308
|
+
tabindex="-1"
|
|
1309
|
+
aria-label="Limpiar fecha"
|
|
1310
|
+
(click)="clear($event)"
|
|
1311
|
+
>
|
|
1312
|
+
<td-icon nombre="close" tamano=".92rem" />
|
|
1313
|
+
</span>
|
|
1314
|
+
}
|
|
1315
|
+
<td-icon
|
|
1316
|
+
class="td-date-picker__chevron"
|
|
1317
|
+
[class.td-date-picker__chevron--open]="open"
|
|
1318
|
+
nombre="chevron_down"
|
|
1319
|
+
/>
|
|
1320
|
+
</button>
|
|
1321
|
+
</div>
|
|
1322
|
+
|
|
1323
|
+
@if (displayError() || hint) {
|
|
1324
|
+
<p class="td-date-picker__message" [class.td-date-picker__message--error]="hasError()">
|
|
1325
|
+
{{ displayError() || hint }}
|
|
1326
|
+
</p>
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
<ng-template
|
|
1330
|
+
cdkConnectedOverlay
|
|
1331
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
1332
|
+
[cdkConnectedOverlayOpen]="open"
|
|
1333
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
1334
|
+
[cdkConnectedOverlayMatchWidth]="false"
|
|
1335
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
1336
|
+
[cdkConnectedOverlayPush]="true"
|
|
1337
|
+
(overlayOutsideClick)="close()"
|
|
1338
|
+
(overlayKeydown)="handleOverlayKeydown($event)"
|
|
1339
|
+
(detach)="close()"
|
|
1340
|
+
>
|
|
1341
|
+
<section
|
|
1342
|
+
class="td-calendar"
|
|
1343
|
+
[class.td-calendar--dark]="dark"
|
|
1344
|
+
[id]="calendarId"
|
|
1345
|
+
role="dialog"
|
|
1346
|
+
aria-modal="true"
|
|
1347
|
+
[attr.aria-label]="mode === 'rango' ? 'Seleccionar rango de fechas' : 'Seleccionar fecha'"
|
|
1348
|
+
>
|
|
1349
|
+
<header class="td-calendar__header">
|
|
1350
|
+
<button type="button" [attr.aria-label]="previousLabel" (click)="previousPage()">
|
|
1351
|
+
<td-icon nombre="chevron_left" />
|
|
1352
|
+
</button>
|
|
1353
|
+
<button
|
|
1354
|
+
type="button"
|
|
1355
|
+
class="td-calendar__period"
|
|
1356
|
+
[attr.aria-label]="periodButtonLabel"
|
|
1357
|
+
(click)="changeCalendarView()"
|
|
1358
|
+
>
|
|
1359
|
+
{{ periodLabel }}
|
|
1360
|
+
@if (calendarView !== 'anios') {
|
|
1361
|
+
<td-icon nombre="chevron_down" tamano=".85rem" />
|
|
1362
|
+
}
|
|
1363
|
+
</button>
|
|
1364
|
+
<button type="button" [attr.aria-label]="nextLabel" (click)="nextPage()">
|
|
1365
|
+
<td-icon nombre="chevron_right" />
|
|
1366
|
+
</button>
|
|
1367
|
+
</header>
|
|
1368
|
+
|
|
1369
|
+
@if (mode === 'rango') {
|
|
1370
|
+
<div class="td-calendar__range-summary">
|
|
1371
|
+
<span><small>Desde</small><strong>{{ rangeStartLabel }}</strong></span>
|
|
1372
|
+
<td-icon nombre="arrow_forward" />
|
|
1373
|
+
<span><small>Hasta</small><strong>{{ rangeEndLabel }}</strong></span>
|
|
1374
|
+
</div>
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
@if (calendarView === 'dias') {
|
|
1378
|
+
<div class="td-calendar__weekdays" aria-hidden="true">
|
|
1379
|
+
@for (weekday of weekdays; track weekday) {
|
|
1380
|
+
<span>{{ weekday }}</span>
|
|
1381
|
+
}
|
|
1382
|
+
</div>
|
|
1383
|
+
|
|
1384
|
+
<div class="td-calendar__grid">
|
|
1385
|
+
@for (date of days; track date.iso) {
|
|
1386
|
+
<button
|
|
1387
|
+
type="button"
|
|
1388
|
+
class="td-calendar__day"
|
|
1389
|
+
[class.td-calendar__day--outside]="!date.currentMonth"
|
|
1390
|
+
[class.td-calendar__day--today]="date.today"
|
|
1391
|
+
[class.td-calendar__day--selected]="isSelected(date.iso)"
|
|
1392
|
+
[class.td-calendar__day--range]="isInRange(date.iso)"
|
|
1393
|
+
[class.td-calendar__day--range-start]="isRangeStart(date.iso)"
|
|
1394
|
+
[class.td-calendar__day--range-end]="isRangeEnd(date.iso)"
|
|
1395
|
+
[disabled]="date.disabled"
|
|
1396
|
+
[attr.aria-label]="formatLong(date.iso)"
|
|
1397
|
+
[attr.aria-pressed]="isSelected(date.iso)"
|
|
1398
|
+
(mouseenter)="hoveredDate = date.iso"
|
|
1399
|
+
(mouseleave)="hoveredDate = null"
|
|
1400
|
+
(click)="selectDate(date)"
|
|
1401
|
+
>
|
|
1402
|
+
{{ date.day }}
|
|
1403
|
+
</button>
|
|
1404
|
+
}
|
|
1405
|
+
</div>
|
|
1406
|
+
} @else if (calendarView === 'meses') {
|
|
1407
|
+
<div class="td-calendar__selector-grid td-calendar__selector-grid--months">
|
|
1408
|
+
@for (month of months; track month.index) {
|
|
1409
|
+
<button
|
|
1410
|
+
type="button"
|
|
1411
|
+
[class.td-calendar__selector--active]="month.index === viewDate.getMonth()"
|
|
1412
|
+
[disabled]="month.disabled"
|
|
1413
|
+
(click)="selectMonth(month.index)"
|
|
1414
|
+
>
|
|
1415
|
+
{{ month.label }}
|
|
1416
|
+
</button>
|
|
1417
|
+
}
|
|
1418
|
+
</div>
|
|
1419
|
+
} @else {
|
|
1420
|
+
<div class="td-calendar__selector-grid td-calendar__selector-grid--years">
|
|
1421
|
+
@for (year of years; track year.value) {
|
|
1422
|
+
<button
|
|
1423
|
+
type="button"
|
|
1424
|
+
[class.td-calendar__selector--active]="year.value === viewDate.getFullYear()"
|
|
1425
|
+
[class.td-calendar__selector--today]="year.value === currentYear"
|
|
1426
|
+
[disabled]="year.disabled"
|
|
1427
|
+
(click)="selectYear(year.value)"
|
|
1428
|
+
>
|
|
1429
|
+
{{ year.value }}
|
|
1430
|
+
</button>
|
|
1431
|
+
}
|
|
1432
|
+
</div>
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
<footer class="td-calendar__footer">
|
|
1436
|
+
<button type="button" class="td-calendar__text-action" (click)="goToday()">
|
|
1437
|
+
Hoy
|
|
1438
|
+
</button>
|
|
1439
|
+
<button type="button" class="td-calendar__text-action" (click)="close()">
|
|
1440
|
+
Cerrar
|
|
1441
|
+
</button>
|
|
1442
|
+
</footer>
|
|
1443
|
+
</section>
|
|
1444
|
+
</ng-template>
|
|
1445
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-date-picker{--td-date-bg: #fff;--td-date-border: #dfe3eb;--td-date-text: #263147;--td-date-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-date-border);border-radius:.78rem;background:var(--td-date-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-date-picker--dark{--td-date-bg: #19191f;--td-date-border: #34343e;--td-date-text: #ededf0;--td-date-muted: #a1a1aa}.td-date-picker:hover:not(.td-date-picker--disabled){border-color:#8d80e8}.td-date-picker--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-date-picker--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-date-picker--disabled{opacity:.58;background:#f5f6f8}.td-date-picker>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;padding:0 .35rem;color:var(--td-date-muted);background:var(--td-date-bg);font-size:.65rem;font-weight:750;line-height:1}.td-date-picker--open>label{color:#5746d8}.td-date-picker--error>label{color:#d33f3f}.td-date-picker__trigger{display:flex;width:100%;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-date-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-date-picker__trigger>span:not(.td-date-picker__clear){min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-date-picker__placeholder{color:color-mix(in srgb,var(--td-date-muted) 72%,transparent)}.td-date-picker__trigger>td-icon{color:var(--td-date-muted)}.td-date-picker__chevron{transition:transform .14s ease}.td-date-picker__chevron--open{transform:rotate(180deg)}.td-date-picker__clear{display:grid;width:1.8rem;height:1.8rem;flex:0 0 auto;place-items:center;border-radius:.45rem;color:var(--td-date-muted)}.td-date-picker__clear:hover{color:#5746d8;background:#f2f0ff}.td-date-picker__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem}.td-date-picker__message--error{color:#c43636}.td-calendar{width:min(21rem,100vw - 1rem);overflow:hidden;border:1px solid #e1e5ee;border-radius:1rem;padding:.8rem;color:#263147;background:#fff;box-shadow:0 22px 55px #0f172a33;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-calendar-in .14s ease-out}.td-calendar--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-calendar__header{display:grid;grid-template-columns:2.35rem 1fr 2.35rem;align-items:center;gap:.35rem}.td-calendar__header button,.td-calendar__footer button{border:0;color:inherit;background:transparent;cursor:pointer}.td-calendar__header button{display:grid;width:2.35rem;height:2.35rem;place-items:center;border-radius:.65rem}.td-calendar__header .td-calendar__period{display:inline-flex;width:auto;min-width:0;height:2.35rem;align-items:center;justify-content:center;gap:.35rem;padding:0 .65rem;font-size:.82rem;font-weight:800}.td-calendar__header button:hover{color:#5746d8;background:#f2f0ff}.td-calendar--dark .td-calendar__header button:hover{background:#2b293d}.td-calendar__range-summary{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:.55rem;margin:.65rem 0 .35rem;border-radius:.72rem;padding:.55rem .65rem;background:#f7f7fb}.td-calendar--dark .td-calendar__range-summary{background:#292931}.td-calendar__range-summary span{min-width:0}.td-calendar__range-summary span:last-child{text-align:right}.td-calendar__range-summary small,.td-calendar__range-summary strong{display:block}.td-calendar__range-summary small{color:#748096;font-size:.58rem}.td-calendar__range-summary strong{overflow:hidden;margin-top:.12rem;font-size:.67rem;text-overflow:ellipsis;white-space:nowrap}.td-calendar__weekdays,.td-calendar__grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.td-calendar__weekdays{margin-top:.55rem}.td-calendar__weekdays span{padding:.35rem 0;color:#8791a4;font-size:.59rem;font-weight:800;text-align:center}.td-calendar__day{position:relative;display:grid;min-width:0;aspect-ratio:1;place-items:center;border:0;border-radius:.6rem;color:inherit;background:transparent;font:650 .7rem/1 system-ui,sans-serif;cursor:pointer}.td-calendar__day:hover:not(:disabled){color:#5746d8;background:#f0eeff}.td-calendar__day--outside{color:#b4bac6}.td-calendar__day--today{box-shadow:inset 0 0 0 1px #8d80e8}.td-calendar__day--range{border-radius:0;color:#5746d8;background:#efedff}.td-calendar__day--selected,.td-calendar__day--range-start,.td-calendar__day--range-end{border-radius:.6rem;color:#fff;background:#5746d8;box-shadow:0 5px 12px #5746d83d}.td-calendar__day:disabled{opacity:.3;cursor:not-allowed}.td-calendar__selector-grid{display:grid;min-height:15.75rem;align-content:center;gap:.45rem;padding:.75rem .15rem}.td-calendar__selector-grid--months,.td-calendar__selector-grid--years{grid-template-columns:repeat(3,minmax(0,1fr))}.td-calendar__selector-grid button{min-height:3.15rem;border:0;border-radius:.7rem;color:inherit;background:transparent;font:700 .72rem/1 system-ui,sans-serif;cursor:pointer}.td-calendar__selector-grid button:hover:not(:disabled){color:#5746d8;background:#f0eeff}.td-calendar--dark .td-calendar__selector-grid button:hover:not(:disabled){color:#b9b0fa;background:#2b293d}.td-calendar__selector-grid button:disabled{opacity:.28;cursor:not-allowed}.td-calendar__selector--active{color:#fff!important;background:#5746d8!important;box-shadow:0 5px 12px #5746d838}.td-calendar__selector--today:not(.td-calendar__selector--active){box-shadow:inset 0 0 0 1px #8d80e8}.td-calendar__footer{display:flex;justify-content:space-between;margin-top:.55rem;border-top:1px solid #e6e9f0;padding-top:.55rem}.td-calendar--dark .td-calendar__footer{border-color:#34343e}.td-calendar__text-action{border-radius:.5rem!important;padding:.45rem .6rem;color:#5746d8!important;font-size:.68rem;font-weight:750}.td-calendar__text-action:hover{background:#f2f0ff!important}@keyframes td-calendar-in{0%{opacity:0;transform:translateY(-.25rem) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}@media(max-width:600px){.td-calendar{width:calc(100vw - 1rem);border-radius:.9rem}}@media(prefers-reduced-motion:reduce){.td-calendar{animation:none}}\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 });
|
|
1446
|
+
}
|
|
1447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdDatePicker, decorators: [{
|
|
1448
|
+
type: Component,
|
|
1449
|
+
args: [{ selector: 'td-date-picker', imports: [CdkConnectedOverlay, CdkOverlayOrigin, TdIcon], template: `
|
|
1450
|
+
<div
|
|
1451
|
+
cdkOverlayOrigin
|
|
1452
|
+
#origin="cdkOverlayOrigin"
|
|
1453
|
+
class="td-date-picker"
|
|
1454
|
+
[class.td-date-picker--open]="open"
|
|
1455
|
+
[class.td-date-picker--error]="hasError()"
|
|
1456
|
+
[class.td-date-picker--disabled]="isDisabled()"
|
|
1457
|
+
[class.td-date-picker--dark]="dark"
|
|
1458
|
+
>
|
|
1459
|
+
<label [id]="labelId">{{ label }}</label>
|
|
1460
|
+
<button
|
|
1461
|
+
type="button"
|
|
1462
|
+
class="td-date-picker__trigger"
|
|
1463
|
+
[disabled]="isDisabled()"
|
|
1464
|
+
[attr.aria-readonly]="readonly()"
|
|
1465
|
+
[attr.aria-required]="required()"
|
|
1466
|
+
[attr.aria-invalid]="hasError()"
|
|
1467
|
+
[attr.aria-labelledby]="labelId"
|
|
1468
|
+
[attr.aria-expanded]="open"
|
|
1469
|
+
[attr.aria-controls]="calendarId"
|
|
1470
|
+
(click)="toggle()"
|
|
1471
|
+
(keydown)="handleTriggerKeydown($event)"
|
|
1472
|
+
>
|
|
1473
|
+
<td-icon nombre="calendar" />
|
|
1474
|
+
<span [class.td-date-picker__placeholder]="!displayValue">
|
|
1475
|
+
{{ displayValue || placeholder }}
|
|
1476
|
+
</span>
|
|
1477
|
+
@if (clearable && value() && !isDisabled() && !readonly()) {
|
|
1478
|
+
<span
|
|
1479
|
+
class="td-date-picker__clear"
|
|
1480
|
+
role="button"
|
|
1481
|
+
tabindex="-1"
|
|
1482
|
+
aria-label="Limpiar fecha"
|
|
1483
|
+
(click)="clear($event)"
|
|
1484
|
+
>
|
|
1485
|
+
<td-icon nombre="close" tamano=".92rem" />
|
|
1486
|
+
</span>
|
|
1487
|
+
}
|
|
1488
|
+
<td-icon
|
|
1489
|
+
class="td-date-picker__chevron"
|
|
1490
|
+
[class.td-date-picker__chevron--open]="open"
|
|
1491
|
+
nombre="chevron_down"
|
|
1492
|
+
/>
|
|
1493
|
+
</button>
|
|
1494
|
+
</div>
|
|
1495
|
+
|
|
1496
|
+
@if (displayError() || hint) {
|
|
1497
|
+
<p class="td-date-picker__message" [class.td-date-picker__message--error]="hasError()">
|
|
1498
|
+
{{ displayError() || hint }}
|
|
1499
|
+
</p>
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
<ng-template
|
|
1503
|
+
cdkConnectedOverlay
|
|
1504
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
1505
|
+
[cdkConnectedOverlayOpen]="open"
|
|
1506
|
+
[cdkConnectedOverlayScrollStrategy]="scrollStrategy"
|
|
1507
|
+
[cdkConnectedOverlayMatchWidth]="false"
|
|
1508
|
+
[cdkConnectedOverlayViewportMargin]="8"
|
|
1509
|
+
[cdkConnectedOverlayPush]="true"
|
|
1510
|
+
(overlayOutsideClick)="close()"
|
|
1511
|
+
(overlayKeydown)="handleOverlayKeydown($event)"
|
|
1512
|
+
(detach)="close()"
|
|
1513
|
+
>
|
|
1514
|
+
<section
|
|
1515
|
+
class="td-calendar"
|
|
1516
|
+
[class.td-calendar--dark]="dark"
|
|
1517
|
+
[id]="calendarId"
|
|
1518
|
+
role="dialog"
|
|
1519
|
+
aria-modal="true"
|
|
1520
|
+
[attr.aria-label]="mode === 'rango' ? 'Seleccionar rango de fechas' : 'Seleccionar fecha'"
|
|
1521
|
+
>
|
|
1522
|
+
<header class="td-calendar__header">
|
|
1523
|
+
<button type="button" [attr.aria-label]="previousLabel" (click)="previousPage()">
|
|
1524
|
+
<td-icon nombre="chevron_left" />
|
|
1525
|
+
</button>
|
|
1526
|
+
<button
|
|
1527
|
+
type="button"
|
|
1528
|
+
class="td-calendar__period"
|
|
1529
|
+
[attr.aria-label]="periodButtonLabel"
|
|
1530
|
+
(click)="changeCalendarView()"
|
|
1531
|
+
>
|
|
1532
|
+
{{ periodLabel }}
|
|
1533
|
+
@if (calendarView !== 'anios') {
|
|
1534
|
+
<td-icon nombre="chevron_down" tamano=".85rem" />
|
|
1535
|
+
}
|
|
1536
|
+
</button>
|
|
1537
|
+
<button type="button" [attr.aria-label]="nextLabel" (click)="nextPage()">
|
|
1538
|
+
<td-icon nombre="chevron_right" />
|
|
1539
|
+
</button>
|
|
1540
|
+
</header>
|
|
1541
|
+
|
|
1542
|
+
@if (mode === 'rango') {
|
|
1543
|
+
<div class="td-calendar__range-summary">
|
|
1544
|
+
<span><small>Desde</small><strong>{{ rangeStartLabel }}</strong></span>
|
|
1545
|
+
<td-icon nombre="arrow_forward" />
|
|
1546
|
+
<span><small>Hasta</small><strong>{{ rangeEndLabel }}</strong></span>
|
|
1547
|
+
</div>
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
@if (calendarView === 'dias') {
|
|
1551
|
+
<div class="td-calendar__weekdays" aria-hidden="true">
|
|
1552
|
+
@for (weekday of weekdays; track weekday) {
|
|
1553
|
+
<span>{{ weekday }}</span>
|
|
1554
|
+
}
|
|
1555
|
+
</div>
|
|
1556
|
+
|
|
1557
|
+
<div class="td-calendar__grid">
|
|
1558
|
+
@for (date of days; track date.iso) {
|
|
1559
|
+
<button
|
|
1560
|
+
type="button"
|
|
1561
|
+
class="td-calendar__day"
|
|
1562
|
+
[class.td-calendar__day--outside]="!date.currentMonth"
|
|
1563
|
+
[class.td-calendar__day--today]="date.today"
|
|
1564
|
+
[class.td-calendar__day--selected]="isSelected(date.iso)"
|
|
1565
|
+
[class.td-calendar__day--range]="isInRange(date.iso)"
|
|
1566
|
+
[class.td-calendar__day--range-start]="isRangeStart(date.iso)"
|
|
1567
|
+
[class.td-calendar__day--range-end]="isRangeEnd(date.iso)"
|
|
1568
|
+
[disabled]="date.disabled"
|
|
1569
|
+
[attr.aria-label]="formatLong(date.iso)"
|
|
1570
|
+
[attr.aria-pressed]="isSelected(date.iso)"
|
|
1571
|
+
(mouseenter)="hoveredDate = date.iso"
|
|
1572
|
+
(mouseleave)="hoveredDate = null"
|
|
1573
|
+
(click)="selectDate(date)"
|
|
1574
|
+
>
|
|
1575
|
+
{{ date.day }}
|
|
1576
|
+
</button>
|
|
1577
|
+
}
|
|
1578
|
+
</div>
|
|
1579
|
+
} @else if (calendarView === 'meses') {
|
|
1580
|
+
<div class="td-calendar__selector-grid td-calendar__selector-grid--months">
|
|
1581
|
+
@for (month of months; track month.index) {
|
|
1582
|
+
<button
|
|
1583
|
+
type="button"
|
|
1584
|
+
[class.td-calendar__selector--active]="month.index === viewDate.getMonth()"
|
|
1585
|
+
[disabled]="month.disabled"
|
|
1586
|
+
(click)="selectMonth(month.index)"
|
|
1587
|
+
>
|
|
1588
|
+
{{ month.label }}
|
|
1589
|
+
</button>
|
|
1590
|
+
}
|
|
1591
|
+
</div>
|
|
1592
|
+
} @else {
|
|
1593
|
+
<div class="td-calendar__selector-grid td-calendar__selector-grid--years">
|
|
1594
|
+
@for (year of years; track year.value) {
|
|
1595
|
+
<button
|
|
1596
|
+
type="button"
|
|
1597
|
+
[class.td-calendar__selector--active]="year.value === viewDate.getFullYear()"
|
|
1598
|
+
[class.td-calendar__selector--today]="year.value === currentYear"
|
|
1599
|
+
[disabled]="year.disabled"
|
|
1600
|
+
(click)="selectYear(year.value)"
|
|
1601
|
+
>
|
|
1602
|
+
{{ year.value }}
|
|
1603
|
+
</button>
|
|
1604
|
+
}
|
|
1605
|
+
</div>
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
<footer class="td-calendar__footer">
|
|
1609
|
+
<button type="button" class="td-calendar__text-action" (click)="goToday()">
|
|
1610
|
+
Hoy
|
|
1611
|
+
</button>
|
|
1612
|
+
<button type="button" class="td-calendar__text-action" (click)="close()">
|
|
1613
|
+
Cerrar
|
|
1614
|
+
</button>
|
|
1615
|
+
</footer>
|
|
1616
|
+
</section>
|
|
1617
|
+
</ng-template>
|
|
1618
|
+
`, providers: [
|
|
1619
|
+
{
|
|
1620
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1621
|
+
useExisting: forwardRef(() => TdDatePicker),
|
|
1622
|
+
multi: true,
|
|
1623
|
+
},
|
|
1624
|
+
], host: {
|
|
1625
|
+
'[hidden]': 'hidden()',
|
|
1626
|
+
'[attr.aria-busy]': 'pending() ? "true" : null',
|
|
1627
|
+
}, 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-date-picker{--td-date-bg: #fff;--td-date-border: #dfe3eb;--td-date-text: #263147;--td-date-muted: #748096;position:relative;min-height:3.15rem;border:1px solid var(--td-date-border);border-radius:.78rem;background:var(--td-date-bg);transition:border-color .14s ease,box-shadow .14s ease}.td-date-picker--dark{--td-date-bg: #19191f;--td-date-border: #34343e;--td-date-text: #ededf0;--td-date-muted: #a1a1aa}.td-date-picker:hover:not(.td-date-picker--disabled){border-color:#8d80e8}.td-date-picker--open{border-color:#5746d8;box-shadow:0 0 0 3px #5746d821}.td-date-picker--error{border-color:#d33f3f;box-shadow:0 0 0 3px #d33f3f1a}.td-date-picker--disabled{opacity:.58;background:#f5f6f8}.td-date-picker>label{position:absolute;z-index:1;top:-.48rem;left:.72rem;padding:0 .35rem;color:var(--td-date-muted);background:var(--td-date-bg);font-size:.65rem;font-weight:750;line-height:1}.td-date-picker--open>label{color:#5746d8}.td-date-picker--error>label{color:#d33f3f}.td-date-picker__trigger{display:flex;width:100%;min-height:3.05rem;align-items:center;gap:.55rem;border:0;border-radius:inherit;padding:.3rem .7rem;color:var(--td-date-text);background:transparent;font:550 .78rem/1.25 system-ui,sans-serif;text-align:left;cursor:pointer}.td-date-picker__trigger>span:not(.td-date-picker__clear){min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.td-date-picker__placeholder{color:color-mix(in srgb,var(--td-date-muted) 72%,transparent)}.td-date-picker__trigger>td-icon{color:var(--td-date-muted)}.td-date-picker__chevron{transition:transform .14s ease}.td-date-picker__chevron--open{transform:rotate(180deg)}.td-date-picker__clear{display:grid;width:1.8rem;height:1.8rem;flex:0 0 auto;place-items:center;border-radius:.45rem;color:var(--td-date-muted)}.td-date-picker__clear:hover{color:#5746d8;background:#f2f0ff}.td-date-picker__message{margin:.38rem .75rem 0;color:#748096;font-size:.66rem}.td-date-picker__message--error{color:#c43636}.td-calendar{width:min(21rem,100vw - 1rem);overflow:hidden;border:1px solid #e1e5ee;border-radius:1rem;padding:.8rem;color:#263147;background:#fff;box-shadow:0 22px 55px #0f172a33;font-family:Inter,ui-sans-serif,system-ui,sans-serif;animation:td-calendar-in .14s ease-out}.td-calendar--dark{border-color:#34343e;color:#ededf0;background:#202028}.td-calendar__header{display:grid;grid-template-columns:2.35rem 1fr 2.35rem;align-items:center;gap:.35rem}.td-calendar__header button,.td-calendar__footer button{border:0;color:inherit;background:transparent;cursor:pointer}.td-calendar__header button{display:grid;width:2.35rem;height:2.35rem;place-items:center;border-radius:.65rem}.td-calendar__header .td-calendar__period{display:inline-flex;width:auto;min-width:0;height:2.35rem;align-items:center;justify-content:center;gap:.35rem;padding:0 .65rem;font-size:.82rem;font-weight:800}.td-calendar__header button:hover{color:#5746d8;background:#f2f0ff}.td-calendar--dark .td-calendar__header button:hover{background:#2b293d}.td-calendar__range-summary{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:.55rem;margin:.65rem 0 .35rem;border-radius:.72rem;padding:.55rem .65rem;background:#f7f7fb}.td-calendar--dark .td-calendar__range-summary{background:#292931}.td-calendar__range-summary span{min-width:0}.td-calendar__range-summary span:last-child{text-align:right}.td-calendar__range-summary small,.td-calendar__range-summary strong{display:block}.td-calendar__range-summary small{color:#748096;font-size:.58rem}.td-calendar__range-summary strong{overflow:hidden;margin-top:.12rem;font-size:.67rem;text-overflow:ellipsis;white-space:nowrap}.td-calendar__weekdays,.td-calendar__grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.td-calendar__weekdays{margin-top:.55rem}.td-calendar__weekdays span{padding:.35rem 0;color:#8791a4;font-size:.59rem;font-weight:800;text-align:center}.td-calendar__day{position:relative;display:grid;min-width:0;aspect-ratio:1;place-items:center;border:0;border-radius:.6rem;color:inherit;background:transparent;font:650 .7rem/1 system-ui,sans-serif;cursor:pointer}.td-calendar__day:hover:not(:disabled){color:#5746d8;background:#f0eeff}.td-calendar__day--outside{color:#b4bac6}.td-calendar__day--today{box-shadow:inset 0 0 0 1px #8d80e8}.td-calendar__day--range{border-radius:0;color:#5746d8;background:#efedff}.td-calendar__day--selected,.td-calendar__day--range-start,.td-calendar__day--range-end{border-radius:.6rem;color:#fff;background:#5746d8;box-shadow:0 5px 12px #5746d83d}.td-calendar__day:disabled{opacity:.3;cursor:not-allowed}.td-calendar__selector-grid{display:grid;min-height:15.75rem;align-content:center;gap:.45rem;padding:.75rem .15rem}.td-calendar__selector-grid--months,.td-calendar__selector-grid--years{grid-template-columns:repeat(3,minmax(0,1fr))}.td-calendar__selector-grid button{min-height:3.15rem;border:0;border-radius:.7rem;color:inherit;background:transparent;font:700 .72rem/1 system-ui,sans-serif;cursor:pointer}.td-calendar__selector-grid button:hover:not(:disabled){color:#5746d8;background:#f0eeff}.td-calendar--dark .td-calendar__selector-grid button:hover:not(:disabled){color:#b9b0fa;background:#2b293d}.td-calendar__selector-grid button:disabled{opacity:.28;cursor:not-allowed}.td-calendar__selector--active{color:#fff!important;background:#5746d8!important;box-shadow:0 5px 12px #5746d838}.td-calendar__selector--today:not(.td-calendar__selector--active){box-shadow:inset 0 0 0 1px #8d80e8}.td-calendar__footer{display:flex;justify-content:space-between;margin-top:.55rem;border-top:1px solid #e6e9f0;padding-top:.55rem}.td-calendar--dark .td-calendar__footer{border-color:#34343e}.td-calendar__text-action{border-radius:.5rem!important;padding:.45rem .6rem;color:#5746d8!important;font-size:.68rem;font-weight:750}.td-calendar__text-action:hover{background:#f2f0ff!important}@keyframes td-calendar-in{0%{opacity:0;transform:translateY(-.25rem) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}@media(max-width:600px){.td-calendar{width:calc(100vw - 1rem);border-radius:.9rem}}@media(prefers-reduced-motion:reduce){.td-calendar{animation:none}}\n"] }]
|
|
1628
|
+
}], propDecorators: { label: [{
|
|
1629
|
+
type: Input
|
|
1630
|
+
}], placeholder: [{
|
|
1631
|
+
type: Input
|
|
1632
|
+
}], mode: [{
|
|
1633
|
+
type: Input
|
|
1634
|
+
}], hint: [{
|
|
1635
|
+
type: Input
|
|
1636
|
+
}], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReasons: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReasons", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], minDate: [{
|
|
1637
|
+
type: Input,
|
|
1638
|
+
args: [{ alias: 'min' }]
|
|
1639
|
+
}], maxDate: [{
|
|
1640
|
+
type: Input,
|
|
1641
|
+
args: [{ alias: 'max' }]
|
|
1642
|
+
}], clearable: [{
|
|
1643
|
+
type: Input
|
|
1644
|
+
}], dark: [{
|
|
1645
|
+
type: Input
|
|
1646
|
+
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], selectionChange: [{
|
|
1647
|
+
type: Output
|
|
1648
|
+
}], openedChange: [{
|
|
1649
|
+
type: Output
|
|
1650
|
+
}] } });
|
|
1651
|
+
|
|
866
1652
|
const TD_DIALOG_DATA = new InjectionToken('TD_DIALOG_DATA');
|
|
867
1653
|
const TD_DIALOG_CONFIG = new InjectionToken('TD_DIALOG_CONFIG');
|
|
868
1654
|
|
|
@@ -1210,83 +1996,147 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1210
1996
|
let inputSequence = 0;
|
|
1211
1997
|
class TdInput {
|
|
1212
1998
|
cdr = inject(ChangeDetectorRef);
|
|
1999
|
+
formBridge = createTdFormControlBridge();
|
|
1213
2000
|
generatedId = `td-input-${++inputSequence}`;
|
|
2001
|
+
legacyMinLength = null;
|
|
2002
|
+
legacyMaxLength = null;
|
|
2003
|
+
receivedNullValue = false;
|
|
2004
|
+
nativeInput;
|
|
1214
2005
|
id = '';
|
|
1215
|
-
name = '';
|
|
1216
2006
|
label = 'Campo';
|
|
1217
2007
|
type = 'text';
|
|
1218
2008
|
placeholder = '';
|
|
1219
2009
|
autocomplete = 'off';
|
|
1220
2010
|
icon = '';
|
|
1221
2011
|
hint = '';
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
2012
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2013
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2014
|
+
disabledReasons = input([], ...(ngDevMode ? [{ debugName: "disabledReasons" }] : /* istanbul ignore next */ []));
|
|
2015
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2016
|
+
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
2017
|
+
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
2018
|
+
pending = input(false, ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
2019
|
+
dirty = input(false, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
2020
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
2021
|
+
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
2022
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
2023
|
+
touch = output();
|
|
2024
|
+
error = input('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1226
2025
|
clearable = false;
|
|
1227
2026
|
dark = false;
|
|
1228
|
-
|
|
1229
|
-
|
|
2027
|
+
emptyValue = 'auto';
|
|
2028
|
+
minValue = input(undefined, { ...(ngDevMode ? { debugName: "minValue" } : /* istanbul ignore next */ {}), alias: 'min' });
|
|
2029
|
+
maxValue = input(undefined, { ...(ngDevMode ? { debugName: "maxValue" } : /* istanbul ignore next */ {}), alias: 'max' });
|
|
2030
|
+
minLength = input(undefined, ...(ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []));
|
|
2031
|
+
maxLength = input(undefined, ...(ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []));
|
|
2032
|
+
pattern = input([], ...(ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []));
|
|
1230
2033
|
step = null;
|
|
1231
|
-
minlength
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
value
|
|
2034
|
+
set minlength(value) {
|
|
2035
|
+
this.legacyMinLength = value;
|
|
2036
|
+
}
|
|
2037
|
+
set maxlength(value) {
|
|
2038
|
+
this.legacyMaxLength = value;
|
|
2039
|
+
}
|
|
2040
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2041
|
+
isDisabled = computed(() => this.formBridge.isDisabled(this.disabled()), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
2042
|
+
displayError = computed(() => this.error() || this.errors()[0]?.message || '', ...(ngDevMode ? [{ debugName: "displayError" }] : /* istanbul ignore next */ []));
|
|
2043
|
+
hasError = computed(() => this.invalid() || !!this.displayError(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
2044
|
+
resolvedMinLength = computed(() => this.minLength() ?? this.legacyMinLength, ...(ngDevMode ? [{ debugName: "resolvedMinLength" }] : /* istanbul ignore next */ []));
|
|
2045
|
+
resolvedMaxLength = computed(() => this.maxLength() ?? this.legacyMaxLength, ...(ngDevMode ? [{ debugName: "resolvedMaxLength" }] : /* istanbul ignore next */ []));
|
|
2046
|
+
resolvedPattern = computed(() => {
|
|
2047
|
+
const patterns = this.pattern();
|
|
2048
|
+
if (!patterns.length)
|
|
2049
|
+
return null;
|
|
2050
|
+
if (patterns.length === 1)
|
|
2051
|
+
return patterns[0].source;
|
|
2052
|
+
return patterns.map((item) => `(?=${item.source})`).join('') + '.*';
|
|
2053
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedPattern" }] : /* istanbul ignore next */ []));
|
|
1235
2054
|
focused = false;
|
|
1236
2055
|
passwordVisible = false;
|
|
1237
2056
|
get inputId() {
|
|
1238
2057
|
return this.id || this.generatedId;
|
|
1239
2058
|
}
|
|
1240
2059
|
get descriptionId() {
|
|
1241
|
-
return this.
|
|
2060
|
+
return this.displayError() || this.hint ? `${this.inputId}-description` : null;
|
|
1242
2061
|
}
|
|
1243
2062
|
get resolvedType() {
|
|
1244
2063
|
return this.type === 'password' && this.passwordVisible ? 'text' : this.type;
|
|
1245
2064
|
}
|
|
1246
2065
|
onChange = () => undefined;
|
|
1247
|
-
onTouched = () => undefined;
|
|
1248
2066
|
writeValue(value) {
|
|
1249
|
-
|
|
2067
|
+
if (value === null || value === undefined) {
|
|
2068
|
+
this.receivedNullValue = true;
|
|
2069
|
+
this.value.set(null);
|
|
2070
|
+
}
|
|
2071
|
+
else if (this.type === 'number' &&
|
|
2072
|
+
this.formBridge.usesSignalForms &&
|
|
2073
|
+
typeof value === 'number') {
|
|
2074
|
+
this.value.set(value);
|
|
2075
|
+
}
|
|
2076
|
+
else {
|
|
2077
|
+
this.value.set(String(value));
|
|
2078
|
+
}
|
|
1250
2079
|
this.cdr.markForCheck();
|
|
1251
2080
|
}
|
|
1252
2081
|
registerOnChange(fn) {
|
|
1253
2082
|
this.onChange = fn;
|
|
1254
2083
|
}
|
|
1255
2084
|
registerOnTouched(fn) {
|
|
1256
|
-
this.
|
|
2085
|
+
this.formBridge.registerOnTouched(fn);
|
|
1257
2086
|
}
|
|
1258
2087
|
setDisabledState(disabled) {
|
|
1259
|
-
this.disabled
|
|
1260
|
-
|
|
2088
|
+
this.formBridge.setDisabledState(disabled);
|
|
2089
|
+
}
|
|
2090
|
+
focus(options) {
|
|
2091
|
+
this.nativeInput?.nativeElement.focus(options);
|
|
1261
2092
|
}
|
|
1262
2093
|
handleInput(event) {
|
|
1263
|
-
|
|
2094
|
+
const inputElement = event.target;
|
|
2095
|
+
this.setValue(this.parseInputValue(inputElement));
|
|
1264
2096
|
}
|
|
1265
2097
|
handleBlur() {
|
|
1266
2098
|
this.focused = false;
|
|
1267
|
-
this.
|
|
2099
|
+
this.formBridge.markTouched(this.touched, this.touch);
|
|
1268
2100
|
}
|
|
1269
2101
|
clear() {
|
|
1270
|
-
this.setValue(
|
|
2102
|
+
this.setValue(this.resolveEmptyValue());
|
|
2103
|
+
}
|
|
2104
|
+
parseInputValue(inputElement) {
|
|
2105
|
+
if (!inputElement.value) {
|
|
2106
|
+
return this.resolveEmptyValue();
|
|
2107
|
+
}
|
|
2108
|
+
if (this.type !== 'number' || !this.formBridge.usesSignalForms) {
|
|
2109
|
+
return inputElement.value;
|
|
2110
|
+
}
|
|
2111
|
+
const numericValue = inputElement.valueAsNumber;
|
|
2112
|
+
return Number.isNaN(numericValue) ? null : numericValue;
|
|
2113
|
+
}
|
|
2114
|
+
resolveEmptyValue() {
|
|
2115
|
+
if (this.emptyValue === 'null')
|
|
2116
|
+
return null;
|
|
2117
|
+
if (this.emptyValue === 'empty-string')
|
|
2118
|
+
return '';
|
|
2119
|
+
if (this.formBridge.usesSignalForms && this.type === 'number')
|
|
2120
|
+
return null;
|
|
2121
|
+
return this.receivedNullValue ? null : '';
|
|
1271
2122
|
}
|
|
1272
2123
|
setValue(value) {
|
|
1273
|
-
this.value
|
|
2124
|
+
this.value.set(value);
|
|
1274
2125
|
this.onChange(value);
|
|
1275
|
-
this.valueChange.emit(value);
|
|
1276
2126
|
}
|
|
1277
2127
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1278
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdInput, isStandalone: true, selector: "td-input", inputs: { id: "id",
|
|
2128
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdInput, isStandalone: true, selector: "td-input", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: false, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReasons: { classPropertyName: "disabledReasons", publicName: "disabledReasons", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, dark: { classPropertyName: "dark", publicName: "dark", isSignal: false, isRequired: false, transformFunction: null }, emptyValue: { classPropertyName: "emptyValue", publicName: "emptyValue", isSignal: false, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: false, isRequired: false, transformFunction: null }, minlength: { classPropertyName: "minlength", publicName: "minlength", isSignal: false, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange", touch: "touch", value: "valueChange" }, host: { properties: { "hidden": "hidden()", "attr.aria-busy": "pending() ? \"true\" : null" } }, providers: [
|
|
1279
2129
|
{
|
|
1280
2130
|
provide: NG_VALUE_ACCESSOR,
|
|
1281
2131
|
useExisting: forwardRef(() => TdInput),
|
|
1282
2132
|
multi: true,
|
|
1283
2133
|
},
|
|
1284
|
-
], ngImport: i0, template: `
|
|
2134
|
+
], viewQueries: [{ propertyName: "nativeInput", first: true, predicate: ["nativeInput"], descendants: true }], ngImport: i0, template: `
|
|
1285
2135
|
<div
|
|
1286
2136
|
class="td-input"
|
|
1287
2137
|
[class.td-input--focused]="focused"
|
|
1288
|
-
[class.td-input--error]="
|
|
1289
|
-
[class.td-input--disabled]="
|
|
2138
|
+
[class.td-input--error]="hasError()"
|
|
2139
|
+
[class.td-input--disabled]="isDisabled()"
|
|
1290
2140
|
[class.td-input--dark]="dark"
|
|
1291
2141
|
>
|
|
1292
2142
|
<label [for]="inputId">{{ label }}</label>
|
|
@@ -1297,28 +2147,30 @@ class TdInput {
|
|
|
1297
2147
|
}
|
|
1298
2148
|
|
|
1299
2149
|
<input
|
|
2150
|
+
#nativeInput
|
|
1300
2151
|
[id]="inputId"
|
|
1301
|
-
[name]="name"
|
|
2152
|
+
[name]="name()"
|
|
1302
2153
|
[type]="resolvedType"
|
|
1303
|
-
[value]="value"
|
|
2154
|
+
[value]="value() ?? ''"
|
|
1304
2155
|
[placeholder]="placeholder"
|
|
1305
2156
|
[autocomplete]="autocomplete"
|
|
1306
|
-
[disabled]="
|
|
1307
|
-
[readonly]="readonly"
|
|
1308
|
-
[required]="required"
|
|
1309
|
-
[min]="
|
|
1310
|
-
[max]="
|
|
2157
|
+
[disabled]="isDisabled()"
|
|
2158
|
+
[readonly]="readonly()"
|
|
2159
|
+
[required]="required()"
|
|
2160
|
+
[min]="minValue()"
|
|
2161
|
+
[max]="maxValue()"
|
|
1311
2162
|
[step]="step"
|
|
1312
|
-
[attr.minlength]="
|
|
1313
|
-
[attr.maxlength]="
|
|
2163
|
+
[attr.minlength]="resolvedMinLength()"
|
|
2164
|
+
[attr.maxlength]="resolvedMaxLength()"
|
|
2165
|
+
[attr.pattern]="resolvedPattern()"
|
|
1314
2166
|
[attr.aria-describedby]="descriptionId"
|
|
1315
|
-
[attr.aria-invalid]="
|
|
2167
|
+
[attr.aria-invalid]="hasError()"
|
|
1316
2168
|
(input)="handleInput($event)"
|
|
1317
2169
|
(focus)="focused = true"
|
|
1318
2170
|
(blur)="handleBlur()"
|
|
1319
2171
|
/>
|
|
1320
2172
|
|
|
1321
|
-
@if (clearable && value && !
|
|
2173
|
+
@if (clearable && value() && !isDisabled() && !readonly()) {
|
|
1322
2174
|
<button type="button" class="td-input__action" title="Limpiar" (click)="clear()">
|
|
1323
2175
|
<td-icon nombre="close" tamano=".95rem" />
|
|
1324
2176
|
</button>
|
|
@@ -1337,13 +2189,13 @@ class TdInput {
|
|
|
1337
2189
|
</div>
|
|
1338
2190
|
</div>
|
|
1339
2191
|
|
|
1340
|
-
@if (
|
|
2192
|
+
@if (displayError() || hint) {
|
|
1341
2193
|
<p
|
|
1342
2194
|
class="td-input__message"
|
|
1343
|
-
[class.td-input__message--error]="
|
|
2195
|
+
[class.td-input__message--error]="hasError()"
|
|
1344
2196
|
[id]="descriptionId"
|
|
1345
2197
|
>
|
|
1346
|
-
{{
|
|
2198
|
+
{{ displayError() || hint }}
|
|
1347
2199
|
</p>
|
|
1348
2200
|
}
|
|
1349
2201
|
`, 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 });
|
|
@@ -1354,8 +2206,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1354
2206
|
<div
|
|
1355
2207
|
class="td-input"
|
|
1356
2208
|
[class.td-input--focused]="focused"
|
|
1357
|
-
[class.td-input--error]="
|
|
1358
|
-
[class.td-input--disabled]="
|
|
2209
|
+
[class.td-input--error]="hasError()"
|
|
2210
|
+
[class.td-input--disabled]="isDisabled()"
|
|
1359
2211
|
[class.td-input--dark]="dark"
|
|
1360
2212
|
>
|
|
1361
2213
|
<label [for]="inputId">{{ label }}</label>
|
|
@@ -1366,28 +2218,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1366
2218
|
}
|
|
1367
2219
|
|
|
1368
2220
|
<input
|
|
2221
|
+
#nativeInput
|
|
1369
2222
|
[id]="inputId"
|
|
1370
|
-
[name]="name"
|
|
2223
|
+
[name]="name()"
|
|
1371
2224
|
[type]="resolvedType"
|
|
1372
|
-
[value]="value"
|
|
2225
|
+
[value]="value() ?? ''"
|
|
1373
2226
|
[placeholder]="placeholder"
|
|
1374
2227
|
[autocomplete]="autocomplete"
|
|
1375
|
-
[disabled]="
|
|
1376
|
-
[readonly]="readonly"
|
|
1377
|
-
[required]="required"
|
|
1378
|
-
[min]="
|
|
1379
|
-
[max]="
|
|
2228
|
+
[disabled]="isDisabled()"
|
|
2229
|
+
[readonly]="readonly()"
|
|
2230
|
+
[required]="required()"
|
|
2231
|
+
[min]="minValue()"
|
|
2232
|
+
[max]="maxValue()"
|
|
1380
2233
|
[step]="step"
|
|
1381
|
-
[attr.minlength]="
|
|
1382
|
-
[attr.maxlength]="
|
|
2234
|
+
[attr.minlength]="resolvedMinLength()"
|
|
2235
|
+
[attr.maxlength]="resolvedMaxLength()"
|
|
2236
|
+
[attr.pattern]="resolvedPattern()"
|
|
1383
2237
|
[attr.aria-describedby]="descriptionId"
|
|
1384
|
-
[attr.aria-invalid]="
|
|
2238
|
+
[attr.aria-invalid]="hasError()"
|
|
1385
2239
|
(input)="handleInput($event)"
|
|
1386
2240
|
(focus)="focused = true"
|
|
1387
2241
|
(blur)="handleBlur()"
|
|
1388
2242
|
/>
|
|
1389
2243
|
|
|
1390
|
-
@if (clearable && value && !
|
|
2244
|
+
@if (clearable && value() && !isDisabled() && !readonly()) {
|
|
1391
2245
|
<button type="button" class="td-input__action" title="Limpiar" (click)="clear()">
|
|
1392
2246
|
<td-icon nombre="close" tamano=".95rem" />
|
|
1393
2247
|
</button>
|
|
@@ -1406,13 +2260,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1406
2260
|
</div>
|
|
1407
2261
|
</div>
|
|
1408
2262
|
|
|
1409
|
-
@if (
|
|
2263
|
+
@if (displayError() || hint) {
|
|
1410
2264
|
<p
|
|
1411
2265
|
class="td-input__message"
|
|
1412
|
-
[class.td-input__message--error]="
|
|
2266
|
+
[class.td-input__message--error]="hasError()"
|
|
1413
2267
|
[id]="descriptionId"
|
|
1414
2268
|
>
|
|
1415
|
-
{{
|
|
2269
|
+
{{ displayError() || hint }}
|
|
1416
2270
|
</p>
|
|
1417
2271
|
}
|
|
1418
2272
|
`, providers: [
|
|
@@ -1421,10 +2275,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1421
2275
|
useExisting: forwardRef(() => TdInput),
|
|
1422
2276
|
multi: true,
|
|
1423
2277
|
},
|
|
1424
|
-
],
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
2278
|
+
], host: {
|
|
2279
|
+
'[hidden]': 'hidden()',
|
|
2280
|
+
'[attr.aria-busy]': 'pending() ? "true" : null',
|
|
2281
|
+
}, 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"] }]
|
|
2282
|
+
}], propDecorators: { nativeInput: [{
|
|
2283
|
+
type: ViewChild,
|
|
2284
|
+
args: ['nativeInput']
|
|
2285
|
+
}], id: [{
|
|
1428
2286
|
type: Input
|
|
1429
2287
|
}], label: [{
|
|
1430
2288
|
type: Input
|
|
@@ -1438,37 +2296,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1438
2296
|
type: Input
|
|
1439
2297
|
}], hint: [{
|
|
1440
2298
|
type: Input
|
|
1441
|
-
}], error: [{
|
|
1442
|
-
type: Input
|
|
1443
|
-
}], readonly: [{
|
|
1444
|
-
type: Input
|
|
1445
|
-
}], disabled: [{
|
|
1446
|
-
type: Input
|
|
1447
|
-
}], required: [{
|
|
1448
|
-
type: Input
|
|
1449
|
-
}], clearable: [{
|
|
2299
|
+
}], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReasons: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReasons", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], clearable: [{
|
|
1450
2300
|
type: Input
|
|
1451
2301
|
}], dark: [{
|
|
1452
2302
|
type: Input
|
|
1453
|
-
}],
|
|
1454
|
-
type: Input
|
|
1455
|
-
}], max: [{
|
|
2303
|
+
}], emptyValue: [{
|
|
1456
2304
|
type: Input
|
|
1457
|
-
}], step: [{
|
|
2305
|
+
}], minValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], maxValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], step: [{
|
|
1458
2306
|
type: Input
|
|
1459
2307
|
}], minlength: [{
|
|
1460
2308
|
type: Input
|
|
1461
2309
|
}], maxlength: [{
|
|
1462
2310
|
type: Input
|
|
1463
|
-
}],
|
|
1464
|
-
type: Output
|
|
1465
|
-
}], value: [{
|
|
1466
|
-
type: Input
|
|
1467
|
-
}] } });
|
|
2311
|
+
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1468
2312
|
|
|
1469
2313
|
let autocompleteSequence = 0;
|
|
1470
2314
|
class TdAutocompleteSelect {
|
|
1471
2315
|
cdr = inject(ChangeDetectorRef);
|
|
2316
|
+
formBridge = createTdFormControlBridge();
|
|
1472
2317
|
document = inject(DOCUMENT);
|
|
1473
2318
|
destroyRef = inject(DestroyRef);
|
|
1474
2319
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
@@ -1479,18 +2324,32 @@ class TdAutocompleteSelect {
|
|
|
1479
2324
|
placeholder = 'Escribe para buscar...';
|
|
1480
2325
|
options = [];
|
|
1481
2326
|
hint = '';
|
|
1482
|
-
|
|
2327
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2328
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2329
|
+
disabledReasons = input([], ...(ngDevMode ? [{ debugName: "disabledReasons" }] : /* istanbul ignore next */ []));
|
|
2330
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2331
|
+
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
2332
|
+
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
2333
|
+
pending = input(false, ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
2334
|
+
dirty = input(false, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
2335
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
2336
|
+
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
2337
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
2338
|
+
touch = output();
|
|
2339
|
+
error = input('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1483
2340
|
emptyText = 'No se encontraron resultados';
|
|
1484
2341
|
clearable = true;
|
|
1485
2342
|
dark = false;
|
|
1486
|
-
disabled = false;
|
|
1487
2343
|
scrollBehavior = 'reposition';
|
|
1488
2344
|
minimumCharacters = 0;
|
|
1489
2345
|
filterWith = (option, search) => `${option.label} ${option.description ?? ''}`.toLocaleLowerCase().includes(search);
|
|
1490
2346
|
compareWith = (first, second) => Object.is(first, second);
|
|
1491
2347
|
selectionChange = new EventEmitter();
|
|
1492
2348
|
searchChange = new EventEmitter();
|
|
1493
|
-
value = null;
|
|
2349
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2350
|
+
isDisabled = computed(() => this.formBridge.isDisabled(this.disabled()), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
2351
|
+
displayError = computed(() => this.error() || this.errors()[0]?.message || '', ...(ngDevMode ? [{ debugName: "displayError" }] : /* istanbul ignore next */ []));
|
|
2352
|
+
hasError = computed(() => this.invalid() || !!this.displayError(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
1494
2353
|
search = '';
|
|
1495
2354
|
open = false;
|
|
1496
2355
|
activeIndex = -1;
|
|
@@ -1508,10 +2367,9 @@ class TdAutocompleteSelect {
|
|
|
1508
2367
|
return this.options.filter((option) => this.filterWith(option, normalized));
|
|
1509
2368
|
}
|
|
1510
2369
|
onTouched = () => {
|
|
1511
|
-
this.touched
|
|
2370
|
+
this.formBridge.markTouched(this.touched, this.touch);
|
|
1512
2371
|
};
|
|
1513
2372
|
changed = () => undefined;
|
|
1514
|
-
touched = () => undefined;
|
|
1515
2373
|
constructor() {
|
|
1516
2374
|
const scrollListener = (event) => {
|
|
1517
2375
|
const target = event.target;
|
|
@@ -1531,39 +2389,42 @@ class TdAutocompleteSelect {
|
|
|
1531
2389
|
this.destroyRef.onDestroy(() => this.document.removeEventListener('scroll', scrollListener, true));
|
|
1532
2390
|
}
|
|
1533
2391
|
writeValue(value) {
|
|
1534
|
-
this.value
|
|
1535
|
-
this.search =
|
|
2392
|
+
this.value.set(value ?? null);
|
|
2393
|
+
this.search =
|
|
2394
|
+
this.options.find((option) => this.compare(option.value, this.value()))?.label ?? '';
|
|
1536
2395
|
this.cdr.markForCheck();
|
|
1537
2396
|
}
|
|
1538
2397
|
registerOnChange(fn) {
|
|
1539
2398
|
this.changed = fn;
|
|
1540
2399
|
}
|
|
1541
2400
|
registerOnTouched(fn) {
|
|
1542
|
-
this.
|
|
2401
|
+
this.formBridge.registerOnTouched(fn);
|
|
1543
2402
|
}
|
|
1544
2403
|
setDisabledState(disabled) {
|
|
1545
|
-
this.disabled
|
|
1546
|
-
|
|
2404
|
+
this.formBridge.setDisabledState(disabled);
|
|
2405
|
+
}
|
|
2406
|
+
focus(options) {
|
|
2407
|
+
this.searchInput?.nativeElement.focus(options);
|
|
1547
2408
|
}
|
|
1548
2409
|
compare(first, second) {
|
|
1549
2410
|
return this.compareWith(first, second);
|
|
1550
2411
|
}
|
|
1551
2412
|
openPanel() {
|
|
1552
|
-
if (this.
|
|
2413
|
+
if (this.isDisabled() || this.readonly())
|
|
1553
2414
|
return;
|
|
1554
2415
|
this.open = true;
|
|
1555
2416
|
this.activeIndex = this.firstEnabledIndex();
|
|
1556
2417
|
}
|
|
1557
2418
|
close() {
|
|
1558
2419
|
this.open = false;
|
|
1559
|
-
const selected = this.options.find((option) => this.compare(option.value, this.value));
|
|
2420
|
+
const selected = this.options.find((option) => this.compare(option.value, this.value()));
|
|
1560
2421
|
if (selected)
|
|
1561
2422
|
this.search = selected.label;
|
|
1562
|
-
this.touched
|
|
2423
|
+
this.formBridge.markTouched(this.touched, this.touch);
|
|
1563
2424
|
}
|
|
1564
2425
|
handleInput(event) {
|
|
1565
2426
|
this.search = event.target.value;
|
|
1566
|
-
this.value
|
|
2427
|
+
this.value.set(null);
|
|
1567
2428
|
this.changed(null);
|
|
1568
2429
|
this.searchChange.emit(this.search);
|
|
1569
2430
|
this.openPanel();
|
|
@@ -1572,7 +2433,7 @@ class TdAutocompleteSelect {
|
|
|
1572
2433
|
select(option) {
|
|
1573
2434
|
if (option.disabled)
|
|
1574
2435
|
return;
|
|
1575
|
-
this.value
|
|
2436
|
+
this.value.set(option.value);
|
|
1576
2437
|
this.search = option.label;
|
|
1577
2438
|
this.changed(option.value);
|
|
1578
2439
|
this.selectionChange.emit(option.value);
|
|
@@ -1580,7 +2441,7 @@ class TdAutocompleteSelect {
|
|
|
1580
2441
|
}
|
|
1581
2442
|
clear(event) {
|
|
1582
2443
|
event.stopPropagation();
|
|
1583
|
-
this.value
|
|
2444
|
+
this.value.set(null);
|
|
1584
2445
|
this.search = '';
|
|
1585
2446
|
this.changed(null);
|
|
1586
2447
|
this.selectionChange.emit(null);
|
|
@@ -1627,7 +2488,7 @@ class TdAutocompleteSelect {
|
|
|
1627
2488
|
return this.filteredOptions.findIndex((option) => !option.disabled);
|
|
1628
2489
|
}
|
|
1629
2490
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdAutocompleteSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1630
|
-
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",
|
|
2491
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdAutocompleteSelect, isStandalone: true, selector: "td-autocomplete-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReasons: { classPropertyName: "disabledReasons", publicName: "disabledReasons", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, dark: { classPropertyName: "dark", publicName: "dark", isSignal: false, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: false, isRequired: false, transformFunction: null }, minimumCharacters: { classPropertyName: "minimumCharacters", publicName: "minimumCharacters", isSignal: false, isRequired: false, transformFunction: null }, filterWith: { classPropertyName: "filterWith", publicName: "filterWith", isSignal: false, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange", touch: "touch", selectionChange: "selectionChange", searchChange: "searchChange", value: "valueChange" }, host: { properties: { "hidden": "hidden()", "attr.aria-busy": "pending() ? \"true\" : null" } }, providers: [
|
|
1631
2492
|
{
|
|
1632
2493
|
provide: NG_VALUE_ACCESSOR,
|
|
1633
2494
|
useExisting: forwardRef(() => TdAutocompleteSelect),
|
|
@@ -1639,8 +2500,8 @@ class TdAutocompleteSelect {
|
|
|
1639
2500
|
#origin="cdkOverlayOrigin"
|
|
1640
2501
|
class="td-select td-select--autocomplete"
|
|
1641
2502
|
[class.td-select--open]="open"
|
|
1642
|
-
[class.td-select--error]="
|
|
1643
|
-
[class.td-select--disabled]="
|
|
2503
|
+
[class.td-select--error]="hasError()"
|
|
2504
|
+
[class.td-select--disabled]="isDisabled()"
|
|
1644
2505
|
[class.td-select--dark]="dark"
|
|
1645
2506
|
>
|
|
1646
2507
|
<label [for]="inputId">{{ label }}</label>
|
|
@@ -1654,7 +2515,10 @@ class TdAutocompleteSelect {
|
|
|
1654
2515
|
role="combobox"
|
|
1655
2516
|
[value]="search"
|
|
1656
2517
|
[placeholder]="placeholder"
|
|
1657
|
-
[disabled]="
|
|
2518
|
+
[disabled]="isDisabled()"
|
|
2519
|
+
[readonly]="readonly()"
|
|
2520
|
+
[required]="required()"
|
|
2521
|
+
[attr.aria-invalid]="hasError()"
|
|
1658
2522
|
[attr.aria-expanded]="open"
|
|
1659
2523
|
[attr.aria-controls]="listId"
|
|
1660
2524
|
(focus)="openPanel()"
|
|
@@ -1662,7 +2526,7 @@ class TdAutocompleteSelect {
|
|
|
1662
2526
|
(keydown)="handleKeydown($event)"
|
|
1663
2527
|
(blur)="onTouched()"
|
|
1664
2528
|
/>
|
|
1665
|
-
@if (clearable && (value !== null || search) && !
|
|
2529
|
+
@if (clearable && (value() !== null || search) && !isDisabled()) {
|
|
1666
2530
|
<button type="button" class="td-select__clear" title="Limpiar" (click)="clear($event)">
|
|
1667
2531
|
<td-icon nombre="close" tamano=".95rem" />
|
|
1668
2532
|
</button>
|
|
@@ -1675,9 +2539,9 @@ class TdAutocompleteSelect {
|
|
|
1675
2539
|
</div>
|
|
1676
2540
|
</div>
|
|
1677
2541
|
|
|
1678
|
-
@if (
|
|
1679
|
-
<p class="td-select__message" [class.td-select__message--error]="
|
|
1680
|
-
{{
|
|
2542
|
+
@if (displayError() || hint) {
|
|
2543
|
+
<p class="td-select__message" [class.td-select__message--error]="hasError()">
|
|
2544
|
+
{{ displayError() || hint }}
|
|
1681
2545
|
</p>
|
|
1682
2546
|
}
|
|
1683
2547
|
|
|
@@ -1708,7 +2572,7 @@ class TdAutocompleteSelect {
|
|
|
1708
2572
|
type="button"
|
|
1709
2573
|
role="option"
|
|
1710
2574
|
[class.td-select-panel__option--active]="index === activeIndex"
|
|
1711
|
-
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
2575
|
+
[class.td-select-panel__option--selected]="compare(option.value, value())"
|
|
1712
2576
|
[disabled]="option.disabled"
|
|
1713
2577
|
(mousedown)="$event.preventDefault()"
|
|
1714
2578
|
(mouseenter)="activeIndex = index"
|
|
@@ -1723,7 +2587,7 @@ class TdAutocompleteSelect {
|
|
|
1723
2587
|
<small>{{ option.description }}</small>
|
|
1724
2588
|
}
|
|
1725
2589
|
</span>
|
|
1726
|
-
@if (compare(option.value, value)) {
|
|
2590
|
+
@if (compare(option.value, value())) {
|
|
1727
2591
|
<td-icon class="td-select-panel__check" nombre="check" />
|
|
1728
2592
|
}
|
|
1729
2593
|
</button>
|
|
@@ -1740,8 +2604,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1740
2604
|
#origin="cdkOverlayOrigin"
|
|
1741
2605
|
class="td-select td-select--autocomplete"
|
|
1742
2606
|
[class.td-select--open]="open"
|
|
1743
|
-
[class.td-select--error]="
|
|
1744
|
-
[class.td-select--disabled]="
|
|
2607
|
+
[class.td-select--error]="hasError()"
|
|
2608
|
+
[class.td-select--disabled]="isDisabled()"
|
|
1745
2609
|
[class.td-select--dark]="dark"
|
|
1746
2610
|
>
|
|
1747
2611
|
<label [for]="inputId">{{ label }}</label>
|
|
@@ -1755,7 +2619,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1755
2619
|
role="combobox"
|
|
1756
2620
|
[value]="search"
|
|
1757
2621
|
[placeholder]="placeholder"
|
|
1758
|
-
[disabled]="
|
|
2622
|
+
[disabled]="isDisabled()"
|
|
2623
|
+
[readonly]="readonly()"
|
|
2624
|
+
[required]="required()"
|
|
2625
|
+
[attr.aria-invalid]="hasError()"
|
|
1759
2626
|
[attr.aria-expanded]="open"
|
|
1760
2627
|
[attr.aria-controls]="listId"
|
|
1761
2628
|
(focus)="openPanel()"
|
|
@@ -1763,7 +2630,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1763
2630
|
(keydown)="handleKeydown($event)"
|
|
1764
2631
|
(blur)="onTouched()"
|
|
1765
2632
|
/>
|
|
1766
|
-
@if (clearable && (value !== null || search) && !
|
|
2633
|
+
@if (clearable && (value() !== null || search) && !isDisabled()) {
|
|
1767
2634
|
<button type="button" class="td-select__clear" title="Limpiar" (click)="clear($event)">
|
|
1768
2635
|
<td-icon nombre="close" tamano=".95rem" />
|
|
1769
2636
|
</button>
|
|
@@ -1776,9 +2643,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1776
2643
|
</div>
|
|
1777
2644
|
</div>
|
|
1778
2645
|
|
|
1779
|
-
@if (
|
|
1780
|
-
<p class="td-select__message" [class.td-select__message--error]="
|
|
1781
|
-
{{
|
|
2646
|
+
@if (displayError() || hint) {
|
|
2647
|
+
<p class="td-select__message" [class.td-select__message--error]="hasError()">
|
|
2648
|
+
{{ displayError() || hint }}
|
|
1782
2649
|
</p>
|
|
1783
2650
|
}
|
|
1784
2651
|
|
|
@@ -1809,7 +2676,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1809
2676
|
type="button"
|
|
1810
2677
|
role="option"
|
|
1811
2678
|
[class.td-select-panel__option--active]="index === activeIndex"
|
|
1812
|
-
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
2679
|
+
[class.td-select-panel__option--selected]="compare(option.value, value())"
|
|
1813
2680
|
[disabled]="option.disabled"
|
|
1814
2681
|
(mousedown)="$event.preventDefault()"
|
|
1815
2682
|
(mouseenter)="activeIndex = index"
|
|
@@ -1824,7 +2691,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1824
2691
|
<small>{{ option.description }}</small>
|
|
1825
2692
|
}
|
|
1826
2693
|
</span>
|
|
1827
|
-
@if (compare(option.value, value)) {
|
|
2694
|
+
@if (compare(option.value, value())) {
|
|
1828
2695
|
<td-icon class="td-select-panel__check" nombre="check" />
|
|
1829
2696
|
}
|
|
1830
2697
|
</button>
|
|
@@ -1837,7 +2704,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1837
2704
|
useExisting: forwardRef(() => TdAutocompleteSelect),
|
|
1838
2705
|
multi: true,
|
|
1839
2706
|
},
|
|
1840
|
-
],
|
|
2707
|
+
], host: {
|
|
2708
|
+
'[hidden]': 'hidden()',
|
|
2709
|
+
'[attr.aria-busy]': 'pending() ? "true" : null',
|
|
2710
|
+
}, 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"] }]
|
|
1841
2711
|
}], ctorParameters: () => [], propDecorators: { searchInput: [{
|
|
1842
2712
|
type: ViewChild,
|
|
1843
2713
|
args: ['searchInput']
|
|
@@ -1852,16 +2722,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1852
2722
|
type: Input
|
|
1853
2723
|
}], hint: [{
|
|
1854
2724
|
type: Input
|
|
1855
|
-
}], error: [{
|
|
1856
|
-
type: Input
|
|
1857
|
-
}], emptyText: [{
|
|
2725
|
+
}], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReasons: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReasons", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], emptyText: [{
|
|
1858
2726
|
type: Input
|
|
1859
2727
|
}], clearable: [{
|
|
1860
2728
|
type: Input
|
|
1861
2729
|
}], dark: [{
|
|
1862
2730
|
type: Input
|
|
1863
|
-
}], disabled: [{
|
|
1864
|
-
type: Input
|
|
1865
2731
|
}], scrollBehavior: [{
|
|
1866
2732
|
type: Input
|
|
1867
2733
|
}], minimumCharacters: [{
|
|
@@ -1874,29 +2740,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1874
2740
|
type: Output
|
|
1875
2741
|
}], searchChange: [{
|
|
1876
2742
|
type: Output
|
|
1877
|
-
}] } });
|
|
2743
|
+
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1878
2744
|
|
|
1879
2745
|
let selectSequence = 0;
|
|
1880
2746
|
class TdSelect {
|
|
1881
2747
|
cdr = inject(ChangeDetectorRef);
|
|
2748
|
+
formBridge = createTdFormControlBridge();
|
|
1882
2749
|
document = inject(DOCUMENT);
|
|
1883
2750
|
destroyRef = inject(DestroyRef);
|
|
1884
2751
|
scrollStrategies = inject(ScrollStrategyOptions);
|
|
1885
2752
|
generatedId = `td-select-${++selectSequence}`;
|
|
1886
2753
|
connectedOverlay;
|
|
2754
|
+
trigger;
|
|
1887
2755
|
label = 'Seleccionar';
|
|
1888
2756
|
placeholder = 'Selecciona una opción';
|
|
1889
2757
|
options = [];
|
|
1890
2758
|
hint = '';
|
|
1891
|
-
|
|
2759
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
2760
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2761
|
+
disabledReasons = input([], ...(ngDevMode ? [{ debugName: "disabledReasons" }] : /* istanbul ignore next */ []));
|
|
2762
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2763
|
+
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
2764
|
+
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
2765
|
+
pending = input(false, ...(ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []));
|
|
2766
|
+
dirty = input(false, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
2767
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
2768
|
+
errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
2769
|
+
touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
2770
|
+
touch = output();
|
|
2771
|
+
error = input('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
1892
2772
|
emptyText = 'No hay opciones disponibles';
|
|
1893
2773
|
clearable = false;
|
|
1894
2774
|
dark = false;
|
|
1895
|
-
disabled = false;
|
|
1896
2775
|
scrollBehavior = 'reposition';
|
|
1897
2776
|
compareWith = (first, second) => Object.is(first, second);
|
|
1898
2777
|
selectionChange = new EventEmitter();
|
|
1899
|
-
value = null;
|
|
2778
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2779
|
+
isDisabled = computed(() => this.formBridge.isDisabled(this.disabled()), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
2780
|
+
displayError = computed(() => this.error() || this.errors()[0]?.message || '', ...(ngDevMode ? [{ debugName: "displayError" }] : /* istanbul ignore next */ []));
|
|
2781
|
+
hasError = computed(() => this.invalid() || !!this.displayError(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
1900
2782
|
open = false;
|
|
1901
2783
|
activeIndex = -1;
|
|
1902
2784
|
scrollStrategy = this.scrollStrategies.reposition();
|
|
@@ -1907,10 +2789,9 @@ class TdSelect {
|
|
|
1907
2789
|
return `${this.generatedId}-list`;
|
|
1908
2790
|
}
|
|
1909
2791
|
get selectedOption() {
|
|
1910
|
-
return this.options.find((option) => this.compare(option.value, this.value));
|
|
2792
|
+
return this.options.find((option) => this.compare(option.value, this.value()));
|
|
1911
2793
|
}
|
|
1912
2794
|
onChange = () => undefined;
|
|
1913
|
-
onTouched = () => undefined;
|
|
1914
2795
|
constructor() {
|
|
1915
2796
|
const scrollListener = (event) => {
|
|
1916
2797
|
const target = event.target;
|
|
@@ -1930,24 +2811,26 @@ class TdSelect {
|
|
|
1930
2811
|
this.destroyRef.onDestroy(() => this.document.removeEventListener('scroll', scrollListener, true));
|
|
1931
2812
|
}
|
|
1932
2813
|
writeValue(value) {
|
|
1933
|
-
this.value
|
|
2814
|
+
this.value.set(value ?? null);
|
|
1934
2815
|
this.cdr.markForCheck();
|
|
1935
2816
|
}
|
|
1936
2817
|
registerOnChange(fn) {
|
|
1937
2818
|
this.onChange = fn;
|
|
1938
2819
|
}
|
|
1939
2820
|
registerOnTouched(fn) {
|
|
1940
|
-
this.
|
|
2821
|
+
this.formBridge.registerOnTouched(fn);
|
|
1941
2822
|
}
|
|
1942
2823
|
setDisabledState(disabled) {
|
|
1943
|
-
this.disabled
|
|
1944
|
-
|
|
2824
|
+
this.formBridge.setDisabledState(disabled);
|
|
2825
|
+
}
|
|
2826
|
+
focus(options) {
|
|
2827
|
+
this.trigger?.nativeElement.focus(options);
|
|
1945
2828
|
}
|
|
1946
2829
|
compare(first, second) {
|
|
1947
2830
|
return this.compareWith(first, second);
|
|
1948
2831
|
}
|
|
1949
2832
|
toggle() {
|
|
1950
|
-
if (this.
|
|
2833
|
+
if (this.isDisabled() || this.readonly())
|
|
1951
2834
|
return;
|
|
1952
2835
|
this.open ? this.close() : this.openPanel();
|
|
1953
2836
|
}
|
|
@@ -1955,7 +2838,7 @@ class TdSelect {
|
|
|
1955
2838
|
if (!this.open)
|
|
1956
2839
|
return;
|
|
1957
2840
|
this.open = false;
|
|
1958
|
-
this.
|
|
2841
|
+
this.formBridge.markTouched(this.touched, this.touch);
|
|
1959
2842
|
}
|
|
1960
2843
|
select(option) {
|
|
1961
2844
|
if (option.disabled)
|
|
@@ -1996,7 +2879,7 @@ class TdSelect {
|
|
|
1996
2879
|
}
|
|
1997
2880
|
openPanel() {
|
|
1998
2881
|
this.open = true;
|
|
1999
|
-
const selectedIndex = this.options.findIndex((option) => this.compare(option.value, this.value));
|
|
2882
|
+
const selectedIndex = this.options.findIndex((option) => this.compare(option.value, this.value()));
|
|
2000
2883
|
this.activeIndex = selectedIndex >= 0 ? selectedIndex : this.firstEnabledIndex();
|
|
2001
2884
|
}
|
|
2002
2885
|
moveActive(direction) {
|
|
@@ -2015,33 +2898,37 @@ class TdSelect {
|
|
|
2015
2898
|
return this.options.findIndex((option) => !option.disabled);
|
|
2016
2899
|
}
|
|
2017
2900
|
setValue(value) {
|
|
2018
|
-
this.value
|
|
2901
|
+
this.value.set(value);
|
|
2019
2902
|
this.onChange(value);
|
|
2020
2903
|
this.selectionChange.emit(value);
|
|
2021
2904
|
}
|
|
2022
2905
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2023
|
-
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",
|
|
2906
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdSelect, isStandalone: true, selector: "td-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReasons: { classPropertyName: "disabledReasons", publicName: "disabledReasons", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: false, isRequired: false, transformFunction: null }, dark: { classPropertyName: "dark", publicName: "dark", isSignal: false, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: false, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange", touch: "touch", selectionChange: "selectionChange", value: "valueChange" }, host: { properties: { "hidden": "hidden()", "attr.aria-busy": "pending() ? \"true\" : null" } }, providers: [
|
|
2024
2907
|
{
|
|
2025
2908
|
provide: NG_VALUE_ACCESSOR,
|
|
2026
2909
|
useExisting: forwardRef(() => TdSelect),
|
|
2027
2910
|
multi: true,
|
|
2028
2911
|
},
|
|
2029
|
-
], viewQueries: [{ propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }], ngImport: i0, template: `
|
|
2912
|
+
], viewQueries: [{ propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }], ngImport: i0, template: `
|
|
2030
2913
|
<div
|
|
2031
2914
|
cdkOverlayOrigin
|
|
2032
2915
|
#origin="cdkOverlayOrigin"
|
|
2033
2916
|
class="td-select"
|
|
2034
2917
|
[class.td-select--open]="open"
|
|
2035
|
-
[class.td-select--error]="
|
|
2036
|
-
[class.td-select--disabled]="
|
|
2918
|
+
[class.td-select--error]="hasError()"
|
|
2919
|
+
[class.td-select--disabled]="isDisabled()"
|
|
2037
2920
|
[class.td-select--dark]="dark"
|
|
2038
2921
|
>
|
|
2039
2922
|
<label [id]="labelId">{{ label }}</label>
|
|
2040
2923
|
<div
|
|
2924
|
+
#trigger
|
|
2041
2925
|
class="td-select__trigger"
|
|
2042
2926
|
role="combobox"
|
|
2043
|
-
[attr.tabindex]="
|
|
2044
|
-
[attr.aria-disabled]="
|
|
2927
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
2928
|
+
[attr.aria-disabled]="isDisabled()"
|
|
2929
|
+
[attr.aria-readonly]="readonly()"
|
|
2930
|
+
[attr.aria-required]="required()"
|
|
2931
|
+
[attr.aria-invalid]="hasError()"
|
|
2045
2932
|
[attr.aria-labelledby]="labelId"
|
|
2046
2933
|
[attr.aria-expanded]="open"
|
|
2047
2934
|
[attr.aria-controls]="listId"
|
|
@@ -2054,7 +2941,7 @@ class TdSelect {
|
|
|
2054
2941
|
<span [class.td-select__placeholder]="!selectedOption">
|
|
2055
2942
|
{{ selectedOption?.label || placeholder }}
|
|
2056
2943
|
</span>
|
|
2057
|
-
@if (clearable && selectedOption && !
|
|
2944
|
+
@if (clearable && selectedOption && !isDisabled()) {
|
|
2058
2945
|
<button
|
|
2059
2946
|
type="button"
|
|
2060
2947
|
class="td-select__clear"
|
|
@@ -2072,9 +2959,9 @@ class TdSelect {
|
|
|
2072
2959
|
</div>
|
|
2073
2960
|
</div>
|
|
2074
2961
|
|
|
2075
|
-
@if (
|
|
2076
|
-
<p class="td-select__message" [class.td-select__message--error]="
|
|
2077
|
-
{{
|
|
2962
|
+
@if (displayError() || hint) {
|
|
2963
|
+
<p class="td-select__message" [class.td-select__message--error]="hasError()">
|
|
2964
|
+
{{ displayError() || hint }}
|
|
2078
2965
|
</p>
|
|
2079
2966
|
}
|
|
2080
2967
|
|
|
@@ -2105,8 +2992,8 @@ class TdSelect {
|
|
|
2105
2992
|
type="button"
|
|
2106
2993
|
role="option"
|
|
2107
2994
|
[class.td-select-panel__option--active]="index === activeIndex"
|
|
2108
|
-
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
2109
|
-
[attr.aria-selected]="compare(option.value, value)"
|
|
2995
|
+
[class.td-select-panel__option--selected]="compare(option.value, value())"
|
|
2996
|
+
[attr.aria-selected]="compare(option.value, value())"
|
|
2110
2997
|
[disabled]="option.disabled"
|
|
2111
2998
|
(mouseenter)="activeIndex = index"
|
|
2112
2999
|
(click)="select(option)"
|
|
@@ -2120,7 +3007,7 @@ class TdSelect {
|
|
|
2120
3007
|
<small>{{ option.description }}</small>
|
|
2121
3008
|
}
|
|
2122
3009
|
</span>
|
|
2123
|
-
@if (compare(option.value, value)) {
|
|
3010
|
+
@if (compare(option.value, value())) {
|
|
2124
3011
|
<td-icon class="td-select-panel__check" nombre="check" />
|
|
2125
3012
|
}
|
|
2126
3013
|
</button>
|
|
@@ -2137,16 +3024,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2137
3024
|
#origin="cdkOverlayOrigin"
|
|
2138
3025
|
class="td-select"
|
|
2139
3026
|
[class.td-select--open]="open"
|
|
2140
|
-
[class.td-select--error]="
|
|
2141
|
-
[class.td-select--disabled]="
|
|
3027
|
+
[class.td-select--error]="hasError()"
|
|
3028
|
+
[class.td-select--disabled]="isDisabled()"
|
|
2142
3029
|
[class.td-select--dark]="dark"
|
|
2143
3030
|
>
|
|
2144
3031
|
<label [id]="labelId">{{ label }}</label>
|
|
2145
3032
|
<div
|
|
3033
|
+
#trigger
|
|
2146
3034
|
class="td-select__trigger"
|
|
2147
3035
|
role="combobox"
|
|
2148
|
-
[attr.tabindex]="
|
|
2149
|
-
[attr.aria-disabled]="
|
|
3036
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
3037
|
+
[attr.aria-disabled]="isDisabled()"
|
|
3038
|
+
[attr.aria-readonly]="readonly()"
|
|
3039
|
+
[attr.aria-required]="required()"
|
|
3040
|
+
[attr.aria-invalid]="hasError()"
|
|
2150
3041
|
[attr.aria-labelledby]="labelId"
|
|
2151
3042
|
[attr.aria-expanded]="open"
|
|
2152
3043
|
[attr.aria-controls]="listId"
|
|
@@ -2159,7 +3050,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2159
3050
|
<span [class.td-select__placeholder]="!selectedOption">
|
|
2160
3051
|
{{ selectedOption?.label || placeholder }}
|
|
2161
3052
|
</span>
|
|
2162
|
-
@if (clearable && selectedOption && !
|
|
3053
|
+
@if (clearable && selectedOption && !isDisabled()) {
|
|
2163
3054
|
<button
|
|
2164
3055
|
type="button"
|
|
2165
3056
|
class="td-select__clear"
|
|
@@ -2177,9 +3068,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2177
3068
|
</div>
|
|
2178
3069
|
</div>
|
|
2179
3070
|
|
|
2180
|
-
@if (
|
|
2181
|
-
<p class="td-select__message" [class.td-select__message--error]="
|
|
2182
|
-
{{
|
|
3071
|
+
@if (displayError() || hint) {
|
|
3072
|
+
<p class="td-select__message" [class.td-select__message--error]="hasError()">
|
|
3073
|
+
{{ displayError() || hint }}
|
|
2183
3074
|
</p>
|
|
2184
3075
|
}
|
|
2185
3076
|
|
|
@@ -2210,8 +3101,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2210
3101
|
type="button"
|
|
2211
3102
|
role="option"
|
|
2212
3103
|
[class.td-select-panel__option--active]="index === activeIndex"
|
|
2213
|
-
[class.td-select-panel__option--selected]="compare(option.value, value)"
|
|
2214
|
-
[attr.aria-selected]="compare(option.value, value)"
|
|
3104
|
+
[class.td-select-panel__option--selected]="compare(option.value, value())"
|
|
3105
|
+
[attr.aria-selected]="compare(option.value, value())"
|
|
2215
3106
|
[disabled]="option.disabled"
|
|
2216
3107
|
(mouseenter)="activeIndex = index"
|
|
2217
3108
|
(click)="select(option)"
|
|
@@ -2225,7 +3116,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2225
3116
|
<small>{{ option.description }}</small>
|
|
2226
3117
|
}
|
|
2227
3118
|
</span>
|
|
2228
|
-
@if (compare(option.value, value)) {
|
|
3119
|
+
@if (compare(option.value, value())) {
|
|
2229
3120
|
<td-icon class="td-select-panel__check" nombre="check" />
|
|
2230
3121
|
}
|
|
2231
3122
|
</button>
|
|
@@ -2238,10 +3129,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2238
3129
|
useExisting: forwardRef(() => TdSelect),
|
|
2239
3130
|
multi: true,
|
|
2240
3131
|
},
|
|
2241
|
-
],
|
|
3132
|
+
], host: {
|
|
3133
|
+
'[hidden]': 'hidden()',
|
|
3134
|
+
'[attr.aria-busy]': 'pending() ? "true" : null',
|
|
3135
|
+
}, 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"] }]
|
|
2242
3136
|
}], ctorParameters: () => [], propDecorators: { connectedOverlay: [{
|
|
2243
3137
|
type: ViewChild,
|
|
2244
3138
|
args: [CdkConnectedOverlay]
|
|
3139
|
+
}], trigger: [{
|
|
3140
|
+
type: ViewChild,
|
|
3141
|
+
args: ['trigger']
|
|
2245
3142
|
}], label: [{
|
|
2246
3143
|
type: Input
|
|
2247
3144
|
}], placeholder: [{
|
|
@@ -2250,23 +3147,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2250
3147
|
type: Input
|
|
2251
3148
|
}], hint: [{
|
|
2252
3149
|
type: Input
|
|
2253
|
-
}], error: [{
|
|
2254
|
-
type: Input
|
|
2255
|
-
}], emptyText: [{
|
|
3150
|
+
}], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReasons: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReasons", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], touch: [{ type: i0.Output, args: ["touch"] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], emptyText: [{
|
|
2256
3151
|
type: Input
|
|
2257
3152
|
}], clearable: [{
|
|
2258
3153
|
type: Input
|
|
2259
3154
|
}], dark: [{
|
|
2260
3155
|
type: Input
|
|
2261
|
-
}], disabled: [{
|
|
2262
|
-
type: Input
|
|
2263
3156
|
}], scrollBehavior: [{
|
|
2264
3157
|
type: Input
|
|
2265
3158
|
}], compareWith: [{
|
|
2266
3159
|
type: Input
|
|
2267
3160
|
}], selectionChange: [{
|
|
2268
3161
|
type: Output
|
|
2269
|
-
}] } });
|
|
3162
|
+
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
2270
3163
|
|
|
2271
3164
|
class TdSidebar {
|
|
2272
3165
|
titulo = 'Gestión Corporativa';
|
|
@@ -2417,6 +3310,7 @@ class TdTabs {
|
|
|
2417
3310
|
tabsChange;
|
|
2418
3311
|
requestedIndex = 0;
|
|
2419
3312
|
tabQuery;
|
|
3313
|
+
tabList;
|
|
2420
3314
|
tabButtons;
|
|
2421
3315
|
set selectedIndex(value) {
|
|
2422
3316
|
this.requestedIndex = Number.isFinite(value) ? Math.max(0, Math.trunc(value)) : 0;
|
|
@@ -2458,8 +3352,11 @@ class TdTabs {
|
|
|
2458
3352
|
this.selectedIndexChange.emit(index);
|
|
2459
3353
|
this.tabChange.emit(tab);
|
|
2460
3354
|
this.cdr.markForCheck();
|
|
2461
|
-
|
|
2462
|
-
|
|
3355
|
+
queueMicrotask(() => {
|
|
3356
|
+
this.ensureTabVisible(index, focus ? 'auto' : 'smooth');
|
|
3357
|
+
if (focus)
|
|
3358
|
+
this.focusButton(index);
|
|
3359
|
+
});
|
|
2463
3360
|
}
|
|
2464
3361
|
handleKeydown(event) {
|
|
2465
3362
|
const horizontalKeys = ['ArrowLeft', 'ArrowRight'];
|
|
@@ -2486,6 +3383,7 @@ class TdTabs {
|
|
|
2486
3383
|
this.tabs = this.tabQuery.toArray();
|
|
2487
3384
|
this.applyRequestedIndex();
|
|
2488
3385
|
this.cdr.markForCheck();
|
|
3386
|
+
queueMicrotask(() => this.ensureTabVisible(this.activeIndex, 'auto'));
|
|
2489
3387
|
}
|
|
2490
3388
|
applyRequestedIndex() {
|
|
2491
3389
|
if (!this.tabs.length) {
|
|
@@ -2524,8 +3422,28 @@ class TdTabs {
|
|
|
2524
3422
|
focusButton(index) {
|
|
2525
3423
|
this.tabButtons.get(index)?.nativeElement.focus();
|
|
2526
3424
|
}
|
|
3425
|
+
ensureTabVisible(index, behavior) {
|
|
3426
|
+
const list = this.tabList?.nativeElement;
|
|
3427
|
+
const button = this.tabButtons?.get(index)?.nativeElement;
|
|
3428
|
+
if (!list || !button || list.scrollWidth <= list.clientWidth)
|
|
3429
|
+
return;
|
|
3430
|
+
const padding = 8;
|
|
3431
|
+
const visibleStart = list.scrollLeft + padding;
|
|
3432
|
+
const visibleEnd = list.scrollLeft + list.clientWidth - padding;
|
|
3433
|
+
const tabStart = button.offsetLeft;
|
|
3434
|
+
const tabEnd = tabStart + button.offsetWidth;
|
|
3435
|
+
if (tabStart < visibleStart) {
|
|
3436
|
+
list.scrollTo({ left: Math.max(0, tabStart - padding), behavior });
|
|
3437
|
+
}
|
|
3438
|
+
else if (tabEnd > visibleEnd) {
|
|
3439
|
+
list.scrollTo({
|
|
3440
|
+
left: tabEnd - list.clientWidth + padding,
|
|
3441
|
+
behavior,
|
|
3442
|
+
});
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
2527
3445
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2528
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdTabs, isStandalone: true, selector: "td-tabs", inputs: { selectedIndex: "selectedIndex", variant: "variant", alignment: "alignment", stretch: "stretch", dark: "dark", ariaLabel: "ariaLabel", panelFocusable: "panelFocusable" }, outputs: { selectedIndexChange: "selectedIndexChange", tabChange: "tabChange" }, queries: [{ propertyName: "tabQuery", predicate: TdTab }], viewQueries: [{ propertyName: "tabButtons", predicate: ["tabButton"], descendants: true }], ngImport: i0, template: `
|
|
3446
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdTabs, isStandalone: true, selector: "td-tabs", inputs: { selectedIndex: "selectedIndex", variant: "variant", alignment: "alignment", stretch: "stretch", dark: "dark", ariaLabel: "ariaLabel", panelFocusable: "panelFocusable" }, outputs: { selectedIndexChange: "selectedIndexChange", tabChange: "tabChange" }, queries: [{ propertyName: "tabQuery", predicate: TdTab }], viewQueries: [{ propertyName: "tabList", first: true, predicate: ["tabList"], descendants: true }, { propertyName: "tabButtons", predicate: ["tabButton"], descendants: true }], ngImport: i0, template: `
|
|
2529
3447
|
<section
|
|
2530
3448
|
class="td-tabs"
|
|
2531
3449
|
[class.td-tabs--dark]="dark"
|
|
@@ -2534,6 +3452,7 @@ class TdTabs {
|
|
|
2534
3452
|
(dark ? ' td-tabs--dark' : '') + (stretch ? ' td-tabs--stretch' : '')"
|
|
2535
3453
|
>
|
|
2536
3454
|
<div
|
|
3455
|
+
#tabList
|
|
2537
3456
|
class="td-tabs__list"
|
|
2538
3457
|
role="tablist"
|
|
2539
3458
|
[attr.aria-label]="ariaLabel"
|
|
@@ -2576,7 +3495,7 @@ class TdTabs {
|
|
|
2576
3495
|
</div>
|
|
2577
3496
|
}
|
|
2578
3497
|
</section>
|
|
2579
|
-
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;min-width:0;overflow-x:auto;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:center}.td-tabs--align-fin .td-tabs__list{justify-content:flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3498
|
+
`, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain;scroll-padding-inline:.5rem;scroll-snap-type:inline proximity;touch-action:pan-x;-webkit-overflow-scrolling:touch;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:safe center}.td-tabs--align-fin .td-tabs__list{justify-content:safe flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;scroll-snap-align:start;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}@media(max-width:600px){.td-tabs__list{justify-content:flex-start!important}.td-tabs--stretch .td-tabs__tab{min-width:max-content;flex:0 0 auto}.td-tabs--contenida .td-tabs__list{padding-inline:.25rem}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2580
3499
|
}
|
|
2581
3500
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTabs, decorators: [{
|
|
2582
3501
|
type: Component,
|
|
@@ -2589,6 +3508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2589
3508
|
(dark ? ' td-tabs--dark' : '') + (stretch ? ' td-tabs--stretch' : '')"
|
|
2590
3509
|
>
|
|
2591
3510
|
<div
|
|
3511
|
+
#tabList
|
|
2592
3512
|
class="td-tabs__list"
|
|
2593
3513
|
role="tablist"
|
|
2594
3514
|
[attr.aria-label]="ariaLabel"
|
|
@@ -2631,10 +3551,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2631
3551
|
</div>
|
|
2632
3552
|
}
|
|
2633
3553
|
</section>
|
|
2634
|
-
`, 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-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;min-width:0;overflow-x:auto;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:center}.td-tabs--align-fin .td-tabs__list{justify-content:flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}\n"] }]
|
|
3554
|
+
`, 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-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain;scroll-padding-inline:.5rem;scroll-snap-type:inline proximity;touch-action:pan-x;-webkit-overflow-scrolling:touch;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:safe center}.td-tabs--align-fin .td-tabs__list{justify-content:safe flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;scroll-snap-align:start;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}@media(max-width:600px){.td-tabs__list{justify-content:flex-start!important}.td-tabs--stretch .td-tabs__tab{min-width:max-content;flex:0 0 auto}.td-tabs--contenida .td-tabs__list{padding-inline:.25rem}}\n"] }]
|
|
2635
3555
|
}], propDecorators: { tabQuery: [{
|
|
2636
3556
|
type: ContentChildren,
|
|
2637
3557
|
args: [TdTab]
|
|
3558
|
+
}], tabList: [{
|
|
3559
|
+
type: ViewChild,
|
|
3560
|
+
args: ['tabList']
|
|
2638
3561
|
}], tabButtons: [{
|
|
2639
3562
|
type: ViewChildren,
|
|
2640
3563
|
args: ['tabButton']
|
|
@@ -2666,5 +3589,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2666
3589
|
* Generated bundle index. Do not edit.
|
|
2667
3590
|
*/
|
|
2668
3591
|
|
|
2669
|
-
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, TdTab, TdTabs, TelcomdevUi };
|
|
3592
|
+
export { TD_DIALOG_CONFIG, TD_DIALOG_DATA, TD_ICONOS, TD_ICONOS_NOMBRES, TdAlerta, TdAutocompleteSelect, TdDataTable, TdDatePicker, TdDialog, TdDialogActions, TdDialogClose, TdDialogPrimary, TdDialogRef, TdFooter, TdHeader, TdIcon, TdIconoRegistry, TdInput, TdSelect, TdSidebar, TdTab, TdTabs, TelcomdevUi, createTdFormControlBridge };
|
|
2670
3593
|
//# sourceMappingURL=telcomdev-ui.mjs.map
|