@odx/angular 12.17.4 → 12.17.6

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cdk/date-input/README.md +3 -0
  3. package/cdk/date-input/index.d.ts +4 -0
  4. package/cdk/date-input/lib/date.config.d.ts +48 -0
  5. package/cdk/date-input/lib/models/input-date-order.d.ts +17 -0
  6. package/cdk/date-input/lib/utils/get-date-input-pattern.d.ts +5 -0
  7. package/cdk/date-input/lib/utils/get-input-value-as-date.d.ts +3 -0
  8. package/components/datepicker/index.d.ts +0 -1
  9. package/components/datepicker/lib/datepicker.component.d.ts +6 -1
  10. package/components/datepicker/lib/datepicker.config.d.ts +1 -48
  11. package/components/daterangepicker/index.d.ts +0 -1
  12. package/components/daterangepicker/lib/daterangepicker.component.d.ts +6 -1
  13. package/components/daterangepicker/lib/daterangepicker.config.d.ts +1 -48
  14. package/esm2022/cdk/date-input/index.mjs +5 -0
  15. package/esm2022/cdk/date-input/lib/date.config.mjs +26 -0
  16. package/esm2022/cdk/date-input/lib/models/input-date-order.mjs +16 -0
  17. package/esm2022/cdk/date-input/lib/utils/get-date-input-pattern.mjs +18 -0
  18. package/esm2022/cdk/date-input/lib/utils/get-input-value-as-date.mjs +38 -0
  19. package/esm2022/cdk/date-input/odx-angular-cdk-date-input.mjs +5 -0
  20. package/esm2022/components/datepicker/index.mjs +1 -2
  21. package/esm2022/components/datepicker/lib/datepicker.component.mjs +15 -11
  22. package/esm2022/components/datepicker/lib/datepicker.config.mjs +52 -26
  23. package/esm2022/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +6 -7
  24. package/esm2022/components/daterangepicker/index.mjs +1 -2
  25. package/esm2022/components/daterangepicker/lib/daterangepicker.component.mjs +16 -12
  26. package/esm2022/components/daterangepicker/lib/daterangepicker.config.mjs +52 -26
  27. package/esm2022/components/daterangepicker/lib/directives/daterangepicker-input-control.directive.mjs +6 -7
  28. package/esm2022/lib/models/index.mjs +1 -1
  29. package/fesm2022/odx-angular-cdk-date-input.mjs +102 -0
  30. package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -0
  31. package/fesm2022/odx-angular-components-datepicker.mjs +22 -102
  32. package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
  33. package/fesm2022/odx-angular-components-daterangepicker.mjs +23 -88
  34. package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
  35. package/package.json +25 -19
  36. package/components/datepicker/lib/models/datepicker-input-date-order.d.ts +0 -6
  37. package/components/datepicker/lib/models/datepicker-input-pattern.d.ts +0 -11
  38. package/components/datepicker/lib/models/index.d.ts +0 -2
  39. package/components/datepicker/lib/utils/get-datepicker-input-pattern.d.ts +0 -5
  40. package/components/datepicker/lib/utils/get-datepicker-input-value-as-date.d.ts +0 -3
  41. package/components/datepicker/lib/utils/index.d.ts +0 -2
  42. package/components/daterangepicker/lib/models/daterangepicker-input-date-order.d.ts +0 -1
  43. package/components/daterangepicker/lib/models/daterangepicker-input-pattern.d.ts +0 -1
  44. package/components/daterangepicker/lib/models/index.d.ts +0 -2
  45. package/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.d.ts +0 -5
  46. package/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.d.ts +0 -3
  47. package/components/daterangepicker/lib/utils/index.d.ts +0 -2
  48. package/esm2022/components/datepicker/lib/models/datepicker-input-date-order.mjs +0 -6
  49. package/esm2022/components/datepicker/lib/models/datepicker-input-pattern.mjs +0 -11
  50. package/esm2022/components/datepicker/lib/models/index.mjs +0 -3
  51. package/esm2022/components/datepicker/lib/utils/get-datepicker-input-pattern.mjs +0 -18
  52. package/esm2022/components/datepicker/lib/utils/get-datepicker-input-value-as-date.mjs +0 -31
  53. package/esm2022/components/datepicker/lib/utils/index.mjs +0 -3
  54. package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-date-order.mjs +0 -2
  55. package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-pattern.mjs +0 -2
  56. package/esm2022/components/daterangepicker/lib/models/index.mjs +0 -3
  57. package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.mjs +0 -18
  58. package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.mjs +0 -31
  59. package/esm2022/components/daterangepicker/lib/utils/index.mjs +0 -3
