@odx/angular 12.17.4 → 12.17.5
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 +6 -0
- package/cdk/date-input/README.md +3 -0
- package/cdk/date-input/index.d.ts +4 -0
- package/cdk/date-input/lib/date.config.d.ts +48 -0
- package/cdk/date-input/lib/models/input-date-order.d.ts +17 -0
- package/cdk/date-input/lib/utils/get-date-input-pattern.d.ts +5 -0
- package/cdk/date-input/lib/utils/get-input-value-as-date.d.ts +3 -0
- package/components/datepicker/index.d.ts +0 -1
- package/components/datepicker/lib/datepicker.config.d.ts +1 -48
- package/components/daterangepicker/index.d.ts +0 -1
- package/components/daterangepicker/lib/daterangepicker.config.d.ts +1 -48
- package/esm2022/cdk/date-input/index.mjs +5 -0
- package/esm2022/cdk/date-input/lib/date.config.mjs +26 -0
- package/esm2022/cdk/date-input/lib/models/input-date-order.mjs +16 -0
- package/esm2022/cdk/date-input/lib/utils/get-date-input-pattern.mjs +18 -0
- package/esm2022/cdk/date-input/lib/utils/get-input-value-as-date.mjs +38 -0
- package/esm2022/cdk/date-input/odx-angular-cdk-date-input.mjs +5 -0
- package/esm2022/components/datepicker/index.mjs +1 -2
- package/esm2022/components/datepicker/lib/datepicker.component.mjs +4 -5
- package/esm2022/components/datepicker/lib/datepicker.config.mjs +52 -26
- package/esm2022/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +6 -7
- package/esm2022/components/daterangepicker/index.mjs +1 -2
- package/esm2022/components/daterangepicker/lib/daterangepicker.component.mjs +5 -6
- package/esm2022/components/daterangepicker/lib/daterangepicker.config.mjs +52 -26
- package/esm2022/components/daterangepicker/lib/directives/daterangepicker-input-control.directive.mjs +6 -7
- package/esm2022/lib/models/index.mjs +1 -1
- package/fesm2022/odx-angular-cdk-date-input.mjs +102 -0
- package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -0
- package/fesm2022/odx-angular-components-datepicker.mjs +11 -96
- package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-daterangepicker.mjs +12 -82
- package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
- package/package.json +14 -8
- package/components/datepicker/lib/models/datepicker-input-date-order.d.ts +0 -6
- package/components/datepicker/lib/models/datepicker-input-pattern.d.ts +0 -11
- package/components/datepicker/lib/models/index.d.ts +0 -2
- package/components/datepicker/lib/utils/get-datepicker-input-pattern.d.ts +0 -5
- package/components/datepicker/lib/utils/get-datepicker-input-value-as-date.d.ts +0 -3
- package/components/datepicker/lib/utils/index.d.ts +0 -2
- package/components/daterangepicker/lib/models/daterangepicker-input-date-order.d.ts +0 -1
- package/components/daterangepicker/lib/models/daterangepicker-input-pattern.d.ts +0 -1
- package/components/daterangepicker/lib/models/index.d.ts +0 -2
- package/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.d.ts +0 -5
- package/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.d.ts +0 -3
- package/components/daterangepicker/lib/utils/index.d.ts +0 -2
- package/esm2022/components/datepicker/lib/models/datepicker-input-date-order.mjs +0 -6
- package/esm2022/components/datepicker/lib/models/datepicker-input-pattern.mjs +0 -11
- package/esm2022/components/datepicker/lib/models/index.mjs +0 -3
- package/esm2022/components/datepicker/lib/utils/get-datepicker-input-pattern.mjs +0 -18
- package/esm2022/components/datepicker/lib/utils/get-datepicker-input-value-as-date.mjs +0 -31
- package/esm2022/components/datepicker/lib/utils/index.mjs +0 -3
- package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-date-order.mjs +0 -2
- package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-pattern.mjs +0 -2
- package/esm2022/components/daterangepicker/lib/models/index.mjs +0 -3
- package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.mjs +0 -18
- package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.mjs +0 -31
- package/esm2022/components/daterangepicker/lib/utils/index.mjs +0 -3
|
@@ -6,6 +6,8 @@ import { inject, EventEmitter, Directive, Output, HostListener, input, booleanAt
|
|
|
6
6
|
import * as i1 from '@odx/angular';
|
|
7
7
|
import { ReadonlyController, WithTabIndex, detectControllerChanges, CoreModule } from '@odx/angular';
|
|
8
8
|
import { InputControlDirective, CustomFormControl } from '@odx/angular/cdk/custom-form-control';
|
|
9
|
+
import { injectDateConfig, getDateInputMask, getDateInputValueAsDate, getDateInputFormat } from '@odx/angular/cdk/date-input';
|
|
10
|
+
export { DateConfig as DatepickerConfig, DateDefaultConfig as DatepickerDefaultConfig, InputDateOrder as DatepickerInputDateOrder, DateInputFormat as DatepickerInputFormat, DateInputMask as DatepickerInputMask, getDateInputFormat as getDatepickerInputFormat, getDateInputMask as getDatepickerInputMask, getDateInputValueAsDate as getDatepickerInputValueAsDate, injectDateConfig as injectDatepickerDateConfig, provideDateConfig as provideDatepickerConfig } from '@odx/angular/cdk/date-input';
|
|
9
11
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
10
12
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
11
13
|
import { CalendarComponent } from '@odx/angular/components/calendar';
|
|
@@ -13,98 +15,11 @@ import * as i2 from '@odx/angular/components/dropdown';
|
|
|
13
15
|
import { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';
|
|
14
16
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
15
17
|
import { CSSComponent } from '@odx/angular/internal';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
+
import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
|
|
19
|
+
import { startOfDay, format } from 'date-fns';
|
|
18
20
|
import { NgxMaskPipe, provideNgxMask } from 'ngx-mask';
|
|
19
21
|
import { fromEvent, distinctUntilChanged, tap, map } from 'rxjs';
|
|
20
22
|
|
|
21
|
-
const DatepickerInputDateOrder = {
|
|
22
|
-
DMY: 'DMY',
|
|
23
|
-
MDY: 'MDY',
|
|
24
|
-
YMD: 'YMD',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const DatepickerInputFormat = {
|
|
28
|
-
DAYS: 'dd',
|
|
29
|
-
MONTH: 'MM',
|
|
30
|
-
YEAR: 'yyyy',
|
|
31
|
-
};
|
|
32
|
-
const DatepickerInputMask = {
|
|
33
|
-
DAYS: 'd0',
|
|
34
|
-
MONTH: 'M0',
|
|
35
|
-
YEAR: '0000',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Tools for injecting and providing the datepicker configuration with default configuration for the datepicker.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Providing custom datepicker configuration.
|
|
43
|
-
* ```ts
|
|
44
|
-
* @Component({
|
|
45
|
-
* providers: [provideDatepickerConfig({ inputDateOrder: DatepickerInputDateOrder.MDY, inputDateSeparator: '/'})]
|
|
46
|
-
* })
|
|
47
|
-
* export class MyComponent {}
|
|
48
|
-
*
|
|
49
|
-
* // Injecting the datepicker configuration.
|
|
50
|
-
* ```ts
|
|
51
|
-
* @Component({})
|
|
52
|
-
* export class MyComponent {
|
|
53
|
-
* constructor(@Inject(injectDatepickerConfig()) private readonly datepickerConfig: DatepickerConfig) {}
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
const { DatepickerConfig, DatepickerDefaultConfig, injectDatepickerConfig, provideDatepickerConfig } = createConfigTokens('Datepicker', '@odx/angular/components/datepicker', {
|
|
58
|
-
inputDateOrder: DatepickerInputDateOrder.DMY,
|
|
59
|
-
inputDateSeparator: '.',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
function getDatepickerInputPattern({ inputDateOrder, inputDateSeparator }, pattern) {
|
|
63
|
-
const patternList = {
|
|
64
|
-
[DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,
|
|
65
|
-
[DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,
|
|
66
|
-
[DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,
|
|
67
|
-
};
|
|
68
|
-
return patternList[inputDateOrder];
|
|
69
|
-
}
|
|
70
|
-
/** @internal */
|
|
71
|
-
function getDatepickerInputFormat(config) {
|
|
72
|
-
return getDatepickerInputPattern(config, DatepickerInputFormat);
|
|
73
|
-
}
|
|
74
|
-
/** @internal */
|
|
75
|
-
function getDatepickerInputMask(config) {
|
|
76
|
-
return getDatepickerInputPattern(config, DatepickerInputMask);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const functionList = {
|
|
80
|
-
[DatepickerInputDateOrder.DMY]: (splittedValue) => {
|
|
81
|
-
const [day, month, year] = splittedValue;
|
|
82
|
-
return { month, day, year };
|
|
83
|
-
},
|
|
84
|
-
[DatepickerInputDateOrder.MDY]: (splittedValue) => {
|
|
85
|
-
const [month, day, year] = splittedValue;
|
|
86
|
-
return { month, day, year };
|
|
87
|
-
},
|
|
88
|
-
[DatepickerInputDateOrder.YMD]: (splittedValue) => {
|
|
89
|
-
const [year, month, day] = splittedValue;
|
|
90
|
-
return { month, day, year };
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
function getDateCandidate({ inputDateOrder, inputDateSeparator }, value) {
|
|
94
|
-
const splittedValue = value.split(inputDateSeparator);
|
|
95
|
-
const { month, day, year } = functionList[inputDateOrder](splittedValue);
|
|
96
|
-
const isDateCandidateInvalid = !month || !day || !year;
|
|
97
|
-
return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;
|
|
98
|
-
}
|
|
99
|
-
/** @internal */
|
|
100
|
-
function getDatepickerInputValueAsDate(config, value) {
|
|
101
|
-
const dateCandidate = getDateCandidate(config, value);
|
|
102
|
-
if (!dateCandidate)
|
|
103
|
-
return null;
|
|
104
|
-
const date = toDate(Date.parse(dateCandidate));
|
|
105
|
-
return isValid(date) ? date : null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
23
|
/**
|
|
109
24
|
* A directive to enhance an input element as part of a datepicker control. It applies date input formatting,
|
|
110
25
|
* mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and
|
|
@@ -120,8 +35,8 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
120
35
|
super(...arguments);
|
|
121
36
|
this.maskConfig = { validation: false, leadZeroDateTime: true };
|
|
122
37
|
this.readonlyController = ReadonlyController.inject();
|
|
123
|
-
this.config =
|
|
124
|
-
this.inputMask =
|
|
38
|
+
this.config = injectDateConfig();
|
|
39
|
+
this.inputMask = getDateInputMask(this.config);
|
|
125
40
|
this.ngxMaskPipe = inject(NgxMaskPipe);
|
|
126
41
|
/**
|
|
127
42
|
* Emits an event when the input field receives focus or loses focus, indicating the focus state.
|
|
@@ -150,7 +65,7 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
150
65
|
* @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.
|
|
151
66
|
*/
|
|
152
67
|
get valueAsDate() {
|
|
153
|
-
return
|
|
68
|
+
return getDateInputValueAsDate(this.config, this.nativeElementValue);
|
|
154
69
|
}
|
|
155
70
|
/**
|
|
156
71
|
* Computes the placeholder text for the input based on the date format from
|
|
@@ -159,7 +74,7 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
159
74
|
* @returns {string} - The placeholder text, typically the date format in uppercase.
|
|
160
75
|
*/
|
|
161
76
|
get placeholder() {
|
|
162
|
-
return
|
|
77
|
+
return getDateInputFormat(this.config).toUpperCase();
|
|
163
78
|
}
|
|
164
79
|
handleFocusIn() {
|
|
165
80
|
this.focused.emit(true);
|
|
@@ -213,7 +128,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
213
128
|
constructor() {
|
|
214
129
|
super(null);
|
|
215
130
|
this.takeUntilDestroyed = untilDestroyed();
|
|
216
|
-
this.config =
|
|
131
|
+
this.config = injectDateConfig();
|
|
217
132
|
this.element = injectElement();
|
|
218
133
|
/**
|
|
219
134
|
* Represents the current date.
|
|
@@ -340,7 +255,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
340
255
|
updateDateField(date) {
|
|
341
256
|
if (!this.dateField)
|
|
342
257
|
return;
|
|
343
|
-
const dateFormat =
|
|
258
|
+
const dateFormat = getDateInputFormat(this.config);
|
|
344
259
|
this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';
|
|
345
260
|
}
|
|
346
261
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -395,5 +310,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
395
310
|
* Generated bundle index. Do not edit.
|
|
396
311
|
*/
|
|
397
312
|
|
|
398
|
-
export { DatepickerComponent,
|
|
313
|
+
export { DatepickerComponent, DatepickerInputControlDirective, DatepickerModule };
|
|
399
314
|
//# sourceMappingURL=odx-angular-components-datepicker.mjs.map
|
|
@@ -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 /**\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,wBA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EAAA,CAAA;sBADpB,MAAM;gBASA,QAAQ,EAAA,CAAA;sBADd,SAAS;uBAAC,iBAAiB,CAAA;gBASrB,sBAAsB,EAAA,CAAA;sBAD5B,SAAS;uBAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;gBASzD,SAAS,EAAA,CAAA;sBADf,YAAY;uBAAC,+BAA+B,CAAA;gBA2EnC,cAAc,EAAA,CAAA;sBADvB,YAAY;uBAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAA;;;AE3NnD,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/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":["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 { getDateInputFormat, getDateInputMask, getDateInputValueAsDate, injectDateConfig } from '@odx/angular/cdk/date-input';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskConfig, NgxMaskPipe, provideNgxMask } from 'ngx-mask';\nimport { distinctUntilChanged, fromEvent, map, tap } from 'rxjs';\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 = injectDateConfig();\n protected readonly inputMask = getDateInputMask(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 getDateInputValueAsDate(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 getDateInputFormat(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 { getDateInputFormat, injectDateConfig } from '@odx/angular/cdk/date-input';\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 { DatepickerInputControlDirective } from './directives';\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 = injectDateConfig();\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 = getDateInputFormat(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":";;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;AASG;AAYI,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,qBAAqB,CAAA;AAAnE,IAA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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;;;;"}
|
|
@@ -6,6 +6,8 @@ import { inject, EventEmitter, Directive, Output, HostListener, input, booleanAt
|
|
|
6
6
|
import * as i1 from '@odx/angular';
|
|
7
7
|
import { ReadonlyController, WithTabIndex, detectControllerChanges, CoreModule } from '@odx/angular';
|
|
8
8
|
import { InputControlDirective, CustomFormControl } from '@odx/angular/cdk/custom-form-control';
|
|
9
|
+
import { injectDateConfig, getDateInputMask, getDateInputValueAsDate, getDateInputFormat } from '@odx/angular/cdk/date-input';
|
|
10
|
+
export { DateConfig as DaterangepickerConfig, DateDefaultConfig as DaterangepickerDefaultConfig, InputDateOrder as DaterangepickerInputDateOrder, DateInputFormat as DaterangepickerInputFormat, DateInputMask as DaterangepickerInputMask, getDateInputFormat as getDaterangepickerInputFormat, getDateInputMask as getDaterangepickerInputMask, getDateInputValueAsDate as getDaterangepickerInputValueAsDate, injectDateConfig as injectDaterangepickerDateConfig, provideDateConfig as provideDaterangepickerConfig } from '@odx/angular/cdk/date-input';
|
|
9
11
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
10
12
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
11
13
|
import { provideCalendarConfig, CalendarSelectionMode, CalendarComponent, validateDaterange } from '@odx/angular/components/calendar';
|
|
@@ -13,84 +15,12 @@ import * as i2 from '@odx/angular/components/dropdown';
|
|
|
13
15
|
import { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';
|
|
14
16
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
15
17
|
import { CSSComponent } from '@odx/angular/internal';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { DatepickerInputDateOrder, DatepickerInputFormat, DatepickerInputMask } from '@odx/angular/components/datepicker';
|
|
19
|
-
export { DatepickerInputDateOrder as DaterangepickerInputDateOrder, DatepickerInputFormat as DaterangepickerInputFormat, DatepickerInputMask as DaterangepickerInputMask } from '@odx/angular/components/datepicker';
|
|
18
|
+
import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
|
|
19
|
+
import { format, startOfDay } from 'date-fns';
|
|
20
20
|
import { NgxMaskPipe, provideNgxMask } from 'ngx-mask';
|
|
21
21
|
import { fromEvent, distinctUntilChanged, tap, map } from 'rxjs';
|
|
22
22
|
import { NG_VALIDATORS } from '@angular/forms';
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Tools for injecting and providing the daterangepicker configuration with default configuration for the daterangepicker.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* // Providing custom daterangepicker configuration.
|
|
29
|
-
* ```ts
|
|
30
|
-
* @Component({
|
|
31
|
-
* providers: [provideDaterangepickerConfig({ inputDateOrder: DaterangepickerInputDateOrder.MDY, inputDateSeparator: '/'})]
|
|
32
|
-
* })
|
|
33
|
-
* export class MyComponent {}
|
|
34
|
-
*
|
|
35
|
-
* // Injecting the daterangepicker configuration.
|
|
36
|
-
* ```ts
|
|
37
|
-
* @Component({})
|
|
38
|
-
* export class MyComponent {
|
|
39
|
-
* constructor(@Inject(injectDaterangepickerConfig()) private readonly daterangepickerConfig: DaterangepickerConfig) {}
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
const { DaterangepickerConfig, DaterangepickerDefaultConfig, injectDaterangepickerConfig, provideDaterangepickerConfig } = createConfigTokens('Daterangepicker', '@odx/angular/components/daterangepicker', {
|
|
44
|
-
inputDateOrder: DatepickerInputDateOrder.DMY,
|
|
45
|
-
inputDateSeparator: '.',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
function getDaterangepickerInputPattern({ inputDateOrder, inputDateSeparator }, pattern) {
|
|
49
|
-
const patternList = {
|
|
50
|
-
[DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,
|
|
51
|
-
[DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,
|
|
52
|
-
[DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,
|
|
53
|
-
};
|
|
54
|
-
return patternList[inputDateOrder];
|
|
55
|
-
}
|
|
56
|
-
/** @internal */
|
|
57
|
-
function getDaterangepickerInputFormat(config) {
|
|
58
|
-
return getDaterangepickerInputPattern(config, DatepickerInputFormat);
|
|
59
|
-
}
|
|
60
|
-
/** @internal */
|
|
61
|
-
function getDaterangepickerInputMask(config) {
|
|
62
|
-
return getDaterangepickerInputPattern(config, DatepickerInputMask);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const functionList = {
|
|
66
|
-
[DatepickerInputDateOrder.DMY]: (splittedValue) => {
|
|
67
|
-
const [day, month, year] = splittedValue;
|
|
68
|
-
return { month, day, year };
|
|
69
|
-
},
|
|
70
|
-
[DatepickerInputDateOrder.MDY]: (splittedValue) => {
|
|
71
|
-
const [month, day, year] = splittedValue;
|
|
72
|
-
return { month, day, year };
|
|
73
|
-
},
|
|
74
|
-
[DatepickerInputDateOrder.YMD]: (splittedValue) => {
|
|
75
|
-
const [year, month, day] = splittedValue;
|
|
76
|
-
return { month, day, year };
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
function getDateCandidate({ inputDateOrder, inputDateSeparator }, value) {
|
|
80
|
-
const splittedValue = value.split(inputDateSeparator);
|
|
81
|
-
const { month, day, year } = functionList[inputDateOrder](splittedValue);
|
|
82
|
-
const isDateCandidateInvalid = !month || !day || !year;
|
|
83
|
-
return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;
|
|
84
|
-
}
|
|
85
|
-
/** @internal */
|
|
86
|
-
function getDaterangepickerInputValueAsDate(config, value) {
|
|
87
|
-
const dateCandidate = getDateCandidate(config, value);
|
|
88
|
-
if (!dateCandidate)
|
|
89
|
-
return null;
|
|
90
|
-
const date = toDate(Date.parse(dateCandidate));
|
|
91
|
-
return isValid(date) ? date : null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
24
|
/**
|
|
95
25
|
* Enhances an input element to support date range picking, applying an input mask for date formatting
|
|
96
26
|
* and managing focus events. This directive is typically used within a date range picker to provide
|
|
@@ -104,8 +34,8 @@ let DaterangepickerInputControlDirective = class DaterangepickerInputControlDire
|
|
|
104
34
|
super(...arguments);
|
|
105
35
|
this.maskConfig = { validation: false, leadZeroDateTime: true };
|
|
106
36
|
this.readonlyController = ReadonlyController.inject();
|
|
107
|
-
this.config =
|
|
108
|
-
this.inputMask =
|
|
37
|
+
this.config = injectDateConfig();
|
|
38
|
+
this.inputMask = getDateInputMask(this.config);
|
|
109
39
|
this.ngxMaskPipe = inject(NgxMaskPipe);
|
|
110
40
|
/**
|
|
111
41
|
* Emits an event when the input gains or loses focus, facilitating external event handling.
|
|
@@ -133,7 +63,7 @@ let DaterangepickerInputControlDirective = class DaterangepickerInputControlDire
|
|
|
133
63
|
* @returns {Date | null} The parsed date object or null if the input does not represent a valid date.
|
|
134
64
|
*/
|
|
135
65
|
get valueAsDate() {
|
|
136
|
-
return
|
|
66
|
+
return getDateInputValueAsDate(this.config, this.nativeElementValue);
|
|
137
67
|
}
|
|
138
68
|
/**
|
|
139
69
|
* Provides the placeholder text for the input, typically the date format in uppercase.
|
|
@@ -141,7 +71,7 @@ let DaterangepickerInputControlDirective = class DaterangepickerInputControlDire
|
|
|
141
71
|
* @returns {string} The placeholder text for the input.
|
|
142
72
|
*/
|
|
143
73
|
get placeholder() {
|
|
144
|
-
return
|
|
74
|
+
return getDateInputFormat(this.config).toUpperCase();
|
|
145
75
|
}
|
|
146
76
|
handleFocusIn() {
|
|
147
77
|
this.focused.emit(true);
|
|
@@ -215,7 +145,7 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
|
|
|
215
145
|
constructor() {
|
|
216
146
|
super(null);
|
|
217
147
|
this.takeUntilDestroyed = untilDestroyed();
|
|
218
|
-
this.config =
|
|
148
|
+
this.config = injectDateConfig();
|
|
219
149
|
this.element = injectElement();
|
|
220
150
|
/**
|
|
221
151
|
* Represents today's date, used for default selections and validations.
|
|
@@ -359,14 +289,14 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
|
|
|
359
289
|
updateStartDateField(date) {
|
|
360
290
|
if (!this.startDateField)
|
|
361
291
|
return;
|
|
362
|
-
const dateFormat =
|
|
292
|
+
const dateFormat = getDateInputFormat(this.config);
|
|
363
293
|
this.startDateField.nativeElementValue = date ? format(date, dateFormat) : '';
|
|
364
294
|
this.updateWidth(this.startDateField, this.startDateMirror, date ? format(date, dateFormat) : '');
|
|
365
295
|
}
|
|
366
296
|
updateEndDateField(date) {
|
|
367
297
|
if (!this.endDateField)
|
|
368
298
|
return;
|
|
369
|
-
const dateFormat =
|
|
299
|
+
const dateFormat = getDateInputFormat(this.config);
|
|
370
300
|
this.endDateField.nativeElementValue = date ? format(date, dateFormat) : '';
|
|
371
301
|
this.updateWidth(this.endDateField, this.endDateMirror, date ? format(date, dateFormat) : '');
|
|
372
302
|
}
|
|
@@ -541,5 +471,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
541
471
|
* Generated bundle index. Do not edit.
|
|
542
472
|
*/
|
|
543
473
|
|
|
544
|
-
export { DaterangepickerComponent,
|
|
474
|
+
export { DaterangepickerComponent, DaterangepickerInputControlDirective, DaterangepickerModule, DaterangepickerRangeValidator, DaterangepickerRequiredValidator };
|
|
545
475
|
//# sourceMappingURL=odx-angular-components-daterangepicker.mjs.map
|