@kksdev/ds-angular 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ import * as i1$1 from '@fortawesome/angular-fontawesome';
|
|
|
6
6
|
import { FaIconComponent, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
7
7
|
import * as i1$4 from '@angular/forms';
|
|
8
8
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
-
import { faInfoCircle, faTimesCircle, faExclamationTriangle, faCheckCircle, faTimes, faEye, faEyeSlash, faClose, faCircleInfo, faCircleXmark, faCircleExclamation, faCircleCheck, faChevronDown, faChevronLeft, faChevronRight, faAnglesLeft, faAnglesRight, faCheck, faSearch, faXmark, faSpinner, faCalendar, faCloudArrowUp, faFile, faFileImage, faFilePdf, faFileWord, faFileExcel, faInbox, faStar, faStarHalfStroke, faClock, faFolder, faFolderOpen, faCircle, faCircleHalfStroke, faTriangleExclamation, faMinus, faPlus, faEyeDropper, faExternalLinkAlt, faBars, faAngleLeft, faAngleRight } from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import { faInfoCircle, faTimesCircle, faExclamationTriangle, faCheckCircle, faTimes, faEye, faEyeSlash, faClose, faCircleInfo, faCircleXmark, faCircleExclamation, faCircleCheck, faChevronDown, faChevronLeft, faChevronRight, faAnglesLeft, faAnglesRight, faCheck, faSearch, faXmark, faSpinner, faCalendar, faCloudArrowUp, faFile, faFileImage, faFilePdf, faFileWord, faFileExcel, faInbox, faStar, faStarHalfStroke, faClock, faFolder, faFolderOpen, faCircle, faCircleHalfStroke, faTriangleExclamation, faMinus, faPlus, faEyeDropper, faExternalLinkAlt, faBars, faAngleLeft, faAngleRight, faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
|
|
10
10
|
import * as i1$2 from '@angular/router';
|
|
11
11
|
import { RouterModule, Router } from '@angular/router';
|
|
12
12
|
import * as i1$3 from '@angular/cdk/overlay';
|
|
@@ -16754,6 +16754,357 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
16754
16754
|
args: ['document:click', ['$event']]
|
|
16755
16755
|
}] } });
|
|
16756
16756
|
|
|
16757
|
+
/** Positions pour le popup overlay */
|
|
16758
|
+
const INPUT_DATE_POSITIONS = [
|
|
16759
|
+
{
|
|
16760
|
+
originX: 'start',
|
|
16761
|
+
originY: 'bottom',
|
|
16762
|
+
overlayX: 'start',
|
|
16763
|
+
overlayY: 'top',
|
|
16764
|
+
offsetY: 4,
|
|
16765
|
+
},
|
|
16766
|
+
{
|
|
16767
|
+
originX: 'start',
|
|
16768
|
+
originY: 'top',
|
|
16769
|
+
overlayX: 'start',
|
|
16770
|
+
overlayY: 'bottom',
|
|
16771
|
+
offsetY: -4,
|
|
16772
|
+
},
|
|
16773
|
+
{
|
|
16774
|
+
originX: 'end',
|
|
16775
|
+
originY: 'bottom',
|
|
16776
|
+
overlayX: 'end',
|
|
16777
|
+
overlayY: 'top',
|
|
16778
|
+
offsetY: 4,
|
|
16779
|
+
},
|
|
16780
|
+
{
|
|
16781
|
+
originX: 'end',
|
|
16782
|
+
originY: 'top',
|
|
16783
|
+
overlayX: 'end',
|
|
16784
|
+
overlayY: 'bottom',
|
|
16785
|
+
offsetY: -4,
|
|
16786
|
+
},
|
|
16787
|
+
];
|
|
16788
|
+
/**
|
|
16789
|
+
* Parse une chaîne de date au format dd/MM/yyyy, dd-MM-yyyy, dd.MM.yyyy ou dd MM yyyy
|
|
16790
|
+
*/
|
|
16791
|
+
function parseDate(input) {
|
|
16792
|
+
if (!input || !input.trim()) {
|
|
16793
|
+
return { valid: true, date: null };
|
|
16794
|
+
}
|
|
16795
|
+
const trimmed = input.trim();
|
|
16796
|
+
// Regex multi-format: dd/MM/yyyy, dd-MM-yyyy, dd.MM.yyyy, dd MM yyyy
|
|
16797
|
+
const regex = /^(\d{1,2})[\/\-\.\s](\d{1,2})[\/\-\.\s](\d{4})$/;
|
|
16798
|
+
const match = trimmed.match(regex);
|
|
16799
|
+
if (!match) {
|
|
16800
|
+
return { valid: false, date: null, error: 'invalid_format' };
|
|
16801
|
+
}
|
|
16802
|
+
const day = parseInt(match[1], 10);
|
|
16803
|
+
const month = parseInt(match[2], 10);
|
|
16804
|
+
const year = parseInt(match[3], 10);
|
|
16805
|
+
// Validation des valeurs
|
|
16806
|
+
if (month < 1 || month > 12) {
|
|
16807
|
+
return { valid: false, date: null, error: 'invalid_date' };
|
|
16808
|
+
}
|
|
16809
|
+
if (day < 1 || day > 31) {
|
|
16810
|
+
return { valid: false, date: null, error: 'invalid_date' };
|
|
16811
|
+
}
|
|
16812
|
+
// Créer la date en heure locale (pas UTC)
|
|
16813
|
+
const date = new Date(year, month - 1, day, 0, 0, 0, 0);
|
|
16814
|
+
// Vérifier que la date est valide (ex: 31/02 créera une date en mars)
|
|
16815
|
+
if (date.getDate() !== day || date.getMonth() !== month - 1 || date.getFullYear() !== year) {
|
|
16816
|
+
return { valid: false, date: null, error: 'invalid_date' };
|
|
16817
|
+
}
|
|
16818
|
+
return { valid: true, date };
|
|
16819
|
+
}
|
|
16820
|
+
/**
|
|
16821
|
+
* Formate une date au format dd/MM/yyyy
|
|
16822
|
+
*/
|
|
16823
|
+
function formatDate(date) {
|
|
16824
|
+
if (!date)
|
|
16825
|
+
return '';
|
|
16826
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
16827
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
16828
|
+
const year = date.getFullYear();
|
|
16829
|
+
return `${day}/${month}/${year}`;
|
|
16830
|
+
}
|
|
16831
|
+
/**
|
|
16832
|
+
* DsInputDate - Composant de saisie de date avec calendrier popup
|
|
16833
|
+
*
|
|
16834
|
+
* @description
|
|
16835
|
+
* Input textuel avec icône calendrier et popup DsDatePicker pour la sélection
|
|
16836
|
+
* de date dans les formulaires. Supporte la saisie manuelle et les contraintes min/max.
|
|
16837
|
+
*
|
|
16838
|
+
* @example
|
|
16839
|
+
* ```html
|
|
16840
|
+
* <ds-input-date
|
|
16841
|
+
* [(ngModel)]="selectedDate"
|
|
16842
|
+
* label="Date de naissance"
|
|
16843
|
+
* placeholder="jj/mm/aaaa">
|
|
16844
|
+
* </ds-input-date>
|
|
16845
|
+
* ```
|
|
16846
|
+
*/
|
|
16847
|
+
class DsInputDate {
|
|
16848
|
+
// ViewChild - référence à l'élément input pour le focus
|
|
16849
|
+
inputElementRef;
|
|
16850
|
+
// Inputs
|
|
16851
|
+
value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
16852
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
16853
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
16854
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
16855
|
+
placeholder = input('dd/mm/yyyy', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
16856
|
+
label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
16857
|
+
error = input(undefined, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
16858
|
+
helper = input(undefined, ...(ngDevMode ? [{ debugName: "helper" }] : []));
|
|
16859
|
+
minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
16860
|
+
maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
16861
|
+
clearable = input(true, ...(ngDevMode ? [{ debugName: "clearable" }] : []));
|
|
16862
|
+
// Outputs
|
|
16863
|
+
dateChange = output();
|
|
16864
|
+
// Icons
|
|
16865
|
+
calendarIcon = faCalendar;
|
|
16866
|
+
clearIcon = faTimes;
|
|
16867
|
+
errorIcon = faExclamationCircle;
|
|
16868
|
+
// Overlay positions
|
|
16869
|
+
overlayPositions = INPUT_DATE_POSITIONS;
|
|
16870
|
+
// Unique ID for aria-controls
|
|
16871
|
+
panelId = `ds-input-date-panel-${Math.random().toString(36).substr(2, 9)}`;
|
|
16872
|
+
// State
|
|
16873
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
16874
|
+
internalValue = signal(null, ...(ngDevMode ? [{ debugName: "internalValue" }] : []));
|
|
16875
|
+
isFocused = signal(false, ...(ngDevMode ? [{ debugName: "isFocused" }] : []));
|
|
16876
|
+
inputText = signal('', ...(ngDevMode ? [{ debugName: "inputText" }] : []));
|
|
16877
|
+
hasParseError = signal(false, ...(ngDevMode ? [{ debugName: "hasParseError" }] : []));
|
|
16878
|
+
// ControlValueAccessor
|
|
16879
|
+
onChange = () => { };
|
|
16880
|
+
onTouched = () => { };
|
|
16881
|
+
hasExternalValue = signal(false, ...(ngDevMode ? [{ debugName: "hasExternalValue" }] : []));
|
|
16882
|
+
// Computed
|
|
16883
|
+
displayValue = computed(() => {
|
|
16884
|
+
const text = this.inputText();
|
|
16885
|
+
if (text)
|
|
16886
|
+
return text;
|
|
16887
|
+
return formatDate(this.internalValue());
|
|
16888
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
16889
|
+
containerClasses = computed(() => {
|
|
16890
|
+
const classes = ['ds-input-date'];
|
|
16891
|
+
classes.push(`ds-input-date--${this.size()}`);
|
|
16892
|
+
if (this.disabled())
|
|
16893
|
+
classes.push('ds-input-date--disabled');
|
|
16894
|
+
if (this.readonly())
|
|
16895
|
+
classes.push('ds-input-date--readonly');
|
|
16896
|
+
if (this.isFocused())
|
|
16897
|
+
classes.push('ds-input-date--focused');
|
|
16898
|
+
if (this.isOpen())
|
|
16899
|
+
classes.push('ds-input-date--open');
|
|
16900
|
+
if (this.inputState() === 'error')
|
|
16901
|
+
classes.push('ds-input-date--error');
|
|
16902
|
+
return classes.join(' ');
|
|
16903
|
+
}, ...(ngDevMode ? [{ debugName: "containerClasses" }] : []));
|
|
16904
|
+
isDisabled = computed(() => this.disabled() || this.readonly(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
16905
|
+
inputState = computed(() => {
|
|
16906
|
+
if (this.hasParseError() || this.error())
|
|
16907
|
+
return 'error';
|
|
16908
|
+
return 'default';
|
|
16909
|
+
}, ...(ngDevMode ? [{ debugName: "inputState" }] : []));
|
|
16910
|
+
showClearButton = computed(() => {
|
|
16911
|
+
return this.clearable() && this.internalValue() !== null && !this.isDisabled();
|
|
16912
|
+
}, ...(ngDevMode ? [{ debugName: "showClearButton" }] : []));
|
|
16913
|
+
effectiveMinDate = computed(() => {
|
|
16914
|
+
const min = this.minDate();
|
|
16915
|
+
const max = this.maxDate();
|
|
16916
|
+
// Si minDate > maxDate (config invalide), ignorer les contraintes
|
|
16917
|
+
if (min && max && min > max) {
|
|
16918
|
+
console.warn('[DsInputDate] minDate > maxDate: constraints ignored');
|
|
16919
|
+
return null;
|
|
16920
|
+
}
|
|
16921
|
+
return min;
|
|
16922
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveMinDate" }] : []));
|
|
16923
|
+
effectiveMaxDate = computed(() => {
|
|
16924
|
+
const min = this.minDate();
|
|
16925
|
+
const max = this.maxDate();
|
|
16926
|
+
// Si minDate > maxDate (config invalide), ignorer les contraintes
|
|
16927
|
+
if (min && max && min > max) {
|
|
16928
|
+
return null;
|
|
16929
|
+
}
|
|
16930
|
+
return max;
|
|
16931
|
+
}, ...(ngDevMode ? [{ debugName: "effectiveMaxDate" }] : []));
|
|
16932
|
+
constructor() {
|
|
16933
|
+
// Sync external value with internal
|
|
16934
|
+
effect(() => {
|
|
16935
|
+
const val = this.value();
|
|
16936
|
+
if (!this.hasExternalValue() && val !== this.internalValue()) {
|
|
16937
|
+
this.internalValue.set(val);
|
|
16938
|
+
this.inputText.set(formatDate(val));
|
|
16939
|
+
}
|
|
16940
|
+
});
|
|
16941
|
+
}
|
|
16942
|
+
// ControlValueAccessor implementation
|
|
16943
|
+
writeValue(value) {
|
|
16944
|
+
this.hasExternalValue.set(true);
|
|
16945
|
+
this.internalValue.set(value);
|
|
16946
|
+
this.inputText.set(formatDate(value));
|
|
16947
|
+
this.hasParseError.set(false);
|
|
16948
|
+
}
|
|
16949
|
+
registerOnChange(fn) {
|
|
16950
|
+
this.onChange = fn;
|
|
16951
|
+
}
|
|
16952
|
+
registerOnTouched(fn) {
|
|
16953
|
+
this.onTouched = fn;
|
|
16954
|
+
}
|
|
16955
|
+
setDisabledState(isDisabled) {
|
|
16956
|
+
// Géré par input disabled
|
|
16957
|
+
}
|
|
16958
|
+
// Event handlers
|
|
16959
|
+
toggle() {
|
|
16960
|
+
if (this.isDisabled())
|
|
16961
|
+
return;
|
|
16962
|
+
if (this.isOpen()) {
|
|
16963
|
+
this.close();
|
|
16964
|
+
}
|
|
16965
|
+
else {
|
|
16966
|
+
this.open();
|
|
16967
|
+
}
|
|
16968
|
+
}
|
|
16969
|
+
open() {
|
|
16970
|
+
if (this.isDisabled() || this.isOpen())
|
|
16971
|
+
return;
|
|
16972
|
+
this.isOpen.set(true);
|
|
16973
|
+
}
|
|
16974
|
+
close() {
|
|
16975
|
+
if (!this.isOpen())
|
|
16976
|
+
return;
|
|
16977
|
+
this.isOpen.set(false);
|
|
16978
|
+
}
|
|
16979
|
+
onInputFocus() {
|
|
16980
|
+
if (!this.disabled()) {
|
|
16981
|
+
this.isFocused.set(true);
|
|
16982
|
+
}
|
|
16983
|
+
}
|
|
16984
|
+
onInputBlur() {
|
|
16985
|
+
this.isFocused.set(false);
|
|
16986
|
+
this.onTouched();
|
|
16987
|
+
// Parse et valide la saisie
|
|
16988
|
+
const text = this.inputText();
|
|
16989
|
+
if (!text) {
|
|
16990
|
+
// Champ vidé
|
|
16991
|
+
if (this.internalValue() !== null) {
|
|
16992
|
+
this.updateValue(null);
|
|
16993
|
+
}
|
|
16994
|
+
this.hasParseError.set(false);
|
|
16995
|
+
return;
|
|
16996
|
+
}
|
|
16997
|
+
const result = parseDate(text);
|
|
16998
|
+
if (!result.valid) {
|
|
16999
|
+
this.hasParseError.set(true);
|
|
17000
|
+
return;
|
|
17001
|
+
}
|
|
17002
|
+
// Validation des contraintes min/max
|
|
17003
|
+
if (result.date) {
|
|
17004
|
+
const min = this.effectiveMinDate();
|
|
17005
|
+
const max = this.effectiveMaxDate();
|
|
17006
|
+
if (min && result.date < min) {
|
|
17007
|
+
this.hasParseError.set(true);
|
|
17008
|
+
return;
|
|
17009
|
+
}
|
|
17010
|
+
if (max && result.date > max) {
|
|
17011
|
+
this.hasParseError.set(true);
|
|
17012
|
+
return;
|
|
17013
|
+
}
|
|
17014
|
+
}
|
|
17015
|
+
this.hasParseError.set(false);
|
|
17016
|
+
if (result.date !== this.internalValue()) {
|
|
17017
|
+
this.updateValue(result.date);
|
|
17018
|
+
}
|
|
17019
|
+
// Reformatter la saisie
|
|
17020
|
+
this.inputText.set(formatDate(result.date));
|
|
17021
|
+
}
|
|
17022
|
+
onInputChange(event) {
|
|
17023
|
+
const input = event.target;
|
|
17024
|
+
this.inputText.set(input.value);
|
|
17025
|
+
// Le parsing/validation se fait uniquement au blur
|
|
17026
|
+
}
|
|
17027
|
+
onInputKeydown(event) {
|
|
17028
|
+
if (this.isDisabled())
|
|
17029
|
+
return;
|
|
17030
|
+
switch (event.key) {
|
|
17031
|
+
case 'Enter':
|
|
17032
|
+
case 'ArrowDown':
|
|
17033
|
+
event.preventDefault();
|
|
17034
|
+
this.open();
|
|
17035
|
+
break;
|
|
17036
|
+
case 'Escape':
|
|
17037
|
+
if (this.isOpen()) {
|
|
17038
|
+
event.preventDefault();
|
|
17039
|
+
this.close();
|
|
17040
|
+
}
|
|
17041
|
+
break;
|
|
17042
|
+
}
|
|
17043
|
+
}
|
|
17044
|
+
onCalendarIconClick(event) {
|
|
17045
|
+
event.preventDefault();
|
|
17046
|
+
event.stopPropagation();
|
|
17047
|
+
this.toggle();
|
|
17048
|
+
}
|
|
17049
|
+
onDateSelected(date) {
|
|
17050
|
+
this.updateValue(date);
|
|
17051
|
+
this.inputText.set(formatDate(date));
|
|
17052
|
+
this.hasParseError.set(false);
|
|
17053
|
+
this.close();
|
|
17054
|
+
this.inputElementRef?.nativeElement.focus();
|
|
17055
|
+
}
|
|
17056
|
+
onBackdropClick() {
|
|
17057
|
+
this.close();
|
|
17058
|
+
}
|
|
17059
|
+
onOverlayKeydown(event) {
|
|
17060
|
+
if (event.key === 'Escape') {
|
|
17061
|
+
this.close();
|
|
17062
|
+
this.inputElementRef?.nativeElement.focus();
|
|
17063
|
+
}
|
|
17064
|
+
}
|
|
17065
|
+
clearValue(event) {
|
|
17066
|
+
event.preventDefault();
|
|
17067
|
+
event.stopPropagation();
|
|
17068
|
+
this.updateValue(null);
|
|
17069
|
+
this.inputText.set('');
|
|
17070
|
+
this.hasParseError.set(false);
|
|
17071
|
+
this.inputElementRef?.nativeElement.focus();
|
|
17072
|
+
}
|
|
17073
|
+
updateValue(value) {
|
|
17074
|
+
this.hasExternalValue.set(true);
|
|
17075
|
+
this.internalValue.set(value);
|
|
17076
|
+
this.onChange(value);
|
|
17077
|
+
this.dateChange.emit(value);
|
|
17078
|
+
}
|
|
17079
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DsInputDate, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
17080
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: DsInputDate, isStandalone: true, selector: "ds-input-date", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, helper: { classPropertyName: "helper", publicName: "helper", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange" }, providers: [
|
|
17081
|
+
{
|
|
17082
|
+
provide: NG_VALUE_ACCESSOR,
|
|
17083
|
+
useExisting: forwardRef(() => DsInputDate),
|
|
17084
|
+
multi: true,
|
|
17085
|
+
},
|
|
17086
|
+
], viewQueries: [{ propertyName: "inputElementRef", first: true, predicate: ["inputElement"], descendants: true }], ngImport: i0, template: "<div [class]=\"containerClasses()\">\n <!-- Label -->\n @if (label()) {\n <label class=\"ds-input-date__label\" [attr.for]=\"panelId + '-input'\">\n {{ label() }}\n </label>\n }\n\n <!-- Input container -->\n <div\n class=\"ds-input-date__wrapper\"\n #triggerOrigin=\"cdkOverlayOrigin\"\n cdkOverlayOrigin>\n\n <input\n #inputElement\n type=\"text\"\n class=\"ds-input-date__input\"\n [id]=\"panelId + '-input'\"\n [value]=\"displayValue()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"isOpen() ? panelId : null\"\n [attr.aria-invalid]=\"inputState() === 'error'\"\n (input)=\"onInputChange($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown)=\"onInputKeydown($event)\">\n\n <!-- Icons zone -->\n <div class=\"ds-input-date__icons\">\n <!-- Clear button -->\n @if (showClearButton()) {\n <button\n type=\"button\"\n class=\"ds-input-date__clear\"\n tabindex=\"-1\"\n aria-label=\"Effacer la date\"\n (click)=\"clearValue($event)\">\n <fa-icon [icon]=\"clearIcon\" aria-hidden=\"true\"></fa-icon>\n </button>\n }\n\n <!-- Calendar icon -->\n <button\n type=\"button\"\n class=\"ds-input-date__calendar-btn\"\n [disabled]=\"isDisabled()\"\n tabindex=\"-1\"\n aria-label=\"Ouvrir le calendrier\"\n (click)=\"onCalendarIconClick($event)\">\n <fa-icon [icon]=\"calendarIcon\" aria-hidden=\"true\"></fa-icon>\n </button>\n </div>\n </div>\n\n <!-- Helper / Error message -->\n @if (error() || hasParseError()) {\n <div class=\"ds-input-date__error\">\n <fa-icon [icon]=\"errorIcon\" aria-hidden=\"true\"></fa-icon>\n <span>{{ error() || 'Format de date invalide' }}</span>\n </div>\n } @else if (helper()) {\n <div class=\"ds-input-date__helper\">{{ helper() }}</div>\n }\n</div>\n\n<!-- Date Picker Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"triggerOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayBackdropClass]=\"'cdk-overlay-transparent-backdrop'\"\n [cdkConnectedOverlayPanelClass]=\"'ds-input-date-overlay'\"\n (backdropClick)=\"onBackdropClick()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\">\n\n <div\n class=\"ds-input-date__popup\"\n [id]=\"panelId\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"S\u00E9lectionner une date\">\n <ds-date-picker\n [mode]=\"'single'\"\n [minDate]=\"effectiveMinDate()\"\n [maxDate]=\"effectiveMaxDate()\"\n [showTodayButton]=\"true\"\n [showClearButton]=\"false\"\n (dateChange)=\"onDateSelected($event)\">\n </ds-date-picker>\n </div>\n</ng-template>\n", styles: [":host{display:inline-flex;width:100%}.ds-input-date{display:flex;flex-direction:column;gap:var(--space-1);width:100%}.ds-input-date__label{display:block;color:var(--input-label-color);font-size:var(--input-label-font-size);font-weight:500;margin-bottom:var(--input-label-margin-bottom)}.ds-input-date__wrapper{position:relative;display:flex;align-items:center}.ds-input-date__input{flex:1;width:100%;height:var(--input-height-md);padding:0 var(--ds-input-date-icon-zone-width, 72px) 0 var(--input-padding-default);background-color:var(--input-bg);border:1px solid var(--input-border);border-radius:var(--input-border-radius);color:var(--input-text);font-size:var(--input-font-size-md);outline:none;transition:all .2s ease}.ds-input-date__input::placeholder{color:var(--input-placeholder)}.ds-input-date__input:hover:not(:disabled):not([readonly]){border-color:var(--input-hover-border)}.ds-input-date__input:focus:not(:disabled){border-color:var(--input-focus-border);box-shadow:var(--input-focus-shadow)}.ds-input-date__input:disabled{opacity:.5;cursor:not-allowed;background-color:var(--input-disabled-bg)}.ds-input-date__input[readonly]{cursor:default;background-color:var(--input-disabled-bg)}.ds-input-date__icons{position:absolute;right:0;top:0;bottom:0;display:flex;align-items:center;gap:var(--space-1);padding-right:var(--space-2)}.ds-input-date__clear{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:var(--radius-1);color:var(--input-icon);cursor:pointer;transition:all .15s ease}.ds-input-date__clear:hover{background-color:var(--surface-hover);color:var(--text-default)}.ds-input-date__clear:focus-visible{outline:2px solid var(--input-focus-border);outline-offset:1px}.ds-input-date__clear fa-icon{font-size:14px}.ds-input-date__calendar-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;background:transparent;border:none;border-radius:var(--radius-1);color:var(--input-icon);cursor:pointer;transition:all .15s ease}.ds-input-date__calendar-btn:hover:not(:disabled){background-color:var(--surface-hover);color:var(--color-primary)}.ds-input-date__calendar-btn:focus-visible{outline:2px solid var(--input-focus-border);outline-offset:1px}.ds-input-date__calendar-btn:disabled{opacity:.5;cursor:not-allowed}.ds-input-date__calendar-btn fa-icon{font-size:16px}.ds-input-date__helper{font-size:var(--font-size-1);color:var(--text-muted)}.ds-input-date__error{display:flex;align-items:center;gap:var(--space-1);font-size:var(--font-size-1);color:var(--text-error)}.ds-input-date__error fa-icon{font-size:12px}.ds-input-date__popup{background-color:var(--surface-default);border:1px solid var(--border-color);border-radius:var(--radius-2);box-shadow:var(--shadow-3);overflow:hidden}.ds-input-date--sm .ds-input-date__input{height:var(--input-height-sm);padding-left:var(--space-2);font-size:var(--input-font-size-sm)}.ds-input-date--sm .ds-input-date__calendar-btn{width:24px;height:24px}.ds-input-date--sm .ds-input-date__calendar-btn fa-icon{font-size:14px}.ds-input-date--sm .ds-input-date__clear{width:20px;height:20px}.ds-input-date--sm .ds-input-date__clear fa-icon{font-size:12px}.ds-input-date--lg .ds-input-date__input{height:var(--input-height-lg);padding-left:var(--space-3);font-size:var(--input-font-size-lg)}.ds-input-date--lg .ds-input-date__calendar-btn{width:32px;height:32px}.ds-input-date--lg .ds-input-date__calendar-btn fa-icon{font-size:18px}.ds-input-date--lg .ds-input-date__clear{width:28px;height:28px}.ds-input-date--lg .ds-input-date__clear fa-icon{font-size:16px}.ds-input-date--focused .ds-input-date__input{border-color:var(--input-focus-border);box-shadow:var(--input-focus-shadow)}.ds-input-date--open .ds-input-date__calendar-btn{color:var(--color-primary)}.ds-input-date--error .ds-input-date__input{border-color:var(--input-error-border)}.ds-input-date--error .ds-input-date__input:focus{border-color:var(--input-error-border);box-shadow:0 0 0 2px color-mix(in oklab,var(--error) 20%,transparent)}.ds-input-date--error .ds-input-date__calendar-btn{color:var(--error)}.ds-input-date--disabled{pointer-events:none;opacity:.5}.ds-input-date--readonly .ds-input-date__calendar-btn{pointer-events:none}::ng-deep .ds-input-date-overlay{z-index:1000}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: i1$1.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { 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"], 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: DsDatePicker, selector: "ds-date-picker", inputs: ["size", "mode", "disabled", "minDate", "maxDate", "showTodayButton", "showClearButton", "todayLabel", "clearLabel", "prevMonthLabel", "nextMonthLabel", "presets", "showPresets", "showRangePreview"], outputs: ["dateChange", "rangeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
17087
|
+
}
|
|
17088
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DsInputDate, decorators: [{
|
|
17089
|
+
type: Component,
|
|
17090
|
+
args: [{ selector: 'ds-input-date', standalone: true, imports: [
|
|
17091
|
+
CommonModule,
|
|
17092
|
+
FontAwesomeModule,
|
|
17093
|
+
CdkConnectedOverlay,
|
|
17094
|
+
CdkOverlayOrigin,
|
|
17095
|
+
DsDatePicker,
|
|
17096
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
17097
|
+
{
|
|
17098
|
+
provide: NG_VALUE_ACCESSOR,
|
|
17099
|
+
useExisting: forwardRef(() => DsInputDate),
|
|
17100
|
+
multi: true,
|
|
17101
|
+
},
|
|
17102
|
+
], template: "<div [class]=\"containerClasses()\">\n <!-- Label -->\n @if (label()) {\n <label class=\"ds-input-date__label\" [attr.for]=\"panelId + '-input'\">\n {{ label() }}\n </label>\n }\n\n <!-- Input container -->\n <div\n class=\"ds-input-date__wrapper\"\n #triggerOrigin=\"cdkOverlayOrigin\"\n cdkOverlayOrigin>\n\n <input\n #inputElement\n type=\"text\"\n class=\"ds-input-date__input\"\n [id]=\"panelId + '-input'\"\n [value]=\"displayValue()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"isOpen() ? panelId : null\"\n [attr.aria-invalid]=\"inputState() === 'error'\"\n (input)=\"onInputChange($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown)=\"onInputKeydown($event)\">\n\n <!-- Icons zone -->\n <div class=\"ds-input-date__icons\">\n <!-- Clear button -->\n @if (showClearButton()) {\n <button\n type=\"button\"\n class=\"ds-input-date__clear\"\n tabindex=\"-1\"\n aria-label=\"Effacer la date\"\n (click)=\"clearValue($event)\">\n <fa-icon [icon]=\"clearIcon\" aria-hidden=\"true\"></fa-icon>\n </button>\n }\n\n <!-- Calendar icon -->\n <button\n type=\"button\"\n class=\"ds-input-date__calendar-btn\"\n [disabled]=\"isDisabled()\"\n tabindex=\"-1\"\n aria-label=\"Ouvrir le calendrier\"\n (click)=\"onCalendarIconClick($event)\">\n <fa-icon [icon]=\"calendarIcon\" aria-hidden=\"true\"></fa-icon>\n </button>\n </div>\n </div>\n\n <!-- Helper / Error message -->\n @if (error() || hasParseError()) {\n <div class=\"ds-input-date__error\">\n <fa-icon [icon]=\"errorIcon\" aria-hidden=\"true\"></fa-icon>\n <span>{{ error() || 'Format de date invalide' }}</span>\n </div>\n } @else if (helper()) {\n <div class=\"ds-input-date__helper\">{{ helper() }}</div>\n }\n</div>\n\n<!-- Date Picker Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"triggerOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayBackdropClass]=\"'cdk-overlay-transparent-backdrop'\"\n [cdkConnectedOverlayPanelClass]=\"'ds-input-date-overlay'\"\n (backdropClick)=\"onBackdropClick()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\">\n\n <div\n class=\"ds-input-date__popup\"\n [id]=\"panelId\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"S\u00E9lectionner une date\">\n <ds-date-picker\n [mode]=\"'single'\"\n [minDate]=\"effectiveMinDate()\"\n [maxDate]=\"effectiveMaxDate()\"\n [showTodayButton]=\"true\"\n [showClearButton]=\"false\"\n (dateChange)=\"onDateSelected($event)\">\n </ds-date-picker>\n </div>\n</ng-template>\n", styles: [":host{display:inline-flex;width:100%}.ds-input-date{display:flex;flex-direction:column;gap:var(--space-1);width:100%}.ds-input-date__label{display:block;color:var(--input-label-color);font-size:var(--input-label-font-size);font-weight:500;margin-bottom:var(--input-label-margin-bottom)}.ds-input-date__wrapper{position:relative;display:flex;align-items:center}.ds-input-date__input{flex:1;width:100%;height:var(--input-height-md);padding:0 var(--ds-input-date-icon-zone-width, 72px) 0 var(--input-padding-default);background-color:var(--input-bg);border:1px solid var(--input-border);border-radius:var(--input-border-radius);color:var(--input-text);font-size:var(--input-font-size-md);outline:none;transition:all .2s ease}.ds-input-date__input::placeholder{color:var(--input-placeholder)}.ds-input-date__input:hover:not(:disabled):not([readonly]){border-color:var(--input-hover-border)}.ds-input-date__input:focus:not(:disabled){border-color:var(--input-focus-border);box-shadow:var(--input-focus-shadow)}.ds-input-date__input:disabled{opacity:.5;cursor:not-allowed;background-color:var(--input-disabled-bg)}.ds-input-date__input[readonly]{cursor:default;background-color:var(--input-disabled-bg)}.ds-input-date__icons{position:absolute;right:0;top:0;bottom:0;display:flex;align-items:center;gap:var(--space-1);padding-right:var(--space-2)}.ds-input-date__clear{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:var(--radius-1);color:var(--input-icon);cursor:pointer;transition:all .15s ease}.ds-input-date__clear:hover{background-color:var(--surface-hover);color:var(--text-default)}.ds-input-date__clear:focus-visible{outline:2px solid var(--input-focus-border);outline-offset:1px}.ds-input-date__clear fa-icon{font-size:14px}.ds-input-date__calendar-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;background:transparent;border:none;border-radius:var(--radius-1);color:var(--input-icon);cursor:pointer;transition:all .15s ease}.ds-input-date__calendar-btn:hover:not(:disabled){background-color:var(--surface-hover);color:var(--color-primary)}.ds-input-date__calendar-btn:focus-visible{outline:2px solid var(--input-focus-border);outline-offset:1px}.ds-input-date__calendar-btn:disabled{opacity:.5;cursor:not-allowed}.ds-input-date__calendar-btn fa-icon{font-size:16px}.ds-input-date__helper{font-size:var(--font-size-1);color:var(--text-muted)}.ds-input-date__error{display:flex;align-items:center;gap:var(--space-1);font-size:var(--font-size-1);color:var(--text-error)}.ds-input-date__error fa-icon{font-size:12px}.ds-input-date__popup{background-color:var(--surface-default);border:1px solid var(--border-color);border-radius:var(--radius-2);box-shadow:var(--shadow-3);overflow:hidden}.ds-input-date--sm .ds-input-date__input{height:var(--input-height-sm);padding-left:var(--space-2);font-size:var(--input-font-size-sm)}.ds-input-date--sm .ds-input-date__calendar-btn{width:24px;height:24px}.ds-input-date--sm .ds-input-date__calendar-btn fa-icon{font-size:14px}.ds-input-date--sm .ds-input-date__clear{width:20px;height:20px}.ds-input-date--sm .ds-input-date__clear fa-icon{font-size:12px}.ds-input-date--lg .ds-input-date__input{height:var(--input-height-lg);padding-left:var(--space-3);font-size:var(--input-font-size-lg)}.ds-input-date--lg .ds-input-date__calendar-btn{width:32px;height:32px}.ds-input-date--lg .ds-input-date__calendar-btn fa-icon{font-size:18px}.ds-input-date--lg .ds-input-date__clear{width:28px;height:28px}.ds-input-date--lg .ds-input-date__clear fa-icon{font-size:16px}.ds-input-date--focused .ds-input-date__input{border-color:var(--input-focus-border);box-shadow:var(--input-focus-shadow)}.ds-input-date--open .ds-input-date__calendar-btn{color:var(--color-primary)}.ds-input-date--error .ds-input-date__input{border-color:var(--input-error-border)}.ds-input-date--error .ds-input-date__input:focus{border-color:var(--input-error-border);box-shadow:0 0 0 2px color-mix(in oklab,var(--error) 20%,transparent)}.ds-input-date--error .ds-input-date__calendar-btn{color:var(--error)}.ds-input-date--disabled{pointer-events:none;opacity:.5}.ds-input-date--readonly .ds-input-date__calendar-btn{pointer-events:none}::ng-deep .ds-input-date-overlay{z-index:1000}\n"] }]
|
|
17103
|
+
}], ctorParameters: () => [], propDecorators: { inputElementRef: [{
|
|
17104
|
+
type: ViewChild,
|
|
17105
|
+
args: ['inputElement']
|
|
17106
|
+
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], helper: [{ type: i0.Input, args: [{ isSignal: true, alias: "helper", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }] } });
|
|
17107
|
+
|
|
16757
17108
|
/*
|
|
16758
17109
|
* Components barrel export
|
|
16759
17110
|
*/
|
|
@@ -17242,5 +17593,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
17242
17593
|
* Generated bundle index. Do not edit.
|
|
17243
17594
|
*/
|
|
17244
17595
|
|
|
17245
|
-
export { AUTOCOMPLETE_POSITIONS, DROPDOWN_POSITIONS, DROPDOWN_POSITIONS_RIGHT, DROPDOWN_POSITIONS_TOP, DsAccordion, DsAccordionItem, DsAlert, DsAvatar, DsBadge, DsBreadcrumb, DsButton, DsCalendar, DsCard, DsCarousel, DsCheckbox, DsCheckboxList, DsChip, DsColorPicker, DsCombobox, DsContainer, DsDatePicker, DsDivider, DsDrawer, DsDropdown, DsEmpty, DsEntityChip, DsEntityPicker, DsFileUpload, DsI18nService, DsInputField, DsInputNumber, DsInputTextarea, DsList, DsListGroup, DsListItem, DsMenu, DsModalComponent, DsNavList, DsNotificationContainerComponent, DsNotificationItemComponent, DsNotificationService, DsPagination, DsPasswordStrength, DsPopover, DsPopoverComponent, DsProgressBar, DsRadioGroup, DsRating, DsSearchInput, DsSegmentedControl, DsSelect, DsSidebar, DsSidebarFooterItemComponent, DsSidebarItemComponent, DsSkeleton, DsSlider, DsStepper, DsTable, DsTabs, DsTimePicker, DsTimeline, DsToastComponent, DsToastContainerComponent, DsToastService, DsToggle, DsTooltip, DsTooltipComponent, DsTransfer, DsTree, IconRegistryService, POPOVER_POSITIONS, PrimitiveBadge, PrimitiveButton, PrimitiveCheckbox, PrimitiveInput, PrimitiveRadio, PrimitiveTextarea, PrimitiveToggle, SIDEBAR_POPOVER_POSITIONS_LEFT, SIDEBAR_POPOVER_POSITIONS_RIGHT, TOOLTIP_POSITIONS, generateId, generateShortId };
|
|
17596
|
+
export { AUTOCOMPLETE_POSITIONS, DROPDOWN_POSITIONS, DROPDOWN_POSITIONS_RIGHT, DROPDOWN_POSITIONS_TOP, DsAccordion, DsAccordionItem, DsAlert, DsAvatar, DsBadge, DsBreadcrumb, DsButton, DsCalendar, DsCard, DsCarousel, DsCheckbox, DsCheckboxList, DsChip, DsColorPicker, DsCombobox, DsContainer, DsDatePicker, DsDivider, DsDrawer, DsDropdown, DsEmpty, DsEntityChip, DsEntityPicker, DsFileUpload, DsI18nService, DsInputDate, DsInputField, DsInputNumber, DsInputTextarea, DsList, DsListGroup, DsListItem, DsMenu, DsModalComponent, DsNavList, DsNotificationContainerComponent, DsNotificationItemComponent, DsNotificationService, DsPagination, DsPasswordStrength, DsPopover, DsPopoverComponent, DsProgressBar, DsRadioGroup, DsRating, DsSearchInput, DsSegmentedControl, DsSelect, DsSidebar, DsSidebarFooterItemComponent, DsSidebarItemComponent, DsSkeleton, DsSlider, DsStepper, DsTable, DsTabs, DsTimePicker, DsTimeline, DsToastComponent, DsToastContainerComponent, DsToastService, DsToggle, DsTooltip, DsTooltipComponent, DsTransfer, DsTree, IconRegistryService, POPOVER_POSITIONS, PrimitiveBadge, PrimitiveButton, PrimitiveCheckbox, PrimitiveInput, PrimitiveRadio, PrimitiveTextarea, PrimitiveToggle, SIDEBAR_POPOVER_POSITIONS_LEFT, SIDEBAR_POPOVER_POSITIONS_RIGHT, TOOLTIP_POSITIONS, generateId, generateShortId };
|
|
17246
17597
|
//# sourceMappingURL=kksdev-ds-angular.mjs.map
|