@odx/angular 12.17.3 → 12.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/cdk/date-input/README.md +3 -0
- package/cdk/date-input/index.d.ts +4 -0
- package/cdk/date-input/lib/date.config.d.ts +48 -0
- package/cdk/date-input/lib/models/input-date-order.d.ts +17 -0
- package/cdk/date-input/lib/utils/get-date-input-pattern.d.ts +5 -0
- package/cdk/date-input/lib/utils/get-input-value-as-date.d.ts +3 -0
- package/components/datepicker/index.d.ts +0 -1
- package/components/datepicker/lib/datepicker.config.d.ts +1 -48
- package/components/daterangepicker/index.d.ts +0 -1
- package/components/daterangepicker/lib/daterangepicker.config.d.ts +1 -48
- package/esm2022/cdk/date-input/index.mjs +5 -0
- package/esm2022/cdk/date-input/lib/date.config.mjs +26 -0
- package/esm2022/cdk/date-input/lib/models/input-date-order.mjs +16 -0
- package/esm2022/cdk/date-input/lib/utils/get-date-input-pattern.mjs +18 -0
- package/esm2022/cdk/date-input/lib/utils/get-input-value-as-date.mjs +38 -0
- package/esm2022/cdk/date-input/odx-angular-cdk-date-input.mjs +5 -0
- package/esm2022/components/card/lib/card.component.mjs +2 -3
- package/esm2022/components/datepicker/index.mjs +1 -2
- package/esm2022/components/datepicker/lib/datepicker.component.mjs +4 -5
- package/esm2022/components/datepicker/lib/datepicker.config.mjs +52 -26
- package/esm2022/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +6 -7
- package/esm2022/components/daterangepicker/index.mjs +1 -2
- package/esm2022/components/daterangepicker/lib/daterangepicker.component.mjs +5 -6
- package/esm2022/components/daterangepicker/lib/daterangepicker.config.mjs +52 -26
- package/esm2022/components/daterangepicker/lib/directives/daterangepicker-input-control.directive.mjs +6 -7
- package/esm2022/lib/models/index.mjs +1 -1
- package/fesm2022/odx-angular-cdk-date-input.mjs +102 -0
- package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -0
- package/fesm2022/odx-angular-components-card.mjs +2 -2
- package/fesm2022/odx-angular-components-card.mjs.map +1 -1
- package/fesm2022/odx-angular-components-datepicker.mjs +11 -96
- package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-daterangepicker.mjs +12 -82
- package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
- package/package.json +14 -8
- package/components/datepicker/lib/models/datepicker-input-date-order.d.ts +0 -6
- package/components/datepicker/lib/models/datepicker-input-pattern.d.ts +0 -11
- package/components/datepicker/lib/models/index.d.ts +0 -2
- package/components/datepicker/lib/utils/get-datepicker-input-pattern.d.ts +0 -5
- package/components/datepicker/lib/utils/get-datepicker-input-value-as-date.d.ts +0 -3
- package/components/datepicker/lib/utils/index.d.ts +0 -2
- package/components/daterangepicker/lib/models/daterangepicker-input-date-order.d.ts +0 -1
- package/components/daterangepicker/lib/models/daterangepicker-input-pattern.d.ts +0 -1
- package/components/daterangepicker/lib/models/index.d.ts +0 -2
- package/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.d.ts +0 -5
- package/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.d.ts +0 -3
- package/components/daterangepicker/lib/utils/index.d.ts +0 -2
- package/esm2022/components/datepicker/lib/models/datepicker-input-date-order.mjs +0 -6
- package/esm2022/components/datepicker/lib/models/datepicker-input-pattern.mjs +0 -11
- package/esm2022/components/datepicker/lib/models/index.mjs +0 -3
- package/esm2022/components/datepicker/lib/utils/get-datepicker-input-pattern.mjs +0 -18
- package/esm2022/components/datepicker/lib/utils/get-datepicker-input-value-as-date.mjs +0 -31
- package/esm2022/components/datepicker/lib/utils/index.mjs +0 -3
- package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-date-order.mjs +0 -2
- package/esm2022/components/daterangepicker/lib/models/daterangepicker-input-pattern.mjs +0 -2
- package/esm2022/components/daterangepicker/lib/models/index.mjs +0 -3
- package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-pattern.mjs +0 -18
- package/esm2022/components/daterangepicker/lib/utils/get-daterangepicker-input-value-as-date.mjs +0 -31
- package/esm2022/components/daterangepicker/lib/utils/index.mjs +0 -3
|
@@ -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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I,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;;;;"}
|
|
@@ -5,12 +5,12 @@ import * as i1 from '@odx/angular/cdk/a11y';
|
|
|
5
5
|
import { InteractiveDirective, A11yModule } from '@odx/angular/cdk/a11y';
|
|
6
6
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
7
7
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
8
|
-
import { ChipListRowComponent } from '@odx/angular/components/chip';
|
|
9
8
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
10
9
|
import * as i3 from '@odx/angular/components/menu';
|
|
11
10
|
import { MenuComponent, MenuDirective, MenuModule } from '@odx/angular/components/menu';
|
|
12
11
|
import { CSSComponent, CSSModifier } from '@odx/angular/internal';
|
|
13
12
|
import { createConfigTokens, injectElement, untilDestroyed, containsElement } from '@odx/angular/utils';
|
|
13
|
+
import { ChipListRowComponent } from '@odx/angular/components/chip';
|
|
14
14
|
import * as i2 from '@angular/common';
|
|
15
15
|
import { CoreModule } from '@odx/angular';
|
|
16
16
|
|
|
@@ -183,7 +183,7 @@ CardComponent = __decorate([
|
|
|
183
183
|
], CardComponent);
|
|
184
184
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CardComponent, decorators: [{
|
|
185
185
|
type: Component,
|
|
186
|
-
args: [{ selector: 'odx-card', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [A11yModule, ButtonComponent, IconComponent, MenuModule, ActionGroupComponent
|
|
186
|
+
args: [{ selector: 'odx-card', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [A11yModule, ButtonComponent, IconComponent, MenuModule, ActionGroupComponent], hostDirectives: [InteractiveDirective], template: "@if (!launchTile) {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-card-image\" />\n <div class=\"odx-card__title odx-heading-5\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"[odxCardContent], odx-card-content\" />\n </div>\n} @else {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-avatar\" />\n <div class=\"odx-card__content\">\n <div class=\"odx-card__title\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"odx-launch-card-subtitle\" />\n </div>\n </div>\n}\n\n<ng-content select=\"odx-card-footer\" />\n\n@if (menu) {\n <odx-action-group class=\"odx-card__menu\">\n <button odxButton [odxMenu]=\"menuTpl\" odxMenuPosition=\"bottom-end\"><odx-icon [name]=\"menuIcon\" iconSet=\"core\" /></button>\n\n <ng-template #menuTpl>\n <ng-content select=\"odx-menu\" />\n </ng-template>\n </odx-action-group>\n} @else if (buttons) {\n <ng-content select=\"odx-action-group\" />\n}\n\n<ng-template #content>\n <ng-content />\n</ng-template>\n" }]
|
|
187
187
|
}], ctorParameters: () => [], propDecorators: { menu: [{
|
|
188
188
|
type: ContentChild,
|
|
189
189
|
args: [MenuComponent]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-components-card.mjs","sources":["../../../../libs/angular/components/card/src/lib/models/card-variant.ts","../../../../libs/angular/components/card/src/lib/card.config.ts","../../../../libs/angular/components/card/src/lib/components/card-footer/card-footer.component.ts","../../../../libs/angular/components/card/src/lib/components/card-footer/card-footer.component.html","../../../../libs/angular/components/card/src/lib/components/card-image/card-image.component.ts","../../../../libs/angular/components/card/src/lib/components/card-image/card-image.component.html","../../../../libs/angular/components/card/src/lib/components/launch-card-subtitle/launch-card-subtitle.component.ts","../../../../libs/angular/components/card/src/lib/components/launch-card-subtitle/launch-card-subtitle.component.html","../../../../libs/angular/components/card/src/lib/card.component.ts","../../../../libs/angular/components/card/src/lib/card.component.html","../../../../libs/angular/components/card/src/lib/directives/card-content.directive.ts","../../../../libs/angular/components/card/src/lib/card.module.ts","../../../../libs/angular/components/card/src/odx-angular-components-card.ts"],"sourcesContent":["export type CardVariant = (typeof CardVariant)[keyof typeof CardVariant];\n\nexport const CardVariant = {\n DEFAULT: 'default',\n LAUNCH_TILE: 'launch-tile',\n LAUNCH_TILE_CENTERED: 'launch-tile-centered',\n IMAGE_CARD: 'image-card',\n} as const;\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { CardVariant } from './models';\n\nexport interface CardConfig {\n variant?: CardVariant;\n maxImageHeight?: string;\n imageRatio?: string;\n}\n\n/**\n * Tools for customizing configuration for the card component\n *\n * @example\n * ```ts\n * @Component({\n * ...\n * providers: [provideCardConfig({imageRatio: '5/3', maxImageHeight: '200px'})]\n * })\n * export class MyCardComponent {}\n * ```\n * @example\n * ```ts\n * constructor(@Inject(CardConfig) private readonly cardConfig: CardConfig) {}\n * ```\n */\nexport const { CardConfig, CardDefaultConfig, injectCardConfig, provideCardConfig } = createConfigTokens('Card', '@odx/angular/components/card', {\n variant: CardVariant.DEFAULT as CardVariant,\n maxImageHeight: 'auto',\n imageRatio: 'auto',\n});\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n/**\n * Represents a card footer component.\n */\n@Component({\n selector: 'odx-card-footer',\n templateUrl: './card-footer.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.odx-card__footer]': 'true',\n },\n})\nexport class CardFooterComponent {}\n","<ng-content />\n","import { Component, HostBinding, Input } from '@angular/core';\nimport { ChipListRowComponent } from '@odx/angular/components/chip';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { injectCardConfig } from '../../card.config';\n\n/**\n * Represents a card image component.\n */\n@CSSComponent('card-image')\n@Component({\n selector: 'odx-card-image',\n templateUrl: './card-image.component.html',\n standalone: true,\n imports: [ChipListRowComponent],\n})\nexport class CardImageComponent {\n private readonly config = injectCardConfig();\n public readonly element = injectElement();\n\n /**\n * The ratio of the card image.\n *\n * @type {string}\n * @default 'auto'\n */\n @Input()\n public imageRatio = this.config.imageRatio ?? 'auto';\n\n /**\n * The maximum height of the card image.\n *\n * @type {string}\n * @default 'auto'\n */\n @Input()\n public maxImageHeight = this.config.maxImageHeight ?? 'auto';\n\n @HostBinding(`style.--odx-card-image-max-height`)\n protected get getMaxImageHeight(): string {\n return this.maxImageHeight ?? this.config.maxImageHeight ?? 'auto';\n }\n\n @HostBinding(`style.--odx-card-image-aspect-ratio`)\n protected get getImageAspectRatio(): string {\n return this.imageRatio ?? this.config.imageRatio ?? 'auto';\n }\n}\n","<odx-chip-list-row>\n <ng-content ngProjectAs=\"odx-chip\" select=\"odx-chip\" />\n</odx-chip-list-row>\n\n<figure class=\"odx-card-image__img\">\n <ng-content select=\"img\" />\n</figure>\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n/**\n * Represents a launch card subtitle component.\n */\n@Component({\n selector: 'odx-launch-card-subtitle',\n templateUrl: './launch-card-subtitle.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.odx-card__subtitle]': 'true',\n },\n})\nexport class LaunchCardSubtitleComponent {}\n","<ng-content />\n","import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, EventEmitter, inject, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';\nimport { A11yModule, InteractiveDirective } from '@odx/angular/cdk/a11y';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { ChipListRowComponent } from '@odx/angular/components/chip';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { MenuComponent, MenuDirective, MenuModule } from '@odx/angular/components/menu';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { containsElement, injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { injectCardConfig } from './card.config';\nimport { CardFooterComponent } from './components';\nimport { CardVariant } from './models';\n\n/**\n * Represents a card component.\n * It can contain a header, body, and footer. The card component can also have a menu and action buttons.\n * Has host directive for interactivity.\n *\n * @see {InteractiveDirective}\n */\n@CSSComponent('card')\n@Component({\n selector: 'odx-card',\n templateUrl: './card.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [A11yModule, ButtonComponent, IconComponent, MenuModule, ActionGroupComponent, ChipListRowComponent],\n hostDirectives: [InteractiveDirective],\n})\nexport class CardComponent {\n private readonly interactiveDirective = inject(InteractiveDirective, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n private readonly config = injectCardConfig();\n\n protected cardVariant = CardVariant;\n\n @ContentChild(MenuComponent)\n protected readonly menu?: MenuComponent;\n\n @ContentChild(ActionGroupComponent)\n protected readonly buttons?: ActionGroupComponent;\n\n @ViewChild(MenuDirective)\n protected readonly menuHost?: MenuDirective;\n\n @ContentChild(CardFooterComponent, { read: ElementRef })\n protected readonly footer?: ElementRef<HTMLElement>;\n\n public element = injectElement();\n /**\n * The variant of the card.\n *\n * @type {CardVariant}\n * @default CardVariant.DEFAULT\n */\n\n @CSSModifier()\n @Input()\n public variant: CardVariant = this.config.variant ?? CardVariant.DEFAULT;\n\n /**\n * Menu icon name.\n *\n * @type {string}\n * @default 'more'\n */\n @Input()\n public menuIcon = 'more';\n\n /**\n * Interactivity event emitter.\n *\n * @emits {Event}\n */\n @Output()\n public interact = new EventEmitter<Event>();\n\n public get launchTile(): boolean {\n return this.variant === CardVariant.LAUNCH_TILE || this.variant === CardVariant.LAUNCH_TILE_CENTERED;\n }\n\n constructor() {\n this.interactiveDirective.interact.pipe(this.takeUntilDestroyed()).subscribe((event) => {\n this.stopEvents(event);\n });\n }\n\n private stopEvents(event: Event): void {\n const target = event.target as Element | null;\n const isFooterEvent = containsElement(this.footer?.nativeElement, target, false);\n const isMenuEvent = containsElement(this.menuHost?.element.nativeElement, target);\n const isHeaderButtonEvent = containsElement(this.buttons?.element.nativeElement, target);\n\n if (!isFooterEvent && !isMenuEvent && !this.menuHost?.isOpen() && !isHeaderButtonEvent) {\n this.interact.emit(event);\n }\n }\n}\n","@if (!launchTile) {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-card-image\" />\n <div class=\"odx-card__title odx-heading-5\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"[odxCardContent], odx-card-content\" />\n </div>\n} @else {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-avatar\" />\n <div class=\"odx-card__content\">\n <div class=\"odx-card__title\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"odx-launch-card-subtitle\" />\n </div>\n </div>\n}\n\n<ng-content select=\"odx-card-footer\" />\n\n@if (menu) {\n <odx-action-group class=\"odx-card__menu\">\n <button odxButton [odxMenu]=\"menuTpl\" odxMenuPosition=\"bottom-end\"><odx-icon [name]=\"menuIcon\" iconSet=\"core\" /></button>\n\n <ng-template #menuTpl>\n <ng-content select=\"odx-menu\" />\n </ng-template>\n </odx-action-group>\n} @else if (buttons) {\n <ng-content select=\"odx-action-group\" />\n}\n\n<ng-template #content>\n <ng-content />\n</ng-template>\n","import { Directive } from '@angular/core';\n\n/**\n * Directive for displaying the content of a card.\n */\n@Directive({\n selector: '[odxCardContent], odx-card-content',\n standalone: true,\n host: {\n '[class.odx-card__content]': 'true',\n },\n})\nexport class CardContentDirective {}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { CardComponent } from './card.component';\nimport { CardFooterComponent, CardImageComponent, LaunchCardSubtitleComponent } from './components';\nimport { CardContentDirective } from './directives';\n\nconst modules = [CardComponent, CardFooterComponent, CardImageComponent, LaunchCardSubtitleComponent, CardContentDirective];\n\n@NgModule({\n imports: [modules],\n exports: [CoreModule, ...modules],\n})\nexport class CardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEa,MAAA,WAAW,GAAG;AACzB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,UAAU,EAAE,YAAY;;;ACG1B;;;;;;;;;;;;;;;AAeG;AACI,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,8BAA8B,EAAE;IAC/I,OAAO,EAAE,WAAW,CAAC,OAAsB;AAC3C,IAAA,cAAc,EAAE,MAAM;AACtB,IAAA,UAAU,EAAE,MAAM;AACnB,CAAA,CAAC;;AC3BF;;AAEG;MAWU,mBAAmB,CAAA;+GAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,mBAAmB,uICfhC,kBACA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;4FDca,mBAAmB,EAAA,UAAA,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AA,IAAI,EAAE;AACJ,wBAAA,2BAA2B,EAAE,MAAM;AACpC,qBAAA;AACF,iBAAA,CAAA;;;ACLD,MAAM,OAAO,GAAG,CAAC,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;MAM/G,UAAU,CAAA;+GAAV,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAV,UAAU,EAAA,OAAA,EAAA,CANN,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,aAI9G,UAAU,EAJL,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,CAAA,EAAA,CAAA,CAAA,EAAA;AAM7G,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,EANN,OAAA,EAAA,CAAA,aAAa,EAAuB,kBAAkB,EAI3D,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,UAAU,EAAA,UAAA,EAAA,CAAA;kBAJtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,OAAO,CAAC;AAClB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-components-card.mjs","sources":["../../../../libs/angular/components/card/src/lib/models/card-variant.ts","../../../../libs/angular/components/card/src/lib/card.config.ts","../../../../libs/angular/components/card/src/lib/components/card-footer/card-footer.component.ts","../../../../libs/angular/components/card/src/lib/components/card-footer/card-footer.component.html","../../../../libs/angular/components/card/src/lib/components/card-image/card-image.component.ts","../../../../libs/angular/components/card/src/lib/components/card-image/card-image.component.html","../../../../libs/angular/components/card/src/lib/components/launch-card-subtitle/launch-card-subtitle.component.ts","../../../../libs/angular/components/card/src/lib/components/launch-card-subtitle/launch-card-subtitle.component.html","../../../../libs/angular/components/card/src/lib/card.component.ts","../../../../libs/angular/components/card/src/lib/card.component.html","../../../../libs/angular/components/card/src/lib/directives/card-content.directive.ts","../../../../libs/angular/components/card/src/lib/card.module.ts","../../../../libs/angular/components/card/src/odx-angular-components-card.ts"],"sourcesContent":["export type CardVariant = (typeof CardVariant)[keyof typeof CardVariant];\n\nexport const CardVariant = {\n DEFAULT: 'default',\n LAUNCH_TILE: 'launch-tile',\n LAUNCH_TILE_CENTERED: 'launch-tile-centered',\n IMAGE_CARD: 'image-card',\n} as const;\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { CardVariant } from './models';\n\nexport interface CardConfig {\n variant?: CardVariant;\n maxImageHeight?: string;\n imageRatio?: string;\n}\n\n/**\n * Tools for customizing configuration for the card component\n *\n * @example\n * ```ts\n * @Component({\n * ...\n * providers: [provideCardConfig({imageRatio: '5/3', maxImageHeight: '200px'})]\n * })\n * export class MyCardComponent {}\n * ```\n * @example\n * ```ts\n * constructor(@Inject(CardConfig) private readonly cardConfig: CardConfig) {}\n * ```\n */\nexport const { CardConfig, CardDefaultConfig, injectCardConfig, provideCardConfig } = createConfigTokens('Card', '@odx/angular/components/card', {\n variant: CardVariant.DEFAULT as CardVariant,\n maxImageHeight: 'auto',\n imageRatio: 'auto',\n});\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n/**\n * Represents a card footer component.\n */\n@Component({\n selector: 'odx-card-footer',\n templateUrl: './card-footer.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.odx-card__footer]': 'true',\n },\n})\nexport class CardFooterComponent {}\n","<ng-content />\n","import { Component, HostBinding, Input } from '@angular/core';\nimport { ChipListRowComponent } from '@odx/angular/components/chip';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { injectElement } from '@odx/angular/utils';\nimport { injectCardConfig } from '../../card.config';\n\n/**\n * Represents a card image component.\n */\n@CSSComponent('card-image')\n@Component({\n selector: 'odx-card-image',\n templateUrl: './card-image.component.html',\n standalone: true,\n imports: [ChipListRowComponent],\n})\nexport class CardImageComponent {\n private readonly config = injectCardConfig();\n public readonly element = injectElement();\n\n /**\n * The ratio of the card image.\n *\n * @type {string}\n * @default 'auto'\n */\n @Input()\n public imageRatio = this.config.imageRatio ?? 'auto';\n\n /**\n * The maximum height of the card image.\n *\n * @type {string}\n * @default 'auto'\n */\n @Input()\n public maxImageHeight = this.config.maxImageHeight ?? 'auto';\n\n @HostBinding(`style.--odx-card-image-max-height`)\n protected get getMaxImageHeight(): string {\n return this.maxImageHeight ?? this.config.maxImageHeight ?? 'auto';\n }\n\n @HostBinding(`style.--odx-card-image-aspect-ratio`)\n protected get getImageAspectRatio(): string {\n return this.imageRatio ?? this.config.imageRatio ?? 'auto';\n }\n}\n","<odx-chip-list-row>\n <ng-content ngProjectAs=\"odx-chip\" select=\"odx-chip\" />\n</odx-chip-list-row>\n\n<figure class=\"odx-card-image__img\">\n <ng-content select=\"img\" />\n</figure>\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n/**\n * Represents a launch card subtitle component.\n */\n@Component({\n selector: 'odx-launch-card-subtitle',\n templateUrl: './launch-card-subtitle.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.odx-card__subtitle]': 'true',\n },\n})\nexport class LaunchCardSubtitleComponent {}\n","<ng-content />\n","import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, EventEmitter, inject, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';\nimport { A11yModule, InteractiveDirective } from '@odx/angular/cdk/a11y';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { MenuComponent, MenuDirective, MenuModule } from '@odx/angular/components/menu';\nimport { CSSComponent, CSSModifier } from '@odx/angular/internal';\nimport { containsElement, injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { injectCardConfig } from './card.config';\nimport { CardFooterComponent } from './components';\nimport { CardVariant } from './models';\n\n/**\n * Represents a card component.\n * It can contain a header, body, and footer. The card component can also have a menu and action buttons.\n * Has host directive for interactivity.\n *\n * @see {InteractiveDirective}\n */\n@CSSComponent('card')\n@Component({\n selector: 'odx-card',\n templateUrl: './card.component.html',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [A11yModule, ButtonComponent, IconComponent, MenuModule, ActionGroupComponent],\n hostDirectives: [InteractiveDirective],\n})\nexport class CardComponent {\n private readonly interactiveDirective = inject(InteractiveDirective, { host: true });\n private readonly takeUntilDestroyed = untilDestroyed();\n private readonly config = injectCardConfig();\n\n protected cardVariant = CardVariant;\n\n @ContentChild(MenuComponent)\n protected readonly menu?: MenuComponent;\n\n @ContentChild(ActionGroupComponent)\n protected readonly buttons?: ActionGroupComponent;\n\n @ViewChild(MenuDirective)\n protected readonly menuHost?: MenuDirective;\n\n @ContentChild(CardFooterComponent, { read: ElementRef })\n protected readonly footer?: ElementRef<HTMLElement>;\n\n public element = injectElement();\n /**\n * The variant of the card.\n *\n * @type {CardVariant}\n * @default CardVariant.DEFAULT\n */\n\n @CSSModifier()\n @Input()\n public variant: CardVariant = this.config.variant ?? CardVariant.DEFAULT;\n\n /**\n * Menu icon name.\n *\n * @type {string}\n * @default 'more'\n */\n @Input()\n public menuIcon = 'more';\n\n /**\n * Interactivity event emitter.\n *\n * @emits {Event}\n */\n @Output()\n public interact = new EventEmitter<Event>();\n\n public get launchTile(): boolean {\n return this.variant === CardVariant.LAUNCH_TILE || this.variant === CardVariant.LAUNCH_TILE_CENTERED;\n }\n\n constructor() {\n this.interactiveDirective.interact.pipe(this.takeUntilDestroyed()).subscribe((event) => {\n this.stopEvents(event);\n });\n }\n\n private stopEvents(event: Event): void {\n const target = event.target as Element | null;\n const isFooterEvent = containsElement(this.footer?.nativeElement, target, false);\n const isMenuEvent = containsElement(this.menuHost?.element.nativeElement, target);\n const isHeaderButtonEvent = containsElement(this.buttons?.element.nativeElement, target);\n\n if (!isFooterEvent && !isMenuEvent && !this.menuHost?.isOpen() && !isHeaderButtonEvent) {\n this.interact.emit(event);\n }\n }\n}\n","@if (!launchTile) {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-card-image\" />\n <div class=\"odx-card__title odx-heading-5\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"[odxCardContent], odx-card-content\" />\n </div>\n} @else {\n <div class=\"odx-card__container\">\n <ng-content select=\"odx-avatar\" />\n <div class=\"odx-card__content\">\n <div class=\"odx-card__title\">\n <ng-container *ngTemplateOutlet=\"content\" />\n </div>\n <ng-content select=\"odx-launch-card-subtitle\" />\n </div>\n </div>\n}\n\n<ng-content select=\"odx-card-footer\" />\n\n@if (menu) {\n <odx-action-group class=\"odx-card__menu\">\n <button odxButton [odxMenu]=\"menuTpl\" odxMenuPosition=\"bottom-end\"><odx-icon [name]=\"menuIcon\" iconSet=\"core\" /></button>\n\n <ng-template #menuTpl>\n <ng-content select=\"odx-menu\" />\n </ng-template>\n </odx-action-group>\n} @else if (buttons) {\n <ng-content select=\"odx-action-group\" />\n}\n\n<ng-template #content>\n <ng-content />\n</ng-template>\n","import { Directive } from '@angular/core';\n\n/**\n * Directive for displaying the content of a card.\n */\n@Directive({\n selector: '[odxCardContent], odx-card-content',\n standalone: true,\n host: {\n '[class.odx-card__content]': 'true',\n },\n})\nexport class CardContentDirective {}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { CardComponent } from './card.component';\nimport { CardFooterComponent, CardImageComponent, LaunchCardSubtitleComponent } from './components';\nimport { CardContentDirective } from './directives';\n\nconst modules = [CardComponent, CardFooterComponent, CardImageComponent, LaunchCardSubtitleComponent, CardContentDirective];\n\n@NgModule({\n imports: [modules],\n exports: [CoreModule, ...modules],\n})\nexport class CardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEa,MAAA,WAAW,GAAG;AACzB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,UAAU,EAAE,YAAY;;;ACG1B;;;;;;;;;;;;;;;AAeG;AACI,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,8BAA8B,EAAE;IAC/I,OAAO,EAAE,WAAW,CAAC,OAAsB;AAC3C,IAAA,cAAc,EAAE,MAAM;AACtB,IAAA,UAAU,EAAE,MAAM;AACnB,CAAA,CAAC;;AC3BF;;AAEG;MAWU,mBAAmB,CAAA;+GAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,mBAAmB,uICfhC,kBACA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;4FDca,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAV/B,SAAS;+BACE,iBAAiB,EAAA,UAAA,EAEf,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,EAChC,aAAA,E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,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,CAAC,CAAC;MAM/G,UAAU,CAAA;+GAAV,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAV,UAAU,EAAA,OAAA,EAAA,CANN,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,aAI9G,UAAU,EAJL,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,oBAAoB,CAAA,EAAA,CAAA,CAAA,EAAA;AAM7G,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,EANN,OAAA,EAAA,CAAA,aAAa,EAAuB,kBAAkB,EAI3D,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,UAAU,EAAA,UAAA,EAAA,CAAA;kBAJtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,OAAO,CAAC;AAClB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACXD;;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 {
|
|
17
|
-
import {
|
|
18
|
+
import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
|
|
19
|
+
import { startOfDay, format } from 'date-fns';
|
|
18
20
|
import { NgxMaskPipe, provideNgxMask } from 'ngx-mask';
|
|
19
21
|
import { fromEvent, distinctUntilChanged, tap, map } from 'rxjs';
|
|
20
22
|
|
|
21
|
-
const DatepickerInputDateOrder = {
|
|
22
|
-
DMY: 'DMY',
|
|
23
|
-
MDY: 'MDY',
|
|
24
|
-
YMD: 'YMD',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const DatepickerInputFormat = {
|
|
28
|
-
DAYS: 'dd',
|
|
29
|
-
MONTH: 'MM',
|
|
30
|
-
YEAR: 'yyyy',
|
|
31
|
-
};
|
|
32
|
-
const DatepickerInputMask = {
|
|
33
|
-
DAYS: 'd0',
|
|
34
|
-
MONTH: 'M0',
|
|
35
|
-
YEAR: '0000',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Tools for injecting and providing the datepicker configuration with default configuration for the datepicker.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Providing custom datepicker configuration.
|
|
43
|
-
* ```ts
|
|
44
|
-
* @Component({
|
|
45
|
-
* providers: [provideDatepickerConfig({ inputDateOrder: DatepickerInputDateOrder.MDY, inputDateSeparator: '/'})]
|
|
46
|
-
* })
|
|
47
|
-
* export class MyComponent {}
|
|
48
|
-
*
|
|
49
|
-
* // Injecting the datepicker configuration.
|
|
50
|
-
* ```ts
|
|
51
|
-
* @Component({})
|
|
52
|
-
* export class MyComponent {
|
|
53
|
-
* constructor(@Inject(injectDatepickerConfig()) private readonly datepickerConfig: DatepickerConfig) {}
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
const { DatepickerConfig, DatepickerDefaultConfig, injectDatepickerConfig, provideDatepickerConfig } = createConfigTokens('Datepicker', '@odx/angular/components/datepicker', {
|
|
58
|
-
inputDateOrder: DatepickerInputDateOrder.DMY,
|
|
59
|
-
inputDateSeparator: '.',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
function getDatepickerInputPattern({ inputDateOrder, inputDateSeparator }, pattern) {
|
|
63
|
-
const patternList = {
|
|
64
|
-
[DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,
|
|
65
|
-
[DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,
|
|
66
|
-
[DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,
|
|
67
|
-
};
|
|
68
|
-
return patternList[inputDateOrder];
|
|
69
|
-
}
|
|
70
|
-
/** @internal */
|
|
71
|
-
function getDatepickerInputFormat(config) {
|
|
72
|
-
return getDatepickerInputPattern(config, DatepickerInputFormat);
|
|
73
|
-
}
|
|
74
|
-
/** @internal */
|
|
75
|
-
function getDatepickerInputMask(config) {
|
|
76
|
-
return getDatepickerInputPattern(config, DatepickerInputMask);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const functionList = {
|
|
80
|
-
[DatepickerInputDateOrder.DMY]: (splittedValue) => {
|
|
81
|
-
const [day, month, year] = splittedValue;
|
|
82
|
-
return { month, day, year };
|
|
83
|
-
},
|
|
84
|
-
[DatepickerInputDateOrder.MDY]: (splittedValue) => {
|
|
85
|
-
const [month, day, year] = splittedValue;
|
|
86
|
-
return { month, day, year };
|
|
87
|
-
},
|
|
88
|
-
[DatepickerInputDateOrder.YMD]: (splittedValue) => {
|
|
89
|
-
const [year, month, day] = splittedValue;
|
|
90
|
-
return { month, day, year };
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
function getDateCandidate({ inputDateOrder, inputDateSeparator }, value) {
|
|
94
|
-
const splittedValue = value.split(inputDateSeparator);
|
|
95
|
-
const { month, day, year } = functionList[inputDateOrder](splittedValue);
|
|
96
|
-
const isDateCandidateInvalid = !month || !day || !year;
|
|
97
|
-
return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;
|
|
98
|
-
}
|
|
99
|
-
/** @internal */
|
|
100
|
-
function getDatepickerInputValueAsDate(config, value) {
|
|
101
|
-
const dateCandidate = getDateCandidate(config, value);
|
|
102
|
-
if (!dateCandidate)
|
|
103
|
-
return null;
|
|
104
|
-
const date = toDate(Date.parse(dateCandidate));
|
|
105
|
-
return isValid(date) ? date : null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
23
|
/**
|
|
109
24
|
* A directive to enhance an input element as part of a datepicker control. It applies date input formatting,
|
|
110
25
|
* mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and
|
|
@@ -120,8 +35,8 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
120
35
|
super(...arguments);
|
|
121
36
|
this.maskConfig = { validation: false, leadZeroDateTime: true };
|
|
122
37
|
this.readonlyController = ReadonlyController.inject();
|
|
123
|
-
this.config =
|
|
124
|
-
this.inputMask =
|
|
38
|
+
this.config = injectDateConfig();
|
|
39
|
+
this.inputMask = getDateInputMask(this.config);
|
|
125
40
|
this.ngxMaskPipe = inject(NgxMaskPipe);
|
|
126
41
|
/**
|
|
127
42
|
* Emits an event when the input field receives focus or loses focus, indicating the focus state.
|
|
@@ -150,7 +65,7 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
150
65
|
* @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.
|
|
151
66
|
*/
|
|
152
67
|
get valueAsDate() {
|
|
153
|
-
return
|
|
68
|
+
return getDateInputValueAsDate(this.config, this.nativeElementValue);
|
|
154
69
|
}
|
|
155
70
|
/**
|
|
156
71
|
* Computes the placeholder text for the input based on the date format from
|
|
@@ -159,7 +74,7 @@ let DatepickerInputControlDirective = class DatepickerInputControlDirective exte
|
|
|
159
74
|
* @returns {string} - The placeholder text, typically the date format in uppercase.
|
|
160
75
|
*/
|
|
161
76
|
get placeholder() {
|
|
162
|
-
return
|
|
77
|
+
return getDateInputFormat(this.config).toUpperCase();
|
|
163
78
|
}
|
|
164
79
|
handleFocusIn() {
|
|
165
80
|
this.focused.emit(true);
|
|
@@ -213,7 +128,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
213
128
|
constructor() {
|
|
214
129
|
super(null);
|
|
215
130
|
this.takeUntilDestroyed = untilDestroyed();
|
|
216
|
-
this.config =
|
|
131
|
+
this.config = injectDateConfig();
|
|
217
132
|
this.element = injectElement();
|
|
218
133
|
/**
|
|
219
134
|
* Represents the current date.
|
|
@@ -340,7 +255,7 @@ let DatepickerComponent = class DatepickerComponent extends CustomFormControl {
|
|
|
340
255
|
updateDateField(date) {
|
|
341
256
|
if (!this.dateField)
|
|
342
257
|
return;
|
|
343
|
-
const dateFormat =
|
|
258
|
+
const dateFormat = getDateInputFormat(this.config);
|
|
344
259
|
this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';
|
|
345
260
|
}
|
|
346
261
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -395,5 +310,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
395
310
|
* Generated bundle index. Do not edit.
|
|
396
311
|
*/
|
|
397
312
|
|
|
398
|
-
export { DatepickerComponent,
|
|
313
|
+
export { DatepickerComponent, DatepickerInputControlDirective, DatepickerModule };
|
|
399
314
|
//# sourceMappingURL=odx-angular-components-datepicker.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-components-datepicker.mjs","sources":["../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-date-order.ts","../../../../libs/angular/components/datepicker/src/lib/models/datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.config.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-pattern.ts","../../../../libs/angular/components/datepicker/src/lib/utils/get-datepicker-input-value-as-date.ts","../../../../libs/angular/components/datepicker/src/lib/directives/datepicker-input-control.directive.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.html","../../../../libs/angular/components/datepicker/src/lib/datepicker.module.ts","../../../../libs/angular/components/datepicker/src/odx-angular-components-datepicker.ts"],"sourcesContent":["export type DatepickerInputDateOrder = (typeof DatepickerInputDateOrder)[keyof typeof DatepickerInputDateOrder];\n\nexport const DatepickerInputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n","export type DatepickerInputPattern = typeof DatepickerInputFormat | typeof DatepickerInputMask;\n\nexport const DatepickerInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DatepickerInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { DatepickerInputDateOrder } from './models';\n\nexport interface DatepickerConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default DatepickerInputDateOrder.DMY\n */\n inputDateOrder: DatepickerInputDateOrder;\n /**\n * Single-character date's separator (dot, slash etc.).\n * @default '.'\n */\n inputDateSeparator: string;\n}\n\n/**\n * Tools for injecting and providing the datepicker configuration with default configuration for the datepicker.\n *\n * @example\n * // Providing custom datepicker configuration.\n * ```ts\n * @Component({\n * providers: [provideDatepickerConfig({ inputDateOrder: DatepickerInputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the datepicker configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDatepickerConfig()) private readonly datepickerConfig: DatepickerConfig) {}\n * }\n * ```\n */\nexport const { DatepickerConfig, DatepickerDefaultConfig, injectDatepickerConfig, provideDatepickerConfig } = createConfigTokens(\n 'Datepicker',\n '@odx/angular/components/datepicker',\n {\n inputDateOrder: DatepickerInputDateOrder.DMY,\n inputDateSeparator: '.',\n },\n);\n","import { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder, DatepickerInputFormat, DatepickerInputMask, DatepickerInputPattern } from '../models';\n\nfunction getDatepickerInputPattern({ inputDateOrder, inputDateSeparator }: DatepickerConfig, pattern: DatepickerInputPattern): string {\n const patternList: Record<DatepickerInputDateOrder, string> = {\n [DatepickerInputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [DatepickerInputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDatepickerInputFormat(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputFormat);\n}\n\n/** @internal */\nexport function getDatepickerInputMask(config: DatepickerConfig): string {\n return getDatepickerInputPattern(config, DatepickerInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DatepickerConfig } from '../datepicker.config';\nimport { DatepickerInputDateOrder } from '../models';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<DatepickerInputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [DatepickerInputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [DatepickerInputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DatepickerConfig, value: string): string | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n const isDateCandidateInvalid = !month || !day || !year;\n\n return isDateCandidateInvalid ? null : `${month}.${day}.${year}`;\n}\n\n/** @internal */\nexport function getDatepickerInputValueAsDate(config: DatepickerConfig, value: string): Date | null {\n const dateCandidate: string | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(Date.parse(dateCandidate));\n\n return isValid(date) ? date : null;\n}\n","import { Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskConfig, NgxMaskPipe, provideNgxMask } from 'ngx-mask';\nimport { distinctUntilChanged, fromEvent, map, tap } from 'rxjs';\nimport { injectDatepickerConfig } from '../datepicker.config';\nimport { getDatepickerInputFormat, getDatepickerInputMask, getDatepickerInputValueAsDate } from '../utils';\n\n/**\n * A directive to enhance an input element as part of a datepicker control. It applies date input formatting,\n * mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and\n * ensures that the input complies with the date format specified in the datepicker configuration.\n * Extends the `InputControlDirective` to provide input control functionality.\n * Has host directive `WithTabIndex` to manage the tabindex attribute of the input element.\n *\n * @see {InputControlDirective}\n * @see {WithTabIndex}\n */\n@CSSComponent('datepicker__control')\n@Directive({\n standalone: true,\n selector: 'input[odxDatepickerControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n '[attr.placeholder]': 'placeholder',\n },\n providers: [ReadonlyController.connect(), provideNgxMask(), NgxMaskPipe],\n hostDirectives: [WithTabIndex],\n})\nexport class DatepickerInputControlDirective extends InputControlDirective {\n private readonly maskConfig: Partial<NgxMaskConfig> = { validation: false, leadZeroDateTime: true };\n\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly config = injectDatepickerConfig();\n protected readonly inputMask = getDatepickerInputMask(this.config);\n protected readonly ngxMaskPipe = inject(NgxMaskPipe);\n\n /**\n * Emits an event when the input field receives focus or loses focus, indicating the focus state.\n *\n * @emits {boolean} - Indicates whether the input field is focused.\n */\n @Output()\n public focused = new EventEmitter<boolean>();\n\n /**\n * Observable stream capturing and processing input events on the native element, applying the mask,\n * and emitting the current value.\n *\n * @emits {string} - The current value of the input field.\n */\n public override valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n tap(() => this.applyMask()),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Applies the configured input mask to the native element's value.\n */\n public applyMask(): void {\n this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);\n }\n\n /**\n * Gets the current value of the input field as a `Date` object, based on the date format from the datepicker\n * configuration.\n *\n * @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.\n */\n public get valueAsDate(): Date | null {\n return getDatepickerInputValueAsDate(this.config, this.nativeElementValue);\n }\n\n /**\n * Computes the placeholder text for the input based on the date format from\n * the datepicker configuration.\n *\n * @returns {string} - The placeholder text, typically the date format in uppercase.\n */\n public get placeholder(): string {\n return getDatepickerInputFormat(this.config).toUpperCase();\n }\n\n @HostListener('focusin')\n protected handleFocusIn(): void {\n this.focused.emit(true);\n }\n\n @HostListener('focusout')\n protected handleFocusOut(): void {\n this.focused.emit(false);\n }\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n input,\n Input,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { CalendarComponent, DateFilter } from '@odx/angular/components/calendar';\nimport { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn, injectElement, Position, untilDestroyed } from '@odx/angular/utils';\nimport { format, startOfDay } from 'date-fns';\nimport { injectDatepickerConfig } from './datepicker.config';\nimport { DatepickerInputControlDirective } from './directives';\nimport { getDatepickerInputFormat } from './utils';\n\n/**\n * Represents a datepicker component for selecting a date.\n * Extends the `CustomFormControl` class and implements the `AfterViewInit` interface.\n *\n * @see {CustomFormControl}\n */\n@CSSComponent('datepicker')\n@Component({\n selector: 'odx-datepicker',\n standalone: true,\n imports: [A11yModule, ActionGroupComponent, ButtonComponent, CalendarComponent, DropdownModule, IconComponent],\n templateUrl: './datepicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class DatepickerComponent extends CustomFormControl<Date | null> implements AfterViewInit {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected readonly config = injectDatepickerConfig();\n\n public readonly element = injectElement();\n\n /**\n * Gets a value indicating whether the datepicker is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return !!this.dropdown.isOpen;\n }\n\n /**\n * Represents the current date.\n *\n * @type {Date}\n */\n public today = new Date();\n\n /**\n * The filter function used to determine if a date should be included or excluded in the datepicker.\n * If set to `null`, no filtering will be applied.\n *\n * @type {DateFilter | null}\n * @default null\n *\n * @example\n * ```ts\n * // Excludes mondays from the datepicker.\n * const filterFn: DateFilter = (date) => date.getDay() !== 1;\n * ```\n */\n @Input()\n public filterFn: DateFilter | null = null;\n\n /**\n * The minimum selectable date for the datepicker.\n * If set to null, there is no minimum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public minDate: Date | null = null;\n\n /**\n * The maximum selectable date for the datepicker.\n * If set to null, there is no maximum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public maxDate: Date | null = null;\n\n /**\n * The position of the dropdown relative to the input field.\n *\n * @type {Position}\n * @default Position.BOTTOM\n */\n @Input()\n public dropdownPosition: Position = 'bottom';\n\n /**\n * When set to true, the select will display a reset button.\n *\n * @type {boolean}\n * @default false\n */\n public clearable = input(false, { transform: booleanAttribute });\n\n /**\n * Emits the selected date when it changes.\n *\n * @emits {Date}\n */\n @Output()\n public selectedChange = new EventEmitter<Date>();\n\n /**\n * The dropdown directive used in the datepicker component.\n *\n * @type {DropdownDirective}\n */\n @ViewChild(DropdownDirective)\n public dropdown!: DropdownDirective;\n\n /**\n * The dropdown trigger element used in the datepicker component.\n *\n * @type {ElementRef<HTMLElement>}\n */\n @ViewChild('dropdownTrigger', { read: ElementRef, static: true })\n public dropdownTriggerElement!: ElementRef<HTMLElement>;\n\n /**\n * The date field input control directive used in the datepicker component.\n *\n * @type {DatepickerInputControlDirective | undefined}\n */\n @ContentChild(DatepickerInputControlDirective)\n public dateField?: DatepickerInputControlDirective;\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n this.handleDateFieldChanges();\n this.handleDateFieldFocus();\n\n deferFn(() => {\n if (!this.value) return;\n this.updateDateField(startOfDay(this.value));\n });\n }\n\n /**\n * Selects a date.\n *\n * @param {Date | null} value - The date value to be selected.\n */\n public selectDate(value: Date | null): void {\n if (!value) return;\n\n this.updateInternalValue(value);\n\n this.selectedChange.emit(value);\n\n this.dropdown.close();\n }\n\n /**\n * Resets the datepicker's value to null.\n */\n public reset(): void {\n this.updateInternalValue(null);\n }\n\n /**\n * @internal\n * Writes a new value to the element.\n * Part of the ControlValueAccessor interface.\n * @param {Date | null} value - The new value.\n */\n public override writeValue(value: Date | null): void {\n super.writeValue(value);\n this.updateDateField(value);\n }\n\n protected updateInternalValue(value: Date | null): void {\n this.updateValue(value);\n this.updateDateField(value);\n }\n\n protected handleDateFieldChanges(): void {\n this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => {\n if (!this.dateField?.valueAsDate) return;\n this.updateValue(this.dateField?.valueAsDate ?? null);\n });\n }\n\n protected handleDateFieldFocus(): void {\n this.dateField?.focused.pipe(this.takeUntilDestroyed()).subscribe((isFocused) => {\n if (!isFocused) {\n this.onTouched();\n }\n if (this.isOpen) {\n this.dropdown.close();\n }\n });\n }\n\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n protected openDatepicker(event: KeyboardEvent) {\n event.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\n }\n\n private updateDateField(date: Date | null): void {\n if (!this.dateField) return;\n\n const dateFormat = getDatepickerInputFormat(this.config);\n this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';\n }\n}\n","<ng-content select=\"input[odxDatepickerControl]\" />\n\n<odx-action-group class=\"odx-datepicker__trigger-wrapper\">\n @if (clearable() && value) {\n <button odxButton class=\"odx-datepicker__clear\" (click)=\"reset()\" size=\"small\" aria-label=\"Reset time\">\n <odx-icon name=\"close\" iconSet=\"core\" />\n </button>\n }\n <button\n #dropdownTrigger\n odxButton\n size=\"small\"\n variant=\"ghost\"\n class=\"odx-datepicker__trigger\"\n [odxDropdown]=\"calendarOverlay\"\n [odxDropdownOptions]=\"{ position: dropdownPosition }\"\n [odxDropdownTriggerElement]=\"dropdownTriggerElement.nativeElement\"\n [odxDropdownHost]=\"null\"\n [odxDropdownReferenceElement]=\"element.nativeElement\"\n (odxDropdownBeforeClose)=\"onTouched()\"\n >\n <odx-icon name=\"calendar\" />\n </button>\n <ng-content select=\"[odxButton]\" ngProjectAs=\"[odxButton]\" />\n</odx-action-group>\n\n<ng-template #calendarOverlay>\n <odx-calendar\n [selectedDate]=\"value || today\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n (selectedDateChange)=\"selectDate($event)\"\n />\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { DatepickerComponent } from './datepicker.component';\nimport { DatepickerInputControlDirective } from './directives';\n\nconst modules = [DatepickerComponent, DatepickerInputControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class DatepickerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEa,MAAA,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;;;;;;;;;;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;;AE3NnD,MAAM,OAAO,GAAG,CAAC,mBAAmB,EAAE,+BAA+B,CAAC,CAAC;MAM1D,gBAAgB,CAAA;+GAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAhB,gBAAgB,EAAA,OAAA,EAAA,CANZ,mBAAmB,EAAE,+BAA+B,aAIzD,UAAU,EAJL,mBAAmB,EAAE,+BAA+B,CAAA,EAAA,CAAA,CAAA,EAAA;gHAMxD,gBAAgB,EAAA,OAAA,EAAA,CANZ,mBAAmB,EAIxB,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-components-datepicker.mjs","sources":["../../../../libs/angular/components/datepicker/src/lib/directives/datepicker-input-control.directive.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.ts","../../../../libs/angular/components/datepicker/src/lib/datepicker.component.html","../../../../libs/angular/components/datepicker/src/lib/datepicker.module.ts","../../../../libs/angular/components/datepicker/src/odx-angular-components-datepicker.ts"],"sourcesContent":["import { Directive, EventEmitter, HostListener, inject, Output } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { getDateInputFormat, getDateInputMask, getDateInputValueAsDate, injectDateConfig } from '@odx/angular/cdk/date-input';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgxMaskConfig, NgxMaskPipe, provideNgxMask } from 'ngx-mask';\nimport { distinctUntilChanged, fromEvent, map, tap } from 'rxjs';\n\n/**\n * A directive to enhance an input element as part of a datepicker control. It applies date input formatting,\n * mask handling, and emits focus events. This directive integrates with ngx-mask to handle input masking and\n * ensures that the input complies with the date format specified in the datepicker configuration.\n * Extends the `InputControlDirective` to provide input control functionality.\n * Has host directive `WithTabIndex` to manage the tabindex attribute of the input element.\n *\n * @see {InputControlDirective}\n * @see {WithTabIndex}\n */\n@CSSComponent('datepicker__control')\n@Directive({\n standalone: true,\n selector: 'input[odxDatepickerControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n '[attr.placeholder]': 'placeholder',\n },\n providers: [ReadonlyController.connect(), provideNgxMask(), NgxMaskPipe],\n hostDirectives: [WithTabIndex],\n})\nexport class DatepickerInputControlDirective extends InputControlDirective {\n private readonly maskConfig: Partial<NgxMaskConfig> = { validation: false, leadZeroDateTime: true };\n\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly config = injectDateConfig();\n protected readonly inputMask = getDateInputMask(this.config);\n protected readonly ngxMaskPipe = inject(NgxMaskPipe);\n\n /**\n * Emits an event when the input field receives focus or loses focus, indicating the focus state.\n *\n * @emits {boolean} - Indicates whether the input field is focused.\n */\n @Output()\n public focused = new EventEmitter<boolean>();\n\n /**\n * Observable stream capturing and processing input events on the native element, applying the mask,\n * and emitting the current value.\n *\n * @emits {string} - The current value of the input field.\n */\n public override valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n tap(() => this.applyMask()),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Applies the configured input mask to the native element's value.\n */\n public applyMask(): void {\n this.nativeElementValue = this.ngxMaskPipe.transform(this.nativeElementValue, this.inputMask, this.maskConfig);\n }\n\n /**\n * Gets the current value of the input field as a `Date` object, based on the date format from the datepicker\n * configuration.\n *\n * @returns {Date | null} - The current value of the input field as a `Date` object, or `null` if the value is invalid.\n */\n public get valueAsDate(): Date | null {\n return getDateInputValueAsDate(this.config, this.nativeElementValue);\n }\n\n /**\n * Computes the placeholder text for the input based on the date format from\n * the datepicker configuration.\n *\n * @returns {string} - The placeholder text, typically the date format in uppercase.\n */\n public get placeholder(): string {\n return getDateInputFormat(this.config).toUpperCase();\n }\n\n @HostListener('focusin')\n protected handleFocusIn(): void {\n this.focused.emit(true);\n }\n\n @HostListener('focusout')\n protected handleFocusOut(): void {\n this.focused.emit(false);\n }\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostListener,\n input,\n Input,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { getDateInputFormat, injectDateConfig } from '@odx/angular/cdk/date-input';\nimport { ActionGroupComponent } from '@odx/angular/components/action-group';\nimport { ButtonComponent } from '@odx/angular/components/button';\nimport { CalendarComponent, DateFilter } from '@odx/angular/components/calendar';\nimport { DropdownDirective, DropdownModule } from '@odx/angular/components/dropdown';\nimport { IconComponent } from '@odx/angular/components/icon';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn, injectElement, Position, untilDestroyed } from '@odx/angular/utils';\nimport { format, startOfDay } from 'date-fns';\nimport { DatepickerInputControlDirective } from './directives';\n\n/**\n * Represents a datepicker component for selecting a date.\n * Extends the `CustomFormControl` class and implements the `AfterViewInit` interface.\n *\n * @see {CustomFormControl}\n */\n@CSSComponent('datepicker')\n@Component({\n selector: 'odx-datepicker',\n standalone: true,\n imports: [A11yModule, ActionGroupComponent, ButtonComponent, CalendarComponent, DropdownModule, IconComponent],\n templateUrl: './datepicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class DatepickerComponent extends CustomFormControl<Date | null> implements AfterViewInit {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected readonly config = injectDateConfig();\n\n public readonly element = injectElement();\n\n /**\n * Gets a value indicating whether the datepicker is currently open.\n *\n * @returns {boolean}\n */\n public get isOpen(): boolean {\n return !!this.dropdown.isOpen;\n }\n\n /**\n * Represents the current date.\n *\n * @type {Date}\n */\n public today = new Date();\n\n /**\n * The filter function used to determine if a date should be included or excluded in the datepicker.\n * If set to `null`, no filtering will be applied.\n *\n * @type {DateFilter | null}\n * @default null\n *\n * @example\n * ```ts\n * // Excludes mondays from the datepicker.\n * const filterFn: DateFilter = (date) => date.getDay() !== 1;\n * ```\n */\n @Input()\n public filterFn: DateFilter | null = null;\n\n /**\n * The minimum selectable date for the datepicker.\n * If set to null, there is no minimum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public minDate: Date | null = null;\n\n /**\n * The maximum selectable date for the datepicker.\n * If set to null, there is no maximum date restriction.\n *\n * @type {Date | null}\n * @default null\n */\n @Input()\n public maxDate: Date | null = null;\n\n /**\n * The position of the dropdown relative to the input field.\n *\n * @type {Position}\n * @default Position.BOTTOM\n */\n @Input()\n public dropdownPosition: Position = 'bottom';\n\n /**\n * When set to true, the select will display a reset button.\n *\n * @type {boolean}\n * @default false\n */\n public clearable = input(false, { transform: booleanAttribute });\n\n /**\n * Emits the selected date when it changes.\n *\n * @emits {Date}\n */\n @Output()\n public selectedChange = new EventEmitter<Date>();\n\n /**\n * The dropdown directive used in the datepicker component.\n *\n * @type {DropdownDirective}\n */\n @ViewChild(DropdownDirective)\n public dropdown!: DropdownDirective;\n\n /**\n * The dropdown trigger element used in the datepicker component.\n *\n * @type {ElementRef<HTMLElement>}\n */\n @ViewChild('dropdownTrigger', { read: ElementRef, static: true })\n public dropdownTriggerElement!: ElementRef<HTMLElement>;\n\n /**\n * The date field input control directive used in the datepicker component.\n *\n * @type {DatepickerInputControlDirective | undefined}\n */\n @ContentChild(DatepickerInputControlDirective)\n public dateField?: DatepickerInputControlDirective;\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n this.handleDateFieldChanges();\n this.handleDateFieldFocus();\n\n deferFn(() => {\n if (!this.value) return;\n this.updateDateField(startOfDay(this.value));\n });\n }\n\n /**\n * Selects a date.\n *\n * @param {Date | null} value - The date value to be selected.\n */\n public selectDate(value: Date | null): void {\n if (!value) return;\n\n this.updateInternalValue(value);\n\n this.selectedChange.emit(value);\n\n this.dropdown.close();\n }\n\n /**\n * Resets the datepicker's value to null.\n */\n public reset(): void {\n this.updateInternalValue(null);\n }\n\n /**\n * @internal\n * Writes a new value to the element.\n * Part of the ControlValueAccessor interface.\n * @param {Date | null} value - The new value.\n */\n public override writeValue(value: Date | null): void {\n super.writeValue(value);\n this.updateDateField(value);\n }\n\n protected updateInternalValue(value: Date | null): void {\n this.updateValue(value);\n this.updateDateField(value);\n }\n\n protected handleDateFieldChanges(): void {\n this.dateField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => {\n if (!this.dateField?.valueAsDate) return;\n this.updateValue(this.dateField?.valueAsDate ?? null);\n });\n }\n\n protected handleDateFieldFocus(): void {\n this.dateField?.focused.pipe(this.takeUntilDestroyed()).subscribe((isFocused) => {\n if (!isFocused) {\n this.onTouched();\n }\n if (this.isOpen) {\n this.dropdown.close();\n }\n });\n }\n\n @HostListener('keydown.alt.ArrowDown', ['$event'])\n protected openDatepicker(event: KeyboardEvent) {\n event.stopPropagation();\n\n if (this.isReadonly || this.isDisabled) return;\n\n this.dropdown.open(event);\n }\n\n private updateDateField(date: Date | null): void {\n if (!this.dateField) return;\n\n const dateFormat = getDateInputFormat(this.config);\n this.dateField.nativeElementValue = date ? format(date, dateFormat) : '';\n }\n}\n","<ng-content select=\"input[odxDatepickerControl]\" />\n\n<odx-action-group class=\"odx-datepicker__trigger-wrapper\">\n @if (clearable() && value) {\n <button odxButton class=\"odx-datepicker__clear\" (click)=\"reset()\" size=\"small\" aria-label=\"Reset time\">\n <odx-icon name=\"close\" iconSet=\"core\" />\n </button>\n }\n <button\n #dropdownTrigger\n odxButton\n size=\"small\"\n variant=\"ghost\"\n class=\"odx-datepicker__trigger\"\n [odxDropdown]=\"calendarOverlay\"\n [odxDropdownOptions]=\"{ position: dropdownPosition }\"\n [odxDropdownTriggerElement]=\"dropdownTriggerElement.nativeElement\"\n [odxDropdownHost]=\"null\"\n [odxDropdownReferenceElement]=\"element.nativeElement\"\n (odxDropdownBeforeClose)=\"onTouched()\"\n >\n <odx-icon name=\"calendar\" />\n </button>\n <ng-content select=\"[odxButton]\" ngProjectAs=\"[odxButton]\" />\n</odx-action-group>\n\n<ng-template #calendarOverlay>\n <odx-calendar\n [selectedDate]=\"value || today\"\n [filterFn]=\"filterFn\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n (selectedDateChange)=\"selectDate($event)\"\n />\n</ng-template>\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { DatepickerComponent } from './datepicker.component';\nimport { DatepickerInputControlDirective } from './directives';\n\nconst modules = [DatepickerComponent, DatepickerInputControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class DatepickerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;AASG;AAYI,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,qBAAqB,CAAA;AAAnE,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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