@@ -0,0 +1,102 @@
1
+ import { createConfigTokens } from '@odx/angular/utils';
2
+ import { toDate, isValid } from 'date-fns';
3
+
4
+ const InputDateOrder = {
5
+ DMY: 'DMY',
6
+ MDY: 'MDY',
7
+ YMD: 'YMD',
8
+ };
9
+ const DateInputFormat = {
10
+ DAYS: 'dd',
11
+ MONTH: 'MM',
12
+ YEAR: 'yyyy',
13
+ };
14
+ const DateInputMask = {
15
+ DAYS: 'd0',
16
+ MONTH: 'M0',
17
+ YEAR: '0000',
18
+ };
19
+
20
+ /**
21
+ * Tools for injecting and providing the date configuration with default configuration for the date.
22
+ *
23
+ * @example
24
+ * // Providing custom date configuration.
25
+ * ```ts
26
+ * @Component({
27
+ * providers: [provideDateConfig({ inputDateOrder: InputDateOrder.MDY, inputDateSeparator: '/'})]
28
+ * })
29
+ * export class MyComponent {}
30
+ *
31
+ * // Injecting the date configuration.
32
+ * ```ts
33
+ * @Component({})
34
+ * export class MyComponent {
35
+ * constructor(@Inject(injectDateConfig()) private readonly dateConfig: DateConfig) {}
36
+ * }
37
+ * ```
38
+ */
39
+ const { DateConfig, DateDefaultConfig, injectDateConfig, provideDateConfig } = createConfigTokens('Date', '@odx/angular/components/date', {
40
+ inputDateOrder: InputDateOrder.DMY,
41
+ inputDateSeparator: '.',
42
+ });
43
+
44
+ function getDateInputPattern({ inputDateOrder, inputDateSeparator }, pattern) {
45
+ const patternList = {
46
+ [InputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,
47
+ [InputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,
48
+ [InputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,
49
+ };
50
+ return patternList[inputDateOrder];
51
+ }
52
+ /** @internal */
53
+ function getDateInputFormat(config) {
54
+ return getDateInputPattern(config, DateInputFormat);
55
+ }
56
+ /** @internal */
57
+ function getDateInputMask(config) {
58
+ return getDateInputPattern(config, DateInputMask);
59
+ }
60
+
61
+ const functionList = {
62
+ [InputDateOrder.DMY]: (splittedValue) => {
63
+ const [day, month, year] = splittedValue;
64
+ return { month, day, year };
65
+ },
66
+ [InputDateOrder.MDY]: (splittedValue) => {
67
+ const [month, day, year] = splittedValue;
68
+ return { month, day, year };
69
+ },
70
+ [InputDateOrder.YMD]: (splittedValue) => {
71
+ const [year, month, day] = splittedValue;
72
+ return { month, day, year };
73
+ },
74
+ };
75
+ function getDateCandidate({ inputDateOrder, inputDateSeparator }, value) {
76
+ const splittedValue = value.split(inputDateSeparator);
77
+ const { month, day, year } = functionList[inputDateOrder](splittedValue);
78
+ if (!month ||
79
+ !day ||
80
+ !year ||
81
+ month.length !== DateInputFormat.MONTH.length ||
82
+ day.length !== DateInputFormat.DAYS.length ||
83
+ year.length !== DateInputFormat.YEAR.length) {
84
+ return null;
85
+ }
86
+ return { month, day, year };
87
+ }
88
+ /** @internal */
89
+ function getDateInputValueAsDate(config, value) {
90
+ const dateCandidate = getDateCandidate(config, value);
91
+ if (!dateCandidate)
92
+ return null;
93
+ const date = toDate(`${dateCandidate.month}.${dateCandidate.day}.${dateCandidate.year}`);
94
+ return isValid(date) ? date : null;
95
+ }
96
+
97
+ /**
98
+ * Generated bundle index. Do not edit.
99
+ */
100
+
101
+ export { DateConfig, DateDefaultConfig, DateInputFormat, DateInputMask, InputDateOrder, getDateInputFormat, getDateInputMask, getDateInputValueAsDate, injectDateConfig, provideDateConfig };
102
+ //# sourceMappingURL=odx-angular-cdk-date-input.mjs.map
@@ -0,0 +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":";;;AAEa,MAAA,cAAc,GAAG;AAC5B,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;EACV;AAIW,MAAA,eAAe,GAAG;AAC7B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;EACZ;AAEW,MAAA,aAAa,GAAG;AAC3B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;;;ACHd;;;;;;;;;;;;;;;;;;AAkBG;AACU,MAAA,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,8BAA8B,EAAE;IAC/I,cAAc,EAAE,cAAc,CAAC,GAAG;AAClC,IAAA,kBAAkB,EAAE,GAAG;AACxB,CAAA;;ACnCD,SAAS,mBAAmB,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAc,EAAE,OAAyB,EAAA;AACxG,IAAA,MAAM,WAAW,GAAmC;QAClD,CAAC,cAAc,CAAC,GAAG,GAAG,CAAG,EAAA,OAAO,CAAC,IAAI,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,KAAK,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,IAAI,CAAE,CAAA;QAChH,CAAC,cAAc,CAAC,GAAG,GAAG,CAAG,EAAA,OAAO,CAAC,KAAK,CAAA,EAAG,kBAAkB,C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AAC,EAAE,cAAc,EAAE,kBAAkB,EAAc,EAAE,KAAa,EAAA;IACzF,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAEtD,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAA2B,YAAY,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC,CAAC;AAEjG,IAAA,IACE,CAAC,KAAK;AACN,QAAA,CAAC,GAAG;AACJ,QAAA,CAAC,IAAI;AACL,QAAA,KAAK,CAAC,MAAM,KAAK,eAAe,CAAC,KAAK,CAAC,MAAM;AAC7C,QAAA,GAAG,CAAC,MAAM,KAAK,eAAe,CAAC,IAAI,CAAC,MAAM;QAC1C,IAAI,CAAC,MAAM,KAAK,eAAe,CAAC,IAAI,CAAC,MAAM,EAC3C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED;AACgB,SAAA,uBAAuB,CAAC,MAAkB,EAAE,KAAa,EAAA;IACvE,MAAM,aAAa,GAAkC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAErF,IAAA,IAAI,CAAC,aAAa;AAAE,QAAA,OAAO,IAAI,CAAC;AAEhC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,CAAG,EAAA,aAAa,CAAC,KAAK,CAAA,CAAA,EAAI,aAAa,CAAC,GAAG,CAAI,CAAA,EAAA,aAAa,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC;AAEzF,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACrC;;ACrDA;;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 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 { createConfigTokens, untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
17
- import { toDate, isValid, startOfDay, format } from 'date-fns';
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 = injectDatepickerConfig();
124
- this.inputMask = getDatepickerInputMask(this.config);
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 getDatepickerInputValueAsDate(this.config, this.nativeElementValue);
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 getDatepickerInputFormat(this.config).toUpperCase();
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 = injectDatepickerConfig();
131
+ this.config = injectDateConfig();
217
132
  this.element = injectElement();
218
133
  /**
219
134
  * Represents the current date.
@@ -310,6 +225,17 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
310
225
  super.writeValue(value);
311
226
  this.updateDateField(value);
312
227
  }
228
+ /**
229
+ * Opens the datepicker dropdown.
230
+ *
231
+ * @param {KeyboardEvent} event
232
+ */
233
+ openDatepicker(event) {
234
+ event?.stopPropagation();
235
+ if (this.isReadonly || this.isDisabled)
236
+ return;
237
+ this.dropdown.open(event);
238
+ }
313
239
  updateInternalValue(value) {
314
240
  this.updateValue(value);
315
241
  this.updateDateField(value);
@@ -331,16 +257,10 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
331
257
  }
332
258
  });
333
259
  }
334
- openDatepicker(event) {
335
- event.stopPropagation();
336
- if (this.isReadonly || this.isDisabled)
337
- return;
338
- this.dropdown.open(event);
339
- }
340
260
  updateDateField(date) {
341
261
  if (!this.dateField)
342
262
  return;
343
- const dateFormat = getDatepickerInputFormat(this.config);
263
+ const dateFormat = getDateInputFormat(this.config);
344
264
  this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';
345
265
  }
346
266
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -395,5 +315,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
395
315
  * Generated bundle index. Do not edit.
396
316
  */
397
317
 
398
- export { DatepickerComponent, DatepickerConfig, DatepickerDefaultConfig, DatepickerInputControlDirective, DatepickerInputDateOrder, DatepickerInputFormat, DatepickerInputMask, DatepickerModule, injectDatepickerConfig, provideDatepickerConfig };
318
+ export { DatepickerComponent, DatepickerInputControlDirective, DatepickerModule };
399
319
  //# 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,wBAAwB,GAAG;AACtC,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;;;ACHC,MAAA,qBAAqB,GAAG;AACnC,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;EACZ;AAEW,MAAA,mBAAmB,GAAG;AACjC,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;;;ACKd;;;;;;;;;;;;;;;;;;AAkBG;AACU,MAAA,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,GAAG,kBAAkB,CAC9H,YAAY,EACZ,oCAAoC,EACpC;IACE,cAAc,EAAE,wBAAwB,CAAC,GAAG;AAC5C,IAAA,kBAAkB,EAAE,GAAG;AACxB,CAAA;;ACtCH,SAAS,yBAAyB,CAAC,EAAE,cAAc,EAAE,kBAAk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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 /**\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,WAAW,CAAC,CAAC;AAErD;;;;AAIG;AAEI,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,YAAY,EAAW,CAAC;AAE7C;;;;;AAKG;AACa,QAAA,IAAA,CAAA,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAChF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,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,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 { createConfigTokens, untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
17
- import { toDate, isValid, format, startOfDay } from 'date-fns';
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 = injectDaterangepickerConfig();
108
- this.inputMask = getDaterangepickerInputMask(this.config);
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 getDaterangepickerInputValueAsDate(this.config, this.nativeElementValue);
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 getDaterangepickerInputFormat(this.config).toUpperCase();
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 = injectDaterangepickerConfig();
148
+ this.config = injectDateConfig();
219
149
  this.element = injectElement();
220
150
  /**
221
151
  * Represents today's date, used for default selections and validations.
@@ -307,6 +237,17 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
307
237
  super.writeValue(value);
308
238
  this.updateInputFields();
309
239
  }
240
+ /**
241
+ * Opens the date range picker dropdown.
242
+ *
243
+ * @param {KeyboardEvent} event
244
+ */
245
+ openDaterangepicker(event) {
246
+ event?.stopPropagation();
247
+ if (this.isReadonly || this.isDisabled)
248
+ return;
249
+ this.dropdown.open(event);
250
+ }
310
251
  isEmpty(value) {
311
252
  return !value || !value.start || !value.end;
312
253
  }
@@ -350,23 +291,17 @@ let DaterangepickerComponent = class DaterangepickerComponent extends CustomForm
350
291
  }
