@sixbell-telco/sdk 1.2.0 → 1.3.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 +88 -0
- package/README.md +183 -70
- package/_index.css +132 -53
- package/components/data-table/expandable/expandable.component.d.ts +129 -0
- package/components/data-table/index.d.ts +5 -0
- package/components/data-table/public-api.d.ts +7 -0
- package/components/data-table/selection/selection.component.d.ts +41 -0
- package/components/data-table/sortable-header/sortable-header.component.d.ts +61 -0
- package/components/data-table/src/data-table-context.service.d.ts +18 -0
- package/components/data-table/src/data-table.component.d.ts +158 -0
- package/components/data-table/src/models.d.ts +58 -0
- package/components/data-table/sub-component-toggle/index.d.ts +1 -0
- package/components/data-table/sub-component-toggle/sub-component-toggle.component.d.ts +12 -0
- package/components/dialog/dialog-title/dialog-title.component.d.ts +4 -0
- package/components/dialog/src/dialog.component.d.ts +22 -8
- package/components/dropdown/dropdown-group/dropdown-group.component.d.ts +1 -1
- package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +2 -2
- package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +2 -2
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +2 -2
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +2 -2
- package/components/forms/datepicker/constants/datepicker.constants.d.ts +5 -0
- package/components/forms/datepicker/public-api.d.ts +2 -1
- package/components/forms/datepicker/src/datepicker.component.d.ts +155 -44
- package/components/forms/datepicker/types/datepicker.types.d.ts +7 -0
- package/components/overlay/index.d.ts +5 -0
- package/components/overlay/overlay-content/overlay-content.component.d.ts +23 -0
- package/components/overlay/overlay-trigger/overlay-trigger.component.d.ts +48 -0
- package/components/overlay/public-api.d.ts +3 -0
- package/components/overlay/src/overlay.component.d.ts +158 -0
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +8 -3
- package/components/paginator/pipes/pagination.pipe.d.ts +40 -0
- package/components/paginator/public-api.d.ts +1 -0
- package/components/paginator/src/paginator.component.d.ts +14 -12
- package/components/table/src/table.component.d.ts +9 -6
- package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs +103 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +1091 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +63 -12
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +6 -6
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +12 -10
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +4 -5
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +439 -164
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-overlay.mjs +408 -0
- package/fesm2022/sixbell-telco-sdk-components-overlay.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +150 -35
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +15 -6
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs +154 -0
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-sync.mjs +84 -0
- package/fesm2022/sixbell-telco-sdk-utils-sync.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +3 -4
- package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
- package/package.json +51 -30
- package/utils/date/index.d.ts +5 -0
- package/utils/date/public-api.d.ts +1 -0
- package/utils/date/src/date-utils.d.ts +81 -0
- package/utils/sync/index.d.ts +5 -0
- package/utils/sync/public-api.d.ts +1 -0
- package/utils/sync/src/sync.d.ts +37 -0
- package/utils/translation/public-api.d.ts +3 -4
- package/components/forms/datepicker/src/datepicker-format-month.pipe.d.ts +0 -10
- package/sixbell-telco-sdk-1.2.0.tgz +0 -0
|
@@ -1,212 +1,487 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, input, computed, model, output, effect, Component } from '@angular/core';
|
|
3
|
-
import 'dayjs/locale/es';
|
|
4
|
-
import 'dayjs/locale/pt';
|
|
5
|
-
import * as i1 from '@angular/common';
|
|
6
1
|
import { CommonModule } from '@angular/common';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { signal, viewChild, input, output, computed, forwardRef, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { matChevronLeft, matChevronRight } from '@ng-icons/material-icons/baseline';
|
|
6
|
+
import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
7
|
+
import { OverlayComponent, OverlayTriggerComponent, OverlayContentComponent } from '@sixbell-telco/sdk/components/overlay';
|
|
8
|
+
import { DateUtils } from '@sixbell-telco/sdk/utils/date';
|
|
9
|
+
import { SyncUtils } from '@sixbell-telco/sdk/utils/sync';
|
|
10
|
+
import { TranslatePipe } from '@sixbell-telco/sdk/utils/translation';
|
|
11
|
+
import 'cally';
|
|
11
12
|
import dayjs from 'dayjs';
|
|
12
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
13
|
-
import isBetween from 'dayjs/plugin/isBetween';
|
|
14
|
-
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Supported locales (BCP 47) for the date picker.
|
|
16
|
+
* These map directly to the underlying calendar web component locale attribute.
|
|
17
|
+
*/
|
|
18
|
+
const SUPPORTED_LOCALES = [
|
|
19
|
+
'en-US', // English (United States)
|
|
20
|
+
'en-GB', // English (United Kingdom)
|
|
21
|
+
'es-ES', // Spanish (Spain)
|
|
22
|
+
'es-MX', // Spanish (Mexico)
|
|
23
|
+
'fr-FR', // French (France)
|
|
24
|
+
'de-DE', // German (Germany)
|
|
25
|
+
'it-IT', // Italian (Italy)
|
|
26
|
+
'pt-BR', // Portuguese (Brazil)
|
|
27
|
+
'pt-PT', // Portuguese (Portugal)
|
|
28
|
+
'ja-JP', // Japanese (Japan)
|
|
29
|
+
'ko-KR', // Korean (Korea)
|
|
30
|
+
'zh-CN', // Chinese (Simplified)
|
|
31
|
+
'zh-TW', // Chinese (Traditional)
|
|
32
|
+
'ru-RU', // Russian (Russia)
|
|
33
|
+
'ar-SA', // Arabic (Saudi Arabia)
|
|
34
|
+
'hi-IN', // Hindi (India)
|
|
35
|
+
'nl-NL', // Dutch (Netherlands)
|
|
36
|
+
'sv-SE', // Swedish (Sweden)
|
|
37
|
+
'da-DK', // Danish (Denmark)
|
|
38
|
+
'no-NO', // Norwegian (Norway)
|
|
39
|
+
'fi-FI', // Finnish (Finland)
|
|
40
|
+
'pl-PL', // Polish (Poland)
|
|
41
|
+
'tr-TR', // Turkish (Turkey)
|
|
42
|
+
'he-IL', // Hebrew (Israel)
|
|
43
|
+
'th-TH', // Thai (Thailand)
|
|
44
|
+
'vi-VN', // Vietnamese (Vietnam)
|
|
45
|
+
];
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
/**
|
|
48
|
+
* DatePicker Component following SOLID principles
|
|
49
|
+
*
|
|
50
|
+
* Responsibilities:
|
|
51
|
+
* - Single Responsibility: Manages date/range selection UI
|
|
52
|
+
* - Open/Closed: Extensible through inputs without modification
|
|
53
|
+
* - Liskov Substitution: Implements ControlValueAccessor contract
|
|
54
|
+
* - Interface Segregation: Focused public API
|
|
55
|
+
* - Dependency Inversion: Uses DateService for date operations
|
|
56
|
+
*/
|
|
33
57
|
class DatepickerComponent {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
// ==================== STATE MANAGEMENT ====================
|
|
59
|
+
/** Internal state for single date (ISO format) */
|
|
60
|
+
_selectedDateValue = signal('');
|
|
61
|
+
/** Internal state for date range (ISO format) */
|
|
62
|
+
_selectedRangeValue = signal(null);
|
|
63
|
+
/** Disabled state */
|
|
64
|
+
_disabled = signal(false);
|
|
65
|
+
/** Flag to prevent concurrent range updates */
|
|
66
|
+
isUpdatingRange = false;
|
|
67
|
+
// ==================== FORM INTEGRATION ====================
|
|
68
|
+
/** Form change callback */
|
|
69
|
+
onControlChange = () => { };
|
|
70
|
+
/** Form touch callback */
|
|
71
|
+
onControlTouch = () => { };
|
|
72
|
+
// ==================== COMPONENT REFERENCES ====================
|
|
73
|
+
/** Overlay reference for controlling calendar popup */
|
|
74
|
+
datePickerOverlay = viewChild('datePickerOverlay');
|
|
75
|
+
// ==================== INPUTS ====================
|
|
76
|
+
/** Label displayed above the fieldset legend */
|
|
49
77
|
label = input('');
|
|
50
|
-
|
|
78
|
+
/** Picker mode (single date or date range) */
|
|
79
|
+
mode = input('single');
|
|
80
|
+
/** Display / parse format */
|
|
81
|
+
format = input('DD/MM/YYYY');
|
|
82
|
+
/** Locale used by the calendar web component */
|
|
83
|
+
language = input('en-US');
|
|
84
|
+
/** Optional minimum selectable date */
|
|
51
85
|
minDate = input(null);
|
|
86
|
+
/** Optional maximum selectable date */
|
|
52
87
|
maxDate = input(null);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
isOpen = false;
|
|
65
|
-
// Form control properties
|
|
88
|
+
/** Single date value (external binding) */
|
|
89
|
+
value = input('');
|
|
90
|
+
/** Date range value (external binding) */
|
|
91
|
+
rangeValue = input(null);
|
|
92
|
+
/** Name attribute for associated input */
|
|
93
|
+
name = input('');
|
|
94
|
+
/** Number of calendars to show in range mode (1 or 2) */
|
|
95
|
+
rangeCalendars = input(2);
|
|
96
|
+
/** Whether to show quick action presets in range mode */
|
|
97
|
+
showQuickActions = input(true);
|
|
98
|
+
/** Parent reactive form group (optional) */
|
|
66
99
|
parentForm = input(null);
|
|
100
|
+
/** Name of the form control inside the parent form (optional) */
|
|
67
101
|
formControlName = input('');
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
// ==================== OUTPUTS ====================
|
|
103
|
+
/** Emits formatted single date when it changes */
|
|
104
|
+
dateUpdated = output();
|
|
105
|
+
/** Emits formatted date range when both start & end are selected */
|
|
106
|
+
rangeUpdated = output();
|
|
107
|
+
/** Emits formatted single date (alias) */
|
|
108
|
+
valueChanged = output();
|
|
109
|
+
/** Emits formatted date range (alias) */
|
|
110
|
+
rangeValueChanged = output();
|
|
111
|
+
// ==================== COMPUTED PROPERTIES ====================
|
|
112
|
+
/** Effective minimum date (input or default 10 years ago) */
|
|
113
|
+
effectiveMinDate = computed(() => {
|
|
114
|
+
const inputMin = this.minDate();
|
|
115
|
+
return inputMin ? DateUtils.toISODate(inputMin) : dayjs().subtract(10, 'year').format('YYYY-MM-DD');
|
|
116
|
+
});
|
|
117
|
+
/** Effective maximum date (input or default 10 years ahead) */
|
|
118
|
+
effectiveMaxDate = computed(() => {
|
|
119
|
+
const inputMax = this.maxDate();
|
|
120
|
+
return inputMax ? DateUtils.toISODate(inputMax) : dayjs().add(10, 'year').format('YYYY-MM-DD');
|
|
121
|
+
});
|
|
122
|
+
/** Locale for calendar components */
|
|
123
|
+
calendarLocale = computed(() => this.language() || 'en-US');
|
|
124
|
+
/** Computed form field reference */
|
|
125
|
+
formField = computed(() => {
|
|
126
|
+
const form = this.parentForm();
|
|
127
|
+
const controlName = this.formControlName();
|
|
128
|
+
if (!form || !controlName)
|
|
70
129
|
return null;
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
130
|
+
return form.get(controlName);
|
|
131
|
+
});
|
|
132
|
+
/** Formatted display value for single date */
|
|
133
|
+
selectedDate = computed(() => {
|
|
134
|
+
const isoValue = this._selectedDateValue();
|
|
135
|
+
return isoValue ? DateUtils.toDisplayDate(isoValue, this.format()) : '';
|
|
136
|
+
});
|
|
137
|
+
/** Formatted display value for date range */
|
|
138
|
+
selectedRange = computed(() => {
|
|
139
|
+
const isoRange = this._selectedRangeValue();
|
|
140
|
+
if (!isoRange?.start || !isoRange?.end)
|
|
141
|
+
return null;
|
|
142
|
+
return {
|
|
143
|
+
start: DateUtils.toDisplayDate(isoRange.start, this.format()),
|
|
144
|
+
end: DateUtils.toDisplayDate(isoRange.end, this.format()),
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
/** Value for calendar-range component (ISO/ISO format) */
|
|
148
|
+
rangeCalendarValue = computed(() => {
|
|
149
|
+
return DateUtils.toRangeValue(this._selectedRangeValue());
|
|
150
|
+
});
|
|
151
|
+
/** Unified display value for triggers */
|
|
152
|
+
displayValue = computed(() => {
|
|
153
|
+
if (this.mode() === 'range') {
|
|
154
|
+
const range = this.selectedRange();
|
|
155
|
+
return range ? `${range.start} - ${range.end}` : '';
|
|
156
|
+
}
|
|
157
|
+
return this.selectedDate();
|
|
158
|
+
});
|
|
159
|
+
/** Exposed selected date value (ISO format) for template access */
|
|
160
|
+
selectedDateValue = computed(() => this._selectedDateValue());
|
|
161
|
+
// ==================== COMPONENT LIFECYCLE ====================
|
|
162
|
+
constructor() {
|
|
163
|
+
// Initialize with default values if none provided
|
|
164
|
+
this.initializeValues();
|
|
80
165
|
}
|
|
81
|
-
|
|
82
|
-
|
|
166
|
+
// ==================== PRIVATE METHODS ====================
|
|
167
|
+
/**
|
|
168
|
+
* Initialize component values based on inputs
|
|
169
|
+
*/
|
|
170
|
+
initializeValues() {
|
|
171
|
+
if (this.mode() === 'range') {
|
|
172
|
+
// Only set a range if one is provided, otherwise leave empty
|
|
173
|
+
const inputRange = this.rangeValue();
|
|
174
|
+
if (inputRange?.start && inputRange?.end) {
|
|
175
|
+
const isoRange = {
|
|
176
|
+
start: DateUtils.toISODate(inputRange.start, this.format()),
|
|
177
|
+
end: DateUtils.toISODate(inputRange.end, this.format()),
|
|
178
|
+
};
|
|
179
|
+
this._selectedRangeValue.set(isoRange);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
this._selectedRangeValue.set(null);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// Only set a date if one is provided, otherwise leave empty
|
|
187
|
+
const inputValue = this.value();
|
|
188
|
+
if (inputValue) {
|
|
189
|
+
const isoDate = DateUtils.toISODate(inputValue, this.format());
|
|
190
|
+
this._selectedDateValue.set(isoDate);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this._selectedDateValue.set('');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
83
196
|
}
|
|
84
|
-
|
|
85
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Set single date value programmatically
|
|
199
|
+
*/
|
|
200
|
+
async setSingleDateValue(isoDate) {
|
|
201
|
+
this._selectedDateValue.set(isoDate);
|
|
202
|
+
const displayDate = this.selectedDate();
|
|
203
|
+
this.emitChanges(displayDate);
|
|
204
|
+
// Wait for next frame to ensure proper synchronization
|
|
205
|
+
await SyncUtils.nextFrame();
|
|
206
|
+
this.closeOverlay();
|
|
86
207
|
}
|
|
87
|
-
|
|
88
|
-
|
|
208
|
+
// ==================== PRIVATE HELPER METHODS ====================
|
|
209
|
+
/**
|
|
210
|
+
* Emit change events and notify form controls
|
|
211
|
+
*/
|
|
212
|
+
emitChanges(value) {
|
|
213
|
+
if (this.mode() === 'range') {
|
|
214
|
+
const rangeValue = value;
|
|
215
|
+
this.rangeUpdated.emit(rangeValue);
|
|
216
|
+
this.rangeValueChanged.emit(rangeValue);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const dateValue = value;
|
|
220
|
+
this.dateUpdated.emit(dateValue);
|
|
221
|
+
this.valueChanged.emit(dateValue);
|
|
222
|
+
}
|
|
223
|
+
// For form controls, emit null for empty values to trigger validation properly
|
|
224
|
+
const formValue = value || null;
|
|
225
|
+
this.onControlChange(formValue);
|
|
226
|
+
this.onControlTouch();
|
|
89
227
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
228
|
+
/**
|
|
229
|
+
* Close overlay if available
|
|
230
|
+
*/
|
|
231
|
+
closeOverlay() {
|
|
232
|
+
this.datePickerOverlay()?.close();
|
|
94
233
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
234
|
+
// ==================== PUBLIC API ====================
|
|
235
|
+
/**
|
|
236
|
+
* Handle calendar change events from Cally components
|
|
237
|
+
*/
|
|
238
|
+
onCalendarChange(calendarElement) {
|
|
239
|
+
if (this.mode() === 'range') {
|
|
240
|
+
// Fire and forget async operation
|
|
241
|
+
this.handleRangeCalendarChange(calendarElement).catch(console.error);
|
|
98
242
|
}
|
|
99
243
|
else {
|
|
100
|
-
|
|
101
|
-
this.getDaysFromDate(d.getMonth() + 1, d.getFullYear());
|
|
244
|
+
this.handleSingleCalendarChange(calendarElement).catch(console.error);
|
|
102
245
|
}
|
|
103
246
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Apply a predefined quick range preset
|
|
249
|
+
*/
|
|
250
|
+
async selectQuickRange(preset) {
|
|
251
|
+
if (this.mode() !== 'range')
|
|
252
|
+
return;
|
|
253
|
+
try {
|
|
254
|
+
const quickRange = DateUtils.generateQuickRange(preset);
|
|
255
|
+
// Prevent rapid consecutive clicks by adding a flag
|
|
256
|
+
if (this.isUpdatingRange)
|
|
257
|
+
return;
|
|
258
|
+
this.isUpdatingRange = true;
|
|
259
|
+
// Use microtask to ensure proper state synchronization with Cally
|
|
260
|
+
await SyncUtils.nextTick();
|
|
261
|
+
await this.setRangeValue(quickRange);
|
|
262
|
+
// Wait before allowing next update
|
|
263
|
+
await SyncUtils.nextFrame();
|
|
264
|
+
this.isUpdatingRange = false;
|
|
107
265
|
}
|
|
108
|
-
|
|
109
|
-
|
|
266
|
+
catch (error) {
|
|
267
|
+
console.error('Error applying quick range:', error);
|
|
268
|
+
this.isUpdatingRange = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Clear the current range selection
|
|
273
|
+
*/
|
|
274
|
+
async clearRange() {
|
|
275
|
+
if (this.mode() !== 'range')
|
|
276
|
+
return;
|
|
277
|
+
// Prevent rapid consecutive clicks
|
|
278
|
+
if (this.isUpdatingRange)
|
|
279
|
+
return;
|
|
280
|
+
this.isUpdatingRange = true;
|
|
281
|
+
// Use microtask to ensure proper state synchronization with Cally
|
|
282
|
+
await SyncUtils.nextTick();
|
|
283
|
+
await this.setRangeValue(null);
|
|
284
|
+
// Wait before allowing next update
|
|
285
|
+
await SyncUtils.nextFrame();
|
|
286
|
+
this.isUpdatingRange = false;
|
|
110
287
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
if (this.maxDate()) {
|
|
137
|
-
// If maxDate is true, disables all dates AFTER 'from' date
|
|
138
|
-
return !day.isBetween(dayjs(from, this.format()).locale(this.language()).subtract(quantity, unit), dayjs(from, this.format()).locale(this.language()), null, '[]');
|
|
139
|
-
}
|
|
140
|
-
if (this.minDate()) {
|
|
141
|
-
// If minDate is true, disables all dates BEFORE 'from' date
|
|
142
|
-
return !day.isBetween(dayjs(from, this.format()).locale(this.language()), dayjs(from, this.format()).locale(this.language()).add(quantity, unit), null, '[]');
|
|
143
|
-
}
|
|
144
|
-
// Disables all dates BEFORE and AFTER 'from' date
|
|
145
|
-
return !day.isBetween(dayjs(from, this.format()).locale(this.language()).subtract(quantity, unit), dayjs(from, this.format()).locale(this.language()).add(quantity, unit), null, '[]');
|
|
146
|
-
}
|
|
147
|
-
shouldDisableDay(day) {
|
|
148
|
-
if (this.disableUntil() && this.disableFrom()) {
|
|
149
|
-
return !day.isBetween(dayjs(this.disableUntil(), this.format()).locale(this.language()).subtract(1, 'day'), dayjs(this.disableFrom(), this.format()).locale(this.language()).add(1, 'day'));
|
|
150
|
-
}
|
|
151
|
-
if (this.disableUntil() && !this.disableFrom()) {
|
|
152
|
-
return day.isBefore(dayjs(this.disableUntil(), this.format()).locale(this.language()));
|
|
153
|
-
}
|
|
154
|
-
if (this.disableFrom() && !this.disableUntil()) {
|
|
155
|
-
return day.isAfter(dayjs(this.disableFrom(), this.format()).locale(this.language()));
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
refresh() {
|
|
160
|
-
// Used to force a refresh on the calendar
|
|
161
|
-
this.changeMonth(true);
|
|
162
|
-
this.changeMonth(false);
|
|
163
|
-
}
|
|
164
|
-
changeMonth(flag) {
|
|
165
|
-
if (flag) {
|
|
166
|
-
const prevDate = this.monthAndYearLabel.clone().subtract(1, 'month');
|
|
167
|
-
this.getDaysFromDate(prevDate.format('MM'), prevDate.format('YYYY'));
|
|
288
|
+
/**
|
|
289
|
+
* Clear the current single date selection
|
|
290
|
+
*/
|
|
291
|
+
clearDate() {
|
|
292
|
+
if (this.mode() !== 'single')
|
|
293
|
+
return;
|
|
294
|
+
this._selectedDateValue.set('');
|
|
295
|
+
this.emitChanges(null);
|
|
296
|
+
this.closeOverlay();
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Set range value programmatically
|
|
300
|
+
*/
|
|
301
|
+
async setRangeValue(range) {
|
|
302
|
+
// Store the range in internal state first
|
|
303
|
+
this._selectedRangeValue.set(range);
|
|
304
|
+
// Update the calendar element value immediately to sync with Cally
|
|
305
|
+
await this.updateCalendarElementValue(range);
|
|
306
|
+
// Emit changes to form and outputs
|
|
307
|
+
if (range && DateUtils.isValidRange(range)) {
|
|
308
|
+
const displayRange = this.selectedRange();
|
|
309
|
+
if (displayRange) {
|
|
310
|
+
this.emitChanges(displayRange);
|
|
311
|
+
}
|
|
168
312
|
}
|
|
169
313
|
else {
|
|
170
|
-
|
|
171
|
-
this.
|
|
314
|
+
// Handle clear case - emit null for proper form validation
|
|
315
|
+
this.emitChanges(null);
|
|
172
316
|
}
|
|
317
|
+
// Close overlay after state is synchronized
|
|
318
|
+
await SyncUtils.nextFrame();
|
|
319
|
+
this.closeOverlay();
|
|
173
320
|
}
|
|
174
|
-
|
|
175
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Update calendar element value to ensure Cally.js synchronization
|
|
323
|
+
*/
|
|
324
|
+
async updateCalendarElementValue(range) {
|
|
325
|
+
// Wait for calendar element to be available
|
|
326
|
+
const calendarElement = await SyncUtils.waitForElement('calendar-range');
|
|
327
|
+
if (calendarElement) {
|
|
328
|
+
const typedElement = calendarElement;
|
|
329
|
+
const rangeValue = DateUtils.toRangeValue(range);
|
|
330
|
+
// Set the value property directly on the calendar element
|
|
331
|
+
typedElement.value = rangeValue;
|
|
332
|
+
// Also trigger a property update to ensure Cally.js internal state sync
|
|
333
|
+
if (range?.start && range?.end) {
|
|
334
|
+
typedElement.setAttribute('start', range.start);
|
|
335
|
+
typedElement.setAttribute('end', range.end);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
typedElement.removeAttribute('start');
|
|
339
|
+
typedElement.removeAttribute('end');
|
|
340
|
+
}
|
|
341
|
+
// Dispatch a change event to notify Cally.js of the programmatic update
|
|
342
|
+
typedElement.dispatchEvent(new Event('change', { bubbles: true }));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// ==================== CALENDAR EVENT HANDLERS ====================
|
|
346
|
+
/**
|
|
347
|
+
* Handle single date calendar change
|
|
348
|
+
*/
|
|
349
|
+
async handleSingleCalendarChange(calendarElement) {
|
|
350
|
+
const dateValue = this.extractDateValue(calendarElement);
|
|
351
|
+
if (dateValue && dayjs(dateValue).isValid()) {
|
|
352
|
+
await this.setSingleDateValue(dateValue);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Handle range calendar change
|
|
357
|
+
*/
|
|
358
|
+
async handleRangeCalendarChange(calendarElement) {
|
|
359
|
+
const rangeValue = this.extractRangeValue(calendarElement);
|
|
360
|
+
if (rangeValue && DateUtils.isValidRange(rangeValue)) {
|
|
361
|
+
// Update internal state immediately
|
|
362
|
+
this._selectedRangeValue.set(rangeValue);
|
|
363
|
+
// Only emit and close when a complete range is selected (different start and end)
|
|
364
|
+
if (rangeValue.start !== rangeValue.end) {
|
|
365
|
+
const displayRange = this.selectedRange();
|
|
366
|
+
if (displayRange) {
|
|
367
|
+
this.emitChanges(displayRange);
|
|
368
|
+
// Wait for proper synchronization before closing
|
|
369
|
+
await SyncUtils.nextFrame();
|
|
370
|
+
this.closeOverlay();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Extract date value from calendar element
|
|
377
|
+
*/
|
|
378
|
+
extractDateValue(element) {
|
|
379
|
+
const elementWithValue = element;
|
|
380
|
+
return elementWithValue.value || element.getAttribute('value') || elementWithValue._value || elementWithValue.__value || '';
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Extract range value from calendar element
|
|
384
|
+
*/
|
|
385
|
+
extractRangeValue(element) {
|
|
386
|
+
const elementWithValue = element;
|
|
387
|
+
// Handle string format (ISO/ISO)
|
|
388
|
+
if (typeof elementWithValue.value === 'string') {
|
|
389
|
+
return DateUtils.parseRangeValue(elementWithValue.value);
|
|
390
|
+
}
|
|
391
|
+
// Handle object format
|
|
392
|
+
if (elementWithValue.value && typeof elementWithValue.value === 'object') {
|
|
393
|
+
return elementWithValue.value;
|
|
394
|
+
}
|
|
395
|
+
// Handle attributes
|
|
396
|
+
const start = element.getAttribute('start');
|
|
397
|
+
const end = element.getAttribute('end');
|
|
398
|
+
if (start && end) {
|
|
399
|
+
return { start, end };
|
|
400
|
+
}
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
// ==================== CONTROL VALUE ACCESSOR ====================
|
|
404
|
+
/**
|
|
405
|
+
* Write external model value into the component
|
|
406
|
+
*/
|
|
407
|
+
writeValue(obj) {
|
|
408
|
+
// Prevent writeValue during internal updates to avoid circular updates
|
|
409
|
+
if (this.isUpdatingRange)
|
|
176
410
|
return;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
411
|
+
if (this.mode() === 'range') {
|
|
412
|
+
const rangeObj = obj;
|
|
413
|
+
if (rangeObj?.start && rangeObj?.end) {
|
|
414
|
+
// Convert display format to ISO if needed
|
|
415
|
+
const isoRange = {
|
|
416
|
+
start: DateUtils.toISODate(rangeObj.start, this.format()),
|
|
417
|
+
end: DateUtils.toISODate(rangeObj.end, this.format()),
|
|
418
|
+
};
|
|
419
|
+
this._selectedRangeValue.set(isoRange);
|
|
420
|
+
// Update calendar element to sync with Cally.js
|
|
421
|
+
this.updateCalendarElementValue(isoRange);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this._selectedRangeValue.set(null);
|
|
425
|
+
// Update calendar element to sync with Cally.js
|
|
426
|
+
this.updateCalendarElementValue(null);
|
|
427
|
+
}
|
|
185
428
|
}
|
|
429
|
+
else {
|
|
430
|
+
const dateStr = obj;
|
|
431
|
+
if (dateStr) {
|
|
432
|
+
const isoDate = DateUtils.toISODate(dateStr, this.format());
|
|
433
|
+
this._selectedDateValue.set(isoDate);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this._selectedDateValue.set('');
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Register form change callback
|
|
442
|
+
*/
|
|
443
|
+
registerOnChange(fn) {
|
|
444
|
+
this.onControlChange = fn;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Register form touched callback
|
|
448
|
+
*/
|
|
449
|
+
registerOnTouched(fn) {
|
|
450
|
+
this.onControlTouch = fn;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Update disabled state from Angular forms
|
|
454
|
+
*/
|
|
455
|
+
setDisabledState(isDisabled) {
|
|
456
|
+
this._disabled.set(isDisabled);
|
|
186
457
|
}
|
|
458
|
+
// ==================== TEMPLATE ACCESS ====================
|
|
459
|
+
/** Icons for navigation buttons */
|
|
460
|
+
iconChevronLeft = matChevronLeft;
|
|
461
|
+
iconChevronRight = matChevronRight;
|
|
187
462
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
188
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DatepickerComponent, isStandalone: true, selector: "st-datepicker", inputs: {
|
|
463
|
+
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 }, 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" }, providers: [
|
|
189
464
|
{
|
|
190
465
|
provide: NG_VALUE_ACCESSOR,
|
|
191
|
-
useExisting: DatepickerComponent,
|
|
466
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
192
467
|
multi: true,
|
|
193
468
|
},
|
|
194
|
-
], ngImport: i0, template: "
|
|
469
|
+
], 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 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<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t</button>\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<!-- Calendar -->\n\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\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<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\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</div>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<!-- Single Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\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</calendar-range>\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<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" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
195
470
|
}
|
|
196
471
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
197
472
|
type: Component,
|
|
198
|
-
args: [{ selector: 'st-datepicker', imports: [CommonModule,
|
|
473
|
+
args: [{ selector: 'st-datepicker', imports: [CommonModule, OverlayComponent, OverlayTriggerComponent, OverlayContentComponent, ButtonComponent, TranslatePipe], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'stDatepicker', providers: [
|
|
199
474
|
{
|
|
200
475
|
provide: NG_VALUE_ACCESSOR,
|
|
201
|
-
useExisting: DatepickerComponent,
|
|
476
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
202
477
|
multi: true,
|
|
203
478
|
},
|
|
204
|
-
], template: "
|
|
479
|
+
], 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 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<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\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{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t</button>\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<!-- Calendar -->\n\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\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<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\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</div>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<!-- Single Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\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</calendar-range>\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<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" }]
|
|
205
480
|
}], ctorParameters: () => [] });
|
|
206
481
|
|
|
207
482
|
/**
|
|
208
483
|
* Generated bundle index. Do not edit.
|
|
209
484
|
*/
|
|
210
485
|
|
|
211
|
-
export { DatepickerComponent,
|
|
486
|
+
export { DatepickerComponent, SUPPORTED_LOCALES };
|
|
212
487
|
//# sourceMappingURL=sixbell-telco-sdk-components-forms-datepicker.mjs.map
|