@odx/angular 12.14.1 → 12.15.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 +16 -0
- package/components/anchor-navigation/README.md +3 -0
- package/components/anchor-navigation/anchor-navigation.component.d.ts +31 -0
- package/components/anchor-navigation/anchor-navigation.module.d.ts +8 -0
- package/components/anchor-navigation/anchor-navigation.service.d.ts +43 -0
- package/components/anchor-navigation/components/anchor-navigation-item.component.d.ts +10 -0
- package/components/anchor-navigation/components/index.d.ts +1 -0
- package/components/anchor-navigation/index.d.ts +4 -0
- package/components/datepicker/lib/datepicker.component.d.ts +10 -0
- package/components/daterangepicker/lib/daterangepicker.component.d.ts +11 -0
- package/components/timepicker/lib/components/timepicker-option.component.d.ts +13 -1
- package/components/timepicker/lib/timepicker.component.d.ts +7 -0
- package/components/timepicker/lib/timepicker.service.d.ts +19 -11
- package/esm2022/components/anchor-navigation/anchor-navigation.component.mjs +60 -0
- package/esm2022/components/anchor-navigation/anchor-navigation.module.mjs +18 -0
- package/esm2022/components/anchor-navigation/anchor-navigation.service.mjs +119 -0
- package/esm2022/components/anchor-navigation/components/anchor-navigation-item.component.mjs +32 -0
- package/esm2022/components/anchor-navigation/components/index.mjs +2 -0
- package/esm2022/components/anchor-navigation/index.mjs +5 -0
- package/esm2022/components/anchor-navigation/odx-angular-components-anchor-navigation.mjs +5 -0
- package/esm2022/components/datepicker/lib/datepicker.component.mjs +19 -2
- package/esm2022/components/daterangepicker/lib/daterangepicker.component.mjs +27 -9
- package/esm2022/components/timepicker/lib/components/timepicker-option.component.mjs +14 -2
- package/esm2022/components/timepicker/lib/timepicker.component.mjs +15 -5
- package/esm2022/components/timepicker/lib/timepicker.service.mjs +35 -13
- package/fesm2022/odx-angular-components-anchor-navigation.mjs +220 -0
- package/fesm2022/odx-angular-components-anchor-navigation.mjs.map +1 -0
- package/fesm2022/odx-angular-components-datepicker.mjs +18 -1
- package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-daterangepicker.mjs +27 -9
- package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-timepicker.mjs +61 -17
- package/fesm2022/odx-angular-components-timepicker.mjs.map +1 -1
- package/package.json +7 -1
|
@@ -13,7 +13,7 @@ export class TimepickerService {
|
|
|
13
13
|
/**
|
|
14
14
|
* Generates a placeholder string for time input fields.
|
|
15
15
|
*
|
|
16
|
-
* @param {boolean} apm - Specifies if the placeholder should include AM/PM notation.
|
|
16
|
+
* @param {boolean} [apm=false] - Specifies if the placeholder should include AM/PM notation.
|
|
17
17
|
* @returns {string} The placeholder string.
|
|
18
18
|
*/
|
|
19
19
|
getPlaceholder(apm = false) {
|
|
@@ -24,18 +24,32 @@ export class TimepickerService {
|
|
|
24
24
|
*
|
|
25
25
|
* @param {string} time - The time to validate.
|
|
26
26
|
* @param {string} max - The maximum allowable time.
|
|
27
|
-
* @returns {boolean} True if the time is valid, false otherwise.
|
|
27
|
+
* @returns {boolean} True if the time is valid (i.e., not after max), false otherwise.
|
|
28
28
|
*/
|
|
29
29
|
maxValidation(time, max) {
|
|
30
30
|
const [targetValue, maxValue] = this.convertToDates([time, max]);
|
|
31
31
|
return isBefore(targetValue, maxValue) || isEqual(targetValue, maxValue);
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the provided value is a valid time string in HH:mm or HH:mm AM/PM format.
|
|
35
|
+
* This method also acts as a type guard.
|
|
36
|
+
*
|
|
37
|
+
* @param {unknown} time - The value to validate.
|
|
38
|
+
* @returns {time is string} True if the value is a valid time string, false otherwise.
|
|
39
|
+
*/
|
|
40
|
+
isValidTime(time) {
|
|
41
|
+
if (!time || typeof time !== 'string')
|
|
42
|
+
return false;
|
|
43
|
+
// Matches "HH:mm" (24h) or "HH:mm AM/PM" (12h)
|
|
44
|
+
const regex = /^([01]\d|2[0-3]):([0-5]\d)(\s?(AM|PM|am|pm))?$/;
|
|
45
|
+
return regex.test(time.trim());
|
|
46
|
+
}
|
|
33
47
|
/**
|
|
34
48
|
* Validates if the given time is greater than or equal to a minimum time constraint.
|
|
35
49
|
*
|
|
36
50
|
* @param {string} time - The time to validate.
|
|
37
51
|
* @param {string} min - The minimum allowable time.
|
|
38
|
-
* @returns {boolean} True if the time is valid, false otherwise.
|
|
52
|
+
* @returns {boolean} True if the time is valid (i.e., not before min), false otherwise.
|
|
39
53
|
*/
|
|
40
54
|
minValidation(time, min) {
|
|
41
55
|
const [targetValue, minValue] = this.convertToDates([time, min]);
|
|
@@ -44,26 +58,34 @@ export class TimepickerService {
|
|
|
44
58
|
/**
|
|
45
59
|
* Finds the closest time to a target time from a list of times.
|
|
46
60
|
*
|
|
47
|
-
* @param {string[]} timeStamps - The list of
|
|
48
|
-
* @param {string} targetTime - The target time to find the closest match for.
|
|
49
|
-
* @returns {string} The closest time to the target.
|
|
61
|
+
* @param {string[]} timeStamps - The list of time strings to search through (e.g., ["10:00", "10:30", "11:00"]).
|
|
62
|
+
* @param {string} targetTime - The target time string to find the closest match for (e.g., "10:35").
|
|
63
|
+
* @returns {string} The closest time string from the list to the target, formatted according to locale.
|
|
50
64
|
*/
|
|
51
65
|
findClosestDate(timeStamps, targetTime) {
|
|
52
66
|
const [target] = this.convertToDates([targetTime]);
|
|
53
67
|
const datesArray = this.convertToDates(timeStamps);
|
|
68
|
+
if (datesArray.length === 0)
|
|
69
|
+
return this.getLocalizedTimeFormat(targetTime);
|
|
54
70
|
const closestDate = datesArray.reduce((prev, curr) => {
|
|
55
|
-
|
|
71
|
+
const prevDiff = Math.abs(prev.getTime() - target.getTime());
|
|
72
|
+
const currDiff = Math.abs(curr.getTime() - target.getTime());
|
|
73
|
+
return currDiff < prevDiff ? curr : prev;
|
|
56
74
|
});
|
|
57
|
-
|
|
75
|
+
const hours = closestDate.getHours().toString().padStart(2, '0');
|
|
76
|
+
const minutes = closestDate.getMinutes().toString().padStart(2, '0');
|
|
77
|
+
return this.getLocalizedTimeFormat(`${hours}:${minutes}`);
|
|
58
78
|
}
|
|
59
79
|
/**
|
|
60
|
-
* Formats a time string to a localized time format.
|
|
80
|
+
* Formats a time string to a localized time format using Intl.DateTimeFormat.
|
|
61
81
|
*
|
|
62
|
-
* @param {
|
|
63
|
-
* @param {boolean} hour12 - Specifies if the output should use 12-hour format with AM/PM notation.
|
|
64
|
-
* @returns {string} The formatted time string.
|
|
82
|
+
* @param {unknown} time - The time string to format (e.g., "14:30").
|
|
83
|
+
* @param {boolean} [hour12=false] - Specifies if the output should use 12-hour format with AM/PM notation.
|
|
84
|
+
* @returns {string} The formatted time string, or an empty string if the input time is invalid.
|
|
65
85
|
*/
|
|
66
86
|
getLocalizedTimeFormat(time, hour12 = false) {
|
|
87
|
+
if (!this.isValidTime(time))
|
|
88
|
+
return '';
|
|
67
89
|
const locale = hour12 ? 'en-US' : 'en-GB';
|
|
68
90
|
const [date] = this.convertToDates([time]);
|
|
69
91
|
return new this.windowRef.nativeWindow.Intl.DateTimeFormat(locale, {
|
|
@@ -82,4 +104,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
82
104
|
type: Injectable,
|
|
83
105
|
args: [{ providedIn: 'root' }]
|
|
84
106
|
}] });
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
107
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZXBpY2tlci5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9hbmd1bGFyL2NvbXBvbmVudHMvdGltZXBpY2tlci9zcmMvbGliL3RpbWVwaWNrZXIuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQU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|
3
|
+
import { inject, computed, signal, effect, Injectable, input, Component, ViewEncapsulation, ChangeDetectionStrategy, contentChildren, booleanAttribute, NgModule } from '@angular/core';
|
|
4
|
+
import { CSSComponent } from '@odx/angular/internal';
|
|
5
|
+
import { injectElement } from '@odx/angular/utils';
|
|
6
|
+
import { WindowRef } from '@odx/angular';
|
|
7
|
+
import { LinkDirective } from '@odx/angular/components/link';
|
|
8
|
+
|
|
9
|
+
class AnchorNavigationService {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.windowRef = inject(WindowRef);
|
|
12
|
+
this.intersectionStates = new Map();
|
|
13
|
+
this.targetScrollSections = computed(() => this.findTargetScrollSections());
|
|
14
|
+
/**
|
|
15
|
+
* A WritableSignal holding the scrollable container element or document.
|
|
16
|
+
* This is set by the AnchorNavigationComponent.
|
|
17
|
+
* Defaults to the window's document.
|
|
18
|
+
*/
|
|
19
|
+
this.scrollableContainer = signal(this.windowRef.document);
|
|
20
|
+
/**
|
|
21
|
+
* A WritableSignal holding an array of `AnchorLinkDirective` instances.
|
|
22
|
+
* These are the links managed by the service, typically set by the `AnchorNavigationComponent`
|
|
23
|
+
* based on its projected content.
|
|
24
|
+
*/
|
|
25
|
+
this.projectedAnchorLinks = signal([]);
|
|
26
|
+
/**
|
|
27
|
+
* A readonly Signal indicating the currently active AnchorLinkDirective.
|
|
28
|
+
* This is updated by the service based on scroll position and intersection.
|
|
29
|
+
*/
|
|
30
|
+
this.activeAnchorLink = signal(null);
|
|
31
|
+
effect((onCleanup) => {
|
|
32
|
+
const currentRoot = this.scrollableContainer();
|
|
33
|
+
const currentLinks = this.projectedAnchorLinks();
|
|
34
|
+
if (!currentLinks.length) {
|
|
35
|
+
this.disconnectObserver();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.initIntersectionObserver(currentRoot);
|
|
39
|
+
this.updateObservedElements();
|
|
40
|
+
onCleanup(() => {
|
|
41
|
+
this.disconnectObserver();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
ngOnDestroy() {
|
|
46
|
+
this.disconnectObserver();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Scrolls the view to the section associated with the given `AnchorLinkDirective`
|
|
50
|
+
* and sets it as the active link.
|
|
51
|
+
*
|
|
52
|
+
* @param anchor The `AnchorLinkDirective` instance representing the target anchor/section.
|
|
53
|
+
* If null or if the anchor's ID is not found, a warning is logged and the method returns.
|
|
54
|
+
*/
|
|
55
|
+
scrollToAnchor(anchor) {
|
|
56
|
+
const anchorId = anchor?.href();
|
|
57
|
+
if (!anchorId) {
|
|
58
|
+
console.warn(`[AnchorNavigationService] Attempted to scroll to an anchor without an ID.`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const anchorElement = this.scrollableContainer().querySelector(`#${CSS.escape(anchorId)}`);
|
|
62
|
+
if (!anchorElement) {
|
|
63
|
+
console.warn(`[AnchorNavigationService] Anchor with ID "${anchorId}" not found in the root container.`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
anchorElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
67
|
+
}
|
|
68
|
+
initIntersectionObserver(root) {
|
|
69
|
+
if (this.intersectionObserver) {
|
|
70
|
+
this.intersectionObserver.disconnect();
|
|
71
|
+
}
|
|
72
|
+
this.intersectionObserver = new IntersectionObserver((entries) => this.onIntersectionUpdate(entries), {
|
|
73
|
+
root: root === this.windowRef.document ? null : root,
|
|
74
|
+
threshold: 0.1,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
updateObservedElements() {
|
|
78
|
+
if (!this.intersectionObserver)
|
|
79
|
+
return;
|
|
80
|
+
this.intersectionObserver.disconnect();
|
|
81
|
+
this.intersectionStates.clear();
|
|
82
|
+
const sections = this.targetScrollSections();
|
|
83
|
+
sections.forEach((section) => {
|
|
84
|
+
if (section) {
|
|
85
|
+
this.intersectionStates.set(section, false);
|
|
86
|
+
this.intersectionObserver.observe(section);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
onIntersectionUpdate(entries) {
|
|
91
|
+
entries.forEach((entry) => this.intersectionStates.set(entry.target, entry.isIntersecting));
|
|
92
|
+
let newActiveCandidate = null;
|
|
93
|
+
const currentSections = this.targetScrollSections();
|
|
94
|
+
for (const section of currentSections) {
|
|
95
|
+
if (this.intersectionStates.get(section) === true) {
|
|
96
|
+
newActiveCandidate = this.projectedAnchorLinks().find((link) => link.href() === section.id) || null;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (this.activeAnchorLink() !== newActiveCandidate)
|
|
101
|
+
this.activeAnchorLink.set(newActiveCandidate);
|
|
102
|
+
}
|
|
103
|
+
findTargetScrollSections() {
|
|
104
|
+
const currentLinks = this.projectedAnchorLinks();
|
|
105
|
+
if (!currentLinks.length)
|
|
106
|
+
return [];
|
|
107
|
+
const selectors = currentLinks
|
|
108
|
+
.map((link) => link.href())
|
|
109
|
+
.filter(Boolean)
|
|
110
|
+
.map((id) => `#${CSS.escape(id)}`)
|
|
111
|
+
.join(',');
|
|
112
|
+
return selectors ? Array.from(this.scrollableContainer().querySelectorAll(selectors)) : [];
|
|
113
|
+
}
|
|
114
|
+
disconnectObserver() {
|
|
115
|
+
this.intersectionObserver?.disconnect();
|
|
116
|
+
this.intersectionObserver = undefined;
|
|
117
|
+
}
|
|
118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
119
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationService }); }
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationService, decorators: [{
|
|
122
|
+
type: Injectable
|
|
123
|
+
}], ctorParameters: () => [] });
|
|
124
|
+
|
|
125
|
+
let AnchorNavigationItemComponent = class AnchorNavigationItemComponent {
|
|
126
|
+
constructor() {
|
|
127
|
+
this.navigationService = inject(AnchorNavigationService);
|
|
128
|
+
this.element = injectElement();
|
|
129
|
+
this.href = input.required();
|
|
130
|
+
this.isActive = computed(() => this.navigationService.activeAnchorLink() === this);
|
|
131
|
+
}
|
|
132
|
+
handleClick(e) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
this.navigationService.scrollToAnchor(this);
|
|
135
|
+
}
|
|
136
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
137
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AnchorNavigationItemComponent, isStandalone: true, selector: "odx-anchor-navigation-item", inputs: { href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.is-active": "isActive()" } }, ngImport: i0, template: "<a odxLink [href]=\"'#' + href()\" (click)=\"handleClick($event)\" (keydown.space)=\"handleClick($event)\" [attr.aria-current]=\"isActive() ? 'page' : null\">\n <ng-content />\n</a>\n", dependencies: [{ kind: "directive", type: LinkDirective, selector: "a[odxLink]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
138
|
+
};
|
|
139
|
+
AnchorNavigationItemComponent = __decorate([
|
|
140
|
+
CSSComponent('anchor-navigation-item')
|
|
141
|
+
], AnchorNavigationItemComponent);
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationItemComponent, decorators: [{
|
|
143
|
+
type: Component,
|
|
144
|
+
args: [{ selector: 'odx-anchor-navigation-item', standalone: true, imports: [LinkDirective], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
145
|
+
'[class.is-active]': 'isActive()',
|
|
146
|
+
}, template: "<a odxLink [href]=\"'#' + href()\" (click)=\"handleClick($event)\" (keydown.space)=\"handleClick($event)\" [attr.aria-current]=\"isActive() ? 'page' : null\">\n <ng-content />\n</a>\n" }]
|
|
147
|
+
}] });
|
|
148
|
+
|
|
149
|
+
let AnchorNavigationComponent = class AnchorNavigationComponent {
|
|
150
|
+
constructor() {
|
|
151
|
+
this.service = inject(AnchorNavigationService);
|
|
152
|
+
this.element = injectElement();
|
|
153
|
+
/**
|
|
154
|
+
* A Signal with list of `AnchorLinkDirective` instances projected into this component.
|
|
155
|
+
* These are the anchor links that this navigation component will manage.
|
|
156
|
+
*/
|
|
157
|
+
this.projectedAnchorLinks = contentChildren(AnchorNavigationItemComponent);
|
|
158
|
+
/**
|
|
159
|
+
* Input to determine if the anchor navigation should be displayed vertically.
|
|
160
|
+
* Defaults to `false` (horizontal).
|
|
161
|
+
*/
|
|
162
|
+
this.vertical = input(false, { transform: booleanAttribute });
|
|
163
|
+
/**
|
|
164
|
+
* Input to specify the scrollable container element or document whose scroll position
|
|
165
|
+
* is used to determine the active anchor link. If not provided, defaults to the
|
|
166
|
+
* `document` of the current window.
|
|
167
|
+
*/
|
|
168
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
169
|
+
this.scrollableContainer = input(undefined, { alias: 'root' });
|
|
170
|
+
this.activeAnchorLink = this.service.activeAnchorLink;
|
|
171
|
+
effect(() => {
|
|
172
|
+
this.service.projectedAnchorLinks.set(this.projectedAnchorLinks());
|
|
173
|
+
const rcInput = this.scrollableContainer();
|
|
174
|
+
if (rcInput !== undefined) {
|
|
175
|
+
this.service.scrollableContainer.set(rcInput);
|
|
176
|
+
}
|
|
177
|
+
}, { allowSignalWrites: true });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Scrolls the view to the section associated with the given `AnchorLinkDirective`.
|
|
181
|
+
* @param anchor The `AnchorLinkDirective` instance representing the target anchor/section.
|
|
182
|
+
*/
|
|
183
|
+
scrollToAnchor(anchor) {
|
|
184
|
+
this.service.scrollToAnchor(anchor);
|
|
185
|
+
}
|
|
186
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
187
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.13", type: AnchorNavigationComponent, isStandalone: true, selector: "odx-anchor-navigation", inputs: { vertical: { classPropertyName: "vertical", publicName: "vertical", isSignal: true, isRequired: false, transformFunction: null }, scrollableContainer: { classPropertyName: "scrollableContainer", publicName: "root", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.odx-anchor-navigation--vertical": "vertical()", "attr.role": "\"navigation\"" } }, providers: [AnchorNavigationService], queries: [{ propertyName: "projectedAnchorLinks", predicate: AnchorNavigationItemComponent, isSignal: true }], ngImport: i0, template: "<ng-content select=\"odx-anchor-navigation-item\" />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
188
|
+
};
|
|
189
|
+
AnchorNavigationComponent = __decorate([
|
|
190
|
+
CSSComponent('anchor-navigation'),
|
|
191
|
+
__metadata("design:paramtypes", [])
|
|
192
|
+
], AnchorNavigationComponent);
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationComponent, decorators: [{
|
|
194
|
+
type: Component,
|
|
195
|
+
args: [{ selector: 'odx-anchor-navigation', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, encapsulation: ViewEncapsulation.None, providers: [AnchorNavigationService], host: {
|
|
196
|
+
'[class.odx-anchor-navigation--vertical]': 'vertical()',
|
|
197
|
+
'[attr.role]': '"navigation"',
|
|
198
|
+
}, template: "<ng-content select=\"odx-anchor-navigation-item\" />\n" }]
|
|
199
|
+
}], ctorParameters: () => [] });
|
|
200
|
+
|
|
201
|
+
const modules = [AnchorNavigationComponent, AnchorNavigationItemComponent];
|
|
202
|
+
class AnchorNavigationModule {
|
|
203
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
204
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationModule, imports: [AnchorNavigationComponent, AnchorNavigationItemComponent], exports: [AnchorNavigationComponent, AnchorNavigationItemComponent] }); }
|
|
205
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationModule }); }
|
|
206
|
+
}
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AnchorNavigationModule, decorators: [{
|
|
208
|
+
type: NgModule,
|
|
209
|
+
args: [{
|
|
210
|
+
imports: modules,
|
|
211
|
+
exports: modules,
|
|
212
|
+
}]
|
|
213
|
+
}] });
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Generated bundle index. Do not edit.
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
export { AnchorNavigationComponent, AnchorNavigationItemComponent, AnchorNavigationModule, AnchorNavigationService };
|
|
220
|
+
//# sourceMappingURL=odx-angular-components-anchor-navigation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odx-angular-components-anchor-navigation.mjs","sources":["../../../../libs/angular/components/anchor-navigation/src/anchor-navigation.service.ts","../../../../libs/angular/components/anchor-navigation/src/components/anchor-navigation-item.component.ts","../../../../libs/angular/components/anchor-navigation/src/components/anchor-navigation-item.component.html","../../../../libs/angular/components/anchor-navigation/src/anchor-navigation.component.ts","../../../../libs/angular/components/anchor-navigation/src/anchor-navigation.component.html","../../../../libs/angular/components/anchor-navigation/src/anchor-navigation.module.ts","../../../../libs/angular/components/anchor-navigation/src/odx-angular-components-anchor-navigation.ts"],"sourcesContent":["import { computed, effect, inject, Injectable, OnDestroy, signal, WritableSignal } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { AnchorNavigationItemComponent } from './components/anchor-navigation-item.component';\n\n@Injectable()\nexport class AnchorNavigationService implements OnDestroy {\n private readonly windowRef = inject(WindowRef);\n private intersectionObserver?: IntersectionObserver;\n private readonly intersectionStates = new Map<Element, boolean>();\n\n private readonly targetScrollSections = computed<HTMLElement[]>(() => this.findTargetScrollSections());\n\n /**\n * A WritableSignal holding the scrollable container element or document.\n * This is set by the AnchorNavigationComponent.\n * Defaults to the window's document.\n */\n public scrollableContainer: WritableSignal<HTMLElement | Document> = signal(this.windowRef.document);\n\n /**\n * A WritableSignal holding an array of `AnchorLinkDirective` instances.\n * These are the links managed by the service, typically set by the `AnchorNavigationComponent`\n * based on its projected content.\n */\n public projectedAnchorLinks: WritableSignal<readonly AnchorNavigationItemComponent[]> = signal([]);\n\n /**\n * A readonly Signal indicating the currently active AnchorLinkDirective.\n * This is updated by the service based on scroll position and intersection.\n */\n public readonly activeAnchorLink = signal<AnchorNavigationItemComponent | null>(null);\n\n constructor() {\n effect((onCleanup) => {\n const currentRoot = this.scrollableContainer();\n const currentLinks = this.projectedAnchorLinks();\n\n if (!currentLinks.length) {\n this.disconnectObserver();\n return;\n }\n\n this.initIntersectionObserver(currentRoot);\n this.updateObservedElements();\n\n onCleanup(() => {\n this.disconnectObserver();\n });\n });\n }\n\n public ngOnDestroy(): void {\n this.disconnectObserver();\n }\n\n /**\n * Scrolls the view to the section associated with the given `AnchorLinkDirective`\n * and sets it as the active link.\n *\n * @param anchor The `AnchorLinkDirective` instance representing the target anchor/section.\n * If null or if the anchor's ID is not found, a warning is logged and the method returns.\n */\n public scrollToAnchor(anchor: AnchorNavigationItemComponent | null): void {\n const anchorId = anchor?.href();\n if (!anchorId) {\n console.warn(`[AnchorNavigationService] Attempted to scroll to an anchor without an ID.`);\n return;\n }\n const anchorElement = this.scrollableContainer().querySelector(`#${CSS.escape(anchorId)}`) as HTMLElement | null;\n\n if (!anchorElement) {\n console.warn(`[AnchorNavigationService] Anchor with ID \"${anchorId}\" not found in the root container.`);\n return;\n }\n\n anchorElement.scrollIntoView({ behavior: 'smooth', block: 'start' });\n }\n\n private initIntersectionObserver(root: HTMLElement | Document): void {\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n }\n this.intersectionObserver = new IntersectionObserver((entries: IntersectionObserverEntry[]) => this.onIntersectionUpdate(entries), {\n root: root === this.windowRef.document ? null : root,\n threshold: 0.1,\n });\n }\n\n private updateObservedElements(): void {\n if (!this.intersectionObserver) return;\n this.intersectionObserver.disconnect();\n this.intersectionStates.clear();\n\n const sections = this.targetScrollSections();\n sections.forEach((section) => {\n if (section) {\n this.intersectionStates.set(section, false);\n this.intersectionObserver!.observe(section);\n }\n });\n }\n\n private onIntersectionUpdate(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => this.intersectionStates.set(entry.target, entry.isIntersecting));\n\n let newActiveCandidate: AnchorNavigationItemComponent | null = null;\n const currentSections = this.targetScrollSections();\n for (const section of currentSections) {\n if (this.intersectionStates.get(section) === true) {\n newActiveCandidate = this.projectedAnchorLinks().find((link) => link.href() === section.id) || null;\n break;\n }\n }\n\n if (this.activeAnchorLink() !== newActiveCandidate) this.activeAnchorLink.set(newActiveCandidate);\n }\n\n private findTargetScrollSections(): HTMLElement[] {\n const currentLinks = this.projectedAnchorLinks();\n if (!currentLinks.length) return [];\n\n const selectors = currentLinks\n .map((link) => link.href())\n .filter(Boolean)\n .map((id) => `#${CSS.escape(id)}`)\n .join(',');\n return selectors ? Array.from(this.scrollableContainer().querySelectorAll<HTMLElement>(selectors)) : [];\n }\n\n private disconnectObserver(): void {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, ViewEncapsulation } from '@angular/core';\nimport { LinkDirective } from '@odx/angular/components/link';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { AnchorNavigationService } from '../anchor-navigation.service';\n\n@CSSComponent('anchor-navigation-item')\n@Component({\n selector: 'odx-anchor-navigation-item',\n templateUrl: './anchor-navigation-item.component.html',\n standalone: true,\n imports: [LinkDirective],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.is-active]': 'isActive()',\n },\n})\nexport class AnchorNavigationItemComponent {\n private readonly navigationService = inject(AnchorNavigationService);\n public readonly element = injectElement();\n\n public href = input.required<string>();\n public isActive = computed(() => this.navigationService.activeAnchorLink() === this);\n\n protected handleClick(e: Event): void {\n e.preventDefault();\n this.navigationService.scrollToAnchor(this);\n }\n}\n","<a odxLink [href]=\"'#' + href()\" (click)=\"handleClick($event)\" (keydown.space)=\"handleClick($event)\" [attr.aria-current]=\"isActive() ? 'page' : null\">\n <ng-content />\n</a>\n","import { booleanAttribute, ChangeDetectionStrategy, Component, contentChildren, effect, inject, input, ViewEncapsulation } from '@angular/core';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { AnchorNavigationService } from './anchor-navigation.service';\nimport { AnchorNavigationItemComponent } from './components';\n\n@CSSComponent('anchor-navigation')\n@Component({\n selector: 'odx-anchor-navigation',\n templateUrl: './anchor-navigation.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n encapsulation: ViewEncapsulation.None,\n providers: [AnchorNavigationService],\n host: {\n '[class.odx-anchor-navigation--vertical]': 'vertical()',\n '[attr.role]': '\"navigation\"',\n },\n})\nexport class AnchorNavigationComponent {\n private readonly service = inject(AnchorNavigationService);\n public readonly element = injectElement();\n\n /**\n * A Signal with list of `AnchorLinkDirective` instances projected into this component.\n * These are the anchor links that this navigation component will manage.\n */\n public readonly projectedAnchorLinks = contentChildren(AnchorNavigationItemComponent);\n\n /**\n * Input to determine if the anchor navigation should be displayed vertically.\n * Defaults to `false` (horizontal).\n */\n public vertical = input<boolean, boolean>(false, { transform: booleanAttribute });\n\n /**\n * Input to specify the scrollable container element or document whose scroll position\n * is used to determine the active anchor link. If not provided, defaults to the\n * `document` of the current window.\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n public scrollableContainer = input<HTMLElement | Document | undefined>(undefined, { alias: 'root' });\n\n public readonly activeAnchorLink = this.service.activeAnchorLink;\n\n constructor() {\n effect(\n () => {\n this.service.projectedAnchorLinks.set(this.projectedAnchorLinks());\n const rcInput = this.scrollableContainer();\n\n if (rcInput !== undefined) {\n this.service.scrollableContainer.set(rcInput);\n }\n },\n { allowSignalWrites: true },\n );\n }\n\n /**\n * Scrolls the view to the section associated with the given `AnchorLinkDirective`.\n * @param anchor The `AnchorLinkDirective` instance representing the target anchor/section.\n */\n public scrollToAnchor(anchor: AnchorNavigationItemComponent): void {\n this.service.scrollToAnchor(anchor);\n }\n}\n","<ng-content select=\"odx-anchor-navigation-item\" />\n","import { NgModule } from '@angular/core';\nimport { AnchorNavigationComponent } from './anchor-navigation.component';\nimport { AnchorNavigationItemComponent } from './components';\n\nconst modules = [AnchorNavigationComponent, AnchorNavigationItemComponent];\n\n@NgModule({\n imports: modules,\n exports: modules,\n})\nexport class AnchorNavigationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAKa,uBAAuB,CAAA;AA2BlC,IAAA,WAAA,GAAA;AA1BiB,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAE9B,QAAA,IAAA,CAAA,kBAAkB,GAAG,IAAI,GAAG,EAAoB,CAAC;QAEjD,IAAoB,CAAA,oBAAA,GAAG,QAAQ,CAAgB,MAAM,IAAI,CAA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
294
|
this.selectedChange.emit(value);
|
|
295
295
|
this.dropdown.close();
|
|
296
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Resets the datepicker's value to null.
|
|
299
|
+
*/
|
|
297
300
|
reset() {
|
|
298
301
|
this.updateInternalValue(null);
|
|
299
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* @internal
|
|
305
|
+
* Writes a new value to the element.
|
|
306
|
+
* Part of the ControlValueAccessor interface.
|
|
307
|
+
* @param {Date | null} value - The new value.
|
|
308
|
+
*/
|
|
309
|
+
writeValue(value) {
|
|
310
|
+
super.writeValue(value);
|
|
311
|
+
this.updateDateField(value);
|
|
312
|
+
}
|
|
300
313
|
updateInternalValue(value) {
|
|
301
314
|
this.updateValue(value);
|
|
302
315
|
this.updateDateField(value);
|
|
303
316
|
}
|
|
304
317
|
handleDateFieldChanges() {
|
|
305
|
-
this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() =>
|
|
318
|
+
this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => {
|
|
319
|
+
if (!this.dateField?.valueAsDate)
|
|
320
|
+
return;
|
|
321
|
+
this.updateValue(this.dateField?.valueAsDate ?? null);
|
|
322
|
+
});
|
|
306
323
|
}
|
|
307
324
|
handleDateFieldFocus() {
|
|
308
325
|
this.dateField?.focused.pipe(this.takeUntilDestroyed()).subscribe((isFocused) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-components-datepicker.mjs","sources":["../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-date-order.ts","../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.config.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-value-as-date.ts","../../../../libs/angular/components/datepicker/src/lib/directives/datepicker-input-control.directive.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.html","../../../../libs/angular/components/datepicker/src/lib/datepicker.module.ts","../../../../libs/angular/components/datepicker/src/odx-angular-components-datepicker.ts"],"sourcesContent":["export type DatepickerInputDateOrder = (typeof DatepickerInputDateOrder)[keyof typeof DatepickerInputDateOrder];\n\nexport const DatepickerInputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n","export type DatepickerInputPattern = typeof DatepickerInputFormat | typeof DatepickerInputMask;\n\nexport const DatepickerInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DatepickerInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { DatepickerInputDateOrder } from './models';\n\nexport interface DatepickerConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default DatepickerInputDateOrder.DMY\n */\n inputDateOrder: DatepickerInputDateOrder;\n /**\n * Single-character date's separator (dot, slash etc.).\n * @default '.'\n */\n inputDateSeparator: string;\n}\n\n/**\n * Tools for injecting and providing the datepicker configuration with default configuration for the datepicker.\n *\n * @example\n * // Providing custom datepicker configuration.\n * ```ts\n * @Component({\n * providers: [provideDatepickerConfig({ inputDateOrder: DatepickerInputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the datepicker configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDatepickerConfig()) private readonly datepickerConfig: DatepickerConfig) {}\n * }\n * ```\n */\nexport const { DatepickerConfig, DatepickerDefaultConfig, injectDatepickerConfig, provideDatepickerConfig } = createConfigTokens(\n 'Datepicker',\n '@odx/angular/components/datepicker',\n {\n inputDateOrder: DatepickerInputDateOrder.DMY,\n inputDateSeparator: '.',\n },\n);\n","import { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder, DatepickerInputFormat, DatepickerInputMask, DatepickerInputPattern } from '../models';\n\nfunction getDatepickerInputPattern({ inputDateOrder, inputDateSeparator }: DatepickerConfig, pattern: DatepickerInputPattern): string {\n const patternList: Record<DatepickerInputDateOrder, string> = {\n [DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDatepickerInputFormat(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputFormat);\n}\n\n/** @internal */\nexport function getDatepickerInputMask(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder } from '../models';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<DatepickerInputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [DatepickerInputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DatepickerConfig, value: string): string | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n const isDateCandidateInvalid = !month || !day || !year;\n\n return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;\n}\n\n/** @internal */\nexport function getDatepickerInputValueAsDate(config: DatepickerConfig, value: string): Date | null {\n const dateCandidate: string | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(Date.parse(dateCandidate));\n\n return isValid(date) ? date : null;\n}\n","import { Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskConfig, NgxMaskPipe, provideNgxMask } from 'ngx-mask';\nimport { distinctUntilChanged, fromEvent, map, tap } from 'rxjs';\nimport { injectDatepickerConfig } from '../datepicker.config';\nimport { getDatepickerInputFormat, getDatepickerInputMask, getDatepickerInputValueAsDate } from '../utils';\n\n/**\n * A directive to enhance an input element as part of a datepicker control. It applies date input formatting,\n * mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and\n * ensures that the input complies with the date format specified in the datepicker configuration.\n * Extends the `InputControlDirective` to provide input control functionality.\n * Has host directive `WithTabIndex` to manage the tabindex attribute of the input element.\n *\n * @see {InputControlDirective}\n * @see {WithTabIndex}\n */\n@CSSComponent('datepicker__control')\n@Directive({\n standalone: true,\n selector: 'input[odxDatepickerControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n '[attr.placeholder]': 'placeholder',\n },\n providers: [ReadonlyController.connect(), provideNgxMask(), NgxMaskPipe],\n hostDirectives: [WithTabIndex],\n})\nexport class DatepickerInputControlDirective extends InputControlDirective {\n private readonly maskConfig: Partial<NgxMaskConfig> = { validation: false, leadZeroDateTime: true };\n\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly config = injectDatepickerConfig();\n protected readonly inputMask = getDatepickerInputMask(this.config);\n protected readonly ngxMaskPipe = inject(NgxMaskPipe);\n\n /**\n * Emits an event when the input field receives focus or loses focus, indicating the focus state.\n *\n * @emits {boolean} - Indicates whether the input field is focused.\n */\n @Output()\n public focused = new EventEmitter<boolean>();\n\n /**\n * Observable stream capturing and processing input events on the native element, applying the mask,\n * and emitting the current value.\n *\n * @emits {string} - The current value of the input field.\n */\n public override valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n tap(() => this.applyMask()),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Applies the configured input mask to the native element's value.\n */\n public applyMask(): void {\n this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);\n }\n\n /**\n * Gets the current value of the input field as a `Date` object, based on the date format from the datepicker\n * configuration.\n *\n * @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.\n */\n public get valueAsDate(): Date | null {\n return getDatepickerInputValueAsDate(this.config, this.nativeElementValue);\n }\n\n /**\n * Computes the placeholder text for the input based on the date format from\n * the datepicker configuration.\n *\n * @returns {string} - The placeholder text, typically the date format in uppercase.\n */\n public get placeholder(): string {\n return getDatepickerInputFormat(this.config).toUpperCase();\n }\n\n @HostListener('focusin')\n protected handleFocusIn(): void {\n this.focused.emit(true);\n }\n\n @HostListener('focusout')\n protected handleFocusOut(): void {\n this.focused.emit(false);\n }\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n input,\n Input,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { CalendarComponent, DateFilter } from '@odx/angular/components/calendar';\nimport { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn, injectElement, Position, untilDestroyed } from '@odx/angular/utils';\nimport { format, startOfDay } from 'date-fns';\nimport { injectDatepickerConfig } from './datepicker.config';\nimport { DatepickerInputControlDirective } from './directives';\nimport { getDatepickerInputFormat } from './utils';\n\n/**\n * Represents a datepicker component for selecting a date.\n * Extends the `CustomFormControl` class and implements the `AfterViewInit` interface.\n *\n * @see {CustomFormControl}\n */\n@CSSComponent('datepicker')\n@Component({\n selector: 'odx-datepicker',\n standalone: true,\n imports: [A11yModule, ActionGroupComponent, ButtonComponent, CalendarComponent, DropdownModule, IconComponent],\n templateUrl: './datepicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class DatepickerComponent extends CustomFormControl<Date | null> implements AfterViewInit {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected readonly config = injectDatepickerConfig();\n\n public readonly element = injectElement();\n\n /**\n * Gets a value indicating whether the datepicker is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return !!this.dropdown.isOpen;\n }\n\n /**\n * Represents the current date.\n *\n * @type {Date}\n */\n public today = new Date();\n\n /**\n * The filter function used to determine if a date should be included or excluded in the datepicker.\n * If set to `null`, no filtering will be applied.\n *\n * @type {DateFilter | null}\n * @default null\n *\n * @example\n * ```ts\n * // Excludes mondays from the datepicker.\n * const filterFn: DateFilter = (date) => date.getDay() !== 1;\n * ```\n */\n @Input()\n public filterFn: DateFilter | null = null;\n\n /**\n * The minimum selectable date for the datepicker.\n * If set to null, there is no minimum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public minDate: Date | null = null;\n\n /**\n * The maximum selectable date for the datepicker.\n * If set to null, there is no maximum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public maxDate: Date | null = null;\n\n /**\n * The position of the dropdown relative to the input field.\n *\n * @type {Position}\n * @default Position.BOTTOM\n */\n @Input()\n public dropdownPosition: Position = 'bottom';\n\n /**\n * When set to true, the select will display a reset button.\n *\n * @type {boolean}\n * @default false\n */\n public clearable = input(false, { transform: booleanAttribute });\n\n /**\n * Emits the selected date when it changes.\n *\n * @emits {Date}\n */\n @Output()\n public selectedChange = new EventEmitter<Date>();\n\n /**\n * The dropdown directive used in the datepicker component.\n *\n * @type {DropdownDirective}\n */\n @ViewChild(DropdownDirective)\n public dropdown!: DropdownDirective;\n\n /**\n * The dropdown trigger element used in the datepicker component.\n *\n * @type {ElementRef<HTMLElement>}\n */\n @ViewChild('dropdownTrigger', { read: ElementRef, static: true })\n public dropdownTriggerElement!: ElementRef<HTMLElement>;\n\n /**\n * The date field input control directive used in the datepicker component.\n *\n * @type {DatepickerInputControlDirective | undefined}\n */\n @ContentChild(DatepickerInputControlDirective)\n public dateField?: DatepickerInputControlDirective;\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n this.handleDateFieldChanges();\n this.handleDateFieldFocus();\n\n deferFn(() => {\n if (!this.value) return;\n this.updateDateField(startOfDay(this.value));\n });\n }\n\n /**\n * Selects a date.\n *\n * @param {Date | null} value - The date value to be selected.\n */\n public selectDate(value: Date | null): void {\n if (!value) return;\n\n this.updateInternalValue(value);\n\n this.selectedChange.emit(value);\n\n this.dropdown.close();\n }\n\n public reset(): void {\n this.updateInternalValue(null);\n }\n\n protected updateInternalValue(value: Date | null): void {\n this.updateValue(value);\n this.updateDateField(value);\n }\n\n protected handleDateFieldChanges(): void {\n this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => this.updateValue(this.dateField?.valueAsDate ?? null));\n }\n\n protected handleDateFieldFocus(): void {\n this.dateField?.focused.pipe(this.takeUntilDestroyed()).subscribe((isFocused) => {\n if (!isFocused) {\n this.onTouched();\n }\n if (this.isOpen) {\n this.dropdown.close();\n }\n });\n }\n\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n protected openDatepicker(event: KeyboardEvent) {\n event.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\n }\n\n private updateDateField(date: Date | null): void {\n if (!this.dateField) return;\n\n const dateFormat = getDatepickerInputFormat(this.config);\n this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';\n }\n}\n","<ng-content select=\"input[odxDatepickerControl]\" />\n\n<odx-action-group class=\"odx-datepicker__trigger-wrapper\">\n @if (clearable() && value) {\n <button odxButton class=\"odx-datepicker__clear\" (click)=\"reset()\" size=\"small\" aria-label=\"Reset time\">\n <odx-icon name=\"close\" iconSet=\"core\" />\n </button>\n }\n <button\n #dropdownTrigger\n odxButton\n size=\"small\"\n variant=\"ghost\"\n class=\"odx-datepicker__trigger\"\n [odxDropdown]=\"calendarOverlay\"\n [odxDropdownOptions]=\"{ position: dropdownPosition }\"\n [odxDropdownTriggerElement]=\"dropdownTriggerElement.nativeElement\"\n [odxDropdownHost]=\"null\"\n [odxDropdownReferenceElement]=\"element.nativeElement\"\n (odxDropdownBeforeClose)=\"onTouched()\"\n >\n <odx-icon name=\"calendar\" />\n </button>\n <ng-content select=\"[odxButton]\" ngProjectAs=\"[odxButton]\" />\n</odx-action-group>\n\n<ng-template #calendarOverlay>\n <odx-calendar\n [selectedDate]=\"value || today\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n (selectedDateChange)=\"selectDate($event)\"\n />\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { DatepickerComponent } from './datepicker.component';\nimport { DatepickerInputControlDirective } from './directives';\n\nconst modules = [DatepickerComponent, DatepickerInputControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class DatepickerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEa,MAAA,wBAAwB,GAAG;AACtC,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IA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CAAA;;;AE1MnD,MAAM,OAAO,GAAG,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC;MAM1D,gBAAgB,CAAA;+GAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAhB,gBAAgB,EAAA,OAAA,EAAA,CANZ,mBAAmB,EAAE,+BAA+B,aAIzD,UAAU,EAJL,mBAAmB,EAAE,+BAA+B,CAAA,EAAA,CAAA,CAAA,EAAA;gHAMxD,gBAAgB,EAAA,OAAA,EAAA,CANZ,mBAAmB,EAIxB,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-components-datepicker.mjs","sources":["../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-date-order.ts","../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.config.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-value-as-date.ts","../../../../libs/angular/components/datepicker/src/lib/directives/datepicker-input-control.directive.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.html","../../../../libs/angular/components/datepicker/src/lib/datepicker.module.ts","../../../../libs/angular/components/datepicker/src/odx-angular-components-datepicker.ts"],"sourcesContent":["export type DatepickerInputDateOrder = (typeof DatepickerInputDateOrder)[keyof typeof DatepickerInputDateOrder];\n\nexport const DatepickerInputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n","export type DatepickerInputPattern = typeof DatepickerInputFormat | typeof DatepickerInputMask;\n\nexport const DatepickerInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DatepickerInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { DatepickerInputDateOrder } from './models';\n\nexport interface DatepickerConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default DatepickerInputDateOrder.DMY\n */\n inputDateOrder: DatepickerInputDateOrder;\n /**\n * Single-character date's separator (dot, slash etc.).\n * @default '.'\n */\n inputDateSeparator: string;\n}\n\n/**\n * Tools for injecting and providing the datepicker configuration with default configuration for the datepicker.\n *\n * @example\n * // Providing custom datepicker configuration.\n * ```ts\n * @Component({\n * providers: [provideDatepickerConfig({ inputDateOrder: DatepickerInputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the datepicker configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDatepickerConfig()) private readonly datepickerConfig: DatepickerConfig) {}\n * }\n * ```\n */\nexport const { DatepickerConfig, DatepickerDefaultConfig, injectDatepickerConfig, provideDatepickerConfig } = createConfigTokens(\n 'Datepicker',\n '@odx/angular/components/datepicker',\n {\n inputDateOrder: DatepickerInputDateOrder.DMY,\n inputDateSeparator: '.',\n },\n);\n","import { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder, DatepickerInputFormat, DatepickerInputMask, DatepickerInputPattern } from '../models';\n\nfunction getDatepickerInputPattern({ inputDateOrder, inputDateSeparator }: DatepickerConfig, pattern: DatepickerInputPattern): string {\n const patternList: Record<DatepickerInputDateOrder, string> = {\n [DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDatepickerInputFormat(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputFormat);\n}\n\n/** @internal */\nexport function getDatepickerInputMask(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder } from '../models';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<DatepickerInputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [DatepickerInputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DatepickerConfig, value: string): string | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n const isDateCandidateInvalid = !month || !day || !year;\n\n return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;\n}\n\n/** @internal */\nexport function getDatepickerInputValueAsDate(config: DatepickerConfig, value: string): Date | null {\n const dateCandidate: string | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(Date.parse(dateCandidate));\n\n return isValid(date) ? date : null;\n}\n","import { Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskConfig, NgxMaskPipe, provideNgxMask } from 'ngx-mask';\nimport { distinctUntilChanged, fromEvent, map, tap } from 'rxjs';\nimport { injectDatepickerConfig } from '../datepicker.config';\nimport { getDatepickerInputFormat, getDatepickerInputMask, getDatepickerInputValueAsDate } from '../utils';\n\n/**\n * A directive to enhance an input element as part of a datepicker control. It applies date input formatting,\n * mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and\n * ensures that the input complies with the date format specified in the datepicker configuration.\n * Extends the `InputControlDirective` to provide input control functionality.\n * Has host directive `WithTabIndex` to manage the tabindex attribute of the input element.\n *\n * @see {InputControlDirective}\n * @see {WithTabIndex}\n */\n@CSSComponent('datepicker__control')\n@Directive({\n standalone: true,\n selector: 'input[odxDatepickerControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n '[attr.placeholder]': 'placeholder',\n },\n providers: [ReadonlyController.connect(), provideNgxMask(), NgxMaskPipe],\n hostDirectives: [WithTabIndex],\n})\nexport class DatepickerInputControlDirective extends InputControlDirective {\n private readonly maskConfig: Partial<NgxMaskConfig> = { validation: false, leadZeroDateTime: true };\n\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly config = injectDatepickerConfig();\n protected readonly inputMask = getDatepickerInputMask(this.config);\n protected readonly ngxMaskPipe = inject(NgxMaskPipe);\n\n /**\n * Emits an event when the input field receives focus or loses focus, indicating the focus state.\n *\n * @emits {boolean} - Indicates whether the input field is focused.\n */\n @Output()\n public focused = new EventEmitter<boolean>();\n\n /**\n * Observable stream capturing and processing input events on the native element, applying the mask,\n * and emitting the current value.\n *\n * @emits {string} - The current value of the input field.\n */\n public override valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n tap(() => this.applyMask()),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Applies the configured input mask to the native element's value.\n */\n public applyMask(): void {\n this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);\n }\n\n /**\n * Gets the current value of the input field as a `Date` object, based on the date format from the datepicker\n * configuration.\n *\n * @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.\n */\n public get valueAsDate(): Date | null {\n return getDatepickerInputValueAsDate(this.config, this.nativeElementValue);\n }\n\n /**\n * Computes the placeholder text for the input based on the date format from\n * the datepicker configuration.\n *\n * @returns {string} - The placeholder text, typically the date format in uppercase.\n */\n public get placeholder(): string {\n return getDatepickerInputFormat(this.config).toUpperCase();\n }\n\n @HostListener('focusin')\n protected handleFocusIn(): void {\n this.focused.emit(true);\n }\n\n @HostListener('focusout')\n protected handleFocusOut(): void {\n this.focused.emit(false);\n }\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n input,\n Input,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { CalendarComponent, DateFilter } from '@odx/angular/components/calendar';\nimport { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn, injectElement, Position, untilDestroyed } from '@odx/angular/utils';\nimport { format, startOfDay } from 'date-fns';\nimport { injectDatepickerConfig } from './datepicker.config';\nimport { DatepickerInputControlDirective } from './directives';\nimport { getDatepickerInputFormat } from './utils';\n\n/**\n * Represents a datepicker component for selecting a date.\n * Extends the `CustomFormControl` class and implements the `AfterViewInit` interface.\n *\n * @see {CustomFormControl}\n */\n@CSSComponent('datepicker')\n@Component({\n selector: 'odx-datepicker',\n standalone: true,\n imports: [A11yModule, ActionGroupComponent, ButtonComponent, CalendarComponent, DropdownModule, IconComponent],\n templateUrl: './datepicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class DatepickerComponent extends CustomFormControl<Date | null> implements AfterViewInit {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected readonly config = injectDatepickerConfig();\n\n public readonly element = injectElement();\n\n /**\n * Gets a value indicating whether the datepicker is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return !!this.dropdown.isOpen;\n }\n\n /**\n * Represents the current date.\n *\n * @type {Date}\n */\n public today = new Date();\n\n /**\n * The filter function used to determine if a date should be included or excluded in the datepicker.\n * If set to `null`, no filtering will be applied.\n *\n * @type {DateFilter | null}\n * @default null\n *\n * @example\n * ```ts\n * // Excludes mondays from the datepicker.\n * const filterFn: DateFilter = (date) => date.getDay() !== 1;\n * ```\n */\n @Input()\n public filterFn: DateFilter | null = null;\n\n /**\n * The minimum selectable date for the datepicker.\n * If set to null, there is no minimum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public minDate: Date | null = null;\n\n /**\n * The maximum selectable date for the datepicker.\n * If set to null, there is no maximum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public maxDate: Date | null = null;\n\n /**\n * The position of the dropdown relative to the input field.\n *\n * @type {Position}\n * @default Position.BOTTOM\n */\n @Input()\n public dropdownPosition: Position = 'bottom';\n\n /**\n * When set to true, the select will display a reset button.\n *\n * @type {boolean}\n * @default false\n */\n public clearable = input(false, { transform: booleanAttribute });\n\n /**\n * Emits the selected date when it changes.\n *\n * @emits {Date}\n */\n @Output()\n public selectedChange = new EventEmitter<Date>();\n\n /**\n * The dropdown directive used in the datepicker component.\n *\n * @type {DropdownDirective}\n */\n @ViewChild(DropdownDirective)\n public dropdown!: DropdownDirective;\n\n /**\n * The dropdown trigger element used in the datepicker component.\n *\n * @type {ElementRef<HTMLElement>}\n */\n @ViewChild('dropdownTrigger', { read: ElementRef, static: true })\n public dropdownTriggerElement!: ElementRef<HTMLElement>;\n\n /**\n * The date field input control directive used in the datepicker component.\n *\n * @type {DatepickerInputControlDirective | undefined}\n */\n @ContentChild(DatepickerInputControlDirective)\n public dateField?: DatepickerInputControlDirective;\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n this.handleDateFieldChanges();\n this.handleDateFieldFocus();\n\n deferFn(() => {\n if (!this.value) return;\n this.updateDateField(startOfDay(this.value));\n });\n }\n\n /**\n * Selects a date.\n *\n * @param {Date | null} value - The date value to be selected.\n */\n public selectDate(value: Date | null): void {\n if (!value) return;\n\n this.updateInternalValue(value);\n\n this.selectedChange.emit(value);\n\n this.dropdown.close();\n }\n\n /**\n * Resets the datepicker's value to null.\n */\n public reset(): void {\n this.updateInternalValue(null);\n }\n\n /**\n * @internal\n * Writes a new value to the element.\n * Part of the ControlValueAccessor interface.\n * @param {Date | null} value - The new value.\n */\n public override writeValue(value: Date | null): void {\n super.writeValue(value);\n this.updateDateField(value);\n }\n\n protected updateInternalValue(value: Date | null): void {\n this.updateValue(value);\n this.updateDateField(value);\n }\n\n protected handleDateFieldChanges(): void {\n this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => {\n if (!this.dateField?.valueAsDate) return;\n this.updateValue(this.dateField?.valueAsDate ?? null);\n });\n }\n\n protected handleDateFieldFocus(): void {\n this.dateField?.focused.pipe(this.takeUntilDestroyed()).subscribe((isFocused) => {\n if (!isFocused) {\n this.onTouched();\n }\n if (this.isOpen) {\n this.dropdown.close();\n }\n });\n }\n\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n protected openDatepicker(event: KeyboardEvent) {\n event.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\n }\n\n private updateDateField(date: Date | null): void {\n if (!this.dateField) return;\n\n const dateFormat = getDatepickerInputFormat(this.config);\n this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';\n }\n}\n","<ng-content select=\"input[odxDatepickerControl]\" />\n\n<odx-action-group class=\"odx-datepicker__trigger-wrapper\">\n @if (clearable() && value) {\n <button odxButton class=\"odx-datepicker__clear\" (click)=\"reset()\" size=\"small\" aria-label=\"Reset time\">\n <odx-icon name=\"close\" iconSet=\"core\" />\n </button>\n }\n <button\n #dropdownTrigger\n odxButton\n size=\"small\"\n variant=\"ghost\"\n class=\"odx-datepicker__trigger\"\n [odxDropdown]=\"calendarOverlay\"\n [odxDropdownOptions]=\"{ position: dropdownPosition }\"\n [odxDropdownTriggerElement]=\"dropdownTriggerElement.nativeElement\"\n [odxDropdownHost]=\"null\"\n [odxDropdownReferenceElement]=\"element.nativeElement\"\n (odxDropdownBeforeClose)=\"onTouched()\"\n >\n <odx-icon name=\"calendar\" />\n </button>\n <ng-content select=\"[odxButton]\" ngProjectAs=\"[odxButton]\" />\n</odx-action-group>\n\n<ng-template #calendarOverlay>\n <odx-calendar\n [selectedDate]=\"value || today\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n (selectedDateChange)=\"selectDate($event)\"\n />\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { DatepickerComponent } from './datepicker.component';\nimport { DatepickerInputControlDirective } from './directives';\n\nconst modules = [DatepickerComponent, DatepickerInputControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class DatepickerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEa,MAAA,wBAAwB,GAAG;AACtC,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;;;ACHC,M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