ngxsmk-datepicker 1.4.5 → 1.4.6
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/.angular/cache/20.3.5/demo-app/vite/deps/@angular_common.js +200 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_core.js +999 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_forms.js +6965 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_platform-browser.js +80 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_router.js +6130 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-42OOCJLE.js +5210 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-DQIUKFFJ.js +30886 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-QJUWYUTH.js +4715 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-WDMUDEB6.js +58 -0
- package/.angular/cache/20.3.5/demo-app/vite/deps/zone__js.js +2394 -0
- package/LICENSE +21 -0
- package/README.md +201 -162
- package/dist/demo-app/browser/main-4XQZTDMM.js +4 -0
- package/dist/demo-app/browser/polyfills-5CFQRCPP.js +2 -0
- package/dist/ngxsmk-datepicker/README.md +268 -0
- package/{index.d.ts → dist/ngxsmk-datepicker/index.d.ts} +2 -3
- package/package.json +40 -28
- package/projects/demo-app/README.md +246 -0
- package/projects/ngxsmk-datepicker/README.md +268 -0
- package/scripts/analyze-bundle.js +39 -0
- package/scripts/optimize-build.js +132 -0
- package/fesm2022/ngxsmk-datepicker.mjs +0 -1131
- package/fesm2022/ngxsmk-datepicker.mjs.map +0 -1
|
@@ -1,1131 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, inject, ElementRef, HostListener, Output, Input, Component, forwardRef, HostBinding, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
4
|
-
import { CommonModule, DatePipe } from '@angular/common';
|
|
5
|
-
import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Date utility functions for ngxsmk-datepicker
|
|
9
|
-
* Extracted to improve tree-shaking and reduce bundle size
|
|
10
|
-
*/
|
|
11
|
-
function getStartOfDay(d) {
|
|
12
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);
|
|
13
|
-
}
|
|
14
|
-
function getEndOfDay(d) {
|
|
15
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
|
|
16
|
-
}
|
|
17
|
-
function addMonths(d, months) {
|
|
18
|
-
const newDate = new Date(d);
|
|
19
|
-
newDate.setMonth(d.getMonth() + months);
|
|
20
|
-
return newDate;
|
|
21
|
-
}
|
|
22
|
-
function subtractDays(d, days) {
|
|
23
|
-
const newDate = new Date(d);
|
|
24
|
-
newDate.setDate(d.getDate() - days);
|
|
25
|
-
return newDate;
|
|
26
|
-
}
|
|
27
|
-
function getStartOfMonth(d) {
|
|
28
|
-
return new Date(d.getFullYear(), d.getMonth(), 1);
|
|
29
|
-
}
|
|
30
|
-
function getEndOfMonth(d) {
|
|
31
|
-
return new Date(d.getFullYear(), d.getMonth() + 1, 0);
|
|
32
|
-
}
|
|
33
|
-
function isSameDay(d1, d2) {
|
|
34
|
-
if (!d1 || !d2)
|
|
35
|
-
return false;
|
|
36
|
-
return (d1.getFullYear() === d2.getFullYear() &&
|
|
37
|
-
d1.getMonth() === d2.getMonth() &&
|
|
38
|
-
d1.getDate() === d2.getDate());
|
|
39
|
-
}
|
|
40
|
-
function normalizeDate(date) {
|
|
41
|
-
if (!date)
|
|
42
|
-
return null;
|
|
43
|
-
const d = (date instanceof Date) ? new Date(date.getTime()) : new Date(date.toDate ? date.toDate() : date);
|
|
44
|
-
if (isNaN(d.getTime()))
|
|
45
|
-
return null;
|
|
46
|
-
return d;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Calendar utility functions for ngxsmk-datepicker
|
|
51
|
-
* Optimized for performance and tree-shaking
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* Generate month options for dropdown
|
|
55
|
-
*/
|
|
56
|
-
function generateMonthOptions(locale, year) {
|
|
57
|
-
return Array.from({ length: 12 }).map((_, i) => ({
|
|
58
|
-
label: new Date(year, i, 1).toLocaleDateString(locale, { month: 'long' }),
|
|
59
|
-
value: i,
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Generate year options for dropdown
|
|
64
|
-
*/
|
|
65
|
-
function generateYearOptions(currentYear, range = 10) {
|
|
66
|
-
const startYear = currentYear - range;
|
|
67
|
-
const endYear = currentYear + range;
|
|
68
|
-
const options = [];
|
|
69
|
-
for (let i = startYear; i <= endYear; i++) {
|
|
70
|
-
options.push({ label: `${i}`, value: i });
|
|
71
|
-
}
|
|
72
|
-
return options;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Generate time options for hour/minute dropdowns
|
|
76
|
-
*/
|
|
77
|
-
function generateTimeOptions(minuteInterval = 1) {
|
|
78
|
-
const hourOptions = Array.from({ length: 12 }).map((_, i) => ({
|
|
79
|
-
label: (i + 1).toString().padStart(2, '0'),
|
|
80
|
-
value: i + 1,
|
|
81
|
-
}));
|
|
82
|
-
const minuteOptions = [];
|
|
83
|
-
for (let i = 0; i < 60; i += minuteInterval) {
|
|
84
|
-
minuteOptions.push({
|
|
85
|
-
label: i.toString().padStart(2, '0'),
|
|
86
|
-
value: i,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return { hourOptions, minuteOptions };
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Generate week days for calendar header
|
|
93
|
-
*/
|
|
94
|
-
function generateWeekDays(locale, firstDayOfWeek = 0) {
|
|
95
|
-
const day = new Date(2024, 0, 7 + firstDayOfWeek);
|
|
96
|
-
return Array.from({ length: 7 }).map(() => {
|
|
97
|
-
const weekDay = new Date(day).toLocaleDateString(locale, { weekday: 'short' });
|
|
98
|
-
day.setDate(day.getDate() + 1);
|
|
99
|
-
return weekDay;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get first day of week for locale
|
|
104
|
-
*/
|
|
105
|
-
function getFirstDayOfWeek(locale) {
|
|
106
|
-
try {
|
|
107
|
-
return (new Intl.Locale(locale).weekInfo?.firstDay || 0) % 7;
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
return 0;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Convert 12-hour to 24-hour format
|
|
115
|
-
*/
|
|
116
|
-
function get24Hour(displayHour, isPm) {
|
|
117
|
-
if (isPm) {
|
|
118
|
-
return displayHour === 12 ? 12 : displayHour + 12;
|
|
119
|
-
}
|
|
120
|
-
return displayHour === 12 ? 0 : displayHour;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Convert 24-hour to 12-hour format
|
|
124
|
-
*/
|
|
125
|
-
function update12HourState(fullHour) {
|
|
126
|
-
return {
|
|
127
|
-
isPm: fullHour >= 12,
|
|
128
|
-
displayHour: fullHour % 12 || 12
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Process date ranges input
|
|
133
|
-
*/
|
|
134
|
-
function processDateRanges(ranges) {
|
|
135
|
-
if (!ranges)
|
|
136
|
-
return null;
|
|
137
|
-
return Object.entries(ranges).reduce((acc, [key, dates]) => {
|
|
138
|
-
const start = normalizeDate(dates[0]);
|
|
139
|
-
const end = normalizeDate(dates[1]);
|
|
140
|
-
if (start && end)
|
|
141
|
-
acc[key] = [start, end];
|
|
142
|
-
return acc;
|
|
143
|
-
}, {});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
class CustomSelectComponent {
|
|
147
|
-
constructor() {
|
|
148
|
-
this.options = [];
|
|
149
|
-
this.disabled = false;
|
|
150
|
-
this.valueChange = new EventEmitter();
|
|
151
|
-
this.isOpen = false;
|
|
152
|
-
this.elementRef = inject(ElementRef);
|
|
153
|
-
}
|
|
154
|
-
onDocumentClick(event) {
|
|
155
|
-
if (!this.elementRef.nativeElement.contains(event.target))
|
|
156
|
-
this.isOpen = false;
|
|
157
|
-
}
|
|
158
|
-
get displayValue() {
|
|
159
|
-
const selectedOption = this.options.find((opt) => opt.value === this.value);
|
|
160
|
-
return selectedOption ? selectedOption.label : '';
|
|
161
|
-
}
|
|
162
|
-
toggleDropdown() {
|
|
163
|
-
if (this.disabled)
|
|
164
|
-
return;
|
|
165
|
-
this.isOpen = !this.isOpen;
|
|
166
|
-
}
|
|
167
|
-
selectOption(option) {
|
|
168
|
-
this.value = option.value;
|
|
169
|
-
this.valueChange.emit(this.value);
|
|
170
|
-
this.isOpen = false;
|
|
171
|
-
}
|
|
172
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: CustomSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
173
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.6", type: CustomSelectComponent, isStandalone: true, selector: "ngxsmk-custom-select", inputs: { options: "options", value: "value", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, ngImport: i0, template: `
|
|
174
|
-
<div class="ngxsmk-select-container" (click)="toggleDropdown()">
|
|
175
|
-
<button type="button" class="ngxsmk-select-display" [disabled]="disabled">
|
|
176
|
-
<span>{{ displayValue }}</span>
|
|
177
|
-
<svg class="ngxsmk-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
178
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
179
|
-
d="M112 184l144 144 144-144"/>
|
|
180
|
-
</svg>
|
|
181
|
-
</button>
|
|
182
|
-
@if (isOpen) {
|
|
183
|
-
<div class="ngxsmk-options-panel">
|
|
184
|
-
<ul>
|
|
185
|
-
@for (option of options; track option.value) {
|
|
186
|
-
<li [class.selected]="option.value === value" (click)="selectOption(option); $event.stopPropagation()">
|
|
187
|
-
{{ option.label }}
|
|
188
|
-
</li>
|
|
189
|
-
}
|
|
190
|
-
</ul>
|
|
191
|
-
</div>
|
|
192
|
-
}
|
|
193
|
-
</div>
|
|
194
|
-
`, isInline: true, styles: [":host{position:relative;display:inline-block}.ngxsmk-select-container{cursor:pointer}.ngxsmk-select-display{display:flex;align-items:center;justify-content:space-between;width:var(--custom-select-width, 115px);background:var(--datepicker-background, #fff);border:1px solid var(--datepicker-border-color, #ccc);color:var(--datepicker-text-color, #333);border-radius:4px;padding:4px 8px;font-size:14px;text-align:left;height:30px}.ngxsmk-select-display:disabled{background-color:var(--datepicker-hover-background, #f0f0f0);cursor:not-allowed;opacity:.7}.ngxsmk-arrow-icon{width:12px;height:12px;margin-left:8px}.ngxsmk-options-panel{position:absolute;top:110%;left:0;width:100%;background:var(--datepicker-background, #fff);border:1px solid var(--datepicker-border-color, #ccc);color:var(--datepicker-text-color, #333);border-radius:4px;box-shadow:0 4px 8px #0000001a;max-height:200px;overflow-y:auto;z-index:9999}.ngxsmk-options-panel ul{list-style:none;padding:4px;margin:0}.ngxsmk-options-panel li{padding:8px 12px;border-radius:4px;cursor:pointer}.ngxsmk-options-panel li:hover{background-color:var(--datepicker-hover-background, #f0f0f0)}.ngxsmk-options-panel li.selected{background-color:var(--datepicker-primary-color, #3880ff);color:var(--datepicker-primary-contrast, #fff)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
|
|
195
|
-
}
|
|
196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: CustomSelectComponent, decorators: [{
|
|
197
|
-
type: Component,
|
|
198
|
-
args: [{ selector: 'ngxsmk-custom-select', standalone: true, imports: [CommonModule], template: `
|
|
199
|
-
<div class="ngxsmk-select-container" (click)="toggleDropdown()">
|
|
200
|
-
<button type="button" class="ngxsmk-select-display" [disabled]="disabled">
|
|
201
|
-
<span>{{ displayValue }}</span>
|
|
202
|
-
<svg class="ngxsmk-arrow-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
203
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
204
|
-
d="M112 184l144 144 144-144"/>
|
|
205
|
-
</svg>
|
|
206
|
-
</button>
|
|
207
|
-
@if (isOpen) {
|
|
208
|
-
<div class="ngxsmk-options-panel">
|
|
209
|
-
<ul>
|
|
210
|
-
@for (option of options; track option.value) {
|
|
211
|
-
<li [class.selected]="option.value === value" (click)="selectOption(option); $event.stopPropagation()">
|
|
212
|
-
{{ option.label }}
|
|
213
|
-
</li>
|
|
214
|
-
}
|
|
215
|
-
</ul>
|
|
216
|
-
</div>
|
|
217
|
-
}
|
|
218
|
-
</div>
|
|
219
|
-
`, styles: [":host{position:relative;display:inline-block}.ngxsmk-select-container{cursor:pointer}.ngxsmk-select-display{display:flex;align-items:center;justify-content:space-between;width:var(--custom-select-width, 115px);background:var(--datepicker-background, #fff);border:1px solid var(--datepicker-border-color, #ccc);color:var(--datepicker-text-color, #333);border-radius:4px;padding:4px 8px;font-size:14px;text-align:left;height:30px}.ngxsmk-select-display:disabled{background-color:var(--datepicker-hover-background, #f0f0f0);cursor:not-allowed;opacity:.7}.ngxsmk-arrow-icon{width:12px;height:12px;margin-left:8px}.ngxsmk-options-panel{position:absolute;top:110%;left:0;width:100%;background:var(--datepicker-background, #fff);border:1px solid var(--datepicker-border-color, #ccc);color:var(--datepicker-text-color, #333);border-radius:4px;box-shadow:0 4px 8px #0000001a;max-height:200px;overflow-y:auto;z-index:9999}.ngxsmk-options-panel ul{list-style:none;padding:4px;margin:0}.ngxsmk-options-panel li{padding:8px 12px;border-radius:4px;cursor:pointer}.ngxsmk-options-panel li:hover{background-color:var(--datepicker-hover-background, #f0f0f0)}.ngxsmk-options-panel li.selected{background-color:var(--datepicker-primary-color, #3880ff);color:var(--datepicker-primary-contrast, #fff)}\n"] }]
|
|
220
|
-
}], propDecorators: { options: [{
|
|
221
|
-
type: Input
|
|
222
|
-
}], value: [{
|
|
223
|
-
type: Input
|
|
224
|
-
}], disabled: [{
|
|
225
|
-
type: Input
|
|
226
|
-
}], valueChange: [{
|
|
227
|
-
type: Output
|
|
228
|
-
}], onDocumentClick: [{
|
|
229
|
-
type: HostListener,
|
|
230
|
-
args: ['document:click', ['$event']]
|
|
231
|
-
}] } });
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Performance utilities for ngxsmk-datepicker
|
|
235
|
-
* Optimized for better runtime performance
|
|
236
|
-
*/
|
|
237
|
-
/**
|
|
238
|
-
* Memoization decorator for expensive computations
|
|
239
|
-
*/
|
|
240
|
-
function memoize(fn, keyGenerator) {
|
|
241
|
-
const cache = new Map();
|
|
242
|
-
return ((...args) => {
|
|
243
|
-
const key = keyGenerator ? keyGenerator(...args) : JSON.stringify(args);
|
|
244
|
-
if (cache.has(key)) {
|
|
245
|
-
return cache.get(key);
|
|
246
|
-
}
|
|
247
|
-
const result = fn(...args);
|
|
248
|
-
cache.set(key, result);
|
|
249
|
-
return result;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Debounce function for performance optimization
|
|
254
|
-
*/
|
|
255
|
-
function debounce(func, wait) {
|
|
256
|
-
let timeout = null;
|
|
257
|
-
return (...args) => {
|
|
258
|
-
if (timeout) {
|
|
259
|
-
clearTimeout(timeout);
|
|
260
|
-
}
|
|
261
|
-
timeout = window.setTimeout(() => {
|
|
262
|
-
func(...args);
|
|
263
|
-
}, wait);
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Throttle function for performance optimization
|
|
268
|
-
*/
|
|
269
|
-
function throttle(func, limit) {
|
|
270
|
-
let inThrottle = false;
|
|
271
|
-
return (...args) => {
|
|
272
|
-
if (!inThrottle) {
|
|
273
|
-
func(...args);
|
|
274
|
-
inThrottle = true;
|
|
275
|
-
window.setTimeout(() => (inThrottle = false), limit);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Create a shallow comparison function for objects
|
|
281
|
-
*/
|
|
282
|
-
function shallowEqual(a, b) {
|
|
283
|
-
const keysA = Object.keys(a);
|
|
284
|
-
const keysB = Object.keys(b);
|
|
285
|
-
if (keysA.length !== keysB.length) {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
for (const key of keysA) {
|
|
289
|
-
if (a[key] !== b[key]) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Optimized date comparison for calendar rendering
|
|
297
|
-
*/
|
|
298
|
-
function createDateComparator() {
|
|
299
|
-
const cache = new Map();
|
|
300
|
-
return (date1, date2) => {
|
|
301
|
-
if (!date1 || !date2)
|
|
302
|
-
return date1 === date2;
|
|
303
|
-
const key = `${date1.getTime()}-${date2.getTime()}`;
|
|
304
|
-
if (cache.has(key)) {
|
|
305
|
-
return cache.get(key);
|
|
306
|
-
}
|
|
307
|
-
const result = (date1.getFullYear() === date2.getFullYear() &&
|
|
308
|
-
date1.getMonth() === date2.getMonth() &&
|
|
309
|
-
date1.getDate() === date2.getDate());
|
|
310
|
-
cache.set(key, result);
|
|
311
|
-
return result;
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Optimized array filtering with caching
|
|
316
|
-
*/
|
|
317
|
-
function createFilteredArray(source, filterFn, cacheKey) {
|
|
318
|
-
const cache = new Map();
|
|
319
|
-
const key = cacheKey || JSON.stringify(source);
|
|
320
|
-
if (cache.has(key)) {
|
|
321
|
-
return cache.get(key);
|
|
322
|
-
}
|
|
323
|
-
const result = source.filter(filterFn);
|
|
324
|
-
cache.set(key, result);
|
|
325
|
-
return result;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
class NgxsmkDatepickerComponent {
|
|
329
|
-
constructor() {
|
|
330
|
-
this.mode = 'single';
|
|
331
|
-
this.isInvalidDate = () => false;
|
|
332
|
-
this.showRanges = true;
|
|
333
|
-
this.showTime = false;
|
|
334
|
-
this.minuteInterval = 1;
|
|
335
|
-
// NEW: Holiday Provider Inputs
|
|
336
|
-
this.holidayProvider = null;
|
|
337
|
-
this.disableHolidays = false;
|
|
338
|
-
// Popover/Input Mode
|
|
339
|
-
this.placeholder = 'Select Date';
|
|
340
|
-
this.inline = false;
|
|
341
|
-
this.isCalendarOpen = false;
|
|
342
|
-
this._internalValue = null;
|
|
343
|
-
this._startAtDate = null;
|
|
344
|
-
this._locale = 'en-US';
|
|
345
|
-
this.theme = 'light';
|
|
346
|
-
this.onChange = (_) => { };
|
|
347
|
-
this.onTouched = () => { };
|
|
348
|
-
this.disabled = false;
|
|
349
|
-
this.valueChange = new EventEmitter();
|
|
350
|
-
this.action = new EventEmitter();
|
|
351
|
-
this._minDate = null;
|
|
352
|
-
this._maxDate = null;
|
|
353
|
-
this._ranges = null;
|
|
354
|
-
this.currentDate = new Date();
|
|
355
|
-
this.daysInMonth = [];
|
|
356
|
-
this.weekDays = [];
|
|
357
|
-
this.today = getStartOfDay(new Date());
|
|
358
|
-
this.selectedDate = null;
|
|
359
|
-
this.selectedDates = [];
|
|
360
|
-
this.startDate = null;
|
|
361
|
-
this.endDate = null;
|
|
362
|
-
this.hoveredDate = null;
|
|
363
|
-
this.rangesArray = [];
|
|
364
|
-
this._currentMonth = this.currentDate.getMonth();
|
|
365
|
-
this._currentYear = this.currentDate.getFullYear();
|
|
366
|
-
this.monthOptions = [];
|
|
367
|
-
this.yearOptions = [];
|
|
368
|
-
this.firstDayOfWeek = 0;
|
|
369
|
-
this.currentHour = 0;
|
|
370
|
-
this.currentMinute = 0;
|
|
371
|
-
this.currentDisplayHour = 12;
|
|
372
|
-
this.isPm = false;
|
|
373
|
-
this.hourOptions = [];
|
|
374
|
-
this.minuteOptions = [];
|
|
375
|
-
this.ampmOptions = [
|
|
376
|
-
{ label: 'AM', value: false },
|
|
377
|
-
{ label: 'PM', value: true }
|
|
378
|
-
];
|
|
379
|
-
// Animation state properties
|
|
380
|
-
this.animateForward = false;
|
|
381
|
-
this.animateBackward = false;
|
|
382
|
-
this.elementRef = inject(ElementRef);
|
|
383
|
-
this.dateComparator = createDateComparator();
|
|
384
|
-
}
|
|
385
|
-
set startAt(value) { this._startAtDate = this._normalizeDate(value); }
|
|
386
|
-
set locale(value) { this._locale = value; }
|
|
387
|
-
get locale() { return this._locale; }
|
|
388
|
-
get isDarkMode() { return this.theme === 'dark'; }
|
|
389
|
-
set disabledState(isDisabled) { this.disabled = isDisabled; }
|
|
390
|
-
set minDate(value) { this._minDate = this._normalizeDate(value); }
|
|
391
|
-
set maxDate(value) { this._maxDate = this._normalizeDate(value); }
|
|
392
|
-
set ranges(value) {
|
|
393
|
-
this._ranges = processDateRanges(value);
|
|
394
|
-
this.updateRangesArray();
|
|
395
|
-
}
|
|
396
|
-
get isInlineMode() {
|
|
397
|
-
return this.inline === true || this.inline === 'always' ||
|
|
398
|
-
(this.inline === 'auto' && typeof window !== 'undefined' && window.matchMedia('(min-width: 768px)').matches);
|
|
399
|
-
}
|
|
400
|
-
get isCalendarVisible() {
|
|
401
|
-
return this.isInlineMode || this.isCalendarOpen;
|
|
402
|
-
}
|
|
403
|
-
get displayValue() {
|
|
404
|
-
if (this.mode === 'single' && this.selectedDate) {
|
|
405
|
-
return this.selectedDate.toLocaleString(this.locale, {
|
|
406
|
-
year: 'numeric', month: 'short', day: '2-digit',
|
|
407
|
-
hour: this.showTime ? '2-digit' : undefined,
|
|
408
|
-
minute: this.showTime ? '2-digit' : undefined
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
else if (this.mode === 'range' && this.startDate && this.endDate) {
|
|
412
|
-
const start = this.startDate.toLocaleString(this.locale, { year: 'numeric', month: 'short', day: '2-digit' });
|
|
413
|
-
const end = this.endDate.toLocaleString(this.locale, { year: 'numeric', month: 'short', day: '2-digit' });
|
|
414
|
-
return `${start} - ${end}`;
|
|
415
|
-
}
|
|
416
|
-
else if (this.mode === 'multiple' && this.selectedDates.length > 0) {
|
|
417
|
-
return `${this.selectedDates.length} dates selected`;
|
|
418
|
-
}
|
|
419
|
-
return '';
|
|
420
|
-
}
|
|
421
|
-
onDocumentClick(event) {
|
|
422
|
-
if (!this.isInlineMode && this.isCalendarOpen && !this.elementRef.nativeElement.contains(event.target)) {
|
|
423
|
-
this.isCalendarOpen = false;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
writeValue(val) {
|
|
427
|
-
this._internalValue = val;
|
|
428
|
-
this.initializeValue(val);
|
|
429
|
-
this.generateCalendar();
|
|
430
|
-
}
|
|
431
|
-
registerOnChange(fn) {
|
|
432
|
-
this.onChange = fn;
|
|
433
|
-
}
|
|
434
|
-
registerOnTouched(fn) {
|
|
435
|
-
this.onTouched = fn;
|
|
436
|
-
}
|
|
437
|
-
setDisabledState(isDisabled) {
|
|
438
|
-
this.disabled = isDisabled;
|
|
439
|
-
}
|
|
440
|
-
emitValue(val) {
|
|
441
|
-
this._internalValue = val;
|
|
442
|
-
this.valueChange.emit(val);
|
|
443
|
-
this.onChange(val);
|
|
444
|
-
this.onTouched();
|
|
445
|
-
// Auto-close popover when a selection is complete
|
|
446
|
-
if (!this.isInlineMode && val !== null) {
|
|
447
|
-
if (this.mode === 'single' || (this.mode === 'range' && this.startDate && this.endDate)) {
|
|
448
|
-
this.isCalendarOpen = false;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
toggleCalendar() {
|
|
453
|
-
if (this.disabled || this.isInlineMode)
|
|
454
|
-
return;
|
|
455
|
-
this.isCalendarOpen = !this.isCalendarOpen;
|
|
456
|
-
}
|
|
457
|
-
clearValue(event) {
|
|
458
|
-
if (event)
|
|
459
|
-
event.stopPropagation();
|
|
460
|
-
if (this.disabled)
|
|
461
|
-
return;
|
|
462
|
-
this.selectedDate = null;
|
|
463
|
-
this.selectedDates = [];
|
|
464
|
-
this.startDate = null;
|
|
465
|
-
this.endDate = null;
|
|
466
|
-
this.hoveredDate = null;
|
|
467
|
-
this.isCalendarOpen = false;
|
|
468
|
-
this.emitValue(null);
|
|
469
|
-
this.action.emit({ type: 'clear', payload: null });
|
|
470
|
-
// Reset view to today after clearing
|
|
471
|
-
this.currentDate = new Date();
|
|
472
|
-
this._currentMonth = this.currentDate.getMonth();
|
|
473
|
-
this._currentYear = this.currentDate.getFullYear();
|
|
474
|
-
this.generateCalendar();
|
|
475
|
-
}
|
|
476
|
-
get currentMonth() { return this._currentMonth; }
|
|
477
|
-
set currentMonth(month) {
|
|
478
|
-
if (this.disabled)
|
|
479
|
-
return;
|
|
480
|
-
if (this._currentMonth !== month) {
|
|
481
|
-
this._currentMonth = month;
|
|
482
|
-
this.currentDate.setMonth(month);
|
|
483
|
-
this.generateCalendar(true);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
get currentYear() { return this._currentYear; }
|
|
487
|
-
set currentYear(year) {
|
|
488
|
-
if (this.disabled)
|
|
489
|
-
return;
|
|
490
|
-
if (this._currentYear !== year) {
|
|
491
|
-
this._currentYear = year;
|
|
492
|
-
this.currentDate.setFullYear(year);
|
|
493
|
-
this.generateCalendar(true);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
ngOnInit() {
|
|
497
|
-
if (this._locale === 'en-US' && typeof navigator !== 'undefined') {
|
|
498
|
-
this._locale = navigator.language;
|
|
499
|
-
}
|
|
500
|
-
this.today.setHours(0, 0, 0, 0);
|
|
501
|
-
this.generateLocaleData();
|
|
502
|
-
this.generateTimeOptions();
|
|
503
|
-
if (this.showTime && !this._internalValue) {
|
|
504
|
-
const now = new Date();
|
|
505
|
-
this.currentHour = now.getHours();
|
|
506
|
-
this.currentMinute = Math.floor(now.getMinutes() / this.minuteInterval) * this.minuteInterval;
|
|
507
|
-
if (this.currentMinute === 60) {
|
|
508
|
-
this.currentMinute = 0;
|
|
509
|
-
this.currentHour = (this.currentHour + 1) % 24;
|
|
510
|
-
}
|
|
511
|
-
this.update12HourState(this.currentHour);
|
|
512
|
-
}
|
|
513
|
-
if (this._internalValue) {
|
|
514
|
-
this.initializeValue(this._internalValue);
|
|
515
|
-
}
|
|
516
|
-
else if (this._startAtDate) {
|
|
517
|
-
this.initializeValue(null);
|
|
518
|
-
}
|
|
519
|
-
this.generateCalendar();
|
|
520
|
-
}
|
|
521
|
-
ngOnChanges(changes) {
|
|
522
|
-
if (changes['locale']) {
|
|
523
|
-
this.generateLocaleData();
|
|
524
|
-
this.generateCalendar();
|
|
525
|
-
}
|
|
526
|
-
if (changes['minuteInterval']) {
|
|
527
|
-
this.generateTimeOptions();
|
|
528
|
-
this.currentMinute = Math.floor(this.currentMinute / this.minuteInterval) * this.minuteInterval;
|
|
529
|
-
this.onTimeChange();
|
|
530
|
-
}
|
|
531
|
-
if (changes['value'] && changes['value'].currentValue !== changes['value'].previousValue) {
|
|
532
|
-
this.writeValue(changes['value'].currentValue);
|
|
533
|
-
}
|
|
534
|
-
// Rerun calendar generation if provider changes to refresh disabled states
|
|
535
|
-
if (changes['holidayProvider'] || changes['disableHolidays']) {
|
|
536
|
-
this.generateCalendar();
|
|
537
|
-
}
|
|
538
|
-
if (changes['startAt']) {
|
|
539
|
-
if (!this._internalValue && this._startAtDate) {
|
|
540
|
-
this.currentDate = new Date(this._startAtDate);
|
|
541
|
-
this._currentMonth = this.currentDate.getMonth();
|
|
542
|
-
this._currentYear = this.currentDate.getFullYear();
|
|
543
|
-
this.generateCalendar();
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
get24Hour(displayHour, isPm) {
|
|
548
|
-
return get24Hour(displayHour, isPm);
|
|
549
|
-
}
|
|
550
|
-
update12HourState(fullHour) {
|
|
551
|
-
const state = update12HourState(fullHour);
|
|
552
|
-
this.isPm = state.isPm;
|
|
553
|
-
this.currentDisplayHour = state.displayHour;
|
|
554
|
-
}
|
|
555
|
-
applyCurrentTime(date) {
|
|
556
|
-
this.currentHour = this.get24Hour(this.currentDisplayHour, this.isPm);
|
|
557
|
-
date.setHours(this.currentHour, this.currentMinute, 0, 0);
|
|
558
|
-
return date;
|
|
559
|
-
}
|
|
560
|
-
initializeValue(value) {
|
|
561
|
-
let initialDate = null;
|
|
562
|
-
this.selectedDate = null;
|
|
563
|
-
this.startDate = null;
|
|
564
|
-
this.endDate = null;
|
|
565
|
-
this.selectedDates = [];
|
|
566
|
-
if (value) {
|
|
567
|
-
if (this.mode === 'single' && value instanceof Date) {
|
|
568
|
-
this.selectedDate = this._normalizeDate(value);
|
|
569
|
-
initialDate = this.selectedDate;
|
|
570
|
-
}
|
|
571
|
-
else if (this.mode === 'range' && typeof value === 'object' && 'start' in value && 'end' in value) {
|
|
572
|
-
this.startDate = this._normalizeDate(value.start);
|
|
573
|
-
this.endDate = this._normalizeDate(value.end);
|
|
574
|
-
initialDate = this.startDate;
|
|
575
|
-
}
|
|
576
|
-
else if (this.mode === 'multiple' && Array.isArray(value)) {
|
|
577
|
-
this.selectedDates = value.map(d => this._normalizeDate(d)).filter((d) => d !== null);
|
|
578
|
-
initialDate = this.selectedDates.length > 0 ? this.selectedDates[this.selectedDates.length - 1] : null;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
const viewCenterDate = initialDate || this._startAtDate || new Date();
|
|
582
|
-
if (viewCenterDate) {
|
|
583
|
-
this.currentDate = new Date(viewCenterDate);
|
|
584
|
-
this._currentMonth = viewCenterDate.getMonth();
|
|
585
|
-
this._currentYear = viewCenterDate.getFullYear();
|
|
586
|
-
this.currentHour = viewCenterDate.getHours();
|
|
587
|
-
this.currentMinute = viewCenterDate.getMinutes();
|
|
588
|
-
this.update12HourState(this.currentHour);
|
|
589
|
-
this.currentMinute = Math.floor(this.currentMinute / this.minuteInterval) * this.minuteInterval;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
_normalizeDate(date) {
|
|
593
|
-
return normalizeDate(date);
|
|
594
|
-
}
|
|
595
|
-
generateTimeOptions() {
|
|
596
|
-
const { hourOptions, minuteOptions } = generateTimeOptions(this.minuteInterval);
|
|
597
|
-
this.hourOptions = hourOptions;
|
|
598
|
-
this.minuteOptions = minuteOptions;
|
|
599
|
-
}
|
|
600
|
-
generateLocaleData() {
|
|
601
|
-
const year = new Date().getFullYear();
|
|
602
|
-
this.monthOptions = generateMonthOptions(this.locale, year);
|
|
603
|
-
this.firstDayOfWeek = getFirstDayOfWeek(this.locale);
|
|
604
|
-
this.weekDays = generateWeekDays(this.locale, this.firstDayOfWeek);
|
|
605
|
-
}
|
|
606
|
-
updateRangesArray() {
|
|
607
|
-
this.rangesArray = this._ranges ? Object.entries(this._ranges).map(([key, value]) => ({ key, value })) : [];
|
|
608
|
-
}
|
|
609
|
-
selectRange(range) {
|
|
610
|
-
if (this.disabled)
|
|
611
|
-
return;
|
|
612
|
-
this.startDate = this.applyCurrentTime(range[0]);
|
|
613
|
-
this.endDate = this.applyCurrentTime(range[1]);
|
|
614
|
-
if (this.startDate && this.endDate) {
|
|
615
|
-
this.emitValue({ start: this.startDate, end: this.endDate });
|
|
616
|
-
}
|
|
617
|
-
this.currentDate = new Date(this.startDate);
|
|
618
|
-
this.initializeValue({ start: this.startDate, end: this.endDate });
|
|
619
|
-
this.generateCalendar();
|
|
620
|
-
this.action.emit({ type: 'rangeSelected', payload: { start: this.startDate, end: this.endDate, key: this.rangesArray.find(r => r.value === range)?.key } });
|
|
621
|
-
}
|
|
622
|
-
// NEW: Check if a date is a holiday
|
|
623
|
-
isHoliday(date) {
|
|
624
|
-
if (!date || !this.holidayProvider)
|
|
625
|
-
return false;
|
|
626
|
-
const dateOnly = getStartOfDay(date);
|
|
627
|
-
return this.holidayProvider.isHoliday(dateOnly);
|
|
628
|
-
}
|
|
629
|
-
// NEW: Get holiday label
|
|
630
|
-
getHolidayLabel(date) {
|
|
631
|
-
if (!date || !this.holidayProvider || !this.isHoliday(date))
|
|
632
|
-
return null;
|
|
633
|
-
return this.holidayProvider.getHolidayLabel ? this.holidayProvider.getHolidayLabel(getStartOfDay(date)) : 'Holiday';
|
|
634
|
-
}
|
|
635
|
-
isDateDisabled(date) {
|
|
636
|
-
if (!date)
|
|
637
|
-
return false;
|
|
638
|
-
const dateOnly = getStartOfDay(date);
|
|
639
|
-
// 1. Check holiday provider for disabling
|
|
640
|
-
if (this.holidayProvider && this.disableHolidays && this.holidayProvider.isHoliday(dateOnly)) {
|
|
641
|
-
return true;
|
|
642
|
-
}
|
|
643
|
-
// 2. Check min/max date
|
|
644
|
-
if (this._minDate) {
|
|
645
|
-
const minDateOnly = getStartOfDay(this._minDate);
|
|
646
|
-
if (dateOnly.getTime() < minDateOnly.getTime())
|
|
647
|
-
return true;
|
|
648
|
-
}
|
|
649
|
-
if (this._maxDate) {
|
|
650
|
-
const maxDateOnly = getStartOfDay(this._maxDate);
|
|
651
|
-
if (dateOnly.getTime() > maxDateOnly.getTime())
|
|
652
|
-
return true;
|
|
653
|
-
}
|
|
654
|
-
// 3. Check custom invalid date function
|
|
655
|
-
return this.isInvalidDate(date);
|
|
656
|
-
}
|
|
657
|
-
isMultipleSelected(d) {
|
|
658
|
-
if (!d || this.mode !== 'multiple')
|
|
659
|
-
return false;
|
|
660
|
-
const dTime = getStartOfDay(d).getTime();
|
|
661
|
-
return this.selectedDates.some(selected => getStartOfDay(selected).getTime() === dTime);
|
|
662
|
-
}
|
|
663
|
-
onTimeChange() {
|
|
664
|
-
if (this.disabled)
|
|
665
|
-
return;
|
|
666
|
-
if (this.mode === 'single' && this.selectedDate) {
|
|
667
|
-
this.selectedDate = this.applyCurrentTime(this.selectedDate);
|
|
668
|
-
this.emitValue(this.selectedDate);
|
|
669
|
-
}
|
|
670
|
-
else if (this.mode === 'range' && this.startDate && this.endDate) {
|
|
671
|
-
this.startDate = this.applyCurrentTime(this.startDate);
|
|
672
|
-
this.endDate = this.applyCurrentTime(this.endDate);
|
|
673
|
-
this.emitValue({ start: this.startDate, end: this.endDate });
|
|
674
|
-
}
|
|
675
|
-
else if (this.mode === 'range' && this.startDate && !this.endDate) {
|
|
676
|
-
this.startDate = this.applyCurrentTime(this.startDate);
|
|
677
|
-
}
|
|
678
|
-
else if (this.mode === 'multiple') {
|
|
679
|
-
this.selectedDates = this.selectedDates.map(date => {
|
|
680
|
-
const newDate = getStartOfDay(date);
|
|
681
|
-
return this.applyCurrentTime(newDate);
|
|
682
|
-
});
|
|
683
|
-
this.emitValue([...this.selectedDates]);
|
|
684
|
-
}
|
|
685
|
-
this.action.emit({ type: 'timeChanged', payload: { hour: this.currentHour, minute: this.currentMinute } });
|
|
686
|
-
}
|
|
687
|
-
onDateClick(day) {
|
|
688
|
-
if (!day || this.isDateDisabled(day) || this.disabled)
|
|
689
|
-
return;
|
|
690
|
-
const dateToToggle = getStartOfDay(day);
|
|
691
|
-
if (this.mode === 'single') {
|
|
692
|
-
this.selectedDate = this.applyCurrentTime(day);
|
|
693
|
-
this.emitValue(this.selectedDate);
|
|
694
|
-
}
|
|
695
|
-
else if (this.mode === 'range') {
|
|
696
|
-
if (!this.startDate || (this.startDate && this.endDate)) {
|
|
697
|
-
this.startDate = this.applyCurrentTime(day);
|
|
698
|
-
this.endDate = null;
|
|
699
|
-
}
|
|
700
|
-
else if (day >= this.startDate) {
|
|
701
|
-
this.endDate = this.applyCurrentTime(day);
|
|
702
|
-
this.emitValue({ start: this.startDate, end: this.endDate });
|
|
703
|
-
}
|
|
704
|
-
else {
|
|
705
|
-
this.startDate = this.applyCurrentTime(day);
|
|
706
|
-
this.endDate = null;
|
|
707
|
-
}
|
|
708
|
-
this.hoveredDate = null;
|
|
709
|
-
}
|
|
710
|
-
else if (this.mode === 'multiple') {
|
|
711
|
-
const existingIndex = this.selectedDates.findIndex(d => this.isSameDay(d, dateToToggle));
|
|
712
|
-
if (existingIndex > -1) {
|
|
713
|
-
this.selectedDates.splice(existingIndex, 1);
|
|
714
|
-
}
|
|
715
|
-
else {
|
|
716
|
-
const dateWithTime = this.applyCurrentTime(dateToToggle);
|
|
717
|
-
this.selectedDates.push(dateWithTime);
|
|
718
|
-
this.selectedDates.sort((a, b) => a.getTime() - b.getTime());
|
|
719
|
-
}
|
|
720
|
-
this.emitValue([...this.selectedDates]);
|
|
721
|
-
}
|
|
722
|
-
const dateToSync = this.mode === 'single' ? this.selectedDate :
|
|
723
|
-
this.mode === 'range' ? this.startDate :
|
|
724
|
-
this.mode === 'multiple' && this.selectedDates.length > 0 ? this.selectedDates[this.selectedDates.length - 1] : null;
|
|
725
|
-
if (dateToSync) {
|
|
726
|
-
this.update12HourState(dateToSync.getHours());
|
|
727
|
-
this.currentMinute = dateToSync.getMinutes();
|
|
728
|
-
}
|
|
729
|
-
this.action.emit({
|
|
730
|
-
type: 'dateSelected',
|
|
731
|
-
payload: {
|
|
732
|
-
mode: this.mode,
|
|
733
|
-
value: this._internalValue,
|
|
734
|
-
date: day
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
onDateHover(day) {
|
|
739
|
-
if (this.mode === 'range' && this.startDate && !this.endDate && day) {
|
|
740
|
-
this.hoveredDate = day;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
isPreviewInRange(day) {
|
|
744
|
-
if (this.mode !== 'range' || !this.startDate || this.endDate || !this.hoveredDate || !day)
|
|
745
|
-
return false;
|
|
746
|
-
const start = getStartOfDay(this.startDate).getTime();
|
|
747
|
-
const end = getStartOfDay(this.hoveredDate).getTime();
|
|
748
|
-
const time = getStartOfDay(day).getTime();
|
|
749
|
-
return time > Math.min(start, end) && time < Math.max(start, end);
|
|
750
|
-
}
|
|
751
|
-
generateCalendar(resetAnimation = true) {
|
|
752
|
-
this.daysInMonth = [];
|
|
753
|
-
const year = this.currentDate.getFullYear();
|
|
754
|
-
const month = this.currentDate.getMonth();
|
|
755
|
-
this._currentMonth = month;
|
|
756
|
-
this._currentYear = year;
|
|
757
|
-
this.generateDropdownOptions();
|
|
758
|
-
const firstDayOfMonth = new Date(year, month, 1);
|
|
759
|
-
const lastDayOfMonth = new Date(year, month + 1, 0);
|
|
760
|
-
const startDayOfWeek = firstDayOfMonth.getDay();
|
|
761
|
-
const emptyCellCount = (startDayOfWeek - this.firstDayOfWeek + 7) % 7;
|
|
762
|
-
for (let i = 0; i < emptyCellCount; i++) {
|
|
763
|
-
this.daysInMonth.push(null);
|
|
764
|
-
}
|
|
765
|
-
for (let i = 1; i <= lastDayOfMonth.getDate(); i++) {
|
|
766
|
-
this.daysInMonth.push(this._normalizeDate(new Date(year, month, i)));
|
|
767
|
-
}
|
|
768
|
-
if (resetAnimation) {
|
|
769
|
-
this.animateForward = false;
|
|
770
|
-
this.animateBackward = false;
|
|
771
|
-
}
|
|
772
|
-
this.action.emit({
|
|
773
|
-
type: 'calendarGenerated',
|
|
774
|
-
payload: {
|
|
775
|
-
month: month,
|
|
776
|
-
year: year,
|
|
777
|
-
days: this.daysInMonth.filter(d => d !== null)
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
generateDropdownOptions() {
|
|
782
|
-
this.yearOptions = generateYearOptions(this._currentYear);
|
|
783
|
-
}
|
|
784
|
-
changeMonth(delta) {
|
|
785
|
-
if (this.disabled)
|
|
786
|
-
return;
|
|
787
|
-
// 1. Set the animation class (triggers slide-out)
|
|
788
|
-
if (delta > 0) {
|
|
789
|
-
this.animateForward = true;
|
|
790
|
-
this.animateBackward = false;
|
|
791
|
-
}
|
|
792
|
-
else {
|
|
793
|
-
this.animateBackward = true;
|
|
794
|
-
this.animateForward = false;
|
|
795
|
-
}
|
|
796
|
-
const newDate = addMonths(this.currentDate, delta);
|
|
797
|
-
// 2. Wait for the slide-out transition to complete (300ms)
|
|
798
|
-
setTimeout(() => {
|
|
799
|
-
// 3. Update the data
|
|
800
|
-
this.currentDate = newDate;
|
|
801
|
-
this._currentMonth = newDate.getMonth();
|
|
802
|
-
this._currentYear = newDate.getFullYear();
|
|
803
|
-
// Generate new calendar view but tell it *not* to reset animation flags yet.
|
|
804
|
-
this.generateCalendar(false);
|
|
805
|
-
// 4. Reset the animation flags to false (triggers slide-in of the new content)
|
|
806
|
-
this.animateForward = false;
|
|
807
|
-
this.animateBackward = false;
|
|
808
|
-
}, 300); // Wait time should match the CSS transition duration (0.3s)
|
|
809
|
-
this.action.emit({ type: 'monthChanged', payload: { delta: delta } });
|
|
810
|
-
}
|
|
811
|
-
isSameDay(d1, d2) {
|
|
812
|
-
return this.dateComparator(d1, d2);
|
|
813
|
-
}
|
|
814
|
-
isInRange(d) {
|
|
815
|
-
if (!d || !this.startDate || !this.endDate)
|
|
816
|
-
return false;
|
|
817
|
-
const dTime = getStartOfDay(d).getTime();
|
|
818
|
-
const startDayTime = getStartOfDay(this.startDate).getTime();
|
|
819
|
-
const endDayTime = getStartOfDay(this.endDate).getTime();
|
|
820
|
-
const startTime = Math.min(startDayTime, endDayTime);
|
|
821
|
-
const endTime = Math.max(startDayTime, endDayTime);
|
|
822
|
-
return dTime > startTime && dTime < endTime;
|
|
823
|
-
}
|
|
824
|
-
ngOnDestroy() {
|
|
825
|
-
// Clean up any subscriptions or timers if needed
|
|
826
|
-
// Currently no cleanup required, but method is here for future optimizations
|
|
827
|
-
}
|
|
828
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: NgxsmkDatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
829
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.6", type: NgxsmkDatepickerComponent, isStandalone: true, selector: "ngxsmk-datepicker", inputs: { mode: "mode", isInvalidDate: "isInvalidDate", showRanges: "showRanges", showTime: "showTime", minuteInterval: "minuteInterval", holidayProvider: "holidayProvider", disableHolidays: "disableHolidays", placeholder: "placeholder", inline: "inline", startAt: "startAt", locale: "locale", theme: "theme", disabledState: "disabledState", minDate: "minDate", maxDate: "maxDate", ranges: "ranges" }, outputs: { valueChange: "valueChange", action: "action" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, properties: { "class.dark-theme": "this.isDarkMode" } }, providers: [{
|
|
830
|
-
provide: NG_VALUE_ACCESSOR,
|
|
831
|
-
useExisting: forwardRef(() => NgxsmkDatepickerComponent),
|
|
832
|
-
multi: true
|
|
833
|
-
}], usesOnChanges: true, ngImport: i0, template: `
|
|
834
|
-
<div class="ngxsmk-datepicker-wrapper" [class.ngxsmk-inline-mode]="isInlineMode">
|
|
835
|
-
@if (!isInlineMode) {
|
|
836
|
-
<div class="ngxsmk-input-group" (click)="toggleCalendar()" [class.disabled]="disabled">
|
|
837
|
-
<input type="text"
|
|
838
|
-
[value]="displayValue"
|
|
839
|
-
[placeholder]="placeholder"
|
|
840
|
-
readonly
|
|
841
|
-
[disabled]="disabled"
|
|
842
|
-
class="ngxsmk-display-input">
|
|
843
|
-
<button type="button" class="ngxsmk-clear-button" (click)="clearValue($event)" [disabled]="disabled" *ngIf="displayValue">
|
|
844
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>
|
|
845
|
-
</button>
|
|
846
|
-
</div>
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
@if (isCalendarVisible) {
|
|
850
|
-
<div class="ngxsmk-popover-container" [class.ngxsmk-inline-container]="isInlineMode">
|
|
851
|
-
<div class="ngxsmk-datepicker-container">
|
|
852
|
-
@if (showRanges && rangesArray.length > 0 && mode === 'range') {
|
|
853
|
-
<div class="ngxsmk-ranges-container">
|
|
854
|
-
<ul>
|
|
855
|
-
@for (range of rangesArray; track range.key) {
|
|
856
|
-
<li (click)="selectRange(range.value)" [class.disabled]="disabled">{{ range.key }}</li>
|
|
857
|
-
}
|
|
858
|
-
</ul>
|
|
859
|
-
</div>
|
|
860
|
-
}
|
|
861
|
-
<div class="ngxsmk-calendar-container">
|
|
862
|
-
<div class="ngxsmk-header">
|
|
863
|
-
<div class="ngxsmk-month-year-selects">
|
|
864
|
-
<ngxsmk-custom-select class="month-select" [options]="monthOptions"
|
|
865
|
-
[(value)]="currentMonth" [disabled]="disabled"></ngxsmk-custom-select>
|
|
866
|
-
<ngxsmk-custom-select class="year-select" [options]="yearOptions" [(value)]="currentYear" [disabled]="disabled"></ngxsmk-custom-select>
|
|
867
|
-
</div>
|
|
868
|
-
<div class="ngxsmk-nav-buttons">
|
|
869
|
-
<button type="button" class="ngxsmk-nav-button" (click)="changeMonth(-1)" [disabled]="disabled">
|
|
870
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
871
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
872
|
-
d="M328 112L184 256l144 144"/>
|
|
873
|
-
</svg>
|
|
874
|
-
</button>
|
|
875
|
-
<button type="button" class="ngxsmk-nav-button" (click)="changeMonth(1)" [disabled]="disabled">
|
|
876
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
877
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
878
|
-
d="M184 112l144 144-144 144"/>
|
|
879
|
-
</svg>
|
|
880
|
-
</button>
|
|
881
|
-
</div>
|
|
882
|
-
</div>
|
|
883
|
-
<div class="ngxsmk-days-grid-wrapper">
|
|
884
|
-
<div class="ngxsmk-days-grid"
|
|
885
|
-
[class.animate-forward]="animateForward"
|
|
886
|
-
[class.animate-backward]="animateBackward">
|
|
887
|
-
@for (day of weekDays; track day) {
|
|
888
|
-
<div class="ngxsmk-day-name">{{ day }}</div>
|
|
889
|
-
}
|
|
890
|
-
@for (day of daysInMonth; track $index) {
|
|
891
|
-
<div class="ngxsmk-day-cell"
|
|
892
|
-
[class.empty]="!day" [class.disabled]="isDateDisabled(day)"
|
|
893
|
-
[class.today]="isSameDay(day, today)"
|
|
894
|
-
[class.holiday]="isHoliday(day)"
|
|
895
|
-
[class.selected]="mode === 'single' && isSameDay(day, selectedDate)"
|
|
896
|
-
[class.multiple-selected]="mode === 'multiple' && isMultipleSelected(day)"
|
|
897
|
-
[class.start-date]="mode === 'range' && isSameDay(day, startDate)"
|
|
898
|
-
[class.end-date]="mode === 'range' && isSameDay(day, endDate)"
|
|
899
|
-
[class.in-range]="mode === 'range' && isInRange(day)"
|
|
900
|
-
[class.preview-range]="isPreviewInRange(day)"
|
|
901
|
-
(click)="onDateClick(day)" (mouseenter)="onDateHover(day)">
|
|
902
|
-
@if (day) {
|
|
903
|
-
<div class="ngxsmk-day-number" [attr.title]="getHolidayLabel(day)">{{ day | date : 'd' }}</div>
|
|
904
|
-
}
|
|
905
|
-
</div>
|
|
906
|
-
}
|
|
907
|
-
</div>
|
|
908
|
-
</div>
|
|
909
|
-
|
|
910
|
-
@if (showTime) {
|
|
911
|
-
<div class="ngxsmk-time-selection">
|
|
912
|
-
<span class="ngxsmk-time-label">Time:</span>
|
|
913
|
-
<ngxsmk-custom-select
|
|
914
|
-
class="hour-select"
|
|
915
|
-
[options]="hourOptions"
|
|
916
|
-
[(value)]="currentDisplayHour"
|
|
917
|
-
(valueChange)="onTimeChange()"
|
|
918
|
-
[disabled]="disabled"
|
|
919
|
-
></ngxsmk-custom-select>
|
|
920
|
-
<span class="ngxsmk-time-separator">:</span>
|
|
921
|
-
<ngxsmk-custom-select
|
|
922
|
-
class="minute-select"
|
|
923
|
-
[options]="minuteOptions"
|
|
924
|
-
[(value)]="currentMinute"
|
|
925
|
-
(valueChange)="onTimeChange()"
|
|
926
|
-
[disabled]="disabled"
|
|
927
|
-
></ngxsmk-custom-select>
|
|
928
|
-
<ngxsmk-custom-select
|
|
929
|
-
class="ampm-select"
|
|
930
|
-
[options]="ampmOptions"
|
|
931
|
-
[(value)]="isPm"
|
|
932
|
-
(valueChange)="onTimeChange()"
|
|
933
|
-
[disabled]="disabled"
|
|
934
|
-
></ngxsmk-custom-select>
|
|
935
|
-
</div>
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
<div class="ngxsmk-footer" *ngIf="!isInlineMode">
|
|
939
|
-
<button type="button" class="ngxsmk-clear-button-footer" (click)="clearValue($event)" [disabled]="disabled">
|
|
940
|
-
Clear
|
|
941
|
-
</button>
|
|
942
|
-
<button type="button" class="ngxsmk-close-button" (click)="isCalendarOpen = false" [disabled]="disabled">
|
|
943
|
-
Close
|
|
944
|
-
</button>
|
|
945
|
-
</div>
|
|
946
|
-
</div>
|
|
947
|
-
</div>
|
|
948
|
-
</div>
|
|
949
|
-
}
|
|
950
|
-
</div>
|
|
951
|
-
`, isInline: true, styles: [":host{--datepicker-primary-color: #6d28d9;--datepicker-primary-contrast: #ffffff;--datepicker-range-background: #f5f3ff;--datepicker-background: #ffffff;--datepicker-text-color: #222428;--datepicker-subtle-text-color: #9ca3af;--datepicker-border-color: #e9e9e9;--datepicker-hover-background: #f0f0f0;--datepicker-font-size-base: 14px;--datepicker-font-size-sm: 12px;--datepicker-font-size-lg: 16px;--datepicker-font-size-xl: 18px;--datepicker-line-height: 1.4;--datepicker-spacing-xs: 4px;--datepicker-spacing-sm: 8px;--datepicker-spacing-md: 12px;--datepicker-spacing-lg: 16px;--datepicker-spacing-xl: 20px;display:inline-block;position:relative}:host(.dark-theme){--datepicker-range-background: rgba(139, 92, 246, .2);--datepicker-background: #1f2937;--datepicker-text-color: #d1d5db;--datepicker-subtle-text-color: #6b7280;--datepicker-border-color: #4b5563;--datepicker-hover-background: #374151}.ngxsmk-datepicker-wrapper{position:relative}.ngxsmk-input-group{display:flex;align-items:center;cursor:pointer;width:100%;min-width:150px;border:1px solid var(--datepicker-border-color, #ccc);border-radius:4px;background:var(--datepicker-background);transition:all .2s ease;position:relative;overflow:hidden}.ngxsmk-input-group:focus-within{border-color:var(--datepicker-primary-color);box-shadow:0 0 0 2px #6d28d91a}.ngxsmk-input-group:hover:not(.disabled){border-color:var(--datepicker-primary-color)}.ngxsmk-input-group.has-value{border-color:var(--datepicker-primary-color)}.ngxsmk-input-group.error{border-color:#dc2626;box-shadow:0 0 0 2px #dc26261a}.ngxsmk-input-group.success{border-color:#16a34a;box-shadow:0 0 0 2px #16a34a1a}.ngxsmk-input-group.disabled{cursor:not-allowed;opacity:.7}.ngxsmk-display-input{flex-grow:1;padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-sm);font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);color:var(--datepicker-text-color, #333);background:transparent;border:none;outline:none;cursor:pointer;transition:all .2s ease;min-height:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ngxsmk-display-input:disabled{background:var(--datepicker-hover-background, #f0f0f0);cursor:not-allowed;opacity:.6}.ngxsmk-display-input:focus{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-display-input::placeholder{color:var(--datepicker-subtle-text-color);font-style:italic}.ngxsmk-input-group:focus-within .ngxsmk-display-input{color:var(--datepicker-primary-color)}.ngxsmk-input-group:hover:not(.disabled) .ngxsmk-display-input{color:var(--datepicker-text-color)}.ngxsmk-input-group.has-value .ngxsmk-display-input{font-weight:500;color:var(--datepicker-text-color)}.ngxsmk-input-group:not(.has-value) .ngxsmk-display-input{color:var(--datepicker-subtle-text-color)}.ngxsmk-input-group.error .ngxsmk-display-input{color:#dc2626;border-color:#dc2626}.ngxsmk-input-group.success .ngxsmk-display-input{color:#16a34a;border-color:#16a34a}.ngxsmk-input-group.compact{min-width:120px;padding:var(--datepicker-spacing-xs)}.ngxsmk-input-group.compact .ngxsmk-display-input{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs)}.ngxsmk-input-group.large{min-width:200px;padding:var(--datepicker-spacing-md)}.ngxsmk-input-group.large .ngxsmk-display-input{font-size:var(--datepicker-font-size-lg);padding:var(--datepicker-spacing-md)}.ngxsmk-input-group.with-icon .ngxsmk-display-input{padding-left:32px}.ngxsmk-input-group .ngxsmk-input-icon{position:absolute;left:var(--datepicker-spacing-sm);top:50%;transform:translateY(-50%);color:var(--datepicker-subtle-text-color);pointer-events:none}.ngxsmk-input-group.loading .ngxsmk-display-input{color:var(--datepicker-subtle-text-color);cursor:wait}.ngxsmk-input-group.loading:after{content:\"\";position:absolute;right:var(--datepicker-spacing-sm);top:50%;transform:translateY(-50%);width:16px;height:16px;border:2px solid var(--datepicker-border-color);border-top:2px solid var(--datepicker-primary-color);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:translateY(-50%) rotate(0)}to{transform:translateY(-50%) rotate(360deg)}}.ngxsmk-clear-button{background:none;border:none;padding:0 8px;cursor:pointer;color:var(--datepicker-subtle-text-color);line-height:1}.ngxsmk-clear-button svg{width:14px;height:14px}.ngxsmk-clear-button:hover{color:var(--datepicker-text-color)}.ngxsmk-popover-container{position:absolute;top:100%;left:0;z-index:10000;margin-top:8px}.ngxsmk-popover-container.ngxsmk-inline-container{position:static;margin-top:0}.ngxsmk-datepicker-wrapper.ngxsmk-inline-mode{display:block}.ngxsmk-datepicker-wrapper.ngxsmk-inline-mode .ngxsmk-datepicker-container{box-shadow:none}.ngxsmk-footer{display:flex;justify-content:flex-end;gap:8px;margin-top:12px;padding-top:8px;border-top:1px solid var(--datepicker-border-color)}.ngxsmk-clear-button-footer,.ngxsmk-close-button{padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-md);border-radius:6px;font-size:var(--datepicker-font-size-sm);line-height:var(--datepicker-line-height);cursor:pointer;transition:background-color .2s;border:1px solid var(--datepicker-border-color)}.ngxsmk-clear-button-footer{background:none;color:var(--datepicker-subtle-text-color)}.ngxsmk-close-button{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast);border-color:var(--datepicker-primary-color)}.ngxsmk-close-button:hover:not(:disabled){opacity:.9}.ngxsmk-clear-button-footer:hover:not(:disabled){background-color:var(--datepicker-hover-background)}.ngxsmk-datepicker-container{display:flex;flex-direction:column;width:100%}.ngxsmk-calendar-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);border-radius:10px;padding:var(--datepicker-spacing-md);background:var(--datepicker-background);box-shadow:0 4px 10px #0000001a;width:100%}.ngxsmk-ranges-container{width:100%;padding:var(--datepicker-spacing-md);border-right:none;background:var(--datepicker-hover-background);border-radius:10px}.ngxsmk-ranges-container ul{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;list-style:none;padding:0;margin:0}.ngxsmk-ranges-container li{padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-sm);margin-bottom:0;font-size:var(--datepicker-font-size-sm);line-height:var(--datepicker-line-height);border:1px solid var(--datepicker-border-color);border-radius:6px;cursor:pointer;transition:background-color .15s ease;flex-shrink:0}.ngxsmk-ranges-container li:hover{background-color:var(--datepicker-hover-background)}.ngxsmk-ranges-container li.disabled{cursor:not-allowed;opacity:.5;background-color:transparent!important;color:var(--datepicker-subtle-text-color, #9ca3af)}.ngxsmk-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;position:relative;z-index:2;gap:4px}.ngxsmk-month-year-selects{display:flex;gap:4px}.ngxsmk-month-year-selects app-custom-select.month-select{--custom-select-width: 100px}.ngxsmk-month-year-selects app-custom-select.year-select{--custom-select-width: 75px}.ngxsmk-nav-buttons{display:flex}.ngxsmk-nav-button{padding:6px;background:none;border:none;cursor:pointer;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--datepicker-text-color)}.ngxsmk-nav-button:hover:not(:disabled){background-color:var(--datepicker-hover-background)}.ngxsmk-nav-button:disabled{cursor:not-allowed;opacity:.5}.ngxsmk-nav-button svg{width:16px;height:16px}.ngxsmk-days-grid-wrapper{overflow-x:hidden}.ngxsmk-days-grid{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;gap:0;transition:transform .3s ease-out,opacity .15s ease-out .15s}.ngxsmk-days-grid.animate-forward{transform:translate(-100%);opacity:0}.ngxsmk-days-grid.animate-backward{transform:translate(100%);opacity:0}.ngxsmk-day-name{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-sm) 0;color:var(--datepicker-subtle-text-color);font-weight:600;line-height:var(--datepicker-line-height)}.ngxsmk-day-cell{height:32px;position:relative;display:flex;justify-content:center;align-items:center;cursor:pointer;border-radius:0}.ngxsmk-day-cell.holiday .ngxsmk-day-number{color:var(--datepicker-primary-color);text-decoration:underline dotted}.ngxsmk-day-number{width:30px;height:30px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--datepicker-text-color);font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);position:relative;z-index:1}.ngxsmk-time-selection{display:flex;align-items:center;gap:var(--datepicker-spacing-xs);flex-wrap:wrap;margin-top:var(--datepicker-spacing-md);padding-top:var(--datepicker-spacing-sm);border-top:1px solid var(--datepicker-border-color)}.ngxsmk-time-label{font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);color:var(--datepicker-subtle-text-color);margin-right:var(--datepicker-spacing-xs)}.ngxsmk-time-separator{font-weight:600;color:var(--datepicker-text-color)}.ngxsmk-time-selection app-custom-select{--custom-select-width: 75px;height:28px}.ngxsmk-time-selection app-custom-select.ampm-select{--custom-select-width: 75px}.ngxsmk-time-selection .hour-select,.ngxsmk-time-selection .minute-select,.ngxsmk-time-selection .ampm-select{--custom-select-width: 75px;--custom-select-height: 28px}.ngxsmk-time-selection app-custom-select:hover{border-color:var(--datepicker-primary-color)}.ngxsmk-time-selection app-custom-select:focus-within{border-color:var(--datepicker-primary-color);box-shadow:0 0 0 2px #6d28d933}.ngxsmk-time-selection .time-select-compact{--custom-select-width: 60px;--custom-select-height: 24px;font-size:var(--datepicker-font-size-sm)}.ngxsmk-time-selection .time-select-large{--custom-select-width: 90px;--custom-select-height: 36px;font-size:var(--datepicker-font-size-lg)}.ngxsmk-time-selection .time-select-disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.ngxsmk-time-selection app-custom-select{transition:border-color .2s ease,box-shadow .2s ease}.ngxsmk-time-selection app-custom-select.ngxsmk-time-select-animated{transition:all .3s cubic-bezier(.4,0,.2,1)}.ngxsmk-day-cell:not(.disabled):hover .ngxsmk-day-number{background-color:var(--datepicker-hover-background);color:var(--datepicker-primary-color)}.ngxsmk-day-cell.start-date .ngxsmk-day-number,.ngxsmk-day-cell.end-date .ngxsmk-day-number,.ngxsmk-day-cell.selected .ngxsmk-day-number,.ngxsmk-day-cell.multiple-selected .ngxsmk-day-number{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast)}.ngxsmk-day-cell.multiple-selected .ngxsmk-day-number{border:1px dashed var(--datepicker-primary-contrast)}.ngxsmk-day-cell.multiple-selected:hover .ngxsmk-day-number{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast)}.ngxsmk-day-cell.in-range,.ngxsmk-day-cell.start-date,.ngxsmk-day-cell.end-date,.ngxsmk-day-cell.preview-range{background-color:var(--datepicker-range-background)}.ngxsmk-day-cell.start-date{border-top-left-radius:100%;border-bottom-left-radius:100%}.ngxsmk-day-cell.end-date{border-top-right-radius:100%;border-bottom-right-radius:100%}.ngxsmk-day-cell.start-date.end-date{border-radius:50px}.ngxsmk-day-cell.disabled{background-color:transparent!important;color:#4b5563;cursor:not-allowed;pointer-events:none;opacity:.5}.ngxsmk-day-cell.today .ngxsmk-day-number{border:1px solid var(--datepicker-primary-color)}@media (min-width: 600px){.ngxsmk-datepicker-container{display:flex;flex-direction:row}.ngxsmk-calendar-container{padding:var(--datepicker-spacing-lg);box-shadow:0 4px 10px #0000001a;width:auto;border-radius:10px;min-height:280px}.ngxsmk-ranges-container{width:180px;padding:var(--datepicker-spacing-lg);border-bottom:none;background:var(--datepicker-background);border-radius:10px 0 0 10px}.ngxsmk-ranges-container ul{flex-direction:column;justify-content:flex-start;gap:0}.ngxsmk-ranges-container li{padding:var(--datepicker-spacing-sm);margin-bottom:var(--datepicker-spacing-sm);border:none;font-size:var(--datepicker-font-size-lg)}.ngxsmk-header{margin-bottom:var(--datepicker-spacing-md);gap:var(--datepicker-spacing-xs)}.ngxsmk-month-year-selects app-custom-select.month-select{--custom-select-width: 120px}.ngxsmk-month-year-selects app-custom-select.year-select{--custom-select-width: 90px}.ngxsmk-nav-button{padding:var(--datepicker-spacing-sm)}.ngxsmk-nav-button svg{width:18px;height:18px}.ngxsmk-day-name{font-size:var(--datepicker-font-size-base);padding:var(--datepicker-spacing-sm) 0}.ngxsmk-day-cell{height:38px}.ngxsmk-day-number{width:36px;height:36px;font-size:var(--datepicker-font-size-lg)}.ngxsmk-time-selection{margin-top:var(--datepicker-spacing-lg);padding-top:var(--datepicker-spacing-md)}.ngxsmk-time-selection app-custom-select{--custom-select-width: 60px;height:30px}.ngxsmk-time-selection app-custom-select.ampm-select{--custom-select-width: 70px}.ngxsmk-time-selection .hour-select,.ngxsmk-time-selection .minute-select{--custom-select-width: 60px;--custom-select-height: 30px}.ngxsmk-time-selection .ampm-select{--custom-select-width: 70px;--custom-select-height: 30px}}@media (prefers-reduced-motion: reduce){.ngxsmk-days-grid{transition:none}.ngxsmk-days-grid.animate-forward,.ngxsmk-days-grid.animate-backward{transform:none;opacity:1}}@media (prefers-contrast: high){:host{--datepicker-border-color: #000000;--datepicker-text-color: #000000;--datepicker-subtle-text-color: #666666}.ngxsmk-day-cell.disabled{opacity:.3}}@media print{.ngxsmk-datepicker-wrapper{display:none}}.ngxsmk-day-cell:focus-visible .ngxsmk-day-number{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-nav-button:focus-visible,.ngxsmk-clear-button:focus-visible,.ngxsmk-clear-button-footer:focus-visible,.ngxsmk-close-button:focus-visible{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-day-cell,.ngxsmk-nav-button,.ngxsmk-clear-button{will-change:auto}.ngxsmk-days-grid{contain:layout style paint}@media (max-width: 480px){.ngxsmk-day-cell{height:28px}.ngxsmk-day-number{width:26px;height:26px;font-size:var(--datepicker-font-size-sm)}.ngxsmk-day-name{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs) 0}.ngxsmk-calendar-container{padding:var(--datepicker-spacing-sm)}.ngxsmk-header{margin-bottom:var(--datepicker-spacing-sm)}.ngxsmk-input-group{min-width:120px}.ngxsmk-display-input{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs)}.ngxsmk-clear-button{padding:0 var(--datepicker-spacing-xs)}.ngxsmk-clear-button svg{width:12px;height:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: CustomSelectComponent, selector: "ngxsmk-custom-select", inputs: ["options", "value", "disabled"], outputs: ["valueChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "pipe", type: i1.DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
952
|
-
}
|
|
953
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: NgxsmkDatepickerComponent, decorators: [{
|
|
954
|
-
type: Component,
|
|
955
|
-
args: [{ selector: 'ngxsmk-datepicker', standalone: true, imports: [CommonModule, FormsModule, CustomSelectComponent, DatePipe, ReactiveFormsModule], providers: [{
|
|
956
|
-
provide: NG_VALUE_ACCESSOR,
|
|
957
|
-
useExisting: forwardRef(() => NgxsmkDatepickerComponent),
|
|
958
|
-
multi: true
|
|
959
|
-
}], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
960
|
-
<div class="ngxsmk-datepicker-wrapper" [class.ngxsmk-inline-mode]="isInlineMode">
|
|
961
|
-
@if (!isInlineMode) {
|
|
962
|
-
<div class="ngxsmk-input-group" (click)="toggleCalendar()" [class.disabled]="disabled">
|
|
963
|
-
<input type="text"
|
|
964
|
-
[value]="displayValue"
|
|
965
|
-
[placeholder]="placeholder"
|
|
966
|
-
readonly
|
|
967
|
-
[disabled]="disabled"
|
|
968
|
-
class="ngxsmk-display-input">
|
|
969
|
-
<button type="button" class="ngxsmk-clear-button" (click)="clearValue($event)" [disabled]="disabled" *ngIf="displayValue">
|
|
970
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>
|
|
971
|
-
</button>
|
|
972
|
-
</div>
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
@if (isCalendarVisible) {
|
|
976
|
-
<div class="ngxsmk-popover-container" [class.ngxsmk-inline-container]="isInlineMode">
|
|
977
|
-
<div class="ngxsmk-datepicker-container">
|
|
978
|
-
@if (showRanges && rangesArray.length > 0 && mode === 'range') {
|
|
979
|
-
<div class="ngxsmk-ranges-container">
|
|
980
|
-
<ul>
|
|
981
|
-
@for (range of rangesArray; track range.key) {
|
|
982
|
-
<li (click)="selectRange(range.value)" [class.disabled]="disabled">{{ range.key }}</li>
|
|
983
|
-
}
|
|
984
|
-
</ul>
|
|
985
|
-
</div>
|
|
986
|
-
}
|
|
987
|
-
<div class="ngxsmk-calendar-container">
|
|
988
|
-
<div class="ngxsmk-header">
|
|
989
|
-
<div class="ngxsmk-month-year-selects">
|
|
990
|
-
<ngxsmk-custom-select class="month-select" [options]="monthOptions"
|
|
991
|
-
[(value)]="currentMonth" [disabled]="disabled"></ngxsmk-custom-select>
|
|
992
|
-
<ngxsmk-custom-select class="year-select" [options]="yearOptions" [(value)]="currentYear" [disabled]="disabled"></ngxsmk-custom-select>
|
|
993
|
-
</div>
|
|
994
|
-
<div class="ngxsmk-nav-buttons">
|
|
995
|
-
<button type="button" class="ngxsmk-nav-button" (click)="changeMonth(-1)" [disabled]="disabled">
|
|
996
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
997
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
998
|
-
d="M328 112L184 256l144 144"/>
|
|
999
|
-
</svg>
|
|
1000
|
-
</button>
|
|
1001
|
-
<button type="button" class="ngxsmk-nav-button" (click)="changeMonth(1)" [disabled]="disabled">
|
|
1002
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
1003
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48"
|
|
1004
|
-
d="M184 112l144 144-144 144"/>
|
|
1005
|
-
</svg>
|
|
1006
|
-
</button>
|
|
1007
|
-
</div>
|
|
1008
|
-
</div>
|
|
1009
|
-
<div class="ngxsmk-days-grid-wrapper">
|
|
1010
|
-
<div class="ngxsmk-days-grid"
|
|
1011
|
-
[class.animate-forward]="animateForward"
|
|
1012
|
-
[class.animate-backward]="animateBackward">
|
|
1013
|
-
@for (day of weekDays; track day) {
|
|
1014
|
-
<div class="ngxsmk-day-name">{{ day }}</div>
|
|
1015
|
-
}
|
|
1016
|
-
@for (day of daysInMonth; track $index) {
|
|
1017
|
-
<div class="ngxsmk-day-cell"
|
|
1018
|
-
[class.empty]="!day" [class.disabled]="isDateDisabled(day)"
|
|
1019
|
-
[class.today]="isSameDay(day, today)"
|
|
1020
|
-
[class.holiday]="isHoliday(day)"
|
|
1021
|
-
[class.selected]="mode === 'single' && isSameDay(day, selectedDate)"
|
|
1022
|
-
[class.multiple-selected]="mode === 'multiple' && isMultipleSelected(day)"
|
|
1023
|
-
[class.start-date]="mode === 'range' && isSameDay(day, startDate)"
|
|
1024
|
-
[class.end-date]="mode === 'range' && isSameDay(day, endDate)"
|
|
1025
|
-
[class.in-range]="mode === 'range' && isInRange(day)"
|
|
1026
|
-
[class.preview-range]="isPreviewInRange(day)"
|
|
1027
|
-
(click)="onDateClick(day)" (mouseenter)="onDateHover(day)">
|
|
1028
|
-
@if (day) {
|
|
1029
|
-
<div class="ngxsmk-day-number" [attr.title]="getHolidayLabel(day)">{{ day | date : 'd' }}</div>
|
|
1030
|
-
}
|
|
1031
|
-
</div>
|
|
1032
|
-
}
|
|
1033
|
-
</div>
|
|
1034
|
-
</div>
|
|
1035
|
-
|
|
1036
|
-
@if (showTime) {
|
|
1037
|
-
<div class="ngxsmk-time-selection">
|
|
1038
|
-
<span class="ngxsmk-time-label">Time:</span>
|
|
1039
|
-
<ngxsmk-custom-select
|
|
1040
|
-
class="hour-select"
|
|
1041
|
-
[options]="hourOptions"
|
|
1042
|
-
[(value)]="currentDisplayHour"
|
|
1043
|
-
(valueChange)="onTimeChange()"
|
|
1044
|
-
[disabled]="disabled"
|
|
1045
|
-
></ngxsmk-custom-select>
|
|
1046
|
-
<span class="ngxsmk-time-separator">:</span>
|
|
1047
|
-
<ngxsmk-custom-select
|
|
1048
|
-
class="minute-select"
|
|
1049
|
-
[options]="minuteOptions"
|
|
1050
|
-
[(value)]="currentMinute"
|
|
1051
|
-
(valueChange)="onTimeChange()"
|
|
1052
|
-
[disabled]="disabled"
|
|
1053
|
-
></ngxsmk-custom-select>
|
|
1054
|
-
<ngxsmk-custom-select
|
|
1055
|
-
class="ampm-select"
|
|
1056
|
-
[options]="ampmOptions"
|
|
1057
|
-
[(value)]="isPm"
|
|
1058
|
-
(valueChange)="onTimeChange()"
|
|
1059
|
-
[disabled]="disabled"
|
|
1060
|
-
></ngxsmk-custom-select>
|
|
1061
|
-
</div>
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
<div class="ngxsmk-footer" *ngIf="!isInlineMode">
|
|
1065
|
-
<button type="button" class="ngxsmk-clear-button-footer" (click)="clearValue($event)" [disabled]="disabled">
|
|
1066
|
-
Clear
|
|
1067
|
-
</button>
|
|
1068
|
-
<button type="button" class="ngxsmk-close-button" (click)="isCalendarOpen = false" [disabled]="disabled">
|
|
1069
|
-
Close
|
|
1070
|
-
</button>
|
|
1071
|
-
</div>
|
|
1072
|
-
</div>
|
|
1073
|
-
</div>
|
|
1074
|
-
</div>
|
|
1075
|
-
}
|
|
1076
|
-
</div>
|
|
1077
|
-
`, styles: [":host{--datepicker-primary-color: #6d28d9;--datepicker-primary-contrast: #ffffff;--datepicker-range-background: #f5f3ff;--datepicker-background: #ffffff;--datepicker-text-color: #222428;--datepicker-subtle-text-color: #9ca3af;--datepicker-border-color: #e9e9e9;--datepicker-hover-background: #f0f0f0;--datepicker-font-size-base: 14px;--datepicker-font-size-sm: 12px;--datepicker-font-size-lg: 16px;--datepicker-font-size-xl: 18px;--datepicker-line-height: 1.4;--datepicker-spacing-xs: 4px;--datepicker-spacing-sm: 8px;--datepicker-spacing-md: 12px;--datepicker-spacing-lg: 16px;--datepicker-spacing-xl: 20px;display:inline-block;position:relative}:host(.dark-theme){--datepicker-range-background: rgba(139, 92, 246, .2);--datepicker-background: #1f2937;--datepicker-text-color: #d1d5db;--datepicker-subtle-text-color: #6b7280;--datepicker-border-color: #4b5563;--datepicker-hover-background: #374151}.ngxsmk-datepicker-wrapper{position:relative}.ngxsmk-input-group{display:flex;align-items:center;cursor:pointer;width:100%;min-width:150px;border:1px solid var(--datepicker-border-color, #ccc);border-radius:4px;background:var(--datepicker-background);transition:all .2s ease;position:relative;overflow:hidden}.ngxsmk-input-group:focus-within{border-color:var(--datepicker-primary-color);box-shadow:0 0 0 2px #6d28d91a}.ngxsmk-input-group:hover:not(.disabled){border-color:var(--datepicker-primary-color)}.ngxsmk-input-group.has-value{border-color:var(--datepicker-primary-color)}.ngxsmk-input-group.error{border-color:#dc2626;box-shadow:0 0 0 2px #dc26261a}.ngxsmk-input-group.success{border-color:#16a34a;box-shadow:0 0 0 2px #16a34a1a}.ngxsmk-input-group.disabled{cursor:not-allowed;opacity:.7}.ngxsmk-display-input{flex-grow:1;padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-sm);font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);color:var(--datepicker-text-color, #333);background:transparent;border:none;outline:none;cursor:pointer;transition:all .2s ease;min-height:20px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ngxsmk-display-input:disabled{background:var(--datepicker-hover-background, #f0f0f0);cursor:not-allowed;opacity:.6}.ngxsmk-display-input:focus{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-display-input::placeholder{color:var(--datepicker-subtle-text-color);font-style:italic}.ngxsmk-input-group:focus-within .ngxsmk-display-input{color:var(--datepicker-primary-color)}.ngxsmk-input-group:hover:not(.disabled) .ngxsmk-display-input{color:var(--datepicker-text-color)}.ngxsmk-input-group.has-value .ngxsmk-display-input{font-weight:500;color:var(--datepicker-text-color)}.ngxsmk-input-group:not(.has-value) .ngxsmk-display-input{color:var(--datepicker-subtle-text-color)}.ngxsmk-input-group.error .ngxsmk-display-input{color:#dc2626;border-color:#dc2626}.ngxsmk-input-group.success .ngxsmk-display-input{color:#16a34a;border-color:#16a34a}.ngxsmk-input-group.compact{min-width:120px;padding:var(--datepicker-spacing-xs)}.ngxsmk-input-group.compact .ngxsmk-display-input{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs)}.ngxsmk-input-group.large{min-width:200px;padding:var(--datepicker-spacing-md)}.ngxsmk-input-group.large .ngxsmk-display-input{font-size:var(--datepicker-font-size-lg);padding:var(--datepicker-spacing-md)}.ngxsmk-input-group.with-icon .ngxsmk-display-input{padding-left:32px}.ngxsmk-input-group .ngxsmk-input-icon{position:absolute;left:var(--datepicker-spacing-sm);top:50%;transform:translateY(-50%);color:var(--datepicker-subtle-text-color);pointer-events:none}.ngxsmk-input-group.loading .ngxsmk-display-input{color:var(--datepicker-subtle-text-color);cursor:wait}.ngxsmk-input-group.loading:after{content:\"\";position:absolute;right:var(--datepicker-spacing-sm);top:50%;transform:translateY(-50%);width:16px;height:16px;border:2px solid var(--datepicker-border-color);border-top:2px solid var(--datepicker-primary-color);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:translateY(-50%) rotate(0)}to{transform:translateY(-50%) rotate(360deg)}}.ngxsmk-clear-button{background:none;border:none;padding:0 8px;cursor:pointer;color:var(--datepicker-subtle-text-color);line-height:1}.ngxsmk-clear-button svg{width:14px;height:14px}.ngxsmk-clear-button:hover{color:var(--datepicker-text-color)}.ngxsmk-popover-container{position:absolute;top:100%;left:0;z-index:10000;margin-top:8px}.ngxsmk-popover-container.ngxsmk-inline-container{position:static;margin-top:0}.ngxsmk-datepicker-wrapper.ngxsmk-inline-mode{display:block}.ngxsmk-datepicker-wrapper.ngxsmk-inline-mode .ngxsmk-datepicker-container{box-shadow:none}.ngxsmk-footer{display:flex;justify-content:flex-end;gap:8px;margin-top:12px;padding-top:8px;border-top:1px solid var(--datepicker-border-color)}.ngxsmk-clear-button-footer,.ngxsmk-close-button{padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-md);border-radius:6px;font-size:var(--datepicker-font-size-sm);line-height:var(--datepicker-line-height);cursor:pointer;transition:background-color .2s;border:1px solid var(--datepicker-border-color)}.ngxsmk-clear-button-footer{background:none;color:var(--datepicker-subtle-text-color)}.ngxsmk-close-button{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast);border-color:var(--datepicker-primary-color)}.ngxsmk-close-button:hover:not(:disabled){opacity:.9}.ngxsmk-clear-button-footer:hover:not(:disabled){background-color:var(--datepicker-hover-background)}.ngxsmk-datepicker-container{display:flex;flex-direction:column;width:100%}.ngxsmk-calendar-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);border-radius:10px;padding:var(--datepicker-spacing-md);background:var(--datepicker-background);box-shadow:0 4px 10px #0000001a;width:100%}.ngxsmk-ranges-container{width:100%;padding:var(--datepicker-spacing-md);border-right:none;background:var(--datepicker-hover-background);border-radius:10px}.ngxsmk-ranges-container ul{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;list-style:none;padding:0;margin:0}.ngxsmk-ranges-container li{padding:var(--datepicker-spacing-sm) var(--datepicker-spacing-sm);margin-bottom:0;font-size:var(--datepicker-font-size-sm);line-height:var(--datepicker-line-height);border:1px solid var(--datepicker-border-color);border-radius:6px;cursor:pointer;transition:background-color .15s ease;flex-shrink:0}.ngxsmk-ranges-container li:hover{background-color:var(--datepicker-hover-background)}.ngxsmk-ranges-container li.disabled{cursor:not-allowed;opacity:.5;background-color:transparent!important;color:var(--datepicker-subtle-text-color, #9ca3af)}.ngxsmk-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;position:relative;z-index:2;gap:4px}.ngxsmk-month-year-selects{display:flex;gap:4px}.ngxsmk-month-year-selects app-custom-select.month-select{--custom-select-width: 100px}.ngxsmk-month-year-selects app-custom-select.year-select{--custom-select-width: 75px}.ngxsmk-nav-buttons{display:flex}.ngxsmk-nav-button{padding:6px;background:none;border:none;cursor:pointer;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--datepicker-text-color)}.ngxsmk-nav-button:hover:not(:disabled){background-color:var(--datepicker-hover-background)}.ngxsmk-nav-button:disabled{cursor:not-allowed;opacity:.5}.ngxsmk-nav-button svg{width:16px;height:16px}.ngxsmk-days-grid-wrapper{overflow-x:hidden}.ngxsmk-days-grid{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;gap:0;transition:transform .3s ease-out,opacity .15s ease-out .15s}.ngxsmk-days-grid.animate-forward{transform:translate(-100%);opacity:0}.ngxsmk-days-grid.animate-backward{transform:translate(100%);opacity:0}.ngxsmk-day-name{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-sm) 0;color:var(--datepicker-subtle-text-color);font-weight:600;line-height:var(--datepicker-line-height)}.ngxsmk-day-cell{height:32px;position:relative;display:flex;justify-content:center;align-items:center;cursor:pointer;border-radius:0}.ngxsmk-day-cell.holiday .ngxsmk-day-number{color:var(--datepicker-primary-color);text-decoration:underline dotted}.ngxsmk-day-number{width:30px;height:30px;display:flex;justify-content:center;align-items:center;border-radius:50%;color:var(--datepicker-text-color);font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);position:relative;z-index:1}.ngxsmk-time-selection{display:flex;align-items:center;gap:var(--datepicker-spacing-xs);flex-wrap:wrap;margin-top:var(--datepicker-spacing-md);padding-top:var(--datepicker-spacing-sm);border-top:1px solid var(--datepicker-border-color)}.ngxsmk-time-label{font-size:var(--datepicker-font-size-base);line-height:var(--datepicker-line-height);color:var(--datepicker-subtle-text-color);margin-right:var(--datepicker-spacing-xs)}.ngxsmk-time-separator{font-weight:600;color:var(--datepicker-text-color)}.ngxsmk-time-selection app-custom-select{--custom-select-width: 75px;height:28px}.ngxsmk-time-selection app-custom-select.ampm-select{--custom-select-width: 75px}.ngxsmk-time-selection .hour-select,.ngxsmk-time-selection .minute-select,.ngxsmk-time-selection .ampm-select{--custom-select-width: 75px;--custom-select-height: 28px}.ngxsmk-time-selection app-custom-select:hover{border-color:var(--datepicker-primary-color)}.ngxsmk-time-selection app-custom-select:focus-within{border-color:var(--datepicker-primary-color);box-shadow:0 0 0 2px #6d28d933}.ngxsmk-time-selection .time-select-compact{--custom-select-width: 60px;--custom-select-height: 24px;font-size:var(--datepicker-font-size-sm)}.ngxsmk-time-selection .time-select-large{--custom-select-width: 90px;--custom-select-height: 36px;font-size:var(--datepicker-font-size-lg)}.ngxsmk-time-selection .time-select-disabled{opacity:.6;cursor:not-allowed;pointer-events:none}.ngxsmk-time-selection app-custom-select{transition:border-color .2s ease,box-shadow .2s ease}.ngxsmk-time-selection app-custom-select.ngxsmk-time-select-animated{transition:all .3s cubic-bezier(.4,0,.2,1)}.ngxsmk-day-cell:not(.disabled):hover .ngxsmk-day-number{background-color:var(--datepicker-hover-background);color:var(--datepicker-primary-color)}.ngxsmk-day-cell.start-date .ngxsmk-day-number,.ngxsmk-day-cell.end-date .ngxsmk-day-number,.ngxsmk-day-cell.selected .ngxsmk-day-number,.ngxsmk-day-cell.multiple-selected .ngxsmk-day-number{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast)}.ngxsmk-day-cell.multiple-selected .ngxsmk-day-number{border:1px dashed var(--datepicker-primary-contrast)}.ngxsmk-day-cell.multiple-selected:hover .ngxsmk-day-number{background-color:var(--datepicker-primary-color);color:var(--datepicker-primary-contrast)}.ngxsmk-day-cell.in-range,.ngxsmk-day-cell.start-date,.ngxsmk-day-cell.end-date,.ngxsmk-day-cell.preview-range{background-color:var(--datepicker-range-background)}.ngxsmk-day-cell.start-date{border-top-left-radius:100%;border-bottom-left-radius:100%}.ngxsmk-day-cell.end-date{border-top-right-radius:100%;border-bottom-right-radius:100%}.ngxsmk-day-cell.start-date.end-date{border-radius:50px}.ngxsmk-day-cell.disabled{background-color:transparent!important;color:#4b5563;cursor:not-allowed;pointer-events:none;opacity:.5}.ngxsmk-day-cell.today .ngxsmk-day-number{border:1px solid var(--datepicker-primary-color)}@media (min-width: 600px){.ngxsmk-datepicker-container{display:flex;flex-direction:row}.ngxsmk-calendar-container{padding:var(--datepicker-spacing-lg);box-shadow:0 4px 10px #0000001a;width:auto;border-radius:10px;min-height:280px}.ngxsmk-ranges-container{width:180px;padding:var(--datepicker-spacing-lg);border-bottom:none;background:var(--datepicker-background);border-radius:10px 0 0 10px}.ngxsmk-ranges-container ul{flex-direction:column;justify-content:flex-start;gap:0}.ngxsmk-ranges-container li{padding:var(--datepicker-spacing-sm);margin-bottom:var(--datepicker-spacing-sm);border:none;font-size:var(--datepicker-font-size-lg)}.ngxsmk-header{margin-bottom:var(--datepicker-spacing-md);gap:var(--datepicker-spacing-xs)}.ngxsmk-month-year-selects app-custom-select.month-select{--custom-select-width: 120px}.ngxsmk-month-year-selects app-custom-select.year-select{--custom-select-width: 90px}.ngxsmk-nav-button{padding:var(--datepicker-spacing-sm)}.ngxsmk-nav-button svg{width:18px;height:18px}.ngxsmk-day-name{font-size:var(--datepicker-font-size-base);padding:var(--datepicker-spacing-sm) 0}.ngxsmk-day-cell{height:38px}.ngxsmk-day-number{width:36px;height:36px;font-size:var(--datepicker-font-size-lg)}.ngxsmk-time-selection{margin-top:var(--datepicker-spacing-lg);padding-top:var(--datepicker-spacing-md)}.ngxsmk-time-selection app-custom-select{--custom-select-width: 60px;height:30px}.ngxsmk-time-selection app-custom-select.ampm-select{--custom-select-width: 70px}.ngxsmk-time-selection .hour-select,.ngxsmk-time-selection .minute-select{--custom-select-width: 60px;--custom-select-height: 30px}.ngxsmk-time-selection .ampm-select{--custom-select-width: 70px;--custom-select-height: 30px}}@media (prefers-reduced-motion: reduce){.ngxsmk-days-grid{transition:none}.ngxsmk-days-grid.animate-forward,.ngxsmk-days-grid.animate-backward{transform:none;opacity:1}}@media (prefers-contrast: high){:host{--datepicker-border-color: #000000;--datepicker-text-color: #000000;--datepicker-subtle-text-color: #666666}.ngxsmk-day-cell.disabled{opacity:.3}}@media print{.ngxsmk-datepicker-wrapper{display:none}}.ngxsmk-day-cell:focus-visible .ngxsmk-day-number{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-nav-button:focus-visible,.ngxsmk-clear-button:focus-visible,.ngxsmk-clear-button-footer:focus-visible,.ngxsmk-close-button:focus-visible{outline:2px solid var(--datepicker-primary-color);outline-offset:2px}.ngxsmk-day-cell,.ngxsmk-nav-button,.ngxsmk-clear-button{will-change:auto}.ngxsmk-days-grid{contain:layout style paint}@media (max-width: 480px){.ngxsmk-day-cell{height:28px}.ngxsmk-day-number{width:26px;height:26px;font-size:var(--datepicker-font-size-sm)}.ngxsmk-day-name{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs) 0}.ngxsmk-calendar-container{padding:var(--datepicker-spacing-sm)}.ngxsmk-header{margin-bottom:var(--datepicker-spacing-sm)}.ngxsmk-input-group{min-width:120px}.ngxsmk-display-input{font-size:var(--datepicker-font-size-sm);padding:var(--datepicker-spacing-xs)}.ngxsmk-clear-button{padding:0 var(--datepicker-spacing-xs)}.ngxsmk-clear-button svg{width:12px;height:12px}}\n"] }]
|
|
1078
|
-
}], propDecorators: { mode: [{
|
|
1079
|
-
type: Input
|
|
1080
|
-
}], isInvalidDate: [{
|
|
1081
|
-
type: Input
|
|
1082
|
-
}], showRanges: [{
|
|
1083
|
-
type: Input
|
|
1084
|
-
}], showTime: [{
|
|
1085
|
-
type: Input
|
|
1086
|
-
}], minuteInterval: [{
|
|
1087
|
-
type: Input
|
|
1088
|
-
}], holidayProvider: [{
|
|
1089
|
-
type: Input
|
|
1090
|
-
}], disableHolidays: [{
|
|
1091
|
-
type: Input
|
|
1092
|
-
}], placeholder: [{
|
|
1093
|
-
type: Input
|
|
1094
|
-
}], inline: [{
|
|
1095
|
-
type: Input
|
|
1096
|
-
}], startAt: [{
|
|
1097
|
-
type: Input
|
|
1098
|
-
}], locale: [{
|
|
1099
|
-
type: Input
|
|
1100
|
-
}], theme: [{
|
|
1101
|
-
type: Input
|
|
1102
|
-
}], isDarkMode: [{
|
|
1103
|
-
type: HostBinding,
|
|
1104
|
-
args: ['class.dark-theme']
|
|
1105
|
-
}], disabledState: [{
|
|
1106
|
-
type: Input
|
|
1107
|
-
}], valueChange: [{
|
|
1108
|
-
type: Output
|
|
1109
|
-
}], action: [{
|
|
1110
|
-
type: Output
|
|
1111
|
-
}], minDate: [{
|
|
1112
|
-
type: Input
|
|
1113
|
-
}], maxDate: [{
|
|
1114
|
-
type: Input
|
|
1115
|
-
}], ranges: [{
|
|
1116
|
-
type: Input
|
|
1117
|
-
}], onDocumentClick: [{
|
|
1118
|
-
type: HostListener,
|
|
1119
|
-
args: ['document:click', ['$event']]
|
|
1120
|
-
}] } });
|
|
1121
|
-
|
|
1122
|
-
/*
|
|
1123
|
-
* Public API Surface of ngxsmk-datepicker
|
|
1124
|
-
*/
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
* Generated bundle index. Do not edit.
|
|
1128
|
-
*/
|
|
1129
|
-
|
|
1130
|
-
export { CustomSelectComponent, NgxsmkDatepickerComponent, addMonths, generateMonthOptions, generateTimeOptions, generateWeekDays, generateYearOptions, get24Hour, getEndOfDay, getEndOfMonth, getFirstDayOfWeek, getStartOfDay, getStartOfMonth, isSameDay, normalizeDate, processDateRanges, subtractDays, update12HourState };
|
|
1131
|
-
//# sourceMappingURL=ngxsmk-datepicker.mjs.map
|