ngx-datex 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +320 -0
- package/fesm2022/ngx-datex.mjs +3562 -0
- package/package.json +81 -0
- package/types/ngx-datex.d.ts +2161 -0
|
@@ -0,0 +1,2161 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef, OnInit, OnDestroy, ElementRef, Signal, OutputEmitterRef, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { OverlayRef } from '@angular/cdk/overlay';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a date range value with start and end dates.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const dateValue: NgxDatexValue = {
|
|
12
|
+
* startDate: new Date('2024-01-01'),
|
|
13
|
+
* endDate: new Date('2024-01-31'),
|
|
14
|
+
* label: 'January 2024'
|
|
15
|
+
* };
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
interface NgxDatexValue {
|
|
19
|
+
/** The start date of the range. Always required. */
|
|
20
|
+
startDate: Date;
|
|
21
|
+
/** The end date of the range. Null for single date picker or incomplete selection. */
|
|
22
|
+
endDate: Date | null;
|
|
23
|
+
/** Optional label describing the date range (e.g., "Last 7 days"). */
|
|
24
|
+
label?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Predefined date ranges configuration.
|
|
28
|
+
* Maps range labels to start and end date tuples.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const ranges: NgxDatexRange = {
|
|
33
|
+
* 'Today': [startOfDay(new Date()), endOfDay(new Date())],
|
|
34
|
+
* 'Last 7 days': [startOfDay(subDays(new Date(), 6)), endOfDay(new Date())]
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
interface NgxDatexRange {
|
|
39
|
+
/** Range label mapped to [startDate, endDate] tuple */
|
|
40
|
+
[key: string]: [Date, Date];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Complete theme configuration for the date picker.
|
|
44
|
+
* Defines colors, typography, spacing, borders, and shadows.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const customTheme: NgxDatexTheme = {
|
|
49
|
+
* name: 'custom-dark',
|
|
50
|
+
* colors: {
|
|
51
|
+
* primary: '#bb86fc',
|
|
52
|
+
* background: '#121212',
|
|
53
|
+
* // ... other colors
|
|
54
|
+
* },
|
|
55
|
+
* // ... other theme properties
|
|
56
|
+
* };
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
interface NgxDatexTheme {
|
|
60
|
+
/** Unique theme identifier */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Color palette configuration */
|
|
63
|
+
colors: {
|
|
64
|
+
/** Primary brand color used for selections and highlights */
|
|
65
|
+
primary: string;
|
|
66
|
+
/** Secondary color for less prominent elements */
|
|
67
|
+
secondary: string;
|
|
68
|
+
/** Accent color for interactive elements */
|
|
69
|
+
accent: string;
|
|
70
|
+
/** Main background color */
|
|
71
|
+
background: string;
|
|
72
|
+
/** Surface color for cards and overlays */
|
|
73
|
+
surface: string;
|
|
74
|
+
/** Primary text color */
|
|
75
|
+
text: string;
|
|
76
|
+
/** Secondary text color for less important content */
|
|
77
|
+
textSecondary: string;
|
|
78
|
+
/** Border color for inputs and dividers */
|
|
79
|
+
border: string;
|
|
80
|
+
/** Hover state color */
|
|
81
|
+
hover: string;
|
|
82
|
+
/** Selected state background color */
|
|
83
|
+
selected: string;
|
|
84
|
+
/** Text color on selected backgrounds */
|
|
85
|
+
selectedText: string;
|
|
86
|
+
/** Disabled state color */
|
|
87
|
+
disabled: string;
|
|
88
|
+
/** Error state color */
|
|
89
|
+
error: string;
|
|
90
|
+
/** Success state color */
|
|
91
|
+
success: string;
|
|
92
|
+
/** Warning state color */
|
|
93
|
+
warning: string;
|
|
94
|
+
};
|
|
95
|
+
/** Typography configuration */
|
|
96
|
+
typography: {
|
|
97
|
+
/** Font family stack */
|
|
98
|
+
fontFamily: string;
|
|
99
|
+
/** Base font size */
|
|
100
|
+
fontSize: string;
|
|
101
|
+
/** Base font weight */
|
|
102
|
+
fontWeight: string;
|
|
103
|
+
/** Base line height */
|
|
104
|
+
lineHeight: string;
|
|
105
|
+
};
|
|
106
|
+
/** Spacing scale configuration */
|
|
107
|
+
spacing: {
|
|
108
|
+
/** Extra small spacing (4px) */
|
|
109
|
+
xs: string;
|
|
110
|
+
/** Small spacing (8px) */
|
|
111
|
+
sm: string;
|
|
112
|
+
/** Medium spacing (16px) */
|
|
113
|
+
md: string;
|
|
114
|
+
/** Large spacing (24px) */
|
|
115
|
+
lg: string;
|
|
116
|
+
/** Extra large spacing (32px) */
|
|
117
|
+
xl: string;
|
|
118
|
+
};
|
|
119
|
+
/** Border radius configuration */
|
|
120
|
+
borderRadius: {
|
|
121
|
+
/** Small border radius */
|
|
122
|
+
sm: string;
|
|
123
|
+
/** Medium border radius */
|
|
124
|
+
md: string;
|
|
125
|
+
/** Large border radius */
|
|
126
|
+
lg: string;
|
|
127
|
+
};
|
|
128
|
+
/** Box shadow configuration */
|
|
129
|
+
shadows: {
|
|
130
|
+
/** Small shadow for subtle elevation */
|
|
131
|
+
sm: string;
|
|
132
|
+
/** Medium shadow for cards */
|
|
133
|
+
md: string;
|
|
134
|
+
/** Large shadow for modals */
|
|
135
|
+
lg: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Configuration options for date picker behavior and validation.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const config: NgxDatexConfig = {
|
|
144
|
+
* dateFormat: 'DD/MM/YYYY',
|
|
145
|
+
* firstDayOfWeek: 1, // Monday
|
|
146
|
+
* businessDaysOnly: true,
|
|
147
|
+
* closeOnSelect: false
|
|
148
|
+
* };
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
interface NgxDatexConfig {
|
|
152
|
+
/** Date format string (default: 'DD/MM/YYYY') */
|
|
153
|
+
dateFormat?: string;
|
|
154
|
+
/** First day of week (0 = Sunday, 1 = Monday, etc.) */
|
|
155
|
+
firstDayOfWeek?: number;
|
|
156
|
+
/** Whether to show week numbers in calendar */
|
|
157
|
+
showWeekNumbers?: boolean;
|
|
158
|
+
/** Restrict selection to business days only (Mon-Fri) */
|
|
159
|
+
businessDaysOnly?: boolean;
|
|
160
|
+
/** Array of specific dates to disable */
|
|
161
|
+
disabledDates?: Date[];
|
|
162
|
+
/** Array of days of week to disable (0 = Sunday, 1 = Monday, etc.) */
|
|
163
|
+
disabledDaysOfWeek?: number[];
|
|
164
|
+
/** Whether to close picker immediately after selection */
|
|
165
|
+
closeOnSelect?: boolean;
|
|
166
|
+
/** Whether to show clear button */
|
|
167
|
+
clearable?: boolean;
|
|
168
|
+
/** Whether to highlight today's date */
|
|
169
|
+
showToday?: boolean;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Localization configuration for the date picker.
|
|
173
|
+
* Controls language, date formats, and UI text.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* const spanishLocale: NgxDatexLocale = {
|
|
178
|
+
* direction: 'ltr',
|
|
179
|
+
* format: 'DD/MM/YYYY',
|
|
180
|
+
* daysOfWeek: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
|
|
181
|
+
* monthNames: ['Enero', 'Febrero', 'Marzo', ...],
|
|
182
|
+
* applyLabel: 'Aplicar',
|
|
183
|
+
* cancelLabel: 'Cancelar'
|
|
184
|
+
* };
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
interface NgxDatexLocale {
|
|
188
|
+
/** Text direction for RTL languages */
|
|
189
|
+
direction?: 'ltr' | 'rtl';
|
|
190
|
+
/** Date format string */
|
|
191
|
+
format?: string;
|
|
192
|
+
/** Separator between start and end dates */
|
|
193
|
+
separator?: string;
|
|
194
|
+
/** Text for apply button */
|
|
195
|
+
applyLabel?: string;
|
|
196
|
+
/** Text for cancel button */
|
|
197
|
+
cancelLabel?: string;
|
|
198
|
+
/** Week column header label */
|
|
199
|
+
weekLabel?: string;
|
|
200
|
+
/** Label for custom range option */
|
|
201
|
+
customRangeLabel?: string;
|
|
202
|
+
/** Short day names (7 items, starting with configured first day) */
|
|
203
|
+
daysOfWeek?: string[];
|
|
204
|
+
/** Full month names (12 items, January to December) */
|
|
205
|
+
monthNames?: string[];
|
|
206
|
+
/** First day of week (0 = Sunday, 1 = Monday, etc.) */
|
|
207
|
+
firstDay?: number;
|
|
208
|
+
}
|
|
209
|
+
interface NgxDatexTimeValue {
|
|
210
|
+
hour: number;
|
|
211
|
+
minute: number;
|
|
212
|
+
ampm: string;
|
|
213
|
+
}
|
|
214
|
+
interface NgxDatexOverlayPosition {
|
|
215
|
+
originX: string;
|
|
216
|
+
originY: string;
|
|
217
|
+
overlayX: string;
|
|
218
|
+
overlayY: string;
|
|
219
|
+
}
|
|
220
|
+
interface NgxDatexValidationResult {
|
|
221
|
+
isValid: boolean;
|
|
222
|
+
error?: string;
|
|
223
|
+
errorCode?: string;
|
|
224
|
+
}
|
|
225
|
+
interface NgxDatexInputs {
|
|
226
|
+
config: NgxDatexConfig;
|
|
227
|
+
locale: NgxDatexLocale;
|
|
228
|
+
theme: NgxDatexTheme;
|
|
229
|
+
appearance: 'fill' | 'outline';
|
|
230
|
+
floatLabel: 'always' | 'auto';
|
|
231
|
+
label: string;
|
|
232
|
+
placeholder: string;
|
|
233
|
+
calendarIcon: string;
|
|
234
|
+
showCalendarIcon: boolean;
|
|
235
|
+
calendarIconPosition: 'prefix' | 'suffix';
|
|
236
|
+
showCheckbox: boolean;
|
|
237
|
+
checkboxPosition: 'prefix' | 'suffix';
|
|
238
|
+
readonly: boolean;
|
|
239
|
+
disabled: boolean;
|
|
240
|
+
showHeader: boolean;
|
|
241
|
+
showFooter: boolean;
|
|
242
|
+
singleDatePicker: boolean;
|
|
243
|
+
autoApply: boolean;
|
|
244
|
+
showDropdowns: boolean;
|
|
245
|
+
timePicker: boolean;
|
|
246
|
+
timePicker24Hour: boolean;
|
|
247
|
+
timePickerIncrement: number;
|
|
248
|
+
timePickerSeconds: boolean;
|
|
249
|
+
linkedCalendars: boolean;
|
|
250
|
+
autoUpdateInput: boolean;
|
|
251
|
+
alwaysShowCalendars: boolean;
|
|
252
|
+
showCustomRangeLabel: boolean;
|
|
253
|
+
startDate: Date | null;
|
|
254
|
+
endDate: Date | null;
|
|
255
|
+
minDate: Date | null;
|
|
256
|
+
maxDate: Date | null;
|
|
257
|
+
maxSpan: {
|
|
258
|
+
[key: string]: number;
|
|
259
|
+
} | null;
|
|
260
|
+
showWeekNumbers: boolean;
|
|
261
|
+
showISOWeekNumbers: boolean;
|
|
262
|
+
buttonClasses: string;
|
|
263
|
+
applyButtonClasses: string;
|
|
264
|
+
cancelButtonClasses: string;
|
|
265
|
+
isInvalidDate: ((date: Date) => boolean) | null;
|
|
266
|
+
isCustomDate: ((date: Date) => string | string[] | false) | null;
|
|
267
|
+
minYear: number;
|
|
268
|
+
maxYear: number;
|
|
269
|
+
ranges: Record<string, [Date, Date]>;
|
|
270
|
+
opens: 'left' | 'right' | 'center';
|
|
271
|
+
drops: 'up' | 'down' | 'auto';
|
|
272
|
+
headerTemplate: TemplateRef<unknown> | null;
|
|
273
|
+
footerTemplate: TemplateRef<unknown> | null;
|
|
274
|
+
dayTemplate: TemplateRef<unknown> | null;
|
|
275
|
+
ariaLabel: string;
|
|
276
|
+
ariaDescribedBy: string;
|
|
277
|
+
}
|
|
278
|
+
interface NgxDatexOutputs {
|
|
279
|
+
dateChange: NgxDatexValue | null;
|
|
280
|
+
rangeChange: {
|
|
281
|
+
startDate: Date;
|
|
282
|
+
endDate: Date | null;
|
|
283
|
+
};
|
|
284
|
+
openEvent: void;
|
|
285
|
+
closeEvent: void;
|
|
286
|
+
monthChange: Date;
|
|
287
|
+
yearChange: number;
|
|
288
|
+
dateHover: Date;
|
|
289
|
+
validationError: {
|
|
290
|
+
error: string;
|
|
291
|
+
errorCode?: string;
|
|
292
|
+
};
|
|
293
|
+
checkboxChange: boolean;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* NgxDatex - Advanced Angular Date Range Picker Component
|
|
298
|
+
*
|
|
299
|
+
* A feature-rich, accessible date picker component that provides both single date
|
|
300
|
+
* and date range selection capabilities. Built with Angular signals for optimal
|
|
301
|
+
* performance and modern Angular patterns.
|
|
302
|
+
*
|
|
303
|
+
* ## Key Features
|
|
304
|
+
* - 📅 Single date and date range selection
|
|
305
|
+
* - ⏰ Optional time picker with 12/24 hour formats
|
|
306
|
+
* - 🎨 Customizable themes and styling
|
|
307
|
+
* - 🌍 Full internationalization support
|
|
308
|
+
* - 📱 Mobile-responsive design
|
|
309
|
+
* - ♿ WCAG accessibility compliant
|
|
310
|
+
* - 🔧 Extensive configuration options
|
|
311
|
+
* - 📋 Angular Forms integration (ControlValueAccessor)
|
|
312
|
+
*
|
|
313
|
+
* ## Basic Usage
|
|
314
|
+
* ```html
|
|
315
|
+
* <ngx-datex
|
|
316
|
+
* [(ngModel)]="selectedRange"
|
|
317
|
+
* [locale]="locale"
|
|
318
|
+
* [ranges]="predefinedRanges">
|
|
319
|
+
* </ngx-datex>
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* ## Advanced Configuration
|
|
323
|
+
* ```typescript
|
|
324
|
+
* // Component
|
|
325
|
+
* export class MyComponent {
|
|
326
|
+
* selectedRange: NgxDatexValue | null = null;
|
|
327
|
+
*
|
|
328
|
+
* customRanges = {
|
|
329
|
+
* 'Today': [startOfDay(new Date()), endOfDay(new Date())],
|
|
330
|
+
* 'Last 7 Days': [startOfDay(subDays(new Date(), 6)), endOfDay(new Date())]
|
|
331
|
+
* };
|
|
332
|
+
*
|
|
333
|
+
* onDateChange(value: NgxDatexValue | null) {
|
|
334
|
+
* console.log('Selected range:', value);
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* ```html
|
|
340
|
+
* <!-- Template -->
|
|
341
|
+
* <ngx-datex
|
|
342
|
+
* [singleDatePicker]="false"
|
|
343
|
+
* [timePicker]="true"
|
|
344
|
+
* [autoApply]="false"
|
|
345
|
+
* [showDropdowns]="true"
|
|
346
|
+
* [ranges]="customRanges"
|
|
347
|
+
* [minDate]="minDate"
|
|
348
|
+
* [maxDate]="maxDate"
|
|
349
|
+
* (dateChange)="onDateChange($event)"
|
|
350
|
+
* (rangeChange)="onRangeChange($event)">
|
|
351
|
+
* </ngx-datex>
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @see {@link NgxDatexValue} for the value interface
|
|
355
|
+
* @see {@link NgxDatexConfig} for configuration options
|
|
356
|
+
* @see {@link NgxDatexLocale} for localization settings
|
|
357
|
+
* @see {@link NgxDatexTheme} for theming options
|
|
358
|
+
*/
|
|
359
|
+
declare class NgxDatex implements OnInit, OnDestroy, ControlValueAccessor {
|
|
360
|
+
inputElement: ElementRef<HTMLInputElement>;
|
|
361
|
+
calendarTemplate: TemplateRef<unknown>;
|
|
362
|
+
private readonly datexService;
|
|
363
|
+
private readonly overlayService;
|
|
364
|
+
private readonly timePickerService;
|
|
365
|
+
private readonly calendarService;
|
|
366
|
+
private readonly platformId;
|
|
367
|
+
private readonly viewContainerRef;
|
|
368
|
+
/**
|
|
369
|
+
* General configuration options for the date picker.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const config: NgxDatexConfig = {
|
|
374
|
+
* dateFormat: 'DD/MM/YYYY',
|
|
375
|
+
* firstDayOfWeek: 1,
|
|
376
|
+
* businessDaysOnly: true
|
|
377
|
+
* };
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
config: _angular_core.InputSignal<NgxDatexConfig>;
|
|
381
|
+
/**
|
|
382
|
+
* Localization settings for internationalization.
|
|
383
|
+
* Controls language, date formats, and UI text.
|
|
384
|
+
*
|
|
385
|
+
* @default SPANISH_LOCALE
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* const frenchLocale: NgxDatexLocale = {
|
|
390
|
+
* format: 'DD/MM/YYYY',
|
|
391
|
+
* daysOfWeek: ['Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa', 'Di'],
|
|
392
|
+
* applyLabel: 'Appliquer',
|
|
393
|
+
* cancelLabel: 'Annuler'
|
|
394
|
+
* };
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
locale: _angular_core.InputSignal<NgxDatexLocale>;
|
|
398
|
+
/**
|
|
399
|
+
* Theme configuration for styling the date picker.
|
|
400
|
+
* Defines colors, typography, spacing, and visual appearance.
|
|
401
|
+
*
|
|
402
|
+
* @default MATERIAL_LIGHT_THEME
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const darkTheme: NgxDatexTheme = {
|
|
407
|
+
* name: 'dark',
|
|
408
|
+
* colors: { primary: '#bb86fc', background: '#121212', ... }
|
|
409
|
+
* };
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
theme: _angular_core.InputSignal<NgxDatexTheme>;
|
|
413
|
+
/**
|
|
414
|
+
* Material form field appearance style.
|
|
415
|
+
*
|
|
416
|
+
* @default 'outline'
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```html
|
|
420
|
+
* <ngx-datex appearance="fill"></ngx-datex>
|
|
421
|
+
* <ngx-datex appearance="outline"></ngx-datex>
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
appearance: _angular_core.InputSignal<"fill" | "outline">;
|
|
425
|
+
/**
|
|
426
|
+
* Controls when the form field label should float.
|
|
427
|
+
*
|
|
428
|
+
* @default 'auto'
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```html
|
|
432
|
+
* <ngx-datex floatLabel="always"></ngx-datex>
|
|
433
|
+
* <ngx-datex floatLabel="auto"></ngx-datex>
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
floatLabel: _angular_core.InputSignal<"always" | "auto">;
|
|
437
|
+
/**
|
|
438
|
+
* Label text displayed above the input field.
|
|
439
|
+
*
|
|
440
|
+
* @default ''
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```html
|
|
444
|
+
* <ngx-datex label="Select Date Range"></ngx-datex>
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
label: _angular_core.InputSignal<string>;
|
|
448
|
+
/**
|
|
449
|
+
* Placeholder text shown when no date is selected.
|
|
450
|
+
*
|
|
451
|
+
* @default 'Seleccionar fecha'
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```html
|
|
455
|
+
* <ngx-datex placeholder="Choose your dates"></ngx-datex>
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
459
|
+
/**
|
|
460
|
+
* Material icon name for the calendar icon.
|
|
461
|
+
*
|
|
462
|
+
* @default 'calendar_today'
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```html
|
|
466
|
+
* <ngx-datex calendarIcon="event" [showCalendarIcon]="true"></ngx-datex>
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
calendarIcon: _angular_core.InputSignal<string>;
|
|
470
|
+
/**
|
|
471
|
+
* Whether to display the calendar icon.
|
|
472
|
+
*
|
|
473
|
+
* @default false
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```html
|
|
477
|
+
* <ngx-datex [showCalendarIcon]="true"></ngx-datex>
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
showCalendarIcon: _angular_core.InputSignal<boolean>;
|
|
481
|
+
/**
|
|
482
|
+
* Position of the calendar icon relative to the input.
|
|
483
|
+
*
|
|
484
|
+
* @default 'suffix'
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```html
|
|
488
|
+
* <ngx-datex [showCalendarIcon]="true" calendarIconPosition="prefix"></ngx-datex>
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
calendarIconPosition: _angular_core.InputSignal<"prefix" | "suffix">;
|
|
492
|
+
/**
|
|
493
|
+
* Whether to display a checkbox alongside the input.
|
|
494
|
+
*
|
|
495
|
+
* @default false
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```html
|
|
499
|
+
* <ngx-datex [showCheckbox]="true" (checkboxChange)="onCheckboxChange($event)"></ngx-datex>
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
showCheckbox: _angular_core.InputSignal<boolean>;
|
|
503
|
+
/**
|
|
504
|
+
* Position of the checkbox relative to the input.
|
|
505
|
+
*
|
|
506
|
+
* @default 'prefix'
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```html
|
|
510
|
+
* <ngx-datex [showCheckbox]="true" checkboxPosition="suffix"></ngx-datex>
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
checkboxPosition: _angular_core.InputSignal<"prefix" | "suffix">;
|
|
514
|
+
/**
|
|
515
|
+
* Whether the input field is readonly.
|
|
516
|
+
* When true, users can only interact with the calendar popup.
|
|
517
|
+
*
|
|
518
|
+
* @default false
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```html
|
|
522
|
+
* <ngx-datex [readonly]="true"></ngx-datex>
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
readonly: _angular_core.InputSignal<boolean>;
|
|
526
|
+
/**
|
|
527
|
+
* Whether the entire component is disabled.
|
|
528
|
+
*
|
|
529
|
+
* @default false
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```html
|
|
533
|
+
* <ngx-datex [disabled]="isFormDisabled"></ngx-datex>
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
536
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
537
|
+
/**
|
|
538
|
+
* Whether to show the calendar header with navigation controls.
|
|
539
|
+
*
|
|
540
|
+
* @default true
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```html
|
|
544
|
+
* <ngx-datex [showHeader]="false"></ngx-datex>
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
showHeader: _angular_core.InputSignal<boolean>;
|
|
548
|
+
/**
|
|
549
|
+
* Whether to show the calendar footer with apply/cancel buttons.
|
|
550
|
+
*
|
|
551
|
+
* @default true
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```html
|
|
555
|
+
* <ngx-datex [showFooter]="false" [autoApply]="true"></ngx-datex>
|
|
556
|
+
* ```
|
|
557
|
+
*/
|
|
558
|
+
showFooter: _angular_core.InputSignal<boolean>;
|
|
559
|
+
/**
|
|
560
|
+
* Whether to use single date selection mode instead of date range selection.
|
|
561
|
+
* When true, only one date can be selected at a time.
|
|
562
|
+
*
|
|
563
|
+
* @default false
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```html
|
|
567
|
+
* <!-- Single date picker -->
|
|
568
|
+
* <ngx-datex [singleDatePicker]="true"></ngx-datex>
|
|
569
|
+
*
|
|
570
|
+
* <!-- Date range picker (default) -->
|
|
571
|
+
* <ngx-datex [singleDatePicker]="false"></ngx-datex>
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
singleDatePicker: _angular_core.InputSignal<boolean>;
|
|
575
|
+
/**
|
|
576
|
+
* Whether to automatically apply the selection without requiring the Apply button.
|
|
577
|
+
* When true, selections are applied immediately. Automatically disabled when timePicker is enabled.
|
|
578
|
+
*
|
|
579
|
+
* @default false
|
|
580
|
+
*
|
|
581
|
+
* @example
|
|
582
|
+
* ```html
|
|
583
|
+
* <!-- Auto-apply selections -->
|
|
584
|
+
* <ngx-datex [autoApply]="true"></ngx-datex>
|
|
585
|
+
*
|
|
586
|
+
* <!-- Require Apply button -->
|
|
587
|
+
* <ngx-datex [autoApply]="false" [showFooter]="true"></ngx-datex>
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
autoApply: _angular_core.InputSignal<boolean>;
|
|
591
|
+
/**
|
|
592
|
+
* Whether to show month and year dropdown selectors in the calendar header.
|
|
593
|
+
* Allows quick navigation to distant dates.
|
|
594
|
+
*
|
|
595
|
+
* @default false
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```html
|
|
599
|
+
* <ngx-datex [showDropdowns]="true"></ngx-datex>
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
showDropdowns: _angular_core.InputSignal<boolean>;
|
|
603
|
+
/**
|
|
604
|
+
* Whether to enable time selection alongside date selection.
|
|
605
|
+
* Adds time picker controls to the calendar.
|
|
606
|
+
*
|
|
607
|
+
* @default false
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```html
|
|
611
|
+
* <!-- Date and time picker -->
|
|
612
|
+
* <ngx-datex [timePicker]="true" [timePicker24Hour]="true"></ngx-datex>
|
|
613
|
+
*
|
|
614
|
+
* <!-- Date only picker -->
|
|
615
|
+
* <ngx-datex [timePicker]="false"></ngx-datex>
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
timePicker: _angular_core.InputSignal<boolean>;
|
|
619
|
+
/**
|
|
620
|
+
* Whether to use 24-hour time format instead of 12-hour AM/PM format.
|
|
621
|
+
* Only applies when timePicker is enabled.
|
|
622
|
+
*
|
|
623
|
+
* @default true
|
|
624
|
+
*
|
|
625
|
+
* @example
|
|
626
|
+
* ```html
|
|
627
|
+
* <!-- 24-hour format: 14:30 -->
|
|
628
|
+
* <ngx-datex [timePicker]="true" [timePicker24Hour]="true"></ngx-datex>
|
|
629
|
+
*
|
|
630
|
+
* <!-- 12-hour format: 2:30 PM -->
|
|
631
|
+
* <ngx-datex [timePicker]="true" [timePicker24Hour]="false"></ngx-datex>
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
timePicker24Hour: _angular_core.InputSignal<boolean>;
|
|
635
|
+
/**
|
|
636
|
+
* The increment step for minute selection in the time picker.
|
|
637
|
+
* Minutes will be rounded to the nearest increment.
|
|
638
|
+
*
|
|
639
|
+
* @default 1
|
|
640
|
+
*
|
|
641
|
+
* @example
|
|
642
|
+
* ```html
|
|
643
|
+
* <!-- 15-minute increments: 00, 15, 30, 45 -->
|
|
644
|
+
* <ngx-datex [timePicker]="true" [timePickerIncrement]="15"></ngx-datex>
|
|
645
|
+
*
|
|
646
|
+
* <!-- 5-minute increments: 00, 05, 10, 15, 20... -->
|
|
647
|
+
* <ngx-datex [timePicker]="true" [timePickerIncrement]="5"></ngx-datex>
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
timePickerIncrement: _angular_core.InputSignal<number>;
|
|
651
|
+
/**
|
|
652
|
+
* Whether to show seconds in the time picker.
|
|
653
|
+
* Only applies when timePicker is enabled.
|
|
654
|
+
*
|
|
655
|
+
* @default false
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* ```html
|
|
659
|
+
* <ngx-datex [timePicker]="true" [timePickerSeconds]="true"></ngx-datex>
|
|
660
|
+
* ```
|
|
661
|
+
*/
|
|
662
|
+
timePickerSeconds: _angular_core.InputSignal<boolean>;
|
|
663
|
+
/**
|
|
664
|
+
* Whether the left and right calendars should be linked for navigation.
|
|
665
|
+
* When true, navigating one calendar automatically updates the other.
|
|
666
|
+
*
|
|
667
|
+
* @default true
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```html
|
|
671
|
+
* <!-- Linked navigation -->
|
|
672
|
+
* <ngx-datex [linkedCalendars]="true"></ngx-datex>
|
|
673
|
+
*
|
|
674
|
+
* <!-- Independent navigation -->
|
|
675
|
+
* <ngx-datex [linkedCalendars]="false"></ngx-datex>
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
linkedCalendars: _angular_core.InputSignal<boolean>;
|
|
679
|
+
/**
|
|
680
|
+
* Whether to automatically update the input field with the selected value.
|
|
681
|
+
* When false, the input remains unchanged until manually updated.
|
|
682
|
+
*
|
|
683
|
+
* @default true
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```html
|
|
687
|
+
* <!-- Auto-update input -->
|
|
688
|
+
* <ngx-datex [autoUpdateInput]="true"></ngx-datex>
|
|
689
|
+
*
|
|
690
|
+
* <!-- Manual input updates -->
|
|
691
|
+
* <ngx-datex [autoUpdateInput]="false"></ngx-datex>
|
|
692
|
+
* ```
|
|
693
|
+
*/
|
|
694
|
+
autoUpdateInput: _angular_core.InputSignal<boolean>;
|
|
695
|
+
/**
|
|
696
|
+
* Whether to always show both calendars even in single date picker mode.
|
|
697
|
+
* Useful for consistent layout regardless of picker mode.
|
|
698
|
+
*
|
|
699
|
+
* @default false
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```html
|
|
703
|
+
* <ngx-datex [singleDatePicker]="true" [alwaysShowCalendars]="true"></ngx-datex>
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
alwaysShowCalendars: _angular_core.InputSignal<boolean>;
|
|
707
|
+
/**
|
|
708
|
+
* Whether to show the "Custom Range" option in the predefined ranges list.
|
|
709
|
+
* Only applies when ranges are configured.
|
|
710
|
+
*
|
|
711
|
+
* @default true
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```html
|
|
715
|
+
* <!-- Show custom range option -->
|
|
716
|
+
* <ngx-datex [ranges]="predefinedRanges" [showCustomRangeLabel]="true"></ngx-datex>
|
|
717
|
+
*
|
|
718
|
+
* <!-- Hide custom range option -->
|
|
719
|
+
* <ngx-datex [ranges]="predefinedRanges" [showCustomRangeLabel]="false"></ngx-datex>
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
showCustomRangeLabel: _angular_core.InputSignal<boolean>;
|
|
723
|
+
readonly effectiveAutoApply: Signal<boolean>;
|
|
724
|
+
/**
|
|
725
|
+
* The initial start date for the date picker.
|
|
726
|
+
* If not provided, defaults to today.
|
|
727
|
+
*
|
|
728
|
+
* @default null
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```typescript
|
|
732
|
+
* const startDate = new Date('2024-01-01');
|
|
733
|
+
* ```
|
|
734
|
+
*
|
|
735
|
+
* ```html
|
|
736
|
+
* <ngx-datex [startDate]="startDate" [endDate]="endDate"></ngx-datex>
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
739
|
+
startDate: _angular_core.InputSignal<Date>;
|
|
740
|
+
/**
|
|
741
|
+
* The initial end date for the date picker.
|
|
742
|
+
* If not provided, defaults to the start date (single date) or today (range).
|
|
743
|
+
*
|
|
744
|
+
* @default null
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```typescript
|
|
748
|
+
* const endDate = new Date('2024-01-31');
|
|
749
|
+
* ```
|
|
750
|
+
*
|
|
751
|
+
* ```html
|
|
752
|
+
* <ngx-datex [startDate]="startDate" [endDate]="endDate"></ngx-datex>
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
endDate: _angular_core.InputSignal<Date>;
|
|
756
|
+
/**
|
|
757
|
+
* The minimum selectable date.
|
|
758
|
+
* Users cannot select dates before this date.
|
|
759
|
+
*
|
|
760
|
+
* @default null
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```typescript
|
|
764
|
+
* // Restrict to dates from today onwards
|
|
765
|
+
* const minDate = new Date();
|
|
766
|
+
* ```
|
|
767
|
+
*
|
|
768
|
+
* ```html
|
|
769
|
+
* <ngx-datex [minDate]="minDate"></ngx-datex>
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
772
|
+
minDate: _angular_core.InputSignal<Date>;
|
|
773
|
+
/**
|
|
774
|
+
* The maximum selectable date.
|
|
775
|
+
* Users cannot select dates after this date.
|
|
776
|
+
*
|
|
777
|
+
* @default null
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* ```typescript
|
|
781
|
+
* // Restrict to dates within the next year
|
|
782
|
+
* const maxDate = new Date();
|
|
783
|
+
* maxDate.setFullYear(maxDate.getFullYear() + 1);
|
|
784
|
+
* ```
|
|
785
|
+
*
|
|
786
|
+
* ```html
|
|
787
|
+
* <ngx-datex [maxDate]="maxDate"></ngx-datex>
|
|
788
|
+
* ```
|
|
789
|
+
*/
|
|
790
|
+
maxDate: _angular_core.InputSignal<Date>;
|
|
791
|
+
/**
|
|
792
|
+
* The maximum allowed span between start and end dates.
|
|
793
|
+
* Prevents users from selecting ranges that exceed the specified duration.
|
|
794
|
+
*
|
|
795
|
+
* @default null
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```typescript
|
|
799
|
+
* // Limit to 30 days maximum
|
|
800
|
+
* const maxSpan = { days: 30 };
|
|
801
|
+
*
|
|
802
|
+
* // Limit to 3 months maximum
|
|
803
|
+
* const maxSpan = { months: 3 };
|
|
804
|
+
*
|
|
805
|
+
* // Limit to 1 year maximum
|
|
806
|
+
* const maxSpan = { years: 1 };
|
|
807
|
+
* ```
|
|
808
|
+
*
|
|
809
|
+
* ```html
|
|
810
|
+
* <ngx-datex [maxSpan]="maxSpan"></ngx-datex>
|
|
811
|
+
* ```
|
|
812
|
+
*/
|
|
813
|
+
maxSpan: _angular_core.InputSignal<{
|
|
814
|
+
[key: string]: number;
|
|
815
|
+
}>;
|
|
816
|
+
/**
|
|
817
|
+
* Whether to show week numbers in the calendar.
|
|
818
|
+
* Displays ISO week numbers on the left side of each week row.
|
|
819
|
+
*
|
|
820
|
+
* @default false
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```html
|
|
824
|
+
* <ngx-datex [showWeekNumbers]="true"></ngx-datex>
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
showWeekNumbers: _angular_core.InputSignal<boolean>;
|
|
828
|
+
/**
|
|
829
|
+
* Whether to show ISO week numbers instead of standard week numbers.
|
|
830
|
+
* Only applies when showWeekNumbers is true.
|
|
831
|
+
*
|
|
832
|
+
* @default false
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```html
|
|
836
|
+
* <ngx-datex [showWeekNumbers]="true" [showISOWeekNumbers]="true"></ngx-datex>
|
|
837
|
+
* ```
|
|
838
|
+
*/
|
|
839
|
+
showISOWeekNumbers: _angular_core.InputSignal<boolean>;
|
|
840
|
+
/**
|
|
841
|
+
* CSS classes to apply to calendar buttons.
|
|
842
|
+
* Used for styling navigation and action buttons.
|
|
843
|
+
*
|
|
844
|
+
* @default 'btn btn-sm'
|
|
845
|
+
*
|
|
846
|
+
* @example
|
|
847
|
+
* ```html
|
|
848
|
+
* <ngx-datex buttonClasses="btn btn-outline-primary btn-sm"></ngx-datex>
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
buttonClasses: _angular_core.InputSignal<string>;
|
|
852
|
+
/**
|
|
853
|
+
* CSS classes to apply to the Apply button.
|
|
854
|
+
* Combined with buttonClasses for the final styling.
|
|
855
|
+
*
|
|
856
|
+
* @default 'btn-success'
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```html
|
|
860
|
+
* <ngx-datex applyButtonClasses="btn-primary"></ngx-datex>
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
863
|
+
applyButtonClasses: _angular_core.InputSignal<string>;
|
|
864
|
+
/**
|
|
865
|
+
* CSS classes to apply to the Cancel button.
|
|
866
|
+
* Combined with buttonClasses for the final styling.
|
|
867
|
+
*
|
|
868
|
+
* @default 'btn-danger'
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* ```html
|
|
872
|
+
* <ngx-datex cancelButtonClasses="btn-secondary"></ngx-datex>
|
|
873
|
+
* ```
|
|
874
|
+
*/
|
|
875
|
+
cancelButtonClasses: _angular_core.InputSignal<string>;
|
|
876
|
+
/**
|
|
877
|
+
* Function to determine if a specific date should be disabled.
|
|
878
|
+
* Return true to disable the date, false to enable it.
|
|
879
|
+
*
|
|
880
|
+
* @default null
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```typescript
|
|
884
|
+
* // Disable weekends
|
|
885
|
+
* const isInvalidDate = (date: Date): boolean => {
|
|
886
|
+
* const day = date.getDay();
|
|
887
|
+
* return day === 0 || day === 6; // Sunday or Saturday
|
|
888
|
+
* };
|
|
889
|
+
*
|
|
890
|
+
* // Disable specific dates
|
|
891
|
+
* const blackoutDates = [new Date('2024-12-25'), new Date('2024-01-01')];
|
|
892
|
+
* const isInvalidDate = (date: Date): boolean => {
|
|
893
|
+
* return blackoutDates.some(blackout =>
|
|
894
|
+
* date.toDateString() === blackout.toDateString()
|
|
895
|
+
* );
|
|
896
|
+
* };
|
|
897
|
+
* ```
|
|
898
|
+
*
|
|
899
|
+
* ```html
|
|
900
|
+
* <ngx-datex [isInvalidDate]="isInvalidDate"></ngx-datex>
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
isInvalidDate: _angular_core.InputSignal<(date: Date) => boolean>;
|
|
904
|
+
/**
|
|
905
|
+
* Function to apply custom CSS classes to specific dates.
|
|
906
|
+
* Return a string or array of strings for CSS classes, or false for no custom styling.
|
|
907
|
+
*
|
|
908
|
+
* @default null
|
|
909
|
+
*
|
|
910
|
+
* @example
|
|
911
|
+
* ```typescript
|
|
912
|
+
* // Highlight holidays
|
|
913
|
+
* const isCustomDate = (date: Date): string | string[] | false => {
|
|
914
|
+
* const holidays = [new Date('2024-12-25'), new Date('2024-01-01')];
|
|
915
|
+
* if (holidays.some(holiday => date.toDateString() === holiday.toDateString())) {
|
|
916
|
+
* return 'holiday-date';
|
|
917
|
+
* }
|
|
918
|
+
* return false;
|
|
919
|
+
* };
|
|
920
|
+
*
|
|
921
|
+
* // Multiple classes for different date types
|
|
922
|
+
* const isCustomDate = (date: Date): string | string[] | false => {
|
|
923
|
+
* if (date.getDay() === 0) return ['weekend', 'sunday'];
|
|
924
|
+
* if (date.getDay() === 6) return ['weekend', 'saturday'];
|
|
925
|
+
* return false;
|
|
926
|
+
* };
|
|
927
|
+
* ```
|
|
928
|
+
*
|
|
929
|
+
* ```html
|
|
930
|
+
* <ngx-datex [isCustomDate]="isCustomDate"></ngx-datex>
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
933
|
+
isCustomDate: _angular_core.InputSignal<(date: Date) => string | string[] | false>;
|
|
934
|
+
/**
|
|
935
|
+
* The minimum year to show in the year dropdown.
|
|
936
|
+
* Only applies when showDropdowns is true.
|
|
937
|
+
*
|
|
938
|
+
* @default Current year - 100
|
|
939
|
+
*
|
|
940
|
+
* @example
|
|
941
|
+
* ```html
|
|
942
|
+
* <ngx-datex [showDropdowns]="true" [minYear]="2020" [maxYear]="2030"></ngx-datex>
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
minYear: _angular_core.InputSignal<number>;
|
|
946
|
+
/**
|
|
947
|
+
* The maximum year to show in the year dropdown.
|
|
948
|
+
* Only applies when showDropdowns is true.
|
|
949
|
+
*
|
|
950
|
+
* @default Current year + 100
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```html
|
|
954
|
+
* <ngx-datex [showDropdowns]="true" [minYear]="2020" [maxYear]="2030"></ngx-datex>
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
957
|
+
maxYear: _angular_core.InputSignal<number>;
|
|
958
|
+
/**
|
|
959
|
+
* Predefined date ranges that users can quickly select.
|
|
960
|
+
* Displayed as a sidebar list for easy access to common date ranges.
|
|
961
|
+
*
|
|
962
|
+
* @default DEFAULT_RANGES
|
|
963
|
+
*
|
|
964
|
+
* @example
|
|
965
|
+
* ```typescript
|
|
966
|
+
* const customRanges = {
|
|
967
|
+
* 'Today': [startOfDay(new Date()), endOfDay(new Date())],
|
|
968
|
+
* 'Yesterday': [
|
|
969
|
+
* startOfDay(subDays(new Date(), 1)),
|
|
970
|
+
* endOfDay(subDays(new Date(), 1))
|
|
971
|
+
* ],
|
|
972
|
+
* 'Last 7 Days': [
|
|
973
|
+
* startOfDay(subDays(new Date(), 6)),
|
|
974
|
+
* endOfDay(new Date())
|
|
975
|
+
* ],
|
|
976
|
+
* 'Last 30 Days': [
|
|
977
|
+
* startOfDay(subDays(new Date(), 29)),
|
|
978
|
+
* endOfDay(new Date())
|
|
979
|
+
* ],
|
|
980
|
+
* 'This Month': [
|
|
981
|
+
* startOfMonth(new Date()),
|
|
982
|
+
* endOfMonth(new Date())
|
|
983
|
+
* ]
|
|
984
|
+
* };
|
|
985
|
+
* ```
|
|
986
|
+
*
|
|
987
|
+
* ```html
|
|
988
|
+
* <ngx-datex [ranges]="customRanges"></ngx-datex>
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
ranges: _angular_core.InputSignal<Record<string, [Date, Date]>>;
|
|
992
|
+
/**
|
|
993
|
+
* The horizontal alignment of the calendar overlay relative to the input.
|
|
994
|
+
* Controls where the calendar appears horizontally.
|
|
995
|
+
*
|
|
996
|
+
* @default 'center'
|
|
997
|
+
*
|
|
998
|
+
* @example
|
|
999
|
+
* ```html
|
|
1000
|
+
* <!-- Calendar opens to the left of the input -->
|
|
1001
|
+
* <ngx-datex opens="left"></ngx-datex>
|
|
1002
|
+
*
|
|
1003
|
+
* <!-- Calendar opens to the right of the input -->
|
|
1004
|
+
* <ngx-datex opens="right"></ngx-datex>
|
|
1005
|
+
*
|
|
1006
|
+
* <!-- Calendar opens centered on the input -->
|
|
1007
|
+
* <ngx-datex opens="center"></ngx-datex>
|
|
1008
|
+
* ```
|
|
1009
|
+
*/
|
|
1010
|
+
opens: _angular_core.InputSignal<"left" | "right" | "center">;
|
|
1011
|
+
/**
|
|
1012
|
+
* The vertical alignment of the calendar overlay relative to the input.
|
|
1013
|
+
* Controls where the calendar appears vertically.
|
|
1014
|
+
*
|
|
1015
|
+
* @default 'auto'
|
|
1016
|
+
*
|
|
1017
|
+
* @example
|
|
1018
|
+
* ```html
|
|
1019
|
+
* <!-- Calendar always opens below the input -->
|
|
1020
|
+
* <ngx-datex drops="down"></ngx-datex>
|
|
1021
|
+
*
|
|
1022
|
+
* <!-- Calendar always opens above the input -->
|
|
1023
|
+
* <ngx-datex drops="up"></ngx-datex>
|
|
1024
|
+
*
|
|
1025
|
+
* <!-- Calendar opens in the best available space -->
|
|
1026
|
+
* <ngx-datex drops="auto"></ngx-datex>
|
|
1027
|
+
* ```
|
|
1028
|
+
*/
|
|
1029
|
+
drops: _angular_core.InputSignal<"auto" | "up" | "down">;
|
|
1030
|
+
/**
|
|
1031
|
+
* Custom template for the calendar header.
|
|
1032
|
+
* Allows complete customization of the header area including navigation controls.
|
|
1033
|
+
*
|
|
1034
|
+
* @default null
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```html
|
|
1038
|
+
* <ngx-datex [headerTemplate]="customHeader">
|
|
1039
|
+
* </ngx-datex>
|
|
1040
|
+
*
|
|
1041
|
+
* <ng-template #customHeader>
|
|
1042
|
+
* <div class="custom-header">
|
|
1043
|
+
* <button (click)="previousMonth()">Previous</button>
|
|
1044
|
+
* <span>{{ currentMonth }}</span>
|
|
1045
|
+
* <button (click)="nextMonth()">Next</button>
|
|
1046
|
+
* </div>
|
|
1047
|
+
* </ng-template>
|
|
1048
|
+
* ```
|
|
1049
|
+
*/
|
|
1050
|
+
headerTemplate: _angular_core.InputSignal<TemplateRef<unknown>>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Custom template for the calendar footer.
|
|
1053
|
+
* Allows complete customization of the footer area including action buttons.
|
|
1054
|
+
*
|
|
1055
|
+
* @default null
|
|
1056
|
+
*
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```html
|
|
1059
|
+
* <ngx-datex [footerTemplate]="customFooter">
|
|
1060
|
+
* </ngx-datex>
|
|
1061
|
+
*
|
|
1062
|
+
* <ng-template #customFooter>
|
|
1063
|
+
* <div class="custom-footer">
|
|
1064
|
+
* <button (click)="clearSelection()">Clear</button>
|
|
1065
|
+
* <button (click)="applySelection()">Apply</button>
|
|
1066
|
+
* </div>
|
|
1067
|
+
* </ng-template>
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
footerTemplate: _angular_core.InputSignal<TemplateRef<unknown>>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Custom template for individual calendar day cells.
|
|
1073
|
+
* Allows complete customization of how each date is displayed.
|
|
1074
|
+
*
|
|
1075
|
+
* @default null
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```html
|
|
1079
|
+
* <ngx-datex [dayTemplate]="customDay">
|
|
1080
|
+
* </ngx-datex>
|
|
1081
|
+
*
|
|
1082
|
+
* <ng-template #customDay let-date="date" let-isSelected="isSelected">
|
|
1083
|
+
* <div class="custom-day" [class.selected]="isSelected">
|
|
1084
|
+
* <span>{{ date.getDate() }}</span>
|
|
1085
|
+
* <small *ngIf="hasEvent(date)">•</small>
|
|
1086
|
+
* </div>
|
|
1087
|
+
* </ng-template>
|
|
1088
|
+
* ```
|
|
1089
|
+
*/
|
|
1090
|
+
dayTemplate: _angular_core.InputSignal<TemplateRef<unknown>>;
|
|
1091
|
+
/**
|
|
1092
|
+
* ARIA label for the date picker input.
|
|
1093
|
+
* Provides accessible description for screen readers.
|
|
1094
|
+
*
|
|
1095
|
+
* @default 'Date picker'
|
|
1096
|
+
*
|
|
1097
|
+
* @example
|
|
1098
|
+
* ```html
|
|
1099
|
+
* <ngx-datex ariaLabel="Select booking dates"></ngx-datex>
|
|
1100
|
+
* <ngx-datex ariaLabel="Choose event date range"></ngx-datex>
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
ariaLabel: _angular_core.InputSignal<string>;
|
|
1104
|
+
/**
|
|
1105
|
+
* ARIA described-by attribute for the date picker input.
|
|
1106
|
+
* References additional descriptive text for screen readers.
|
|
1107
|
+
*
|
|
1108
|
+
* @default ''
|
|
1109
|
+
*
|
|
1110
|
+
* @example
|
|
1111
|
+
* ```html
|
|
1112
|
+
* <ngx-datex ariaDescribedBy="date-help-text"></ngx-datex>
|
|
1113
|
+
* <div id="date-help-text">Select your preferred date range</div>
|
|
1114
|
+
* ```
|
|
1115
|
+
*/
|
|
1116
|
+
ariaDescribedBy: _angular_core.InputSignal<string>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Emitted when the selected date or date range changes.
|
|
1119
|
+
* Provides the complete NgxDatexValue with start and end dates.
|
|
1120
|
+
*
|
|
1121
|
+
* @example
|
|
1122
|
+
* ```html
|
|
1123
|
+
* <ngx-datex (dateChange)="onDateChange($event)"></ngx-datex>
|
|
1124
|
+
* ```
|
|
1125
|
+
*
|
|
1126
|
+
* ```typescript
|
|
1127
|
+
* onDateChange(value: NgxDatexValue | null) {
|
|
1128
|
+
* if (value) {
|
|
1129
|
+
* console.log('Start:', value.startDate);
|
|
1130
|
+
* console.log('End:', value.endDate);
|
|
1131
|
+
* }
|
|
1132
|
+
* }
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
dateChange: OutputEmitterRef<NgxDatexValue | null>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Emitted when a date range is selected (not for single date picker).
|
|
1138
|
+
* Provides start and end dates separately for convenience.
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* ```html
|
|
1142
|
+
* <ngx-datex (rangeChange)="onRangeChange($event)"></ngx-datex>
|
|
1143
|
+
* ```
|
|
1144
|
+
*
|
|
1145
|
+
* ```typescript
|
|
1146
|
+
* onRangeChange(range: { startDate: Date; endDate: Date | null }) {
|
|
1147
|
+
* console.log('Range selected:', range.startDate, 'to', range.endDate);
|
|
1148
|
+
* }
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
rangeChange: OutputEmitterRef<{
|
|
1152
|
+
startDate: Date;
|
|
1153
|
+
endDate: Date | null;
|
|
1154
|
+
}>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Emitted when the calendar overlay is opened.
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```html
|
|
1160
|
+
* <ngx-datex (openEvent)="onCalendarOpen()"></ngx-datex>
|
|
1161
|
+
* ```
|
|
1162
|
+
*
|
|
1163
|
+
* ```typescript
|
|
1164
|
+
* onCalendarOpen() {
|
|
1165
|
+
* console.log('Calendar opened');
|
|
1166
|
+
* // Perform actions when calendar opens
|
|
1167
|
+
* }
|
|
1168
|
+
* ```
|
|
1169
|
+
*/
|
|
1170
|
+
openEvent: OutputEmitterRef<void>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Emitted when the calendar overlay is closed.
|
|
1173
|
+
*
|
|
1174
|
+
* @example
|
|
1175
|
+
* ```html
|
|
1176
|
+
* <ngx-datex (closeEvent)="onCalendarClose()"></ngx-datex>
|
|
1177
|
+
* ```
|
|
1178
|
+
*
|
|
1179
|
+
* ```typescript
|
|
1180
|
+
* onCalendarClose() {
|
|
1181
|
+
* console.log('Calendar closed');
|
|
1182
|
+
* // Perform cleanup or validation
|
|
1183
|
+
* }
|
|
1184
|
+
* ```
|
|
1185
|
+
*/
|
|
1186
|
+
closeEvent: OutputEmitterRef<void>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Emitted when the displayed month changes in the calendar.
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* ```html
|
|
1192
|
+
* <ngx-datex (monthChange)="onMonthChange($event)"></ngx-datex>
|
|
1193
|
+
* ```
|
|
1194
|
+
*
|
|
1195
|
+
* ```typescript
|
|
1196
|
+
* onMonthChange(date: Date) {
|
|
1197
|
+
* console.log('Month changed to:', date.getMonth() + 1, date.getFullYear());
|
|
1198
|
+
* }
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
monthChange: OutputEmitterRef<Date>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Emitted when the displayed year changes in the calendar.
|
|
1204
|
+
*
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```html
|
|
1207
|
+
* <ngx-datex (yearChange)="onYearChange($event)"></ngx-datex>
|
|
1208
|
+
* ```
|
|
1209
|
+
*
|
|
1210
|
+
* ```typescript
|
|
1211
|
+
* onYearChange(year: number) {
|
|
1212
|
+
* console.log('Year changed to:', year);
|
|
1213
|
+
* }
|
|
1214
|
+
* ```
|
|
1215
|
+
*/
|
|
1216
|
+
yearChange: OutputEmitterRef<number>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Emitted when a date is hovered in the calendar.
|
|
1219
|
+
* Useful for showing preview information or highlighting date ranges.
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* ```html
|
|
1223
|
+
* <ngx-datex (dateHover)="onDateHover($event)"></ngx-datex>
|
|
1224
|
+
* ```
|
|
1225
|
+
*
|
|
1226
|
+
* ```typescript
|
|
1227
|
+
* onDateHover(date: Date) {
|
|
1228
|
+
* console.log('Hovering over:', date);
|
|
1229
|
+
* // Show preview or update UI
|
|
1230
|
+
* }
|
|
1231
|
+
* ```
|
|
1232
|
+
*/
|
|
1233
|
+
dateHover: OutputEmitterRef<Date>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Emitted when a validation error occurs.
|
|
1236
|
+
* Provides error message and optional error code for handling.
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```html
|
|
1240
|
+
* <ngx-datex (validationError)="onValidationError($event)"></ngx-datex>
|
|
1241
|
+
* ```
|
|
1242
|
+
*
|
|
1243
|
+
* ```typescript
|
|
1244
|
+
* onValidationError(error: { error: string; errorCode?: string }) {
|
|
1245
|
+
* console.error('Validation error:', error.error);
|
|
1246
|
+
* if (error.errorCode) {
|
|
1247
|
+
* // Handle specific error types
|
|
1248
|
+
* switch (error.errorCode) {
|
|
1249
|
+
* case 'MIN_DATE':
|
|
1250
|
+
* // Handle minimum date error
|
|
1251
|
+
* break;
|
|
1252
|
+
* case 'MAX_DATE':
|
|
1253
|
+
* // Handle maximum date error
|
|
1254
|
+
* break;
|
|
1255
|
+
* }
|
|
1256
|
+
* }
|
|
1257
|
+
* }
|
|
1258
|
+
* ```
|
|
1259
|
+
*/
|
|
1260
|
+
validationError: OutputEmitterRef<{
|
|
1261
|
+
error: string;
|
|
1262
|
+
errorCode?: string;
|
|
1263
|
+
}>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Emitted when the checkbox state changes (if showCheckbox is enabled).
|
|
1266
|
+
*
|
|
1267
|
+
* @example
|
|
1268
|
+
* ```html
|
|
1269
|
+
* <ngx-datex [showCheckbox]="true" (checkboxChange)="onCheckboxChange($event)"></ngx-datex>
|
|
1270
|
+
* ```
|
|
1271
|
+
*
|
|
1272
|
+
* ```typescript
|
|
1273
|
+
* onCheckboxChange(checked: boolean) {
|
|
1274
|
+
* console.log('Checkbox is now:', checked ? 'checked' : 'unchecked');
|
|
1275
|
+
* }
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
checkboxChange: OutputEmitterRef<boolean>;
|
|
1279
|
+
private readonly _isOpen;
|
|
1280
|
+
private readonly _currentValue;
|
|
1281
|
+
private readonly _leftCalendarMonth;
|
|
1282
|
+
private readonly _rightCalendarMonth;
|
|
1283
|
+
private readonly _hoverDate;
|
|
1284
|
+
private readonly _errorMessage;
|
|
1285
|
+
private readonly _startTime;
|
|
1286
|
+
private readonly _endTime;
|
|
1287
|
+
private readonly _overlayPosition;
|
|
1288
|
+
private readonly _inputFocused;
|
|
1289
|
+
private readonly _displayValue;
|
|
1290
|
+
private readonly _checkboxValue;
|
|
1291
|
+
private readonly _leftCalendarMatrix;
|
|
1292
|
+
private readonly _rightCalendarMatrix;
|
|
1293
|
+
private _internalStartDate;
|
|
1294
|
+
private _internalEndDate;
|
|
1295
|
+
private oldStartDate;
|
|
1296
|
+
private oldEndDate;
|
|
1297
|
+
private previousRightTime;
|
|
1298
|
+
get currentStartDate(): Date;
|
|
1299
|
+
set currentStartDate(value: Date);
|
|
1300
|
+
get currentEndDate(): Date | null;
|
|
1301
|
+
set currentEndDate(value: Date | null);
|
|
1302
|
+
readonly isOpen: Signal<boolean>;
|
|
1303
|
+
readonly currentValue: Signal<NgxDatexValue | null>;
|
|
1304
|
+
readonly displayValue: Signal<string>;
|
|
1305
|
+
readonly hasStartDate: Signal<boolean>;
|
|
1306
|
+
readonly hasEndDate: Signal<boolean>;
|
|
1307
|
+
readonly leftCalendarMonth: Signal<Date>;
|
|
1308
|
+
readonly rightCalendarMonth: Signal<Date>;
|
|
1309
|
+
readonly leftCalendarMatrix: Signal<Date[][]>;
|
|
1310
|
+
readonly rightCalendarMatrix: Signal<Date[][]>;
|
|
1311
|
+
readonly errorMessage: Signal<string>;
|
|
1312
|
+
readonly hasError: Signal<boolean>;
|
|
1313
|
+
readonly checkboxValue: Signal<boolean>;
|
|
1314
|
+
readonly leftCalendarMonthValue: Signal<number>;
|
|
1315
|
+
readonly leftCalendarYearValue: Signal<number>;
|
|
1316
|
+
readonly rightCalendarMonthValue: Signal<number>;
|
|
1317
|
+
readonly rightCalendarYearValue: Signal<number>;
|
|
1318
|
+
readonly monthNames: Signal<string[]>;
|
|
1319
|
+
readonly daysOfWeek: Signal<string[]>;
|
|
1320
|
+
readonly availableYears: Signal<number[]>;
|
|
1321
|
+
readonly rangeEntries: Signal<{
|
|
1322
|
+
label: string;
|
|
1323
|
+
range: [Date, Date];
|
|
1324
|
+
}[]>;
|
|
1325
|
+
readonly showRanges: Signal<boolean>;
|
|
1326
|
+
readonly isMobileDevice: Signal<boolean>;
|
|
1327
|
+
readonly headerTitle: Signal<string>;
|
|
1328
|
+
readonly canApplyValue: Signal<boolean>;
|
|
1329
|
+
readonly arrowDirection: Signal<'up' | 'down' | 'left' | 'right'>;
|
|
1330
|
+
readonly arrowAlignment: Signal<'start' | 'center' | 'end'>;
|
|
1331
|
+
readonly formattedSelectedRange: Signal<string>;
|
|
1332
|
+
readonly currentLabel: Signal<string>;
|
|
1333
|
+
readonly isCustomRange: Signal<boolean>;
|
|
1334
|
+
readonly selectedStartHour: Signal<number>;
|
|
1335
|
+
readonly selectedStartMinute: Signal<number>;
|
|
1336
|
+
readonly selectedStartAmPm: Signal<string>;
|
|
1337
|
+
readonly selectedEndHour: Signal<number>;
|
|
1338
|
+
readonly selectedEndMinute: Signal<number>;
|
|
1339
|
+
readonly selectedEndAmPm: Signal<string>;
|
|
1340
|
+
readonly hours24: Signal<number[]>;
|
|
1341
|
+
readonly hours12: Signal<number[]>;
|
|
1342
|
+
readonly minutes: Signal<number[]>;
|
|
1343
|
+
readonly availableStartHours: Signal<{
|
|
1344
|
+
value: number;
|
|
1345
|
+
disabled: boolean;
|
|
1346
|
+
}[]>;
|
|
1347
|
+
readonly availableEndHours: Signal<{
|
|
1348
|
+
value: number;
|
|
1349
|
+
disabled: boolean;
|
|
1350
|
+
}[]>;
|
|
1351
|
+
readonly availableStartMinutes: Signal<{
|
|
1352
|
+
value: number;
|
|
1353
|
+
disabled: boolean;
|
|
1354
|
+
}[]>;
|
|
1355
|
+
readonly availableEndMinutes: Signal<{
|
|
1356
|
+
value: number;
|
|
1357
|
+
disabled: boolean;
|
|
1358
|
+
}[]>;
|
|
1359
|
+
private onChange;
|
|
1360
|
+
private onTouched;
|
|
1361
|
+
constructor();
|
|
1362
|
+
ngOnInit(): void;
|
|
1363
|
+
ngOnDestroy(): void;
|
|
1364
|
+
writeValue(value: NgxDatexValue | null): void;
|
|
1365
|
+
registerOnChange(fn: (value: NgxDatexValue | null) => void): void;
|
|
1366
|
+
registerOnTouched(fn: () => void): void;
|
|
1367
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1368
|
+
/**
|
|
1369
|
+
* Toggles the calendar visibility.
|
|
1370
|
+
* Opens the calendar if closed, closes it if open.
|
|
1371
|
+
* Does nothing if the component is disabled or readonly.
|
|
1372
|
+
*
|
|
1373
|
+
* @example
|
|
1374
|
+
* ```typescript
|
|
1375
|
+
* // In component
|
|
1376
|
+
* @ViewChild(NgxDatex) datePicker!: NgxDatex;
|
|
1377
|
+
*
|
|
1378
|
+
* togglePicker() {
|
|
1379
|
+
* this.datePicker.toggle();
|
|
1380
|
+
* }
|
|
1381
|
+
* ```
|
|
1382
|
+
*/
|
|
1383
|
+
toggle(): void;
|
|
1384
|
+
/**
|
|
1385
|
+
* Opens the calendar overlay.
|
|
1386
|
+
* Saves current state for potential cancellation and initializes the calendar view.
|
|
1387
|
+
*
|
|
1388
|
+
* @example
|
|
1389
|
+
* ```typescript
|
|
1390
|
+
* // Programmatically open the calendar
|
|
1391
|
+
* this.datePicker.openCalendar();
|
|
1392
|
+
* ```
|
|
1393
|
+
*/
|
|
1394
|
+
openCalendar(): void;
|
|
1395
|
+
/**
|
|
1396
|
+
* Closes the calendar overlay.
|
|
1397
|
+
* Handles incomplete selections and emits change events if values have changed.
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* ```typescript
|
|
1401
|
+
* // Programmatically close the calendar
|
|
1402
|
+
* this.datePicker.closeCalendar();
|
|
1403
|
+
* ```
|
|
1404
|
+
*/
|
|
1405
|
+
closeCalendar(): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Applies the current selection and closes the calendar.
|
|
1408
|
+
* Only works if there's a valid selection to apply.
|
|
1409
|
+
*
|
|
1410
|
+
* @example
|
|
1411
|
+
* ```typescript
|
|
1412
|
+
* // Apply current selection programmatically
|
|
1413
|
+
* if (this.datePicker.canApplyValue()) {
|
|
1414
|
+
* this.datePicker.apply();
|
|
1415
|
+
* }
|
|
1416
|
+
* ```
|
|
1417
|
+
*/
|
|
1418
|
+
apply(): void;
|
|
1419
|
+
/**
|
|
1420
|
+
* Cancels the current selection and reverts to the previous values.
|
|
1421
|
+
* Closes the calendar without applying changes.
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* ```typescript
|
|
1425
|
+
* // Cancel current selection
|
|
1426
|
+
* this.datePicker.cancel();
|
|
1427
|
+
* ```
|
|
1428
|
+
*/
|
|
1429
|
+
cancel(): void;
|
|
1430
|
+
/**
|
|
1431
|
+
* Selects a specific date in the calendar.
|
|
1432
|
+
* Handles both single date and range selection logic.
|
|
1433
|
+
*
|
|
1434
|
+
* @param date - The date to select
|
|
1435
|
+
*
|
|
1436
|
+
* @example
|
|
1437
|
+
* ```typescript
|
|
1438
|
+
* // Programmatically select a date
|
|
1439
|
+
* const today = new Date();
|
|
1440
|
+
* this.datePicker.selectDate(today);
|
|
1441
|
+
* ```
|
|
1442
|
+
*/
|
|
1443
|
+
selectDate(date: Date): void;
|
|
1444
|
+
/**
|
|
1445
|
+
* Selects a predefined date range by label.
|
|
1446
|
+
*
|
|
1447
|
+
* @param label - The label of the range to select (must exist in ranges configuration)
|
|
1448
|
+
*
|
|
1449
|
+
* @example
|
|
1450
|
+
* ```typescript
|
|
1451
|
+
* // Select "Last 7 days" range
|
|
1452
|
+
* this.datePicker.selectRange('Last 7 days');
|
|
1453
|
+
* ```
|
|
1454
|
+
*/
|
|
1455
|
+
selectRange(label: string): void;
|
|
1456
|
+
selectCustomRange(): void;
|
|
1457
|
+
onInputClick(): void;
|
|
1458
|
+
onInputFocus(): void;
|
|
1459
|
+
onInputBlur(): void;
|
|
1460
|
+
onInputKeydown(event: KeyboardEvent): void;
|
|
1461
|
+
onInputKeyup(): void;
|
|
1462
|
+
onDateHover(date: Date): void;
|
|
1463
|
+
onCalendarMouseLeave(): void;
|
|
1464
|
+
onCalendarKeydown(event: KeyboardEvent): void;
|
|
1465
|
+
onCheckboxChange(checked: boolean): void;
|
|
1466
|
+
previousMonth(calendar: 'left' | 'right'): void;
|
|
1467
|
+
nextMonth(calendar: 'left' | 'right'): void;
|
|
1468
|
+
canNavigatePrevious(calendar: 'left' | 'right'): boolean;
|
|
1469
|
+
canNavigateNext(calendar: 'left' | 'right'): boolean;
|
|
1470
|
+
onMonthChange(calendar: 'left' | 'right', event: Event): void;
|
|
1471
|
+
onYearChange(calendar: 'left' | 'right', event: Event): void;
|
|
1472
|
+
isRangeActive(label: string): boolean;
|
|
1473
|
+
isDisabled(date: Date): boolean;
|
|
1474
|
+
isSelected(date: Date): boolean;
|
|
1475
|
+
isInRange(date: Date): boolean;
|
|
1476
|
+
isRangeStart(date: Date): boolean;
|
|
1477
|
+
isRangeEnd(date: Date): boolean;
|
|
1478
|
+
isToday(date: Date): boolean;
|
|
1479
|
+
isOtherMonth(date: Date, calendarMonth: Date): boolean;
|
|
1480
|
+
isHovered(date: Date): boolean;
|
|
1481
|
+
isHoverStart(date: Date): boolean;
|
|
1482
|
+
isHoverEnd(date: Date): boolean;
|
|
1483
|
+
formatDateForAria(date: Date): string;
|
|
1484
|
+
onStartHourChange(event: Event): void;
|
|
1485
|
+
onStartMinuteChange(event: Event): void;
|
|
1486
|
+
onStartAmPmChange(event: Event): void;
|
|
1487
|
+
onEndHourChange(event: Event): void;
|
|
1488
|
+
onEndMinuteChange(event: Event): void;
|
|
1489
|
+
onEndAmPmChange(event: Event): void;
|
|
1490
|
+
private initializeComponent;
|
|
1491
|
+
private initializeDefaultDates;
|
|
1492
|
+
private initializeWithInputDates;
|
|
1493
|
+
private initializeCalendars;
|
|
1494
|
+
private updateMonthsInView;
|
|
1495
|
+
private updateLeftCalendarMatrix;
|
|
1496
|
+
private updateRightCalendarMatrix;
|
|
1497
|
+
private updateTimeSignalsFromDate;
|
|
1498
|
+
private setStartDate;
|
|
1499
|
+
private setEndDate;
|
|
1500
|
+
private updateElement;
|
|
1501
|
+
private updateCurrentValue;
|
|
1502
|
+
private emitValueChange;
|
|
1503
|
+
private updateView;
|
|
1504
|
+
private updateTimePickers;
|
|
1505
|
+
private updateTimeFromPicker;
|
|
1506
|
+
private elementChanged;
|
|
1507
|
+
private parseInputDate;
|
|
1508
|
+
private createOverlay;
|
|
1509
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDatex, never>;
|
|
1510
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgxDatex, "ngx-datex", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "floatLabel": { "alias": "floatLabel"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "calendarIcon": { "alias": "calendarIcon"; "required": false; "isSignal": true; }; "showCalendarIcon": { "alias": "showCalendarIcon"; "required": false; "isSignal": true; }; "calendarIconPosition": { "alias": "calendarIconPosition"; "required": false; "isSignal": true; }; "showCheckbox": { "alias": "showCheckbox"; "required": false; "isSignal": true; }; "checkboxPosition": { "alias": "checkboxPosition"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "showHeader": { "alias": "showHeader"; "required": false; "isSignal": true; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "singleDatePicker": { "alias": "singleDatePicker"; "required": false; "isSignal": true; }; "autoApply": { "alias": "autoApply"; "required": false; "isSignal": true; }; "showDropdowns": { "alias": "showDropdowns"; "required": false; "isSignal": true; }; "timePicker": { "alias": "timePicker"; "required": false; "isSignal": true; }; "timePicker24Hour": { "alias": "timePicker24Hour"; "required": false; "isSignal": true; }; "timePickerIncrement": { "alias": "timePickerIncrement"; "required": false; "isSignal": true; }; "timePickerSeconds": { "alias": "timePickerSeconds"; "required": false; "isSignal": true; }; "linkedCalendars": { "alias": "linkedCalendars"; "required": false; "isSignal": true; }; "autoUpdateInput": { "alias": "autoUpdateInput"; "required": false; "isSignal": true; }; "alwaysShowCalendars": { "alias": "alwaysShowCalendars"; "required": false; "isSignal": true; }; "showCustomRangeLabel": { "alias": "showCustomRangeLabel"; "required": false; "isSignal": true; }; "startDate": { "alias": "startDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "endDate"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "maxSpan": { "alias": "maxSpan"; "required": false; "isSignal": true; }; "showWeekNumbers": { "alias": "showWeekNumbers"; "required": false; "isSignal": true; }; "showISOWeekNumbers": { "alias": "showISOWeekNumbers"; "required": false; "isSignal": true; }; "buttonClasses": { "alias": "buttonClasses"; "required": false; "isSignal": true; }; "applyButtonClasses": { "alias": "applyButtonClasses"; "required": false; "isSignal": true; }; "cancelButtonClasses": { "alias": "cancelButtonClasses"; "required": false; "isSignal": true; }; "isInvalidDate": { "alias": "isInvalidDate"; "required": false; "isSignal": true; }; "isCustomDate": { "alias": "isCustomDate"; "required": false; "isSignal": true; }; "minYear": { "alias": "minYear"; "required": false; "isSignal": true; }; "maxYear": { "alias": "maxYear"; "required": false; "isSignal": true; }; "ranges": { "alias": "ranges"; "required": false; "isSignal": true; }; "opens": { "alias": "opens"; "required": false; "isSignal": true; }; "drops": { "alias": "drops"; "required": false; "isSignal": true; }; "headerTemplate": { "alias": "headerTemplate"; "required": false; "isSignal": true; }; "footerTemplate": { "alias": "footerTemplate"; "required": false; "isSignal": true; }; "dayTemplate": { "alias": "dayTemplate"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; }, { "dateChange": "dateChange"; "rangeChange": "rangeChange"; "openEvent": "openEvent"; "closeEvent": "closeEvent"; "monthChange": "monthChange"; "yearChange": "yearChange"; "dateHover": "dateHover"; "validationError": "validationError"; "checkboxChange": "checkboxChange"; }, never, never, true, never>;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* @fileoverview Default configurations for NgxDatex component.
|
|
1515
|
+
*
|
|
1516
|
+
* This file contains predefined locales, themes, and date ranges
|
|
1517
|
+
* that can be used out-of-the-box or as starting points for customization.
|
|
1518
|
+
*/
|
|
1519
|
+
/**
|
|
1520
|
+
* Default Spanish locale configuration.
|
|
1521
|
+
*
|
|
1522
|
+
* Provides Spanish language support with DD/MM/YYYY format,
|
|
1523
|
+
* Spanish day/month names, and Monday as the first day of the week.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* ```typescript
|
|
1527
|
+
* <ngx-datex [locale]="SPANISH_LOCALE"></ngx-datex>
|
|
1528
|
+
* ```
|
|
1529
|
+
*/
|
|
1530
|
+
declare const SPANISH_LOCALE: NgxDatexLocale;
|
|
1531
|
+
/**
|
|
1532
|
+
* Default Material Design light theme.
|
|
1533
|
+
*
|
|
1534
|
+
* A clean, modern theme following Material Design principles
|
|
1535
|
+
* with blue primary colors and proper contrast ratios.
|
|
1536
|
+
*
|
|
1537
|
+
* @example
|
|
1538
|
+
* ```typescript
|
|
1539
|
+
* <ngx-datex [theme]="MATERIAL_LIGHT_THEME"></ngx-datex>
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
declare const MATERIAL_LIGHT_THEME: NgxDatexTheme;
|
|
1543
|
+
/**
|
|
1544
|
+
* Default predefined date ranges in Spanish.
|
|
1545
|
+
*
|
|
1546
|
+
* Provides commonly used date ranges like "Today", "Last 7 days", etc.
|
|
1547
|
+
* All ranges are calculated dynamically based on the current date.
|
|
1548
|
+
*
|
|
1549
|
+
* @example
|
|
1550
|
+
* ```typescript
|
|
1551
|
+
* <ngx-datex [ranges]="DEFAULT_RANGES"></ngx-datex>
|
|
1552
|
+
*
|
|
1553
|
+
* // Or customize with your own ranges
|
|
1554
|
+
* const customRanges = {
|
|
1555
|
+
* ...DEFAULT_RANGES,
|
|
1556
|
+
* 'Custom Range': [startDate, endDate]
|
|
1557
|
+
* };
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
declare const DEFAULT_RANGES: Record<string, [Date, Date]>;
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Core service for NgxDatex component operations.
|
|
1564
|
+
*
|
|
1565
|
+
* Provides essential functionality for:
|
|
1566
|
+
* - Configuration management
|
|
1567
|
+
* - Locale handling
|
|
1568
|
+
* - Date formatting
|
|
1569
|
+
* - Calendar matrix generation
|
|
1570
|
+
* - Date validation
|
|
1571
|
+
*
|
|
1572
|
+
* @example
|
|
1573
|
+
* ```typescript
|
|
1574
|
+
* // Inject the service
|
|
1575
|
+
* constructor(private datexService: NgxDatexService) {}
|
|
1576
|
+
*
|
|
1577
|
+
* // Update configuration
|
|
1578
|
+
* this.datexService.updateConfig({
|
|
1579
|
+
* dateFormat: 'DD/MM/YYYY',
|
|
1580
|
+
* firstDayOfWeek: 1
|
|
1581
|
+
* });
|
|
1582
|
+
*
|
|
1583
|
+
* // Format a date range
|
|
1584
|
+
* const formatted = this.datexService.formatDateValue(dateRange, 'DD/MM/YYYY');
|
|
1585
|
+
* ```
|
|
1586
|
+
*/
|
|
1587
|
+
declare class NgxDatexService {
|
|
1588
|
+
private config;
|
|
1589
|
+
private locale;
|
|
1590
|
+
/**
|
|
1591
|
+
* Updates the component configuration.
|
|
1592
|
+
*
|
|
1593
|
+
* @param config - Partial configuration object to merge with existing config
|
|
1594
|
+
*
|
|
1595
|
+
* @example
|
|
1596
|
+
* ```typescript
|
|
1597
|
+
* this.datexService.updateConfig({
|
|
1598
|
+
* dateFormat: 'YYYY-MM-DD',
|
|
1599
|
+
* firstDayOfWeek: 0, // Sunday
|
|
1600
|
+
* businessDaysOnly: true
|
|
1601
|
+
* });
|
|
1602
|
+
* ```
|
|
1603
|
+
*/
|
|
1604
|
+
updateConfig(config: NgxDatexConfig): void;
|
|
1605
|
+
/**
|
|
1606
|
+
* Sets the locale configuration for internationalization.
|
|
1607
|
+
*
|
|
1608
|
+
* @param locale - Locale configuration object
|
|
1609
|
+
*
|
|
1610
|
+
* @example
|
|
1611
|
+
* ```typescript
|
|
1612
|
+
* this.datexService.setLocale({
|
|
1613
|
+
* format: 'DD/MM/YYYY',
|
|
1614
|
+
* daysOfWeek: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
|
|
1615
|
+
* monthNames: ['Enero', 'Febrero', ...],
|
|
1616
|
+
* applyLabel: 'Aplicar',
|
|
1617
|
+
* cancelLabel: 'Cancelar'
|
|
1618
|
+
* });
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
setLocale(locale: NgxDatexLocale): void;
|
|
1622
|
+
/**
|
|
1623
|
+
* Formats a date range value into a display string.
|
|
1624
|
+
*
|
|
1625
|
+
* @param value - The date range value to format
|
|
1626
|
+
* @param format - Optional format string (uses locale format if not provided)
|
|
1627
|
+
* @returns Formatted date string
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```typescript
|
|
1631
|
+
* const dateRange: NgxDatexValue = {
|
|
1632
|
+
* startDate: new Date('2024-01-01'),
|
|
1633
|
+
* endDate: new Date('2024-01-31')
|
|
1634
|
+
* };
|
|
1635
|
+
*
|
|
1636
|
+
* const formatted = this.datexService.formatDateValue(dateRange, 'DD/MM/YYYY');
|
|
1637
|
+
* // Returns: "01/01/2024 - 31/01/2024"
|
|
1638
|
+
* ```
|
|
1639
|
+
*/
|
|
1640
|
+
formatDateValue(value: NgxDatexValue | null, format?: string): string;
|
|
1641
|
+
buildCalendarMatrix(month: Date): Date[][];
|
|
1642
|
+
validateDate(date: Date): NgxDatexValidationResult;
|
|
1643
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDatexService, never>;
|
|
1644
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxDatexService>;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* @fileoverview NgxDatex Overlay Service
|
|
1649
|
+
*
|
|
1650
|
+
* Service responsible for managing the calendar overlay positioning, creation, and lifecycle.
|
|
1651
|
+
* Handles both desktop and mobile overlay strategies with proper event management.
|
|
1652
|
+
*/
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Service for managing calendar overlay positioning and lifecycle.
|
|
1656
|
+
*
|
|
1657
|
+
* Provides methods to create, position, and manage the calendar overlay
|
|
1658
|
+
* with support for both desktop and mobile layouts. Handles click outside
|
|
1659
|
+
* detection, keyboard events, and responsive positioning.
|
|
1660
|
+
*
|
|
1661
|
+
* @example
|
|
1662
|
+
* ```typescript
|
|
1663
|
+
* // In component
|
|
1664
|
+
* constructor(private overlayService: NgxDatexOverlayService) {}
|
|
1665
|
+
*
|
|
1666
|
+
* openCalendar() {
|
|
1667
|
+
* this.overlayService.createOverlay(
|
|
1668
|
+
* this.inputElement,
|
|
1669
|
+
* this.calendarTemplate,
|
|
1670
|
+
* this.viewContainerRef,
|
|
1671
|
+
* this.locale,
|
|
1672
|
+
* 'center',
|
|
1673
|
+
* 'auto',
|
|
1674
|
+
* () => this.closeCalendar(),
|
|
1675
|
+
* (event) => this.handleKeydown(event),
|
|
1676
|
+
* (position) => this.updatePosition(position)
|
|
1677
|
+
* );
|
|
1678
|
+
* }
|
|
1679
|
+
* ```
|
|
1680
|
+
*/
|
|
1681
|
+
declare class NgxDatexOverlayService {
|
|
1682
|
+
private overlayRef?;
|
|
1683
|
+
private readonly overlay;
|
|
1684
|
+
/**
|
|
1685
|
+
* Creates and configures the calendar overlay.
|
|
1686
|
+
*
|
|
1687
|
+
* Sets up the overlay with appropriate positioning strategy, event handlers,
|
|
1688
|
+
* and responsive behavior. Reuses existing overlay if already created.
|
|
1689
|
+
*
|
|
1690
|
+
* @param inputElement - Reference to the input element for positioning
|
|
1691
|
+
* @param calendarTemplate - Template reference for the calendar content
|
|
1692
|
+
* @param viewContainerRef - View container for template portal
|
|
1693
|
+
* @param locale - Localization settings for RTL/LTR direction
|
|
1694
|
+
* @param opens - Horizontal alignment preference
|
|
1695
|
+
* @param drops - Vertical alignment preference
|
|
1696
|
+
* @param onOutsideClick - Callback for clicks outside the overlay
|
|
1697
|
+
* @param onKeydown - Callback for keyboard events
|
|
1698
|
+
* @param onPositionChange - Callback for position updates
|
|
1699
|
+
* @returns The created or existing overlay reference
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* ```typescript
|
|
1703
|
+
* const overlayRef = this.overlayService.createOverlay(
|
|
1704
|
+
* this.inputElement,
|
|
1705
|
+
* this.calendarTemplate,
|
|
1706
|
+
* this.viewContainerRef,
|
|
1707
|
+
* this.locale(),
|
|
1708
|
+
* this.opens(),
|
|
1709
|
+
* this.drops(),
|
|
1710
|
+
* () => this.closeCalendar(),
|
|
1711
|
+
* (event) => {
|
|
1712
|
+
* if (event.key === 'Escape') {
|
|
1713
|
+
* this.closeCalendar();
|
|
1714
|
+
* }
|
|
1715
|
+
* },
|
|
1716
|
+
* (position) => this.updateArrowPosition(position)
|
|
1717
|
+
* );
|
|
1718
|
+
* ```
|
|
1719
|
+
*/
|
|
1720
|
+
createOverlay(inputElement: ElementRef<HTMLInputElement>, calendarTemplate: TemplateRef<unknown>, viewContainerRef: ViewContainerRef, locale: NgxDatexLocale, opens: 'left' | 'right' | 'center', drops: 'up' | 'down' | 'auto', onOutsideClick: () => void, onKeydown: (event: KeyboardEvent) => void, onPositionChange: (position: NgxDatexOverlayPosition) => void): OverlayRef;
|
|
1721
|
+
/**
|
|
1722
|
+
* Closes the calendar overlay without disposing it.
|
|
1723
|
+
*
|
|
1724
|
+
* Detaches the overlay content while keeping the overlay reference
|
|
1725
|
+
* for potential reuse. The overlay can be reopened without recreation.
|
|
1726
|
+
*
|
|
1727
|
+
* @example
|
|
1728
|
+
* ```typescript
|
|
1729
|
+
* // Close the overlay
|
|
1730
|
+
* this.overlayService.closeOverlay();
|
|
1731
|
+
* ```
|
|
1732
|
+
*/
|
|
1733
|
+
closeOverlay(): void;
|
|
1734
|
+
/**
|
|
1735
|
+
* Completely disposes of the overlay and cleans up resources.
|
|
1736
|
+
*
|
|
1737
|
+
* Detaches content, disposes the overlay reference, and cleans up
|
|
1738
|
+
* all associated resources. Should be called during component destruction.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```typescript
|
|
1742
|
+
* ngOnDestroy() {
|
|
1743
|
+
* this.overlayService.disposeOverlay();
|
|
1744
|
+
* }
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
disposeOverlay(): void;
|
|
1748
|
+
/**
|
|
1749
|
+
* Sets up event listeners for the overlay.
|
|
1750
|
+
*
|
|
1751
|
+
* Configures click outside detection and keyboard event handling
|
|
1752
|
+
* with different strategies for desktop and mobile devices.
|
|
1753
|
+
*
|
|
1754
|
+
* @private
|
|
1755
|
+
* @param inputElement - Reference to the input element
|
|
1756
|
+
* @param onOutsideClick - Callback for outside clicks
|
|
1757
|
+
* @param onKeydown - Callback for keyboard events
|
|
1758
|
+
*/
|
|
1759
|
+
private setupOverlayEvents;
|
|
1760
|
+
/**
|
|
1761
|
+
* Creates the overlay configuration based on device type and preferences.
|
|
1762
|
+
*
|
|
1763
|
+
* Returns different configurations for mobile and desktop devices,
|
|
1764
|
+
* with appropriate positioning strategies and styling.
|
|
1765
|
+
*
|
|
1766
|
+
* @private
|
|
1767
|
+
* @param inputElement - Reference to the input element
|
|
1768
|
+
* @param locale - Localization settings
|
|
1769
|
+
* @param opens - Horizontal alignment preference
|
|
1770
|
+
* @param drops - Vertical alignment preference
|
|
1771
|
+
* @param onPositionChange - Callback for position updates
|
|
1772
|
+
* @returns Overlay configuration object
|
|
1773
|
+
*/
|
|
1774
|
+
private getOverlayConfig;
|
|
1775
|
+
/**
|
|
1776
|
+
* Creates the flexible positioning strategy for desktop overlays.
|
|
1777
|
+
*
|
|
1778
|
+
* Configures multiple fallback positions based on user preferences
|
|
1779
|
+
* and available space, with automatic repositioning on scroll.
|
|
1780
|
+
*
|
|
1781
|
+
* @private
|
|
1782
|
+
* @param inputElement - Reference to the input element
|
|
1783
|
+
* @param opens - Horizontal alignment preference
|
|
1784
|
+
* @param drops - Vertical alignment preference
|
|
1785
|
+
* @param onPositionChange - Callback for position updates
|
|
1786
|
+
* @returns Flexible connected position strategy
|
|
1787
|
+
*/
|
|
1788
|
+
private getPositionStrategy;
|
|
1789
|
+
/**
|
|
1790
|
+
* Generates position configurations based on user preferences.
|
|
1791
|
+
*
|
|
1792
|
+
* Creates an array of connected positions with fallbacks,
|
|
1793
|
+
* prioritizing user preferences while providing alternatives
|
|
1794
|
+
* when space is limited.
|
|
1795
|
+
*
|
|
1796
|
+
* @private
|
|
1797
|
+
* @param opens - Horizontal alignment preference
|
|
1798
|
+
* @param drops - Vertical alignment preference
|
|
1799
|
+
* @returns Array of connected position configurations
|
|
1800
|
+
*/
|
|
1801
|
+
private getPositions;
|
|
1802
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDatexOverlayService, never>;
|
|
1803
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxDatexOverlayService>;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Service for managing time picker operations and validations.
|
|
1808
|
+
*
|
|
1809
|
+
* Handles time component updates, validates time selections against date constraints,
|
|
1810
|
+
* and provides available time options based on minimum/maximum date restrictions.
|
|
1811
|
+
* Supports both 12-hour and 24-hour time formats with proper AM/PM handling.
|
|
1812
|
+
*
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```typescript
|
|
1815
|
+
* // In component
|
|
1816
|
+
* constructor(private timePickerService: NgxDatexTimePickerService) {}
|
|
1817
|
+
*
|
|
1818
|
+
* onTimeChange(side: 'start' | 'end', component: 'hour' | 'minute', value: number) {
|
|
1819
|
+
* this.timePickerService.updateTimeFromPicker(
|
|
1820
|
+
* this.currentStartDate,
|
|
1821
|
+
* this.currentEndDate,
|
|
1822
|
+
* side,
|
|
1823
|
+
* component,
|
|
1824
|
+
* value,
|
|
1825
|
+
* this.startTime,
|
|
1826
|
+
* this.endTime,
|
|
1827
|
+
* this.timePicker24Hour,
|
|
1828
|
+
* this.singleDatePicker,
|
|
1829
|
+
* (date) => this.setStartDate(date),
|
|
1830
|
+
* (date) => this.setEndDate(date),
|
|
1831
|
+
* (side, time) => this.updateTimeSignal(side, time)
|
|
1832
|
+
* );
|
|
1833
|
+
* }
|
|
1834
|
+
* ```
|
|
1835
|
+
*/
|
|
1836
|
+
declare class NgxDatexTimePickerService {
|
|
1837
|
+
/**
|
|
1838
|
+
* Updates time from picker component changes and applies to dates.
|
|
1839
|
+
*
|
|
1840
|
+
* Handles time component updates (hour, minute, AM/PM) and applies the changes
|
|
1841
|
+
* to the corresponding dates. Manages single date picker logic and ensures
|
|
1842
|
+
* end dates don't precede start dates on the same day.
|
|
1843
|
+
*
|
|
1844
|
+
* @param currentStartDate - Current start date
|
|
1845
|
+
* @param currentEndDate - Current end date (can be null)
|
|
1846
|
+
* @param side - Which time picker is being updated ('start' or 'end')
|
|
1847
|
+
* @param component - Which time component is changing ('hour', 'minute', or 'ampm')
|
|
1848
|
+
* @param value - New value for the time component
|
|
1849
|
+
* @param startTime - Current start time value
|
|
1850
|
+
* @param endTime - Current end time value
|
|
1851
|
+
* @param timePicker24Hour - Whether using 24-hour format
|
|
1852
|
+
* @param singleDatePicker - Whether in single date picker mode
|
|
1853
|
+
* @param onStartDateChange - Callback for start date changes
|
|
1854
|
+
* @param onEndDateChange - Callback for end date changes
|
|
1855
|
+
* @param onTimeChange - Callback for time signal updates
|
|
1856
|
+
*
|
|
1857
|
+
* @example
|
|
1858
|
+
* ```typescript
|
|
1859
|
+
* // Update start hour to 14 (2 PM)
|
|
1860
|
+
* this.timePickerService.updateTimeFromPicker(
|
|
1861
|
+
* this.startDate,
|
|
1862
|
+
* this.endDate,
|
|
1863
|
+
* 'start',
|
|
1864
|
+
* 'hour',
|
|
1865
|
+
* 14,
|
|
1866
|
+
* this.startTime,
|
|
1867
|
+
* this.endTime,
|
|
1868
|
+
* true, // 24-hour format
|
|
1869
|
+
* false, // range picker
|
|
1870
|
+
* (date) => this.updateStartDate(date),
|
|
1871
|
+
* (date) => this.updateEndDate(date),
|
|
1872
|
+
* (side, time) => this.updateTimeSignal(side, time)
|
|
1873
|
+
* );
|
|
1874
|
+
* ```
|
|
1875
|
+
*/
|
|
1876
|
+
updateTimeFromPicker(currentStartDate: Date, currentEndDate: Date | null, side: 'start' | 'end', component: 'hour' | 'minute' | 'ampm', value: string | number, startTime: NgxDatexTimeValue, endTime: NgxDatexTimeValue, timePicker24Hour: boolean, singleDatePicker: boolean, onStartDateChange: (date: Date) => void, onEndDateChange: (date: Date) => void, onTimeChange: (side: 'start' | 'end', time: NgxDatexTimeValue) => void): void;
|
|
1877
|
+
/**
|
|
1878
|
+
* Applies time values to a date object.
|
|
1879
|
+
*
|
|
1880
|
+
* Creates a new date with the specified time components applied.
|
|
1881
|
+
* Handles 12-hour to 24-hour conversion and ensures proper time formatting.
|
|
1882
|
+
*
|
|
1883
|
+
* @private
|
|
1884
|
+
* @param date - Base date to apply time to
|
|
1885
|
+
* @param time - Time value with hour, minute, and AM/PM
|
|
1886
|
+
* @param is24Hour - Whether using 24-hour format
|
|
1887
|
+
* @returns New date with applied time
|
|
1888
|
+
*
|
|
1889
|
+
* @example
|
|
1890
|
+
* ```typescript
|
|
1891
|
+
* const date = new Date('2024-01-15');
|
|
1892
|
+
* const time = { hour: 2, minute: 30, ampm: 'PM' };
|
|
1893
|
+
* const result = this.applyTimeToDate(date, time, false);
|
|
1894
|
+
* // Result: 2024-01-15 14:30:00
|
|
1895
|
+
* ```
|
|
1896
|
+
*/
|
|
1897
|
+
private applyTimeToDate;
|
|
1898
|
+
/**
|
|
1899
|
+
* Extracts time components from a date object.
|
|
1900
|
+
*
|
|
1901
|
+
* Converts a date to time picker format, handling both 12-hour and 24-hour
|
|
1902
|
+
* formats with proper AM/PM designation.
|
|
1903
|
+
*
|
|
1904
|
+
* @param date - Date to extract time from
|
|
1905
|
+
* @param timePicker24Hour - Whether using 24-hour format
|
|
1906
|
+
* @returns Time value object with hour, minute, and AM/PM
|
|
1907
|
+
*
|
|
1908
|
+
* @example
|
|
1909
|
+
* ```typescript
|
|
1910
|
+
* const date = new Date('2024-01-15 14:30:00');
|
|
1911
|
+
*
|
|
1912
|
+
* // 24-hour format
|
|
1913
|
+
* const time24 = this.updateTimeSignalsFromDate(date, true);
|
|
1914
|
+
* // Result: { hour: 14, minute: 30, ampm: 'AM' }
|
|
1915
|
+
*
|
|
1916
|
+
* // 12-hour format
|
|
1917
|
+
* const time12 = this.updateTimeSignalsFromDate(date, false);
|
|
1918
|
+
* // Result: { hour: 2, minute: 30, ampm: 'PM' }
|
|
1919
|
+
* ```
|
|
1920
|
+
*/
|
|
1921
|
+
updateTimeSignalsFromDate(date: Date, timePicker24Hour: boolean): NgxDatexTimeValue;
|
|
1922
|
+
/**
|
|
1923
|
+
* Gets available hours based on date constraints.
|
|
1924
|
+
*
|
|
1925
|
+
* Returns an array of hour options with disabled state based on minimum/maximum
|
|
1926
|
+
* date restrictions and start date constraints for end time selection.
|
|
1927
|
+
*
|
|
1928
|
+
* @param date - Date to get hours for
|
|
1929
|
+
* @param minDate - Minimum allowed date
|
|
1930
|
+
* @param maxDate - Maximum allowed date
|
|
1931
|
+
* @param timePicker24Hour - Whether using 24-hour format
|
|
1932
|
+
* @param timeValue - Current time value for AM/PM context
|
|
1933
|
+
* @param isEndTime - Whether this is for end time selection
|
|
1934
|
+
* @param startDate - Start date for end time validation
|
|
1935
|
+
* @returns Array of hour options with availability status
|
|
1936
|
+
*
|
|
1937
|
+
* @example
|
|
1938
|
+
* ```typescript
|
|
1939
|
+
* const availableHours = this.timePickerService.getAvailableHours(
|
|
1940
|
+
* new Date('2024-01-15'),
|
|
1941
|
+
* new Date('2024-01-15 10:00:00'), // minDate
|
|
1942
|
+
* new Date('2024-01-15 18:00:00'), // maxDate
|
|
1943
|
+
* false, // 12-hour format
|
|
1944
|
+
* { hour: 2, minute: 0, ampm: 'PM' },
|
|
1945
|
+
* false, // start time
|
|
1946
|
+
* );
|
|
1947
|
+
* // Result: [
|
|
1948
|
+
* // { value: 1, disabled: true }, // Before minDate
|
|
1949
|
+
* // { value: 2, disabled: false }, // Available
|
|
1950
|
+
* // { value: 6, disabled: true }, // After maxDate
|
|
1951
|
+
* // ]
|
|
1952
|
+
* ```
|
|
1953
|
+
*/
|
|
1954
|
+
getAvailableHours(date: Date | null, minDate: Date | null, maxDate: Date | null, timePicker24Hour: boolean, timeValue: NgxDatexTimeValue, isEndTime?: boolean, startDate?: Date): {
|
|
1955
|
+
value: number;
|
|
1956
|
+
disabled: boolean;
|
|
1957
|
+
}[];
|
|
1958
|
+
/**
|
|
1959
|
+
* Gets available minutes based on date and hour constraints.
|
|
1960
|
+
*
|
|
1961
|
+
* Returns an array of minute options with disabled state based on minimum/maximum
|
|
1962
|
+
* date restrictions, time picker increment, and start date constraints.
|
|
1963
|
+
*
|
|
1964
|
+
* @param date - Date to get minutes for
|
|
1965
|
+
* @param minDate - Minimum allowed date
|
|
1966
|
+
* @param maxDate - Maximum allowed date
|
|
1967
|
+
* @param timeValue - Current time value for hour context
|
|
1968
|
+
* @param timePickerIncrement - Minute increment step
|
|
1969
|
+
* @param timePicker24Hour - Whether using 24-hour format
|
|
1970
|
+
* @param isEndTime - Whether this is for end time selection
|
|
1971
|
+
* @param startDate - Start date for end time validation
|
|
1972
|
+
* @returns Array of minute options with availability status
|
|
1973
|
+
*
|
|
1974
|
+
* @example
|
|
1975
|
+
* ```typescript
|
|
1976
|
+
* const availableMinutes = this.timePickerService.getAvailableMinutes(
|
|
1977
|
+
* new Date('2024-01-15'),
|
|
1978
|
+
* new Date('2024-01-15 14:15:00'), // minDate
|
|
1979
|
+
* new Date('2024-01-15 14:45:00'), // maxDate
|
|
1980
|
+
* { hour: 14, minute: 30, ampm: 'PM' },
|
|
1981
|
+
* 15, // 15-minute increments
|
|
1982
|
+
* true, // 24-hour format
|
|
1983
|
+
* false, // start time
|
|
1984
|
+
* );
|
|
1985
|
+
* // Result: [
|
|
1986
|
+
* // { value: 0, disabled: true }, // Before minDate
|
|
1987
|
+
* // { value: 15, disabled: false }, // Available
|
|
1988
|
+
* // { value: 30, disabled: false }, // Available
|
|
1989
|
+
* // { value: 45, disabled: false }, // Available
|
|
1990
|
+
* // ]
|
|
1991
|
+
* ```
|
|
1992
|
+
*/
|
|
1993
|
+
getAvailableMinutes(date: Date | null, minDate: Date | null, maxDate: Date | null, timeValue: NgxDatexTimeValue, timePickerIncrement: number, timePicker24Hour: boolean, isEndTime?: boolean, startDate?: Date): {
|
|
1994
|
+
value: number;
|
|
1995
|
+
disabled: boolean;
|
|
1996
|
+
}[];
|
|
1997
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDatexTimePickerService, never>;
|
|
1998
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxDatexTimePickerService>;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
declare class NgxDatexCalendarService {
|
|
2002
|
+
updateMonthsInView(startDate: Date, endDate: Date | null, currentLeftMonth: Date, currentRightMonth: Date, singleDatePicker: boolean, linkedCalendars: boolean, maxDate: Date | null, onLeftMonthChange: (month: Date) => void, onRightMonthChange: (month: Date) => void): void;
|
|
2003
|
+
setStartDate(startDate: Date, minDate: Date | null, maxDate: Date | null, timePicker: boolean, timePickerIncrement: number): Date;
|
|
2004
|
+
setEndDate(endDate: Date, startDate: Date, maxDate: Date | null, maxSpan: {
|
|
2005
|
+
[key: string]: number;
|
|
2006
|
+
} | null, timePicker: boolean, timePickerIncrement: number): Date;
|
|
2007
|
+
private getMaxSpanDays;
|
|
2008
|
+
isDateDisabled(date: Date, minDate: Date | null, maxDate: Date | null, maxSpan: {
|
|
2009
|
+
[key: string]: number;
|
|
2010
|
+
} | null, currentStartDate: Date | null, currentEndDate: Date | null, singleDatePicker: boolean, isInvalidDateFn: ((date: Date) => boolean) | null): boolean;
|
|
2011
|
+
isDateSelected(date: Date, currentStartDate: Date | null, currentEndDate: Date | null, singleDatePicker: boolean): boolean;
|
|
2012
|
+
isDateInRange(date: Date, currentStartDate: Date | null, currentEndDate: Date | null, singleDatePicker: boolean): boolean;
|
|
2013
|
+
isDateRangeStart(date: Date, currentStartDate: Date | null): boolean;
|
|
2014
|
+
isDateRangeEnd(date: Date, currentEndDate: Date | null): boolean;
|
|
2015
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxDatexCalendarService, never>;
|
|
2016
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxDatexCalendarService>;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* @fileoverview Date utility functions for NgxDatex component.
|
|
2021
|
+
* Provides date manipulation, formatting, and validation utilities.
|
|
2022
|
+
* Built on top of @formkit/tempo for reliable date operations.
|
|
2023
|
+
*/
|
|
2024
|
+
/**
|
|
2025
|
+
* Adds the specified number of days to a date.
|
|
2026
|
+
*
|
|
2027
|
+
* @param date - The base date
|
|
2028
|
+
* @param days - Number of days to add (can be negative)
|
|
2029
|
+
* @returns New date with days added
|
|
2030
|
+
*
|
|
2031
|
+
* @example
|
|
2032
|
+
* ```typescript
|
|
2033
|
+
* const tomorrow = addDays(new Date(), 1);
|
|
2034
|
+
* const lastWeek = addDays(new Date(), -7);
|
|
2035
|
+
* ```
|
|
2036
|
+
*/
|
|
2037
|
+
declare function addDays(date: Date, days: number): Date;
|
|
2038
|
+
/**
|
|
2039
|
+
* Adds the specified number of months to a date.
|
|
2040
|
+
*
|
|
2041
|
+
* @param date - The base date
|
|
2042
|
+
* @param months - Number of months to add (can be negative)
|
|
2043
|
+
* @returns New date with months added
|
|
2044
|
+
*
|
|
2045
|
+
* @example
|
|
2046
|
+
* ```typescript
|
|
2047
|
+
* const nextMonth = addMonths(new Date(), 1);
|
|
2048
|
+
* const lastYear = addMonths(new Date(), -12);
|
|
2049
|
+
* ```
|
|
2050
|
+
*/
|
|
2051
|
+
declare function addMonths(date: Date, months: number): Date;
|
|
2052
|
+
/**
|
|
2053
|
+
* Returns a new date set to the start of the day (00:00:00.000).
|
|
2054
|
+
*
|
|
2055
|
+
* @param date - The input date
|
|
2056
|
+
* @returns New date at start of day
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```typescript
|
|
2060
|
+
* const today = startOfDay(new Date()); // Today at 00:00:00
|
|
2061
|
+
* ```
|
|
2062
|
+
*/
|
|
2063
|
+
declare function startOfDay(date: Date): Date;
|
|
2064
|
+
/**
|
|
2065
|
+
* Returns a new date set to the end of the day (23:59:59.999).
|
|
2066
|
+
*
|
|
2067
|
+
* @param date - The input date
|
|
2068
|
+
* @returns New date at end of day
|
|
2069
|
+
*
|
|
2070
|
+
* @example
|
|
2071
|
+
* ```typescript
|
|
2072
|
+
* const endToday = endOfDay(new Date()); // Today at 23:59:59.999
|
|
2073
|
+
* ```
|
|
2074
|
+
*/
|
|
2075
|
+
declare function endOfDay(date: Date): Date;
|
|
2076
|
+
/**
|
|
2077
|
+
* Returns a new date set to the first day of the month.
|
|
2078
|
+
*
|
|
2079
|
+
* @param date - The input date
|
|
2080
|
+
* @returns New date at start of month
|
|
2081
|
+
*
|
|
2082
|
+
* @example
|
|
2083
|
+
* ```typescript
|
|
2084
|
+
* const monthStart = startOfMonth(new Date()); // 1st day of current month
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
declare function startOfMonth(date: Date): Date;
|
|
2088
|
+
/**
|
|
2089
|
+
* Returns a new date set to the start of the week.
|
|
2090
|
+
*
|
|
2091
|
+
* @param date - The input date
|
|
2092
|
+
* @param firstDay - First day of week (0 = Sunday, 1 = Monday, etc.)
|
|
2093
|
+
* @returns New date at start of week
|
|
2094
|
+
*
|
|
2095
|
+
* @example
|
|
2096
|
+
* ```typescript
|
|
2097
|
+
* const mondayStart = startOfWeek(new Date(), 1); // Start of week (Monday)
|
|
2098
|
+
* const sundayStart = startOfWeek(new Date(), 0); // Start of week (Sunday)
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
declare function startOfWeek(date: Date, firstDay?: number): Date;
|
|
2102
|
+
/**
|
|
2103
|
+
* Checks if two dates represent the same day.
|
|
2104
|
+
*
|
|
2105
|
+
* @param date1 - First date to compare
|
|
2106
|
+
* @param date2 - Second date to compare
|
|
2107
|
+
* @returns True if dates are on the same day
|
|
2108
|
+
*
|
|
2109
|
+
* @example
|
|
2110
|
+
* ```typescript
|
|
2111
|
+
* const today = new Date();
|
|
2112
|
+
* const todayEvening = new Date();
|
|
2113
|
+
* todayEvening.setHours(23, 59, 59);
|
|
2114
|
+
*
|
|
2115
|
+
* isSameDay(today, todayEvening); // true
|
|
2116
|
+
* ```
|
|
2117
|
+
*/
|
|
2118
|
+
declare function isSameDay(date1: Date, date2: Date): boolean;
|
|
2119
|
+
/**
|
|
2120
|
+
* Checks if two dates are in the same month and year.
|
|
2121
|
+
*
|
|
2122
|
+
* @param date1 - First date to compare
|
|
2123
|
+
* @param date2 - Second date to compare
|
|
2124
|
+
* @returns True if dates are in the same month
|
|
2125
|
+
*
|
|
2126
|
+
* @example
|
|
2127
|
+
* ```typescript
|
|
2128
|
+
* const jan1 = new Date(2024, 0, 1);
|
|
2129
|
+
* const jan31 = new Date(2024, 0, 31);
|
|
2130
|
+
*
|
|
2131
|
+
* isSameMonth(jan1, jan31); // true
|
|
2132
|
+
* ```
|
|
2133
|
+
*/
|
|
2134
|
+
declare function isSameMonth(date1: Date, date2: Date): boolean;
|
|
2135
|
+
/**
|
|
2136
|
+
* Checks if two dates are in the same year.
|
|
2137
|
+
*
|
|
2138
|
+
* @param date1 - First date to compare
|
|
2139
|
+
* @param date2 - Second date to compare
|
|
2140
|
+
* @returns True if dates are in the same year
|
|
2141
|
+
*
|
|
2142
|
+
* @example
|
|
2143
|
+
* ```typescript
|
|
2144
|
+
* const jan2024 = new Date(2024, 0, 1);
|
|
2145
|
+
* const dec2024 = new Date(2024, 11, 31);
|
|
2146
|
+
*
|
|
2147
|
+
* isSameYear(jan2024, dec2024); // true
|
|
2148
|
+
* ```
|
|
2149
|
+
*/
|
|
2150
|
+
declare function isSameYear(date1: Date, date2: Date): boolean;
|
|
2151
|
+
declare function formatDateValue(date: Date, formatStr: string): string;
|
|
2152
|
+
declare function parseDateValue(dateStr: string, formatStr: string): Date;
|
|
2153
|
+
declare function isSameDate(date1: Date, date2: Date, unit?: 'day' | 'month' | 'year'): boolean;
|
|
2154
|
+
declare function isValidDate(date: Date | null | undefined): date is Date;
|
|
2155
|
+
declare function isBeforeDate(date1: Date, date2: Date): boolean;
|
|
2156
|
+
declare function getStartOfMonth(date: Date): Date;
|
|
2157
|
+
declare function getStartOfWeek(date: Date, firstDay?: number): Date;
|
|
2158
|
+
declare function isMobileDevice(): boolean;
|
|
2159
|
+
|
|
2160
|
+
export { DEFAULT_RANGES, MATERIAL_LIGHT_THEME, NgxDatex, NgxDatexCalendarService, NgxDatexOverlayService, NgxDatexService, NgxDatexTimePickerService, SPANISH_LOCALE, addDays, addMonths, endOfDay, formatDateValue, getStartOfMonth, getStartOfWeek, isBeforeDate, isMobileDevice, isSameDate, isSameDay, isSameMonth, isSameYear, isValidDate, parseDateValue, startOfDay, startOfMonth, startOfWeek };
|
|
2161
|
+
export type { NgxDatexConfig, NgxDatexInputs, NgxDatexLocale, NgxDatexOutputs, NgxDatexOverlayPosition, NgxDatexRange, NgxDatexTheme, NgxDatexTimeValue, NgxDatexValidationResult, NgxDatexValue };
|