@odx/angular 12.21.0 → 12.21.2
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 +12 -0
- package/cdk/date-input/index.d.ts +1 -0
- package/cdk/date-input/lib/utils/ngx-mask-init.d.ts +3 -0
- package/components/datepicker/lib/directives/datepicker-input-control.directive.d.ts +4 -16
- package/components/daterangepicker/lib/directives/daterangepicker-input-control.directive.d.ts +4 -16
- package/components/timepicker/lib/directives/timepicker-input-control.directive.d.ts +6 -15
- package/components/timepicker/lib/timepicker.service.d.ts +5 -4
- package/esm2022/cdk/date-input/index.mjs +2 -1
- package/esm2022/cdk/date-input/lib/utils/ngx-mask-init.mjs +22 -0
- package/esm2022/components/datepicker/lib/datepicker.component.mjs +3 -2
- package/esm2022/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +8 -23
- package/esm2022/components/daterangepicker/lib/daterangepicker.component.mjs +4 -2
- package/esm2022/components/daterangepicker/lib/directives/daterangepicker-input-control.directive.mjs +8 -23
- package/esm2022/components/timepicker/lib/directives/timepicker-input-control.directive.mjs +17 -37
- package/esm2022/components/timepicker/lib/timepicker.component.mjs +21 -6
- package/esm2022/components/timepicker/lib/timepicker.service.mjs +42 -15
- package/esm2022/localization/lib/localization.service.mjs +5 -2
- package/fesm2022/odx-angular-cdk-date-input.mjs +23 -2
- package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -1
- package/fesm2022/odx-angular-components-datepicker.mjs +10 -24
- package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-daterangepicker.mjs +11 -24
- package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-timepicker.mjs +113 -90
- package/fesm2022/odx-angular-components-timepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-localization.mjs +4 -1
- package/fesm2022/odx-angular-localization.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -53,9 +53,12 @@ export class LocalizationService {
|
|
|
53
53
|
setActiveLanguage(language) {
|
|
54
54
|
try {
|
|
55
55
|
const locale = new Intl.Locale(language);
|
|
56
|
-
if (this.availableLanguages.includes(locale.baseName)
|
|
56
|
+
if (this.availableLanguages.includes(locale.baseName)) {
|
|
57
57
|
this.localeState$.next(locale);
|
|
58
58
|
}
|
|
59
|
+
else if (this.availableLanguages.includes(locale.language)) {
|
|
60
|
+
this.localeState$.next(new Intl.Locale(locale.language));
|
|
61
|
+
}
|
|
59
62
|
else {
|
|
60
63
|
throw new Error(`Unrecognizable language '${language}'. Make sure it's a part of availableLanguages inside LocalizationService config.`);
|
|
61
64
|
}
|
|
@@ -95,4 +98,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
95
98
|
type: Injectable,
|
|
96
99
|
args: [{ providedIn: 'root' }]
|
|
97
100
|
}] });
|
|
98
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
101
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxpemF0aW9uLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2FuZ3VsYXIvbG9jYWxpemF0aW9uL3NyYy9saWIvbG9jYWxpemF0aW9uLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLHFCQUFxQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3BGLE9BQU8sRUFBRSxlQUFlLEVBQWMsb0JBQW9CLEVBQUUsTUFBTSxFQUFFLGNBQWMsRUFBRSxJQUFJLEVBQUUsWUFBWSxFQUFFLEdBQUcsRUFBRSxFQUFFLEVBQUUsV0FBVyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQzNJLE9BQ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aW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICByZXR1cm4gZnJvbShsYW5ndWFnZSk7XG4gICAgfVxuICAgIHJldHVybiBvZihsYW5ndWFnZSk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createConfigTokens } from '@odx/angular/utils';
|
|
1
|
+
import { createConfigTokens, isFunction } from '@odx/angular/utils';
|
|
2
2
|
import { toDate, isValid } from 'date-fns';
|
|
3
|
+
import { initialConfig } from 'ngx-mask';
|
|
3
4
|
|
|
4
5
|
const InputDateOrder = {
|
|
5
6
|
DMY: 'DMY',
|
|
@@ -94,9 +95,29 @@ function getDateInputValueAsDate(config, value) {
|
|
|
94
95
|
return isValid(date) ? date : null;
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
function initNgxMask(ngxMask = undefined, mask) {
|
|
99
|
+
if (!ngxMask)
|
|
100
|
+
return;
|
|
101
|
+
if (!Object.hasOwn(ngxMask, '_maskValue')) {
|
|
102
|
+
throw new Error('[DatepickerInputControlDirective] initNgxMask: ngx-mask internal API changed, mask signal not available.');
|
|
103
|
+
}
|
|
104
|
+
const maskSignal = ngxMask['_maskValue'];
|
|
105
|
+
isFunction(maskSignal.set) && maskSignal.set(mask);
|
|
106
|
+
ngxMask._maskService.maskExpression = mask;
|
|
107
|
+
}
|
|
108
|
+
const ngxMaskProviderConfig = {
|
|
109
|
+
validation: false,
|
|
110
|
+
leadZeroDateTime: true,
|
|
111
|
+
patterns: {
|
|
112
|
+
...initialConfig.patterns,
|
|
113
|
+
A: { pattern: new RegExp('[AaPp]') },
|
|
114
|
+
M: { pattern: new RegExp('[mM]') },
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
97
118
|
/**
|
|
98
119
|
* Generated bundle index. Do not edit.
|
|
99
120
|
*/
|
|
100
121
|
|
|
101
|
-
export { DateConfig, DateDefaultConfig, DateInputFormat, DateInputMask, InputDateOrder, getDateInputFormat, getDateInputMask, getDateInputValueAsDate, injectDateConfig, provideDateConfig };
|
|
122
|
+
export { DateConfig, DateDefaultConfig, DateInputFormat, DateInputMask, InputDateOrder, getDateInputFormat, getDateInputMask, getDateInputValueAsDate, initNgxMask, injectDateConfig, ngxMaskProviderConfig, provideDateConfig };
|
|
102
123
|
//# sourceMappingURL=odx-angular-cdk-date-input.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-date-input.mjs","sources":["../../../../libs/angular/cdk/date-input/src/lib/models/input-date-order.ts","../../../../libs/angular/cdk/date-input/src/lib/date.config.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-date-input-pattern.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-input-value-as-date.ts","../../../../libs/angular/cdk/date-input/src/odx-angular-cdk-date-input.ts"],"sourcesContent":["export type InputDateOrder = (typeof InputDateOrder)[keyof typeof InputDateOrder];\n\nexport const InputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n\nexport type DateInputPattern = typeof DateInputFormat | typeof DateInputMask;\n\nexport const DateInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DateInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { InputDateOrder } from './models/input-date-order';\n\nexport interface DateConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default InputDateOrder.DMY\n */\n inputDateOrder: InputDateOrder;\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 date configuration with default configuration for the date.\n *\n * @example\n * // Providing custom date configuration.\n * ```ts\n * @Component({\n * providers: [provideDateConfig({ inputDateOrder: InputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the date configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDateConfig()) private readonly dateConfig: DateConfig) {}\n * }\n * ```\n */\nexport const { DateConfig, DateDefaultConfig, injectDateConfig, provideDateConfig } = createConfigTokens('Date', '@odx/angular/components/date', {\n inputDateOrder: InputDateOrder.DMY,\n inputDateSeparator: '.',\n});\n","import { DateConfig } from '../date.config';\nimport { DateInputFormat, DateInputMask, DateInputPattern, InputDateOrder } from '../models/input-date-order';\n\nfunction getDateInputPattern({ inputDateOrder, inputDateSeparator }: DateConfig, pattern: DateInputPattern): string {\n const patternList: Record<InputDateOrder, string> = {\n [InputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDateInputFormat(config: DateConfig): string {\n return getDateInputPattern(config, DateInputFormat);\n}\n\n/** @internal */\nexport function getDateInputMask(config: DateConfig): string {\n return getDateInputPattern(config, DateInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DateConfig } from '../date.config';\nimport { DateInputFormat, InputDateOrder } from '../models/input-date-order';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<InputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [InputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DateConfig, value: string): DateCandidateInterface | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n if (\n !month ||\n !day ||\n !year ||\n month.length !== DateInputFormat.MONTH.length ||\n day.length !== DateInputFormat.DAYS.length ||\n year.length !== DateInputFormat.YEAR.length\n ) {\n return null;\n }\n\n return { month, day, year };\n}\n\n/** @internal */\nexport function getDateInputValueAsDate(config: DateConfig, value: string): Date | null {\n const dateCandidate: DateCandidateInterface | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(`${dateCandidate.month}.${dateCandidate.day}.${dateCandidate.year}`);\n\n return isValid(date) ? date : null;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"odx-angular-cdk-date-input.mjs","sources":["../../../../libs/angular/cdk/date-input/src/lib/models/input-date-order.ts","../../../../libs/angular/cdk/date-input/src/lib/date.config.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-date-input-pattern.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-input-value-as-date.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/ngx-mask-init.ts","../../../../libs/angular/cdk/date-input/src/odx-angular-cdk-date-input.ts"],"sourcesContent":["export type InputDateOrder = (typeof InputDateOrder)[keyof typeof InputDateOrder];\n\nexport const InputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n\nexport type DateInputPattern = typeof DateInputFormat | typeof DateInputMask;\n\nexport const DateInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DateInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { InputDateOrder } from './models/input-date-order';\n\nexport interface DateConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default InputDateOrder.DMY\n */\n inputDateOrder: InputDateOrder;\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 date configuration with default configuration for the date.\n *\n * @example\n * // Providing custom date configuration.\n * ```ts\n * @Component({\n * providers: [provideDateConfig({ inputDateOrder: InputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the date configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDateConfig()) private readonly dateConfig: DateConfig) {}\n * }\n * ```\n */\nexport const { DateConfig, DateDefaultConfig, injectDateConfig, provideDateConfig } = createConfigTokens('Date', '@odx/angular/components/date', {\n inputDateOrder: InputDateOrder.DMY,\n inputDateSeparator: '.',\n});\n","import { DateConfig } from '../date.config';\nimport { DateInputFormat, DateInputMask, DateInputPattern, InputDateOrder } from '../models/input-date-order';\n\nfunction getDateInputPattern({ inputDateOrder, inputDateSeparator }: DateConfig, pattern: DateInputPattern): string {\n const patternList: Record<InputDateOrder, string> = {\n [InputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDateInputFormat(config: DateConfig): string {\n return getDateInputPattern(config, DateInputFormat);\n}\n\n/** @internal */\nexport function getDateInputMask(config: DateConfig): string {\n return getDateInputPattern(config, DateInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DateConfig } from '../date.config';\nimport { DateInputFormat, InputDateOrder } from '../models/input-date-order';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<InputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [InputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DateConfig, value: string): DateCandidateInterface | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n if (\n !month ||\n !day ||\n !year ||\n month.length !== DateInputFormat.MONTH.length ||\n day.length !== DateInputFormat.DAYS.length ||\n year.length !== DateInputFormat.YEAR.length\n ) {\n return null;\n }\n\n return { month, day, year };\n}\n\n/** @internal */\nexport function getDateInputValueAsDate(config: DateConfig, value: string): Date | null {\n const dateCandidate: DateCandidateInterface | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(`${dateCandidate.month}.${dateCandidate.day}.${dateCandidate.year}`);\n\n return isValid(date) ? date : null;\n}\n","import { isFunction } from '@odx/angular/utils';\nimport { initialConfig, NgxMaskConfig, NgxMaskDirective } from 'ngx-mask';\n\nexport function initNgxMask(ngxMask: NgxMaskDirective | undefined = undefined, mask: string): void {\n if (!ngxMask) return;\n if (!Object.hasOwn(ngxMask, '_maskValue')) {\n throw new Error('[DatepickerInputControlDirective] initNgxMask: ngx-mask internal API changed, mask signal not available.');\n }\n const maskSignal = ngxMask['_maskValue'];\n isFunction(maskSignal.set) && maskSignal.set(mask);\n ngxMask._maskService.maskExpression = mask;\n}\n\nexport const ngxMaskProviderConfig: Partial<NgxMaskConfig> = {\n validation: false,\n leadZeroDateTime: true,\n patterns: {\n ...initialConfig.patterns,\n A: { pattern: new RegExp('[AaPp]') },\n M: { pattern: new RegExp('[mM]') },\n },\n};\n","/**\n * Generated bundle index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CAAC;AACnD,IAAA,OAAO,CAAC,YAAY,CAAC,cAAc,GAAG,IAAI,CAAC;AAC7C,CAAC;AAEY,MAAA,qBAAqB,GAA2B;AAC3D,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,QAAQ,EAAE;QACR,GAAG,aAAa,CAAC,QAAQ;QACzB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;QACpC,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;AACnC,KAAA;;;ACpBH;;AAEG;;;;"}
|
|
@@ -6,19 +6,19 @@ 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,
|
|
9
|
+
import { injectDateConfig, getDateInputValueAsDate, getDateInputFormat, initNgxMask, getDateInputMask } from '@odx/angular/cdk/date-input';
|
|
10
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';
|
|
11
11
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
12
12
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
13
13
|
import { CalendarComponent } from '@odx/angular/components/calendar';
|
|
14
|
-
import * as i2 from '@odx/angular/components/dropdown';
|
|
14
|
+
import * as i2$1 from '@odx/angular/components/dropdown';
|
|
15
15
|
import { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';
|
|
16
16
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
17
17
|
import { CSSComponent } from '@odx/angular/internal';
|
|
18
18
|
import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
|
|
19
19
|
import { startOfDay, format } from 'date-fns';
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
20
|
+
import * as i2 from 'ngx-mask';
|
|
21
|
+
import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* A directive to enhance an input element as part of a datepicker control. It applies date input formatting,
|
|
@@ -33,30 +33,15 @@ import { fromEvent, distinctUntilChanged, tap, map } from 'rxjs';
|
|
|
33
33
|
let DatepickerInputControlDirective = class DatepickerInputControlDirective extends InputControlDirective {
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
|
-
this.maskConfig = { validation: false, leadZeroDateTime: true };
|
|
37
36
|
this.readonlyController = ReadonlyController.inject();
|
|
38
37
|
this.config = injectDateConfig();
|
|
39
|
-
this.
|
|
40
|
-
this.ngxMaskPipe = inject(NgxMaskPipe);
|
|
38
|
+
this.ngxMaskDirective = inject(NgxMaskDirective);
|
|
41
39
|
/**
|
|
42
40
|
* Emits an event when the input field receives focus or loses focus, indicating the focus state.
|
|
43
41
|
*
|
|
44
42
|
* @emits {boolean} - Indicates whether the input field is focused.
|
|
45
43
|
*/
|
|
46
44
|
this.focused = new EventEmitter();
|
|
47
|
-
/**
|
|
48
|
-
* Observable stream capturing and processing input events on the native element, applying the mask,
|
|
49
|
-
* and emitting the current value.
|
|
50
|
-
*
|
|
51
|
-
* @emits {string} - The current value of the input field.
|
|
52
|
-
*/
|
|
53
|
-
this.valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(distinctUntilChanged(), tap(() => this.applyMask()), map(() => this.nativeElementValue));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Applies the configured input mask to the native element's value.
|
|
57
|
-
*/
|
|
58
|
-
applyMask() {
|
|
59
|
-
this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);
|
|
60
45
|
}
|
|
61
46
|
/**
|
|
62
47
|
* Gets the current value of the input field as a `Date` object, based on the date format from the datepicker
|
|
@@ -83,7 +68,7 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
83
68
|
this.focused.emit(false);
|
|
84
69
|
}
|
|
85
70
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatepickerInputControlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
86
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DatepickerInputControlDirective, isStandalone: true, selector: "input[odxDatepickerControl]", outputs: { focused: "focused" }, host: { listeners: { "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.readonly": "readonlyController?.readonly || null", "attr.placeholder": "placeholder" } }, providers: [ReadonlyController.connect(), provideNgxMask(
|
|
71
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DatepickerInputControlDirective, isStandalone: true, selector: "input[odxDatepickerControl]", outputs: { focused: "focused" }, host: { listeners: { "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.readonly": "readonlyController?.readonly || null", "attr.placeholder": "placeholder" } }, providers: [ReadonlyController.connect(), provideNgxMask({ validation: false, leadZeroDateTime: true })], usesInheritance: true, hostDirectives: [{ directive: i1.WithTabIndex }, { directive: i2.NgxMaskDirective }], ngImport: i0 }); }
|
|
87
72
|
};
|
|
88
73
|
DatepickerInputControlDirective = __decorate([
|
|
89
74
|
CSSComponent('datepicker__control')
|
|
@@ -97,8 +82,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
97
82
|
'[attr.readonly]': 'readonlyController?.readonly || null',
|
|
98
83
|
'[attr.placeholder]': 'placeholder',
|
|
99
84
|
},
|
|
100
|
-
providers: [ReadonlyController.connect(), provideNgxMask(
|
|
101
|
-
hostDirectives: [WithTabIndex],
|
|
85
|
+
providers: [ReadonlyController.connect(), provideNgxMask({ validation: false, leadZeroDateTime: true })],
|
|
86
|
+
hostDirectives: [WithTabIndex, NgxMaskDirective],
|
|
102
87
|
}]
|
|
103
88
|
}], propDecorators: { focused: [{
|
|
104
89
|
type: Output
|
|
@@ -241,6 +226,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
241
226
|
this.updateDateField(value);
|
|
242
227
|
}
|
|
243
228
|
handleDateFieldChanges() {
|
|
229
|
+
initNgxMask(this.dateField?.ngxMaskDirective, getDateInputMask(this.config));
|
|
244
230
|
this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => {
|
|
245
231
|
if (!this.dateField?.valueAsDate)
|
|
246
232
|
return;
|
|
@@ -264,7 +250,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
264
250
|
this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';
|
|
265
251
|
}
|
|
266
252
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
267
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DatepickerComponent, isStandalone: true, selector: "odx-datepicker", inputs: { filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dropdownPosition: { classPropertyName: "dropdownPosition", publicName: "dropdownPosition", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "keydown.alt.ArrowDown": "openDatepicker($event)" } }, queries: [{ propertyName: "dateField", first: true, predicate: DatepickerInputControlDirective, descendants: true }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: DropdownDirective, descendants: true }, { propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<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", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: CalendarComponent, selector: "odx-calendar", inputs: ["selectedDate", "selectedDateRange", "minDate", "maxDate", "filterFn"], outputs: ["selectedDateChange", "selectedDateRangeChange"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i2.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
253
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DatepickerComponent, isStandalone: true, selector: "odx-datepicker", inputs: { filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dropdownPosition: { classPropertyName: "dropdownPosition", publicName: "dropdownPosition", isSignal: false, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "keydown.alt.ArrowDown": "openDatepicker($event)" } }, queries: [{ propertyName: "dateField", first: true, predicate: DatepickerInputControlDirective, descendants: true }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: DropdownDirective, descendants: true }, { propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<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", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: CalendarComponent, selector: "odx-calendar", inputs: ["selectedDate", "selectedDateRange", "minDate", "maxDate", "filterFn"], outputs: ["selectedDateChange", "selectedDateRangeChange"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i2$1.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
268
254
|
};
|
|
269
255
|
DatepickerComponent = __decorate([
|
|
270
256
|
CSSComponent('datepicker'),
|
|
@@ -1 +1 @@
|
|
|
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 /**\n * Opens the datepicker dropdown.\n *\n * @param {KeyboardEvent} event\n */\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n public openDatepicker(event?: KeyboardEvent) {\n event?.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\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 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,IAAA,WAAA,GAAA;;QACY,IAAU,CAAA,UAAA,GAA2B,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAEjF,QAAA,IAAA,CAAA,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACjD,IAAM,CAAA,MAAA,GAAG,gBAAgB,EAAE,CAAC;AAC5B,QAAA,IAAA,CAAA,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1C,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,WA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
+
{"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, getDateInputValueAsDate, injectDateConfig } from '@odx/angular/cdk/date-input';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskDirective, provideNgxMask } from 'ngx-mask';\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({ validation: false, leadZeroDateTime: true })],\n hostDirectives: [WithTabIndex, NgxMaskDirective],\n})\nexport class DatepickerInputControlDirective extends InputControlDirective {\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly config = injectDateConfig();\n public readonly ngxMaskDirective = inject(NgxMaskDirective);\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 * 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, getDateInputMask, initNgxMask, 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 /**\n * Opens the datepicker dropdown.\n *\n * @param {KeyboardEvent} event\n */\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n public openDatepicker(event?: KeyboardEvent) {\n event?.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\n }\n\n protected updateInternalValue(value: Date | null): void {\n this.updateValue(value);\n this.updateDateField(value);\n }\n\n protected handleDateFieldChanges(): void {\n initNgxMask(this.dateField?.ngxMaskDirective, getDateInputMask(this.config));\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 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":";;;;;;;;;;;;;;;;;;;;;;AAOA;;;;;;;;;AASG;AAYI,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,qBAAqB,CAAA;AAAnE,IAAA,WAAA,GAAA;;AACc,QAAA,IAAA,CAAA,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACjD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iBC,cAAc,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;gBAyDtC,cAAc,EAAA,CAAA;sBADpB,YAAY;uBAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAA;;;AExMnD,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;;;;"}
|
|
@@ -6,19 +6,19 @@ 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,
|
|
9
|
+
import { injectDateConfig, getDateInputValueAsDate, getDateInputFormat, initNgxMask, getDateInputMask } from '@odx/angular/cdk/date-input';
|
|
10
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';
|
|
11
11
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
12
12
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
13
13
|
import { provideCalendarConfig, CalendarSelectionMode, CalendarComponent, validateDaterange } from '@odx/angular/components/calendar';
|
|
14
|
-
import * as i2 from '@odx/angular/components/dropdown';
|
|
14
|
+
import * as i2$1 from '@odx/angular/components/dropdown';
|
|
15
15
|
import { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';
|
|
16
16
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
17
17
|
import { CSSComponent } from '@odx/angular/internal';
|
|
18
18
|
import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
|
|
19
19
|
import { format, startOfDay } from 'date-fns';
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
20
|
+
import * as i2 from 'ngx-mask';
|
|
21
|
+
import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
|
|
22
22
|
import { NG_VALIDATORS } from '@angular/forms';
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -32,30 +32,15 @@ import { NG_VALIDATORS } from '@angular/forms';
|
|
|
32
32
|
let DaterangepickerInputControlDirective = class DaterangepickerInputControlDirective extends InputControlDirective {
|
|
33
33
|
constructor() {
|
|
34
34
|
super(...arguments);
|
|
35
|
-
this.maskConfig = { validation: false, leadZeroDateTime: true };
|
|
36
35
|
this.readonlyController = ReadonlyController.inject();
|
|
37
36
|
this.config = injectDateConfig();
|
|
38
|
-
this.
|
|
39
|
-
this.ngxMaskPipe = inject(NgxMaskPipe);
|
|
37
|
+
this.ngxMaskDirective = inject(NgxMaskDirective);
|
|
40
38
|
/**
|
|
41
39
|
* Emits an event when the input gains or loses focus, facilitating external event handling.
|
|
42
40
|
*
|
|
43
41
|
* @emits {boolean} - Indicates whether the input is focused.
|
|
44
42
|
*/
|
|
45
43
|
this.focused = new EventEmitter();
|
|
46
|
-
/**
|
|
47
|
-
* Captures and processes changes to the input element's value, applying the mask and updating
|
|
48
|
-
* the form control.
|
|
49
|
-
*
|
|
50
|
-
* @emits {string} - The updated value of the input element.
|
|
51
|
-
*/
|
|
52
|
-
this.valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(distinctUntilChanged(), tap(() => this.applyMask()), map(() => this.nativeElementValue));
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Applies the configured input mask to the native input element's value.
|
|
56
|
-
*/
|
|
57
|
-
applyMask() {
|
|
58
|
-
this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);
|
|
59
44
|
}
|
|
60
45
|
/**
|
|
61
46
|
* Converts the current input value to a Date object based on the configuration's date format.
|
|
@@ -80,7 +65,7 @@ let DaterangepickerInputControlDirective = class DaterangepickerInputControlDire
|
|
|
80
65
|
this.focused.emit(false);
|
|
81
66
|
}
|
|
82
67
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DaterangepickerInputControlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
83
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DaterangepickerInputControlDirective, isStandalone: true, selector: "input[odxDaterangepickerControl],input[odxDaterangepickerStartDateControl], input[odxDaterangepickerEndDateControl]", outputs: { focused: "focused" }, host: { listeners: { "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.readonly": "readonlyController?.readonly || null", "attr.placeholder": "placeholder" } }, providers: [ReadonlyController.connect(), provideNgxMask(
|
|
68
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DaterangepickerInputControlDirective, isStandalone: true, selector: "input[odxDaterangepickerControl],input[odxDaterangepickerStartDateControl], input[odxDaterangepickerEndDateControl]", outputs: { focused: "focused" }, host: { listeners: { "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.readonly": "readonlyController?.readonly || null", "attr.placeholder": "placeholder" } }, providers: [ReadonlyController.connect(), provideNgxMask({ validation: false, leadZeroDateTime: true })], usesInheritance: true, hostDirectives: [{ directive: i1.WithTabIndex }, { directive: i2.NgxMaskDirective }], ngImport: i0 }); }
|
|
84
69
|
};
|
|
85
70
|
DaterangepickerInputControlDirective = __decorate([
|
|
86
71
|
CSSComponent('daterangepicker__control')
|
|
@@ -94,8 +79,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
94
79
|
'[attr.readonly]': 'readonlyController?.readonly || null',
|
|
95
80
|
'[attr.placeholder]': 'placeholder',
|
|
96
81
|
},
|
|
97
|
-
providers: [ReadonlyController.connect(), provideNgxMask(
|
|
98
|
-
hostDirectives: [WithTabIndex],
|
|
82
|
+
providers: [ReadonlyController.connect(), provideNgxMask({ validation: false, leadZeroDateTime: true })],
|
|
83
|
+
hostDirectives: [WithTabIndex, NgxMaskDirective],
|
|
99
84
|
}]
|
|
100
85
|
}], propDecorators: { focused: [{
|
|
101
86
|
type: Output
|
|
@@ -257,6 +242,8 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
|
|
|
257
242
|
this.updateEndDateField(value.end);
|
|
258
243
|
}
|
|
259
244
|
handleDateFieldChanges() {
|
|
245
|
+
initNgxMask(this.startDateField?.ngxMaskDirective, getDateInputMask(this.config));
|
|
246
|
+
initNgxMask(this.endDateField?.ngxMaskDirective, getDateInputMask(this.config));
|
|
260
247
|
this.startDateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe((value) => {
|
|
261
248
|
this.updateWidth(this.startDateField, this.startDateMirror, value);
|
|
262
249
|
this.updateValue({ start: this.startDateField?.valueAsDate ?? null, end: this.endDateField?.valueAsDate ?? null });
|
|
@@ -321,7 +308,7 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
|
|
|
321
308
|
displayAdjacentDays: false,
|
|
322
309
|
selectionMode: CalendarSelectionMode.DateRange,
|
|
323
310
|
}),
|
|
324
|
-
], queries: [{ propertyName: "dateFields", predicate: DaterangepickerInputControlDirective }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: DropdownDirective, descendants: true }, { propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, read: ElementRef, static: true }, { propertyName: "startDateMirror", first: true, predicate: ["startDateMirror"], descendants: true, read: ElementRef, static: true }, { propertyName: "endDateMirror", first: true, predicate: ["endDateMirror"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<span #startDateMirror role=\"none\" class=\"odx-daterangepicker__mirror\"></span>\n<ng-content select=\"input[odxDaterangepickerStartDateControl]\" />\n<span role=\"none\" class=\"odx-daterangepicker__separator\">\u2013</span>\n<span #endDateMirror role=\"none\" class=\"odx-daterangepicker__mirror\"></span>\n<ng-content select=\"input[odxDaterangepickerEndDateControl]\" />\n\n<odx-action-group class=\"odx-daterangepicker__trigger-wrapper\">\n @if (clearable() && !isEmpty(value)) {\n <button class=\"odx-daterangepicker__clear\" (click)=\"reset()\" odxButton 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-daterangepicker__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]=\"today\"\n [selectedDateRange]=\"value\"\n (selectedDateRangeChange)=\"selectDateRange($event)\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n />\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: CalendarComponent, selector: "odx-calendar", inputs: ["selectedDate", "selectedDateRange", "minDate", "maxDate", "filterFn"], outputs: ["selectedDateChange", "selectedDateRangeChange"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i2.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
311
|
+
], queries: [{ propertyName: "dateFields", predicate: DaterangepickerInputControlDirective }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: DropdownDirective, descendants: true }, { propertyName: "dropdownTriggerElement", first: true, predicate: ["dropdownTrigger"], descendants: true, read: ElementRef, static: true }, { propertyName: "startDateMirror", first: true, predicate: ["startDateMirror"], descendants: true, read: ElementRef, static: true }, { propertyName: "endDateMirror", first: true, predicate: ["endDateMirror"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<span #startDateMirror role=\"none\" class=\"odx-daterangepicker__mirror\"></span>\n<ng-content select=\"input[odxDaterangepickerStartDateControl]\" />\n<span role=\"none\" class=\"odx-daterangepicker__separator\">\u2013</span>\n<span #endDateMirror role=\"none\" class=\"odx-daterangepicker__mirror\"></span>\n<ng-content select=\"input[odxDaterangepickerEndDateControl]\" />\n\n<odx-action-group class=\"odx-daterangepicker__trigger-wrapper\">\n @if (clearable() && !isEmpty(value)) {\n <button class=\"odx-daterangepicker__clear\" (click)=\"reset()\" odxButton 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-daterangepicker__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]=\"today\"\n [selectedDateRange]=\"value\"\n (selectedDateRangeChange)=\"selectDateRange($event)\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n />\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: CalendarComponent, selector: "odx-calendar", inputs: ["selectedDate", "selectedDateRange", "minDate", "maxDate", "filterFn"], outputs: ["selectedDateChange", "selectedDateRangeChange"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "directive", type: i2$1.DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
325
312
|
};
|
|
326
313
|
DaterangepickerComponent = __decorate([
|
|
327
314
|
CSSComponent('daterangepicker'),
|