@sixbell-telco/sdk 1.3.0 → 1.4.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/CHANGELOG.md +33 -0
- package/README.md +28 -1
- package/_index.css +109 -11
- package/assets/styles/toast.css +8 -0
- package/components/forms/date-picker/constants/date-picker.constants.d.ts +13 -0
- package/components/forms/date-picker/index.d.ts +5 -0
- package/components/forms/date-picker/public-api.d.ts +3 -0
- package/components/forms/date-picker/src/date-picker.component.d.ts +323 -0
- package/components/forms/date-picker/types/date-picker.types.d.ts +39 -0
- package/components/{forms/datepicker → sonner}/index.d.ts +1 -1
- package/components/sonner/public-api.d.ts +2 -0
- package/components/sonner/src/sonner.component.d.ts +39 -0
- package/components/sonner/toaster/index.d.ts +5 -0
- package/components/sonner/toaster/public-api.d.ts +1 -0
- package/components/sonner/toaster/src/toaster.component.d.ts +89 -0
- package/components/toast/public-api.d.ts +9 -0
- package/components/toast/services/toast.service.d.ts +3 -0
- package/components/toast/toast-message/toast-message.component.d.ts +3 -0
- package/components/toast/toasts-container/toasts-container.component.d.ts +3 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +885 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs +132 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs +179 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +14 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs +90 -2
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -1
- package/package.json +47 -38
- package/utils/date/src/date-utils.d.ts +44 -0
- package/components/forms/datepicker/constants/datepicker.constants.d.ts +0 -5
- package/components/forms/datepicker/public-api.d.ts +0 -3
- package/components/forms/datepicker/src/datepicker.component.d.ts +0 -165
- package/components/forms/datepicker/types/datepicker.types.d.ts +0 -7
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +0 -487
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +0 -1
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { signal, inject, viewChild, input, output, computed, effect, forwardRef, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
6
|
+
import { IconComponent } from '@sixbell-telco/sdk/components/icon';
|
|
7
|
+
import { heroClock } from '@sixbell-telco/sdk/components/icon/heroicons/outline';
|
|
8
|
+
import { matChevronLeft, matChevronRight } from '@sixbell-telco/sdk/components/icon/material/baseline';
|
|
9
|
+
import { OverlayComponent, OverlayTriggerComponent, OverlayContentComponent } from '@sixbell-telco/sdk/components/overlay';
|
|
10
|
+
import { DateUtils, TIME_SECONDS_FORMAT, TIME_MINUTES_FORMAT } from '@sixbell-telco/sdk/utils/date';
|
|
11
|
+
import { SyncUtils } from '@sixbell-telco/sdk/utils/sync';
|
|
12
|
+
import { TranslationService, TranslatePipe } from '@sixbell-telco/sdk/utils/translation';
|
|
13
|
+
import 'cally';
|
|
14
|
+
import dayjs from 'dayjs';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Supported locales (BCP 47) for the date picker.
|
|
18
|
+
* These map directly to the underlying calendar web component locale attribute.
|
|
19
|
+
*/
|
|
20
|
+
const SUPPORTED_LOCALES = [
|
|
21
|
+
'en-US', // English (United States)
|
|
22
|
+
'en-GB', // English (United Kingdom)
|
|
23
|
+
'es-ES', // Spanish (Spain)
|
|
24
|
+
'es-MX', // Spanish (Mexico)
|
|
25
|
+
'fr-FR', // French (France)
|
|
26
|
+
'de-DE', // German (Germany)
|
|
27
|
+
'it-IT', // Italian (Italy)
|
|
28
|
+
'pt-BR', // Portuguese (Brazil)
|
|
29
|
+
'pt-PT', // Portuguese (Portugal)
|
|
30
|
+
'ja-JP', // Japanese (Japan)
|
|
31
|
+
'ko-KR', // Korean (Korea)
|
|
32
|
+
'zh-CN', // Chinese (Simplified)
|
|
33
|
+
'zh-TW', // Chinese (Traditional)
|
|
34
|
+
'ru-RU', // Russian (Russia)
|
|
35
|
+
'ar-SA', // Arabic (Saudi Arabia)
|
|
36
|
+
'hi-IN', // Hindi (India)
|
|
37
|
+
'nl-NL', // Dutch (Netherlands)
|
|
38
|
+
'sv-SE', // Swedish (Sweden)
|
|
39
|
+
'da-DK', // Danish (Denmark)
|
|
40
|
+
'no-NO', // Norwegian (Norway)
|
|
41
|
+
'fi-FI', // Finnish (Finland)
|
|
42
|
+
'pl-PL', // Polish (Poland)
|
|
43
|
+
'tr-TR', // Turkish (Turkey)
|
|
44
|
+
'he-IL', // Hebrew (Israel)
|
|
45
|
+
'th-TH', // Thai (Thailand)
|
|
46
|
+
'vi-VN', // Vietnamese (Vietnam)
|
|
47
|
+
];
|
|
48
|
+
/** Allowed datepicker modes */
|
|
49
|
+
const DATEPICKER_MODES = ['single', 'range'];
|
|
50
|
+
/** Allowed time display formats for trigger text */
|
|
51
|
+
const TIME_DISPLAY_FORMATS = ['24h', '12h'];
|
|
52
|
+
/** Allowed Intl.DateTimeFormat dateStyle values we support */
|
|
53
|
+
const DATE_STYLES = ['short', 'medium', 'long', 'full'];
|
|
54
|
+
/** Allowed number of calendars in range mode */
|
|
55
|
+
const RANGE_CALENDARS = [1, 2];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Datepicker - Single date and date range picker with optional time selection
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* This component wraps Cally.js calendar elements and provides a rich, accessible
|
|
62
|
+
* date and date-range picking experience for Angular apps. It supports:
|
|
63
|
+
* - Single or range modes
|
|
64
|
+
* - Quick action ranges
|
|
65
|
+
* - Optional time selection with minutes or seconds
|
|
66
|
+
* - 12h/24h time display for the trigger text
|
|
67
|
+
* - Locale-aware calendar (auto-mapped from the TranslationService or overridden)
|
|
68
|
+
* - Form integration (reactive forms) and standalone usage
|
|
69
|
+
*
|
|
70
|
+
* The component is exported as `stDatepicker` for template reference variables
|
|
71
|
+
* to access methods (e.g. displayValue()).
|
|
72
|
+
*
|
|
73
|
+
* @example Basic single date
|
|
74
|
+
* ```html
|
|
75
|
+
* <st-datepicker
|
|
76
|
+
* label="Pick a date"
|
|
77
|
+
* mode="single"
|
|
78
|
+
* format="DD/MM/YYYY"
|
|
79
|
+
* (dateUpdated)="onDate($event)"
|
|
80
|
+
* #picker="stDatepicker"
|
|
81
|
+
* >
|
|
82
|
+
* <st-button [outline]="true">{{ picker.displayValue() || 'Pick a date' }}</st-button>
|
|
83
|
+
* </st-datepicker>
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @example Date range with time (minutes)
|
|
87
|
+
* ```html
|
|
88
|
+
* <st-datepicker
|
|
89
|
+
* label="Pick range with time"
|
|
90
|
+
* mode="range"
|
|
91
|
+
* [showTimePicker]="true"
|
|
92
|
+
* [showSeconds]="false"
|
|
93
|
+
* (rangeUpdated)="onRange($event)"
|
|
94
|
+
* (startTimeChanged)="onStartTime($event)"
|
|
95
|
+
* (endTimeChanged)="onEndTime($event)"
|
|
96
|
+
* #picker="stDatepicker"
|
|
97
|
+
* >
|
|
98
|
+
* <st-button [outline]="true">{{ picker.displayValue() || 'Pick range' }}</st-button>
|
|
99
|
+
* </st-datepicker>
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example Reactive form control (range)
|
|
103
|
+
* ```html
|
|
104
|
+
* <form [formGroup]="form">
|
|
105
|
+
* <st-datepicker
|
|
106
|
+
* [parentForm]="form"
|
|
107
|
+
* formControlName="range"
|
|
108
|
+
* mode="range"
|
|
109
|
+
* [rangeCalendars]="2"
|
|
110
|
+
* [showQuickActions]="true"
|
|
111
|
+
* name="range"
|
|
112
|
+
* >
|
|
113
|
+
* <st-input [value]="picker.displayValue()" [readonly]="true" name="range"></st-input>
|
|
114
|
+
* </st-datepicker>
|
|
115
|
+
* </form>
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
class DatepickerComponent {
|
|
119
|
+
// ==================== STATE MANAGEMENT ====================
|
|
120
|
+
/** Internal state for single date (ISO format) */
|
|
121
|
+
_selectedDateValue = signal('');
|
|
122
|
+
/** Internal state for date range (ISO format) */
|
|
123
|
+
_selectedRangeValue = signal(null);
|
|
124
|
+
/** Disabled state */
|
|
125
|
+
_disabled = signal(false);
|
|
126
|
+
/** Flag to prevent concurrent range updates */
|
|
127
|
+
isUpdatingRange = false;
|
|
128
|
+
// ==================== DEPENDENCIES ====================
|
|
129
|
+
/** Translation service for reactive language changes */
|
|
130
|
+
translationService = inject(TranslationService);
|
|
131
|
+
// ==================== FORM INTEGRATION ====================
|
|
132
|
+
/** Form change callback */
|
|
133
|
+
onControlChange = () => { };
|
|
134
|
+
/** Form touch callback */
|
|
135
|
+
onControlTouch = () => { };
|
|
136
|
+
// ==================== COMPONENT REFERENCES ====================
|
|
137
|
+
/** Overlay reference for controlling calendar popup */
|
|
138
|
+
datePickerOverlay = viewChild('datePickerOverlay');
|
|
139
|
+
// ==================== INPUTS ====================
|
|
140
|
+
/** Label displayed above the fieldset legend */
|
|
141
|
+
label = input('');
|
|
142
|
+
/**
|
|
143
|
+
* Picker mode
|
|
144
|
+
* @defaultValue 'single'
|
|
145
|
+
* @remarks 'single' for single date, 'range' for start/end selection
|
|
146
|
+
*/
|
|
147
|
+
mode = input('single');
|
|
148
|
+
/**
|
|
149
|
+
* Display/parse format for dates
|
|
150
|
+
* @defaultValue 'DD/MM/YYYY'
|
|
151
|
+
* @remarks Used for trigger text and for parsing external values (when provided as display strings)
|
|
152
|
+
*/
|
|
153
|
+
format = input('DD/MM/YYYY');
|
|
154
|
+
/**
|
|
155
|
+
* Locale used by the calendar web component
|
|
156
|
+
* @defaultValue 'en-US'
|
|
157
|
+
* @remarks If omitted or set to 'en-US', the component will auto-map from the TranslationService using `languageMapping`.
|
|
158
|
+
*/
|
|
159
|
+
language = input('en-US');
|
|
160
|
+
/** Optional minimum selectable date (display or ISO). Internally coerced to ISO. */
|
|
161
|
+
minDate = input(null);
|
|
162
|
+
/** Optional maximum selectable date (display or ISO). Internally coerced to ISO. */
|
|
163
|
+
maxDate = input(null);
|
|
164
|
+
/** Single date value (external binding). Accepts display or ISO; stored internally as ISO. */
|
|
165
|
+
value = input('');
|
|
166
|
+
/** Date range value (external binding). Accepts display or ISO; stored internally as ISO. */
|
|
167
|
+
rangeValue = input(null);
|
|
168
|
+
/** Name attribute for associated input (useful when wrapping with st-input). */
|
|
169
|
+
name = input('');
|
|
170
|
+
/**
|
|
171
|
+
* Number of calendars to show in range mode
|
|
172
|
+
* @defaultValue 2
|
|
173
|
+
*/
|
|
174
|
+
rangeCalendars = input(2);
|
|
175
|
+
/**
|
|
176
|
+
* Whether to show quick action buttons for common ranges
|
|
177
|
+
* @defaultValue true
|
|
178
|
+
*/
|
|
179
|
+
showQuickActions = input(true);
|
|
180
|
+
/**
|
|
181
|
+
* Whether to show time pickers for start/end
|
|
182
|
+
* @defaultValue false
|
|
183
|
+
*/
|
|
184
|
+
showTimePicker = input(false);
|
|
185
|
+
/**
|
|
186
|
+
* Whether to include seconds in time inputs and display
|
|
187
|
+
* @defaultValue false
|
|
188
|
+
*/
|
|
189
|
+
showSeconds = input(false);
|
|
190
|
+
/**
|
|
191
|
+
* Time display format for trigger text
|
|
192
|
+
* @defaultValue '24h'
|
|
193
|
+
* @remarks Affects only the textual display in the trigger, not the underlying stored time format
|
|
194
|
+
*/
|
|
195
|
+
timeDisplayFormat = input('24h');
|
|
196
|
+
/**
|
|
197
|
+
* Mapping of translation language codes (e.g. 'en','es','pt') to calendar locales (e.g. 'en-US','es-MX','pt-BR')
|
|
198
|
+
* @defaultValue { en: 'en-US', es: 'es-MX', pt: 'pt-BR' }
|
|
199
|
+
*/
|
|
200
|
+
languageMapping = input({
|
|
201
|
+
en: 'en-US',
|
|
202
|
+
es: 'es-MX',
|
|
203
|
+
pt: 'pt-BR',
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* Use locale-based formatting for the trigger display instead of the custom pattern
|
|
207
|
+
* @defaultValue false
|
|
208
|
+
*/
|
|
209
|
+
useLocaleDisplay = input(false);
|
|
210
|
+
/**
|
|
211
|
+
* Locale date style when useLocaleDisplay=true
|
|
212
|
+
* @defaultValue 'short'
|
|
213
|
+
*/
|
|
214
|
+
dateStyle = input('short');
|
|
215
|
+
/** Optional external defaults for start/end time (HH:mm or HH:mm:ss). When empty string, inputs render blank. */
|
|
216
|
+
startTimeValue = input('');
|
|
217
|
+
endTimeValue = input('');
|
|
218
|
+
/**
|
|
219
|
+
* Current start time value (internal signal). Empty when unset.
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
startTime = signal('');
|
|
223
|
+
/**
|
|
224
|
+
* Current end time value (internal signal). Empty when unset.
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
endTime = signal('');
|
|
228
|
+
/** Parent reactive form group (optional) */
|
|
229
|
+
parentForm = input(null);
|
|
230
|
+
/** Name of the form control inside the parent form (optional) */
|
|
231
|
+
formControlName = input('');
|
|
232
|
+
// ==================== OUTPUTS ====================
|
|
233
|
+
/**
|
|
234
|
+
* Emits formatted single date when it changes
|
|
235
|
+
* @remarks Uses the `format` (or locale display if enabled). For range mode, use `rangeUpdated`.
|
|
236
|
+
*/
|
|
237
|
+
dateUpdated = output();
|
|
238
|
+
/**
|
|
239
|
+
* Emits an ISO `DateRange` when both start & end are selected
|
|
240
|
+
* @remarks Start/end are always emitted in ISO (YYYY-MM-DD). Time values are emitted separately.
|
|
241
|
+
*/
|
|
242
|
+
rangeUpdated = output();
|
|
243
|
+
/** Emits formatted date when value changes (single mode). Alias of `dateUpdated`. */
|
|
244
|
+
valueChanged = output();
|
|
245
|
+
/** Emits ISO date range (alias of `rangeUpdated`). */
|
|
246
|
+
rangeValueChanged = output();
|
|
247
|
+
/** Emits start time (HH:mm or HH:mm:ss) changes; empty string when cleared */
|
|
248
|
+
startTimeChanged = output();
|
|
249
|
+
/** Emits end time (HH:mm or HH:mm:ss) changes; empty string when cleared */
|
|
250
|
+
endTimeChanged = output();
|
|
251
|
+
// ==================== COMPUTED PROPERTIES ====================
|
|
252
|
+
/** Effective minimum date (input or default 10 years ago) */
|
|
253
|
+
effectiveMinDate = computed(() => {
|
|
254
|
+
const inputMin = this.minDate();
|
|
255
|
+
return inputMin ? DateUtils.toISODate(inputMin) : dayjs().subtract(10, 'year').format('YYYY-MM-DD');
|
|
256
|
+
});
|
|
257
|
+
/** Effective maximum date (input or default 10 years ahead) */
|
|
258
|
+
effectiveMaxDate = computed(() => {
|
|
259
|
+
const inputMax = this.maxDate();
|
|
260
|
+
return inputMax ? DateUtils.toISODate(inputMax) : dayjs().add(10, 'year').format('YYYY-MM-DD');
|
|
261
|
+
});
|
|
262
|
+
/** Locale for calendar components */
|
|
263
|
+
calendarLocale = computed(() => {
|
|
264
|
+
// If a specific language is provided via input, use it
|
|
265
|
+
if (this.language() && this.language() !== 'en-US') {
|
|
266
|
+
return this.language();
|
|
267
|
+
}
|
|
268
|
+
// Otherwise, map the current translation language to a calendar locale
|
|
269
|
+
const currentLang = this.translationService.getCurrentLanguage();
|
|
270
|
+
const mapping = this.languageMapping();
|
|
271
|
+
return mapping[currentLang] || mapping['en'] || 'en-US';
|
|
272
|
+
});
|
|
273
|
+
/** Form control instance from parent form group */
|
|
274
|
+
formField = computed(() => {
|
|
275
|
+
const form = this.parentForm();
|
|
276
|
+
const controlName = this.formControlName();
|
|
277
|
+
if (!form || !controlName)
|
|
278
|
+
return null;
|
|
279
|
+
return form.get(controlName);
|
|
280
|
+
});
|
|
281
|
+
/** Formatted display value for single date */
|
|
282
|
+
selectedDate = computed(() => {
|
|
283
|
+
const isoValue = this._selectedDateValue();
|
|
284
|
+
if (!isoValue)
|
|
285
|
+
return '';
|
|
286
|
+
return this.useLocaleDisplay() ? this.formatDateLocale(isoValue) : DateUtils.toDisplayDate(isoValue, this.format());
|
|
287
|
+
});
|
|
288
|
+
/** Formatted display value for date range */
|
|
289
|
+
selectedRange = computed(() => {
|
|
290
|
+
const isoRange = this._selectedRangeValue();
|
|
291
|
+
if (!isoRange?.start || !isoRange?.end)
|
|
292
|
+
return null;
|
|
293
|
+
if (this.useLocaleDisplay()) {
|
|
294
|
+
return {
|
|
295
|
+
start: this.formatDateLocale(isoRange.start),
|
|
296
|
+
end: this.formatDateLocale(isoRange.end),
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return { start: DateUtils.toDisplayDate(isoRange.start, this.format()), end: DateUtils.toDisplayDate(isoRange.end, this.format()) };
|
|
300
|
+
});
|
|
301
|
+
/** @internal Value for calendar-range component (ISO/ISO format) */
|
|
302
|
+
rangeCalendarValue = computed(() => {
|
|
303
|
+
return DateUtils.toRangeValue(this._selectedRangeValue());
|
|
304
|
+
});
|
|
305
|
+
// Unified display value (normalize seconds when enabled)
|
|
306
|
+
displayValue = computed(() => {
|
|
307
|
+
const includeTime = this.showTimePicker();
|
|
308
|
+
const withSeconds = this.showSeconds();
|
|
309
|
+
const timeFormat = this.timeDisplayFormat();
|
|
310
|
+
const use12Hour = timeFormat === '12h';
|
|
311
|
+
const normalize = (time) => {
|
|
312
|
+
if (!time)
|
|
313
|
+
return '';
|
|
314
|
+
// Normalize time format first
|
|
315
|
+
let normalizedTime;
|
|
316
|
+
if (withSeconds) {
|
|
317
|
+
normalizedTime = time.length === 8 ? time : `${time}:00`;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
normalizedTime = time.length >= 5 ? time.slice(0, 5) : time;
|
|
321
|
+
}
|
|
322
|
+
// Convert to 12-hour format if requested
|
|
323
|
+
if (use12Hour) {
|
|
324
|
+
normalizedTime = DateUtils.to12HourFormat(normalizedTime, withSeconds);
|
|
325
|
+
}
|
|
326
|
+
return normalizedTime;
|
|
327
|
+
};
|
|
328
|
+
if (this.mode() === 'range') {
|
|
329
|
+
const range = this.selectedRange();
|
|
330
|
+
if (!range)
|
|
331
|
+
return '';
|
|
332
|
+
if (!includeTime)
|
|
333
|
+
return `${range.start} - ${range.end}`;
|
|
334
|
+
const stDisp = normalize(this.startTime());
|
|
335
|
+
const etDisp = normalize(this.endTime());
|
|
336
|
+
const startLabel = stDisp ? `${range.start} ${stDisp}` : range.start;
|
|
337
|
+
const endLabel = etDisp ? `${range.end} ${etDisp}` : range.end;
|
|
338
|
+
return `${startLabel} - ${endLabel}`;
|
|
339
|
+
}
|
|
340
|
+
const d = this.selectedDate();
|
|
341
|
+
if (!includeTime)
|
|
342
|
+
return d;
|
|
343
|
+
const stDisp = normalize(this.startTime());
|
|
344
|
+
if (!d)
|
|
345
|
+
return '';
|
|
346
|
+
return stDisp ? `${d} ${stDisp}` : d;
|
|
347
|
+
});
|
|
348
|
+
/** Time values normalized for the inputs based on showSeconds */
|
|
349
|
+
startTimeDisplay = computed(() => {
|
|
350
|
+
const t = this.startTime();
|
|
351
|
+
const withSeconds = this.showSeconds();
|
|
352
|
+
if (!t)
|
|
353
|
+
return '';
|
|
354
|
+
if (withSeconds)
|
|
355
|
+
return t.length === 8 ? t : `${t.slice(0, 5)}:00`;
|
|
356
|
+
return t.length >= 5 ? t.slice(0, 5) : '';
|
|
357
|
+
});
|
|
358
|
+
endTimeDisplay = computed(() => {
|
|
359
|
+
const t = this.endTime();
|
|
360
|
+
const withSeconds = this.showSeconds();
|
|
361
|
+
if (!t)
|
|
362
|
+
return '';
|
|
363
|
+
if (withSeconds)
|
|
364
|
+
return t.length === 8 ? t : `${t.slice(0, 5)}:00`;
|
|
365
|
+
return t.length >= 5 ? t.slice(0, 5) : '';
|
|
366
|
+
});
|
|
367
|
+
/** Keep internal state in sync when rangeValue input changes */
|
|
368
|
+
syncInputEff = effect(() => {
|
|
369
|
+
if (this.mode() !== 'range')
|
|
370
|
+
return;
|
|
371
|
+
const inputRange = this.rangeValue();
|
|
372
|
+
if (inputRange?.start && inputRange?.end) {
|
|
373
|
+
const isoRange = {
|
|
374
|
+
start: DateUtils.toISODate(inputRange.start, this.format()),
|
|
375
|
+
end: DateUtils.toISODate(inputRange.end, this.format()),
|
|
376
|
+
};
|
|
377
|
+
this._selectedRangeValue.set(isoRange);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
/** Sync external start/end time inputs into internal signals */
|
|
381
|
+
syncTimeInputsEff = effect(() => {
|
|
382
|
+
const st = this.startTimeValue();
|
|
383
|
+
this.startTime.set(st ?? '');
|
|
384
|
+
const et = this.endTimeValue();
|
|
385
|
+
this.endTime.set(et ?? '');
|
|
386
|
+
});
|
|
387
|
+
/** Exposed selected date value (ISO format) for template access */
|
|
388
|
+
selectedDateValue = computed(() => this._selectedDateValue());
|
|
389
|
+
// Localized From/To date labels (timezone-safe via dayjs)
|
|
390
|
+
formatMonthYear(date, locale) {
|
|
391
|
+
return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(date);
|
|
392
|
+
}
|
|
393
|
+
formatWeekday(date, locale) {
|
|
394
|
+
return new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date);
|
|
395
|
+
}
|
|
396
|
+
// Localized short/medium/long/full date for trigger display, timezone-safe for YYYY-MM-DD
|
|
397
|
+
formatDateLocale(iso) {
|
|
398
|
+
const d = dayjs(iso, 'YYYY-MM-DD', true);
|
|
399
|
+
if (!d.isValid())
|
|
400
|
+
return iso;
|
|
401
|
+
// Create a local Date to avoid TZ shifts when formatting
|
|
402
|
+
const safe = new Date(d.year(), d.month(), d.date());
|
|
403
|
+
return new Intl.DateTimeFormat(this.calendarLocale(), { dateStyle: this.dateStyle() }).format(safe);
|
|
404
|
+
}
|
|
405
|
+
fromDay = computed(() => {
|
|
406
|
+
const r = this._selectedRangeValue();
|
|
407
|
+
if (!r?.start)
|
|
408
|
+
return '';
|
|
409
|
+
const d = dayjs(r.start, 'YYYY-MM-DD', true);
|
|
410
|
+
return d.isValid() ? String(d.date()) : '';
|
|
411
|
+
});
|
|
412
|
+
fromMonthYear = computed(() => {
|
|
413
|
+
const r = this._selectedRangeValue();
|
|
414
|
+
if (!r?.start)
|
|
415
|
+
return '';
|
|
416
|
+
const d = dayjs(r.start, 'YYYY-MM-DD', true);
|
|
417
|
+
return d.isValid() ? this.formatMonthYear(d.toDate(), this.calendarLocale()) : '';
|
|
418
|
+
});
|
|
419
|
+
fromWeekday = computed(() => {
|
|
420
|
+
const r = this._selectedRangeValue();
|
|
421
|
+
if (!r?.start)
|
|
422
|
+
return '';
|
|
423
|
+
const d = dayjs(r.start, 'YYYY-MM-DD', true);
|
|
424
|
+
return d.isValid() ? this.formatWeekday(d.toDate(), this.calendarLocale()) : '';
|
|
425
|
+
});
|
|
426
|
+
toDay = computed(() => {
|
|
427
|
+
const r = this._selectedRangeValue();
|
|
428
|
+
if (!r?.end)
|
|
429
|
+
return '';
|
|
430
|
+
const d = dayjs(r.end, 'YYYY-MM-DD', true);
|
|
431
|
+
return d.isValid() ? String(d.date()) : '';
|
|
432
|
+
});
|
|
433
|
+
toMonthYear = computed(() => {
|
|
434
|
+
const r = this._selectedRangeValue();
|
|
435
|
+
if (!r?.end)
|
|
436
|
+
return '';
|
|
437
|
+
const d = dayjs(r.end, 'YYYY-MM-DD', true);
|
|
438
|
+
return d.isValid() ? this.formatMonthYear(d.toDate(), this.calendarLocale()) : '';
|
|
439
|
+
});
|
|
440
|
+
toWeekday = computed(() => {
|
|
441
|
+
const r = this._selectedRangeValue();
|
|
442
|
+
if (!r?.end)
|
|
443
|
+
return '';
|
|
444
|
+
const d = dayjs(r.end, 'YYYY-MM-DD', true);
|
|
445
|
+
return d.isValid() ? this.formatWeekday(d.toDate(), this.calendarLocale()) : '';
|
|
446
|
+
});
|
|
447
|
+
// ==================== COMPONENT LIFECYCLE ====================
|
|
448
|
+
constructor() {
|
|
449
|
+
// Initialize with default values if none provided
|
|
450
|
+
this.initializeValues();
|
|
451
|
+
}
|
|
452
|
+
// ==================== PRIVATE METHODS ====================
|
|
453
|
+
/**
|
|
454
|
+
* Initialize component values based on inputs
|
|
455
|
+
*/
|
|
456
|
+
initializeValues() {
|
|
457
|
+
if (this.mode() === 'range') {
|
|
458
|
+
// Only set a range if one is provided, otherwise leave empty
|
|
459
|
+
const inputRange = this.rangeValue();
|
|
460
|
+
if (inputRange?.start && inputRange?.end) {
|
|
461
|
+
const isoRange = {
|
|
462
|
+
start: DateUtils.toISODate(inputRange.start, this.format()),
|
|
463
|
+
end: DateUtils.toISODate(inputRange.end, this.format()),
|
|
464
|
+
};
|
|
465
|
+
this._selectedRangeValue.set(isoRange);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this._selectedRangeValue.set(null);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
// Only set a date if one is provided, otherwise leave empty
|
|
473
|
+
const inputValue = this.value();
|
|
474
|
+
if (inputValue) {
|
|
475
|
+
const isoDate = DateUtils.toISODate(inputValue, this.format());
|
|
476
|
+
this._selectedDateValue.set(isoDate);
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this._selectedDateValue.set('');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Set single date value programmatically
|
|
485
|
+
*/
|
|
486
|
+
async setSingleDateValue(isoDate) {
|
|
487
|
+
this._selectedDateValue.set(isoDate);
|
|
488
|
+
const displayDate = this.selectedDate();
|
|
489
|
+
this.emitChanges(displayDate);
|
|
490
|
+
// Wait for next frame to ensure proper synchronization
|
|
491
|
+
await SyncUtils.nextFrame();
|
|
492
|
+
this.closeOverlay();
|
|
493
|
+
}
|
|
494
|
+
// ==================== PRIVATE HELPER METHODS ====================
|
|
495
|
+
/**
|
|
496
|
+
* Emit change events and notify form controls
|
|
497
|
+
*/
|
|
498
|
+
emitChanges(value) {
|
|
499
|
+
if (this.mode() === 'range') {
|
|
500
|
+
const rangeValue = value;
|
|
501
|
+
this.rangeUpdated.emit(rangeValue);
|
|
502
|
+
this.rangeValueChanged.emit(rangeValue);
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
const dateValue = value;
|
|
506
|
+
this.dateUpdated.emit(dateValue);
|
|
507
|
+
this.valueChanged.emit(dateValue);
|
|
508
|
+
}
|
|
509
|
+
// For form controls, emit null for empty values to trigger validation properly
|
|
510
|
+
const formValue = value || null;
|
|
511
|
+
this.onControlChange(formValue);
|
|
512
|
+
this.onControlTouch();
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Close overlay if available
|
|
516
|
+
*/
|
|
517
|
+
closeOverlay() {
|
|
518
|
+
this.datePickerOverlay()?.close();
|
|
519
|
+
}
|
|
520
|
+
// ==================== PUBLIC API ====================
|
|
521
|
+
/**
|
|
522
|
+
* Handle calendar change events from Cally components
|
|
523
|
+
* @internal
|
|
524
|
+
*/
|
|
525
|
+
onCalendarChange(calendarElement, event) {
|
|
526
|
+
if (this.mode() === 'range') {
|
|
527
|
+
// Fire and forget async operation
|
|
528
|
+
this.handleRangeCalendarChange(calendarElement, event).catch(console.error);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
this.handleSingleCalendarChange(calendarElement).catch(console.error);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Apply a predefined quick range preset
|
|
536
|
+
* @param preset One of: 'last7Days' | 'last30Days' | 'last6Months' | 'lastYear'
|
|
537
|
+
* @remarks This updates the date range (ISO). Time inputs are not modified.
|
|
538
|
+
*/
|
|
539
|
+
async selectQuickRange(preset) {
|
|
540
|
+
if (this.mode() !== 'range')
|
|
541
|
+
return;
|
|
542
|
+
try {
|
|
543
|
+
// Get pure date range (ISO) from utils
|
|
544
|
+
const quickRange = DateUtils.generateQuickRange(preset);
|
|
545
|
+
if (this.isUpdatingRange)
|
|
546
|
+
return;
|
|
547
|
+
this.isUpdatingRange = true;
|
|
548
|
+
await SyncUtils.nextTick();
|
|
549
|
+
// Always set range; time picker visibility only affects UI, not logic
|
|
550
|
+
await this.setRangeValue(quickRange);
|
|
551
|
+
await SyncUtils.nextFrame();
|
|
552
|
+
this.isUpdatingRange = false;
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
console.error('Error applying quick range:', error);
|
|
556
|
+
this.isUpdatingRange = false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Apply a time-based quick range (last N hours). Visible only when time picker is enabled.
|
|
561
|
+
* @param hours Number of hours to go back from now
|
|
562
|
+
* @remarks Updates the date range and emits start/end time strings (HH:mm:ss)
|
|
563
|
+
*/
|
|
564
|
+
async selectQuickLastHours(hours) {
|
|
565
|
+
if (this.mode() !== 'range')
|
|
566
|
+
return;
|
|
567
|
+
try {
|
|
568
|
+
const { range, startTime, endTime } = DateUtils.generateLastHoursRange(hours);
|
|
569
|
+
if (this.isUpdatingRange)
|
|
570
|
+
return;
|
|
571
|
+
this.isUpdatingRange = true;
|
|
572
|
+
await SyncUtils.nextTick();
|
|
573
|
+
await this.setRangeValue(range);
|
|
574
|
+
// Update times and notify
|
|
575
|
+
this.startTime.set(startTime);
|
|
576
|
+
this.endTime.set(endTime);
|
|
577
|
+
this.startTimeChanged.emit(startTime);
|
|
578
|
+
this.endTimeChanged.emit(endTime);
|
|
579
|
+
await SyncUtils.nextFrame();
|
|
580
|
+
this.isUpdatingRange = false;
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
console.error('Error applying last-hours range:', error);
|
|
584
|
+
this.isUpdatingRange = false;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Clear the current range selection
|
|
589
|
+
* @remarks Also clears start/end time inputs and emits empty strings for time changes.
|
|
590
|
+
*/
|
|
591
|
+
async clearRange() {
|
|
592
|
+
if (this.mode() !== 'range')
|
|
593
|
+
return;
|
|
594
|
+
// Prevent rapid consecutive clicks
|
|
595
|
+
if (this.isUpdatingRange)
|
|
596
|
+
return;
|
|
597
|
+
this.isUpdatingRange = true;
|
|
598
|
+
// Use microtask to ensure proper state synchronization with Cally
|
|
599
|
+
await SyncUtils.nextTick();
|
|
600
|
+
await this.setRangeValue(null);
|
|
601
|
+
// Clear time inputs as well to reflect cleared selection
|
|
602
|
+
this.startTime.set('');
|
|
603
|
+
this.endTime.set('');
|
|
604
|
+
this.startTimeChanged.emit('');
|
|
605
|
+
this.endTimeChanged.emit('');
|
|
606
|
+
// Wait before allowing next update
|
|
607
|
+
await SyncUtils.nextFrame();
|
|
608
|
+
this.isUpdatingRange = false;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Clear the current single date selection
|
|
612
|
+
*/
|
|
613
|
+
clearDate() {
|
|
614
|
+
if (this.mode() !== 'single')
|
|
615
|
+
return;
|
|
616
|
+
this._selectedDateValue.set('');
|
|
617
|
+
this.emitChanges(null);
|
|
618
|
+
this.closeOverlay();
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Set range value programmatically
|
|
622
|
+
*/
|
|
623
|
+
async setRangeValue(range) {
|
|
624
|
+
// Store the range in internal state first
|
|
625
|
+
this._selectedRangeValue.set(range);
|
|
626
|
+
// Update the calendar element value immediately to sync with Cally
|
|
627
|
+
await this.updateCalendarElementValue(range);
|
|
628
|
+
// Emit changes to form and outputs (always emit ISO to consumers)
|
|
629
|
+
if (range && DateUtils.isValidRange(range)) {
|
|
630
|
+
this.emitChanges(range);
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
// Handle clear case - emit null for proper form validation
|
|
634
|
+
this.emitChanges(null);
|
|
635
|
+
}
|
|
636
|
+
// Close overlay after state is synchronized
|
|
637
|
+
await SyncUtils.nextFrame();
|
|
638
|
+
this.closeOverlay();
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Update calendar element to ensure Cally.js synchronization
|
|
642
|
+
*/
|
|
643
|
+
async updateCalendarElementValue(range) {
|
|
644
|
+
// Wait for calendar element to be available
|
|
645
|
+
const calendarElement = await SyncUtils.waitForElement('calendar-range');
|
|
646
|
+
if (calendarElement) {
|
|
647
|
+
const typedElement = calendarElement;
|
|
648
|
+
const rangeValue = DateUtils.toRangeValue(range);
|
|
649
|
+
// Set the value property directly on the calendar element
|
|
650
|
+
typedElement.value = rangeValue;
|
|
651
|
+
// Also trigger a property update to ensure Cally.js internal state sync
|
|
652
|
+
if (range?.start && range?.end) {
|
|
653
|
+
typedElement.setAttribute('start', range.start);
|
|
654
|
+
typedElement.setAttribute('end', range.end);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
typedElement.removeAttribute('start');
|
|
658
|
+
typedElement.removeAttribute('end');
|
|
659
|
+
}
|
|
660
|
+
// Dispatch a change event to notify Cally.js of the programmatic update
|
|
661
|
+
typedElement.dispatchEvent(new Event('change', { bubbles: true }));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
// ==================== CALENDAR EVENT HANDLERS ====================
|
|
665
|
+
/**
|
|
666
|
+
* Handle single date calendar change
|
|
667
|
+
*/
|
|
668
|
+
async handleSingleCalendarChange(calendarElement) {
|
|
669
|
+
const dateValue = this.extractDateValue(calendarElement);
|
|
670
|
+
if (dateValue && dayjs(dateValue).isValid()) {
|
|
671
|
+
await this.setSingleDateValue(dateValue);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Handle range calendar change
|
|
676
|
+
*/
|
|
677
|
+
async handleRangeCalendarChange(calendarElement, event) {
|
|
678
|
+
const rangeValue = this.extractRangeValue(calendarElement);
|
|
679
|
+
if (rangeValue && DateUtils.isValidRange(rangeValue)) {
|
|
680
|
+
// Update internal state immediately
|
|
681
|
+
this._selectedRangeValue.set(rangeValue);
|
|
682
|
+
// Determine if this event signals end of selection
|
|
683
|
+
const isRangeEnd = event?.type === 'rangeend';
|
|
684
|
+
const isSameDay = rangeValue.start === rangeValue.end;
|
|
685
|
+
await this.finalizeRangeSelection(rangeValue, isSameDay, isRangeEnd);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Finalize range selection: ensure same-day times if needed and emit when selection is complete
|
|
690
|
+
*/
|
|
691
|
+
async finalizeRangeSelection(rangeValue, isSameDay, isRangeEnd) {
|
|
692
|
+
// When time picker is enabled and the range selection is finalized (rangeend),
|
|
693
|
+
// ensure default times are set for both same-day and different-day ranges.
|
|
694
|
+
// IMPORTANT: Do not override non-empty times provided by the developer or already set by the user.
|
|
695
|
+
if (this.showTimePicker() && isRangeEnd) {
|
|
696
|
+
const withSeconds = this.showSeconds();
|
|
697
|
+
const fmt = withSeconds ? TIME_SECONDS_FORMAT : TIME_MINUTES_FORMAT;
|
|
698
|
+
const defaultStart = DateUtils.startOfDay(fmt);
|
|
699
|
+
const defaultEnd = DateUtils.endOfDay(fmt);
|
|
700
|
+
if (isSameDay) {
|
|
701
|
+
// Exception: when start and end are the same day, always span the full day
|
|
702
|
+
// even if times were previously set by developer/user.
|
|
703
|
+
this.startTime.set(defaultStart);
|
|
704
|
+
this.endTime.set(defaultEnd);
|
|
705
|
+
this.startTimeChanged.emit(defaultStart);
|
|
706
|
+
this.endTimeChanged.emit(defaultEnd);
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
// Different-day range: set defaults only if empty, don't override developer values
|
|
710
|
+
if (!this.startTime()) {
|
|
711
|
+
this.startTime.set(defaultStart);
|
|
712
|
+
this.startTimeChanged.emit(defaultStart);
|
|
713
|
+
}
|
|
714
|
+
if (!this.endTime()) {
|
|
715
|
+
this.endTime.set(defaultEnd);
|
|
716
|
+
this.endTimeChanged.emit(defaultEnd);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
// Emit and close when:
|
|
721
|
+
// - a full different-day range has been selected on change or rangeend
|
|
722
|
+
// - a same-day selection is finalized (rangeend)
|
|
723
|
+
if (!isSameDay || (isSameDay && isRangeEnd)) {
|
|
724
|
+
this.emitChanges(rangeValue);
|
|
725
|
+
await SyncUtils.nextFrame();
|
|
726
|
+
this.closeOverlay();
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Extract date value from calendar element
|
|
731
|
+
*/
|
|
732
|
+
extractDateValue(element) {
|
|
733
|
+
const elementWithValue = element;
|
|
734
|
+
return elementWithValue.value || element.getAttribute('value') || elementWithValue._value || elementWithValue.__value || '';
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Extract range value from calendar element
|
|
738
|
+
*/
|
|
739
|
+
extractRangeValue(element) {
|
|
740
|
+
const elementWithValue = element;
|
|
741
|
+
// Handle string format (ISO/ISO)
|
|
742
|
+
if (typeof elementWithValue.value === 'string') {
|
|
743
|
+
return DateUtils.parseRangeValue(elementWithValue.value);
|
|
744
|
+
}
|
|
745
|
+
// Handle object format
|
|
746
|
+
if (elementWithValue.value && typeof elementWithValue.value === 'object') {
|
|
747
|
+
return elementWithValue.value;
|
|
748
|
+
}
|
|
749
|
+
// Handle attributes
|
|
750
|
+
const start = element.getAttribute('start');
|
|
751
|
+
const end = element.getAttribute('end');
|
|
752
|
+
if (start && end) {
|
|
753
|
+
return { start, end };
|
|
754
|
+
}
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
// ==================== CONTROL VALUE ACCESSOR ====================
|
|
758
|
+
/**
|
|
759
|
+
* Write external model value into the component
|
|
760
|
+
*/
|
|
761
|
+
writeValue(obj) {
|
|
762
|
+
// Prevent writeValue during internal updates to avoid circular updates
|
|
763
|
+
if (this.isUpdatingRange)
|
|
764
|
+
return;
|
|
765
|
+
if (this.mode() === 'range') {
|
|
766
|
+
const rangeObj = obj;
|
|
767
|
+
if (rangeObj?.start && rangeObj?.end) {
|
|
768
|
+
// Convert display format to ISO if needed
|
|
769
|
+
const isoRange = {
|
|
770
|
+
start: DateUtils.toISODate(rangeObj.start, this.format()),
|
|
771
|
+
end: DateUtils.toISODate(rangeObj.end, this.format()),
|
|
772
|
+
};
|
|
773
|
+
this._selectedRangeValue.set(isoRange);
|
|
774
|
+
// Update calendar element to sync with Cally.js
|
|
775
|
+
this.updateCalendarElementValue(isoRange);
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
this._selectedRangeValue.set(null);
|
|
779
|
+
// Update calendar element to sync with Cally.js
|
|
780
|
+
this.updateCalendarElementValue(null);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
const dateStr = obj;
|
|
785
|
+
if (dateStr) {
|
|
786
|
+
const isoDate = DateUtils.toISODate(dateStr, this.format());
|
|
787
|
+
this._selectedDateValue.set(isoDate);
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
this._selectedDateValue.set('');
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Register form change callback
|
|
796
|
+
*/
|
|
797
|
+
registerOnChange(fn) {
|
|
798
|
+
this.onControlChange = fn;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Register form touched callback
|
|
802
|
+
*/
|
|
803
|
+
registerOnTouched(fn) {
|
|
804
|
+
this.onControlTouch = fn;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Update disabled state from Angular forms
|
|
808
|
+
*/
|
|
809
|
+
setDisabledState(isDisabled) {
|
|
810
|
+
this._disabled.set(isDisabled);
|
|
811
|
+
}
|
|
812
|
+
// ==================== TEMPLATE ACCESS ====================
|
|
813
|
+
/** Icons for navigation buttons */
|
|
814
|
+
iconChevronLeft = matChevronLeft;
|
|
815
|
+
iconChevronRight = matChevronRight;
|
|
816
|
+
iconClock = heroClock;
|
|
817
|
+
// ==================== TIME PICKER HANDLERS ====================
|
|
818
|
+
clampTime(raw, withSeconds) {
|
|
819
|
+
// Accept HH:mm or HH:mm:ss; coerce to valid bounds
|
|
820
|
+
const parts = raw.split(':').map((p) => p.trim());
|
|
821
|
+
let h = Number(parts[0]);
|
|
822
|
+
let m = Number(parts[1] ?? '0');
|
|
823
|
+
let s = Number(parts[2] ?? '0');
|
|
824
|
+
if (!Number.isFinite(h))
|
|
825
|
+
h = 0;
|
|
826
|
+
if (!Number.isFinite(m))
|
|
827
|
+
m = 0;
|
|
828
|
+
if (!Number.isFinite(s))
|
|
829
|
+
s = 0;
|
|
830
|
+
h = Math.max(0, Math.min(23, h));
|
|
831
|
+
m = Math.max(0, Math.min(59, m));
|
|
832
|
+
s = Math.max(0, Math.min(59, s));
|
|
833
|
+
const hh = String(h).padStart(2, '0');
|
|
834
|
+
const mm = String(m).padStart(2, '0');
|
|
835
|
+
const ss = String(s).padStart(2, '0');
|
|
836
|
+
return (withSeconds ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`);
|
|
837
|
+
}
|
|
838
|
+
onStartTimeChange(ev) {
|
|
839
|
+
const raw = ev.target?.value ?? '';
|
|
840
|
+
if (!raw) {
|
|
841
|
+
this.startTime.set('');
|
|
842
|
+
this.startTimeChanged.emit('');
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
const val = this.clampTime(raw, this.showSeconds());
|
|
846
|
+
this.startTime.set(val);
|
|
847
|
+
this.startTimeChanged.emit(val);
|
|
848
|
+
}
|
|
849
|
+
onEndTimeChange(ev) {
|
|
850
|
+
const raw = ev.target?.value ?? '';
|
|
851
|
+
if (!raw) {
|
|
852
|
+
this.endTime.set('');
|
|
853
|
+
this.endTimeChanged.emit('');
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const val = this.clampTime(raw, this.showSeconds());
|
|
857
|
+
this.endTime.set(val);
|
|
858
|
+
this.endTimeChanged.emit(val);
|
|
859
|
+
}
|
|
860
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
861
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DatepickerComponent, isStandalone: true, selector: "st-datepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rangeValue: { classPropertyName: "rangeValue", publicName: "rangeValue", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, rangeCalendars: { classPropertyName: "rangeCalendars", publicName: "rangeCalendars", isSignal: true, isRequired: false, transformFunction: null }, showQuickActions: { classPropertyName: "showQuickActions", publicName: "showQuickActions", isSignal: true, isRequired: false, transformFunction: null }, showTimePicker: { classPropertyName: "showTimePicker", publicName: "showTimePicker", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, timeDisplayFormat: { classPropertyName: "timeDisplayFormat", publicName: "timeDisplayFormat", isSignal: true, isRequired: false, transformFunction: null }, languageMapping: { classPropertyName: "languageMapping", publicName: "languageMapping", isSignal: true, isRequired: false, transformFunction: null }, useLocaleDisplay: { classPropertyName: "useLocaleDisplay", publicName: "useLocaleDisplay", isSignal: true, isRequired: false, transformFunction: null }, dateStyle: { classPropertyName: "dateStyle", publicName: "dateStyle", isSignal: true, isRequired: false, transformFunction: null }, startTimeValue: { classPropertyName: "startTimeValue", publicName: "startTimeValue", isSignal: true, isRequired: false, transformFunction: null }, endTimeValue: { classPropertyName: "endTimeValue", publicName: "endTimeValue", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateUpdated: "dateUpdated", rangeUpdated: "rangeUpdated", valueChanged: "valueChanged", rangeValueChanged: "rangeValueChanged", startTimeChanged: "startTimeChanged", endTimeChanged: "endTimeChanged" }, providers: [
|
|
862
|
+
{
|
|
863
|
+
provide: NG_VALUE_ACCESSOR,
|
|
864
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
865
|
+
multi: true,
|
|
866
|
+
},
|
|
867
|
+
], viewQueries: [{ propertyName: "datePickerOverlay", first: true, predicate: ["datePickerOverlay"], descendants: true, isSignal: true }], exportAs: ["stDatepicker"], ngImport: i0, template: "<fieldset class=\"fieldset p-0\">\n\t@if (label()) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label() }}</legend>\n\t}\n\n\t<!-- Calendar overlay -->\n\t<st-overlay #datePickerOverlay=\"stOverlay\">\n\t\t<st-overlay-trigger>\n\t\t\t<!-- Projected trigger content (input, button, etc.) -->\n\t\t\t<ng-content></ng-content>\n\t\t</st-overlay-trigger>\n\t\t<st-overlay-content>\n\t\t\t<div class=\"bg-base-200 border-neutral rounded-box shadow-main border p-4\">\n\t\t\t\t@if (mode() === 'range') {\n\t\t\t\t\t<div class=\"flex gap-4\">\n\t\t\t\t\t\t@if (showQuickActions()) {\n\t\t\t\t\t\t\t<!-- Quick Options Sidebar -->\n\t\t\t\t\t\t\t<div class=\"flex w-56 shrink-0 flex-col gap-2\">\n\t\t\t\t\t\t\t\t<h4 class=\"mb-2 text-sm font-medium\">{{ 'sdk.datePicker.quickActions.title' | translate }}</h4>\n\t\t\t\t\t\t\t\t<div class=\"relative\">\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclass=\"flex flex-col overflow-y-auto overscroll-contain\"\n\t\t\t\t\t\t\t\t\t\t[class.pb-4]=\"showTimePicker()\"\n\t\t\t\t\t\t\t\t\t\t[class.max-h-auto]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t[class.max-h-52]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(1)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastHour' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(3)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last3Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(6)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(12)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last12Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(24)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last24Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last30Days')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last6Months')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('lastYear')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t\t\t<div class=\"from-base-200 pointer-events-none absolute right-2 bottom-0 left-0 z-10 h-8 bg-gradient-to-t to-transparent\"></div>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"clearRange()\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.clear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"divider divider-horizontal m-0 w-0\"></div>\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<div class=\"flex max-w-132 flex-1 flex-col gap-4\" [class.items-start]=\"!showTimePicker()\" [class.items-stretch]=\"showTimePicker()\">\n\t\t\t\t\t\t\t<!-- Calendar -->\n\t\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar, $event)\"\n\t\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-wrap justify-center gap-6\">\n\t\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"1\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t<!-- Single Calendar View (one month) within range mode) -->\n\t\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar, $event)\"\n\t\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<!-- Bottom Time Picker Sidebar -->\n\t\t\t\t\t\t\t\t<div class=\"flex w-full justify-evenly gap-6\" [class.flex-col]=\"rangeCalendars() === 1\">\n\t\t\t\t\t\t\t\t\t<!-- From Time Picker -->\n\t\t\t\t\t\t\t\t\t<div class=\"flex w-63 flex-col\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"text-neutral-secondary font-body text-[14px] leading-normal font-medium tracking-tight text-pretty text-clip\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.labels.from' | translate }}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col\">\n\t\t\t\t\t\t\t\t\t\t\t<!-- Date Display -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-primary font-heading leading-tight font-light tracking-wide text-balance text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-5xl]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-6xl]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromDay() }}\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col items-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"font-body leading-normal font-medium tracking-tight text-pretty text-clip whitespace-nowrap text-inherit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromMonthYear() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-neutral-secondary font-body leading-normal font-medium tracking-tight text-pretty text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromWeekday() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<!-- Time Picker -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<st-icon [icon]=\"iconClock\" class=\"text-primary text-2xl\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\t\t[attr.step]=\"showSeconds() ? 1 : null\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"time\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"input input-sm input-bordered input-secondary max-w-fit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[value]=\"startTimeDisplay()\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t(input)=\"onStartTimeChange($event)\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<!-- To Time Picker -->\n\t\t\t\t\t\t\t\t\t<div class=\"flex w-63 flex-col\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"text-neutral-secondary font-body text-[14px] leading-normal font-medium tracking-tight text-pretty text-clip\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.labels.to' | translate }}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col\">\n\t\t\t\t\t\t\t\t\t\t\t<!-- Date Display -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-primary font-heading leading-tight font-light tracking-wide text-balance text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-5xl]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-6xl]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toDay() }}\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col items-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"font-body leading-normal font-medium tracking-tight text-pretty text-clip whitespace-nowrap text-inherit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toMonthYear() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-neutral-secondary font-body leading-normal font-medium tracking-tight text-pretty text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toWeekday() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<!-- Time Picker -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<st-icon [icon]=\"iconClock\" class=\"text-primary text-2xl\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\t\t[attr.step]=\"showSeconds() ? 1 : null\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"time\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"input input-sm input-bordered input-secondary max-w-fit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[value]=\"endTimeDisplay()\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t(input)=\"onEndTimeChange($event)\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t} @else {\n\t\t\t\t\t<!-- Single Date Mode -->\n\t\t\t\t\t<calendar-date\n\t\t\t\t\t\t#singleCalendar\n\t\t\t\t\t\t[value]=\"selectedDateValue() || ''\"\n\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t(change)=\"onCalendarChange(singleCalendar)\"\n\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t<st-button variant=\"base\" [square]=\"true\" [icon]=\"iconChevronRight\" size=\"xs\" [ghost]=\"true\" aria-label=\"Next\" slot=\"next\"></st-button>\n\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t</calendar-date>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</st-overlay-content>\n\t</st-overlay>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label() }}</label>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: OverlayComponent, selector: "st-overlay", inputs: ["offsetX", "offsetY", "originX", "originY", "overlayX", "overlayY", "fallbacks", "syncWidth"], outputs: ["opened", "closed"], exportAs: ["stOverlay"] }, { kind: "component", type: OverlayTriggerComponent, selector: "st-overlay-trigger" }, { kind: "component", type: OverlayContentComponent, selector: "st-overlay-content" }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
868
|
+
}
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
870
|
+
type: Component,
|
|
871
|
+
args: [{ selector: 'st-datepicker', imports: [CommonModule, OverlayComponent, OverlayTriggerComponent, OverlayContentComponent, ButtonComponent, TranslatePipe, IconComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'stDatepicker', providers: [
|
|
872
|
+
{
|
|
873
|
+
provide: NG_VALUE_ACCESSOR,
|
|
874
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
875
|
+
multi: true,
|
|
876
|
+
},
|
|
877
|
+
], template: "<fieldset class=\"fieldset p-0\">\n\t@if (label()) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label() }}</legend>\n\t}\n\n\t<!-- Calendar overlay -->\n\t<st-overlay #datePickerOverlay=\"stOverlay\">\n\t\t<st-overlay-trigger>\n\t\t\t<!-- Projected trigger content (input, button, etc.) -->\n\t\t\t<ng-content></ng-content>\n\t\t</st-overlay-trigger>\n\t\t<st-overlay-content>\n\t\t\t<div class=\"bg-base-200 border-neutral rounded-box shadow-main border p-4\">\n\t\t\t\t@if (mode() === 'range') {\n\t\t\t\t\t<div class=\"flex gap-4\">\n\t\t\t\t\t\t@if (showQuickActions()) {\n\t\t\t\t\t\t\t<!-- Quick Options Sidebar -->\n\t\t\t\t\t\t\t<div class=\"flex w-56 shrink-0 flex-col gap-2\">\n\t\t\t\t\t\t\t\t<h4 class=\"mb-2 text-sm font-medium\">{{ 'sdk.datePicker.quickActions.title' | translate }}</h4>\n\t\t\t\t\t\t\t\t<div class=\"relative\">\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclass=\"flex flex-col overflow-y-auto overscroll-contain\"\n\t\t\t\t\t\t\t\t\t\t[class.pb-4]=\"showTimePicker()\"\n\t\t\t\t\t\t\t\t\t\t[class.max-h-auto]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t[class.max-h-52]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(1)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastHour' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(3)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last3Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(6)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(12)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last12Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickLastHours(24)\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last24Hours' | translate }}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last30Days')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last6Months')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('lastYear')\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t\t\t<div class=\"from-base-200 pointer-events-none absolute right-2 bottom-0 left-0 z-10 h-8 bg-gradient-to-t to-transparent\"></div>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"clearRange()\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.clear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"divider divider-horizontal m-0 w-0\"></div>\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<div class=\"flex max-w-132 flex-1 flex-col gap-4\" [class.items-start]=\"!showTimePicker()\" [class.items-stretch]=\"showTimePicker()\">\n\t\t\t\t\t\t\t<!-- Calendar -->\n\t\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar, $event)\"\n\t\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-wrap justify-center gap-6\">\n\t\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"1\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t<!-- Single Calendar View (one month) within range mode) -->\n\t\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar, $event)\"\n\t\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t@if (showTimePicker()) {\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<!-- Bottom Time Picker Sidebar -->\n\t\t\t\t\t\t\t\t<div class=\"flex w-full justify-evenly gap-6\" [class.flex-col]=\"rangeCalendars() === 1\">\n\t\t\t\t\t\t\t\t\t<!-- From Time Picker -->\n\t\t\t\t\t\t\t\t\t<div class=\"flex w-63 flex-col\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"text-neutral-secondary font-body text-[14px] leading-normal font-medium tracking-tight text-pretty text-clip\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.labels.from' | translate }}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col\">\n\t\t\t\t\t\t\t\t\t\t\t<!-- Date Display -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-primary font-heading leading-tight font-light tracking-wide text-balance text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-5xl]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-6xl]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromDay() }}\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col items-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"font-body leading-normal font-medium tracking-tight text-pretty text-clip whitespace-nowrap text-inherit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromMonthYear() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-neutral-secondary font-body leading-normal font-medium tracking-tight text-pretty text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ fromWeekday() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<!-- Time Picker -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<st-icon [icon]=\"iconClock\" class=\"text-primary text-2xl\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\t\t[attr.step]=\"showSeconds() ? 1 : null\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"time\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"input input-sm input-bordered input-secondary max-w-fit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[value]=\"startTimeDisplay()\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t(input)=\"onStartTimeChange($event)\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<!-- To Time Picker -->\n\t\t\t\t\t\t\t\t\t<div class=\"flex w-63 flex-col\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"text-neutral-secondary font-body text-[14px] leading-normal font-medium tracking-tight text-pretty text-clip\">\n\t\t\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.labels.to' | translate }}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col\">\n\t\t\t\t\t\t\t\t\t\t\t<!-- Date Display -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-primary font-heading leading-tight font-light tracking-wide text-balance text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-5xl]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-6xl]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toDay() }}\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex flex-col items-start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"font-body leading-normal font-medium tracking-tight text-pretty text-clip whitespace-nowrap text-inherit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toMonthYear() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-neutral-secondary font-body leading-normal font-medium tracking-tight text-pretty text-clip\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-xs]=\"rangeCalendars() === 1\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[class.text-sm]=\"rangeCalendars() === 2\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{ toWeekday() }}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<!-- Time Picker -->\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t\t\t\t\t<st-icon [icon]=\"iconClock\" class=\"text-primary text-2xl\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\t\t\t[attr.step]=\"showSeconds() ? 1 : null\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"time\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclass=\"input input-sm input-bordered input-secondary max-w-fit\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t[value]=\"endTimeDisplay()\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t(input)=\"onEndTimeChange($event)\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t} @else {\n\t\t\t\t\t<!-- Single Date Mode -->\n\t\t\t\t\t<calendar-date\n\t\t\t\t\t\t#singleCalendar\n\t\t\t\t\t\t[value]=\"selectedDateValue() || ''\"\n\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t(change)=\"onCalendarChange(singleCalendar)\"\n\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t<st-button variant=\"base\" [square]=\"true\" [icon]=\"iconChevronRight\" size=\"xs\" [ghost]=\"true\" aria-label=\"Next\" slot=\"next\"></st-button>\n\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t</calendar-date>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</st-overlay-content>\n\t</st-overlay>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label() }}</label>\n</fieldset>\n" }]
|
|
878
|
+
}], ctorParameters: () => [] });
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* Generated bundle index. Do not edit.
|
|
882
|
+
*/
|
|
883
|
+
|
|
884
|
+
export { DATEPICKER_MODES, DATE_STYLES, DatepickerComponent, RANGE_CALENDARS, SUPPORTED_LOCALES, TIME_DISPLAY_FORMATS };
|
|
885
|
+
//# sourceMappingURL=sixbell-telco-sdk-components-forms-date-picker.mjs.map
|