351
292
  });
352
293
  }
353
- openDaterangepicker(event) {
354
- event.stopPropagation();
355
- if (this.isReadonly || this.isDisabled)
356
- return;
357
- this.dropdown.open(event);
358
- }
359
294
  updateStartDateField(date) {
360
295
  if (!this.startDateField)
361
296
  return;
362
- const dateFormat = getDaterangepickerInputFormat(this.config);
297
+ const dateFormat = getDateInputFormat(this.config);
363
298
  this.startDateField.nativeElementValue = date ? format(date, dateFormat) : '';
364
299
  this.updateWidth(this.startDateField, this.startDateMirror, date ? format(date, dateFormat) : '');
365
300
  }
366
301
  updateEndDateField(date) {
367
302
  if (!this.endDateField)
368
303
  return;
369
- const dateFormat = getDaterangepickerInputFormat(this.config);
304
+ const dateFormat = getDateInputFormat(this.config);
370
305
  this.endDateField.nativeElementValue = date ? format(date, dateFormat) : '';
371
306
  this.updateWidth(this.endDateField, this.endDateMirror, date ? format(date, dateFormat) : '');
372
307
  }
@@ -541,5 +476,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
541
476
  * Generated bundle index. Do not edit.
542
477
  */
543
478
 
544
- export { DaterangepickerComponent, DaterangepickerConfig, DaterangepickerDefaultConfig, DaterangepickerInputControlDirective, DaterangepickerModule, DaterangepickerRangeValidator, DaterangepickerRequiredValidator, injectDaterangepickerConfig, provideDaterangepickerConfig };
479
+ export { DaterangepickerComponent, DaterangepickerInputControlDirective, DaterangepickerModule, DaterangepickerRangeValidator, DaterangepickerRequiredValidator };
545
480
  //# sourceMappingURL=odx-angular-components-daterangepicker.mjs.map