@xui/date-input 2.0.0-alpha.20 → 2.0.0-alpha.21
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.
|
@@ -20,22 +20,34 @@ import { XuiPopoverImports } from '@xui/popover';
|
|
|
20
20
|
*/
|
|
21
21
|
class XuiDateInput {
|
|
22
22
|
adapter = injectXDateAdapter();
|
|
23
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
23
24
|
class = input('', /* @ts-ignore */
|
|
24
25
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
25
26
|
/** The selected date. Two-way bindable with `[(value)]`. */
|
|
26
27
|
value = model(null, /* @ts-ignore */
|
|
27
28
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
29
|
+
/** Earliest selectable date. Dates before it are disabled in the calendar and rejected when typed. */
|
|
28
30
|
min = input(null, /* @ts-ignore */
|
|
29
31
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/** Latest selectable date. Dates after it are disabled in the calendar and rejected when typed. */
|
|
30
33
|
max = input(null, /* @ts-ignore */
|
|
31
34
|
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/**
|
|
36
|
+
* Per-date predicate for holes that `min`/`max` cannot express — weekends, blackout days. Return `false` to disable
|
|
37
|
+
* a date.
|
|
38
|
+
*/
|
|
32
39
|
dateFilter = input(null, /* @ts-ignore */
|
|
33
40
|
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Which weekday the calendar starts on, `0` for Sunday through `6` for Saturday. */
|
|
34
42
|
firstDayOfWeek = input(0, { ...(ngDevMode ? { debugName: "firstDayOfWeek" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
43
|
+
/** Text shown in the empty field. Also the hint about the expected format, so keep it in step with `parseDate`. */
|
|
35
44
|
placeholder = input('YYYY-MM-DD', /* @ts-ignore */
|
|
36
45
|
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
46
|
+
/** Block interaction and dim the field. */
|
|
37
47
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
48
|
+
/** Close the calendar as soon as a date is picked. Turn it off to leave it open for a second look. */
|
|
38
49
|
closeOnSelection = input(true, { ...(ngDevMode ? { debugName: "closeOnSelection" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
50
|
+
/** BCP 47 tag used to format the displayed date and the calendar's labels. Defaults to the runtime locale. */
|
|
39
51
|
locale = input(undefined, /* @ts-ignore */
|
|
40
52
|
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
41
53
|
/** Format a value for the input. Defaults to a locale short date. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-date-input.mjs","sources":["../../../../../../libs/ui/date-input/xui/src/lib/date-input.ts","../../../../../../libs/ui/date-input/xui/src/index.ts","../../../../../../libs/ui/date-input/xui/src/xui-date-input.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matCalendarTodayRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { defaultXDateFormat, defaultXDateParse, injectXDateAdapter } from '@xui/core/date-time';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiDatePickerImports } from '@xui/date-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A date field: a text input paired with a popover calendar. Type a date (parsed\n * best-effort, or via a custom `parseDate`) or pick one from the calendar.\n * `[(value)]` two-way binding; `T` is the active `DateAdapter`'s type (`Date`\n * by default). It is a full `ControlValueAccessor`, so `ngModel`/`formControl`\n * bind to it directly.\n */\n@Component({\n selector: 'xui-date-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDatePickerImports],\n providers: [provideXValueAccessor(() => XuiDateInput)],\n template: `\n <div [class]=\"groupClass()\">\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [value]=\"displayValue()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onType($event)\"\n (blur)=\"onBlur()\"\n (keydown.enter)=\"commitTyped()\"\n />\n <!-- The [disabled] binding feeds the popover trigger directive's input, so\n the native attribute needs its own binding to actually disable the button. -->\n <button\n type=\"button\"\n [class]=\"triggerClass()\"\n aria-label=\"Open calendar\"\n [disabled]=\"isDisabled()\"\n [attr.disabled]=\"isDisabled() ? '' : null\"\n [xuiPopover]=\"panel\"\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [role]=\"'dialog'\"\n [bare]=\"true\"\n placement=\"bottom-end\"\n >\n <ng-icon xui name=\"matCalendarTodayRound\" size=\"sm\" />\n </button>\n </div>\n\n <ng-template #panel>\n <xui-date-picker\n [value]=\"value()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [dateFilter]=\"dateFilter()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (valueChange)=\"onPick($event)\"\n />\n </ng-template>\n `,\n host: {\n '[class]': 'computedClass()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [provideIcons({ matCalendarTodayRound })]\n})\nexport class XuiDateInput<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n\n readonly class = input<ClassValue>('');\n\n /** The selected date. Two-way bindable with `[(value)]`. */\n readonly value = model<T | null>(null);\n\n readonly min = input<T | null>(null);\n readonly max = input<T | null>(null);\n readonly dateFilter = input<((date: T) => boolean) | null>(null);\n readonly firstDayOfWeek = input<number, NumberInput>(0, { transform: numberAttribute });\n\n readonly placeholder = input<string>('YYYY-MM-DD');\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly closeOnSelection = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n readonly locale = input<string | undefined>(undefined);\n\n /** Format a value for the input. Defaults to a locale short date. */\n readonly formatDate = input<(date: T, locale?: string) => string>(defaultXDateFormat(this.adapter));\n\n /** Parse typed text into a value, or `null` if it can't. Defaults to `Date.parse`. */\n readonly parseDate = input<(text: string) => T | null>(defaultXDateParse);\n\n protected readonly open = model(false);\n private readonly typed = signal<string | null>(null);\n\n protected readonly cva = createXValueAccessor<T | null>({\n onWrite: value => {\n // A form write replaces any half-typed text — the display must show it.\n this.typed.set(null);\n this.value.set(value ?? null);\n },\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-48 items-center rounded-lg border pe-1 ps-(--control-padding-md) text-sm',\n 'focus-within:border-focus transition-colors',\n this.isDisabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground placeholder:text-foreground-subtle flex-1 bg-transparent outline-none')\n );\n protected readonly triggerClass = computed(() =>\n xui(\n // 28px, which is what the control height leaves once its border is taken off. At 32px the\n // hover fill stood proud of the field it sits in, top and bottom.\n 'text-foreground-muted hover:bg-surface-raised hover:text-foreground flex size-7 items-center justify-center rounded'\n )\n );\n\n /** The input shows the live typing, else the formatted value. */\n protected readonly displayValue = computed(() => {\n const typed = this.typed();\n if (typed !== null) {\n return typed;\n }\n\n const value = this.value();\n return value == null ? '' : this.formatDate()(value, this.locale());\n });\n\n protected onType(event: Event): void {\n this.typed.set((event.target as HTMLInputElement).value);\n }\n\n protected onBlur(): void {\n this.commitTyped();\n this.cva.markTouched();\n }\n\n protected onOpenChange(open: boolean): void {\n this.open.set(open);\n if (!open) {\n this.cva.markTouched();\n }\n }\n\n protected commitTyped(): void {\n const typed = this.typed();\n if (typed === null) {\n return;\n }\n\n this.typed.set(null);\n if (typed.trim() === '') {\n this.setValue(null);\n return;\n }\n\n const parsed = this.parseDate()(typed);\n if (parsed != null) {\n this.setValue(parsed);\n }\n // On a parse failure, fall back to the formatted current value (display resets).\n }\n\n protected onPick(date: T | null): void {\n this.typed.set(null);\n this.setValue(date);\n if (this.closeOnSelection()) {\n // Closing from here bypasses the trigger's `openChange`, so touch explicitly.\n this.open.set(false);\n this.cva.markTouched();\n }\n }\n\n /** The single write path for user edits — typed text or a calendar pick. */\n private setValue(date: T | null): void {\n this.value.set(date);\n this.cva.notifyChange(date);\n }\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiDateInput } from './lib/date-input';\n\nexport * from './lib/date-input';\n\nexport const XuiDateInputImports = [XuiDateInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;;;AAMG;MAsDU,YAAY,CAAA;IACN,OAAO,GAAG,kBAAkB,EAAK;IAEzC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAW,IAAI;8EAAC;IAE7B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,UAAU,GAAG,KAAK,CAAgC,IAAI;mFAAC;IACvD,cAAc,GAAG,KAAK,CAAsB,CAAC,sFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IAE9E,WAAW,GAAG,KAAK,CAAS,YAAY;oFAAC;IACzC,QAA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AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-date-input.mjs","sources":["../../../../../../libs/ui/date-input/xui/src/lib/date-input.ts","../../../../../../libs/ui/date-input/xui/src/index.ts","../../../../../../libs/ui/date-input/xui/src/xui-date-input.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matCalendarTodayRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { defaultXDateFormat, defaultXDateParse, injectXDateAdapter } from '@xui/core/date-time';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiDatePickerImports } from '@xui/date-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A date field: a text input paired with a popover calendar. Type a date (parsed\n * best-effort, or via a custom `parseDate`) or pick one from the calendar.\n * `[(value)]` two-way binding; `T` is the active `DateAdapter`'s type (`Date`\n * by default). It is a full `ControlValueAccessor`, so `ngModel`/`formControl`\n * bind to it directly.\n */\n@Component({\n selector: 'xui-date-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDatePickerImports],\n providers: [provideXValueAccessor(() => XuiDateInput)],\n template: `\n <div [class]=\"groupClass()\">\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [value]=\"displayValue()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onType($event)\"\n (blur)=\"onBlur()\"\n (keydown.enter)=\"commitTyped()\"\n />\n <!-- The [disabled] binding feeds the popover trigger directive's input, so\n the native attribute needs its own binding to actually disable the button. -->\n <button\n type=\"button\"\n [class]=\"triggerClass()\"\n aria-label=\"Open calendar\"\n [disabled]=\"isDisabled()\"\n [attr.disabled]=\"isDisabled() ? '' : null\"\n [xuiPopover]=\"panel\"\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [role]=\"'dialog'\"\n [bare]=\"true\"\n placement=\"bottom-end\"\n >\n <ng-icon xui name=\"matCalendarTodayRound\" size=\"sm\" />\n </button>\n </div>\n\n <ng-template #panel>\n <xui-date-picker\n [value]=\"value()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [dateFilter]=\"dateFilter()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n (valueChange)=\"onPick($event)\"\n />\n </ng-template>\n `,\n host: {\n '[class]': 'computedClass()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n viewProviders: [provideIcons({ matCalendarTodayRound })]\n})\nexport class XuiDateInput<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n /** The selected date. Two-way bindable with `[(value)]`. */\n readonly value = model<T | null>(null);\n\n /** Earliest selectable date. Dates before it are disabled in the calendar and rejected when typed. */\n readonly min = input<T | null>(null);\n /** Latest selectable date. Dates after it are disabled in the calendar and rejected when typed. */\n readonly max = input<T | null>(null);\n /**\n * Per-date predicate for holes that `min`/`max` cannot express — weekends, blackout days. Return `false` to disable\n * a date.\n */\n readonly dateFilter = input<((date: T) => boolean) | null>(null);\n /** Which weekday the calendar starts on, `0` for Sunday through `6` for Saturday. */\n readonly firstDayOfWeek = input<number, NumberInput>(0, { transform: numberAttribute });\n\n /** Text shown in the empty field. Also the hint about the expected format, so keep it in step with `parseDate`. */\n readonly placeholder = input<string>('YYYY-MM-DD');\n /** Block interaction and dim the field. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Close the calendar as soon as a date is picked. Turn it off to leave it open for a second look. */\n readonly closeOnSelection = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n /** BCP 47 tag used to format the displayed date and the calendar's labels. Defaults to the runtime locale. */\n readonly locale = input<string | undefined>(undefined);\n\n /** Format a value for the input. Defaults to a locale short date. */\n readonly formatDate = input<(date: T, locale?: string) => string>(defaultXDateFormat(this.adapter));\n\n /** Parse typed text into a value, or `null` if it can't. Defaults to `Date.parse`. */\n readonly parseDate = input<(text: string) => T | null>(defaultXDateParse);\n\n protected readonly open = model(false);\n private readonly typed = signal<string | null>(null);\n\n protected readonly cva = createXValueAccessor<T | null>({\n onWrite: value => {\n // A form write replaces any half-typed text — the display must show it.\n this.typed.set(null);\n this.value.set(value ?? null);\n },\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset flex h-(--control-height-md) w-full min-w-48 items-center rounded-lg border pe-1 ps-(--control-padding-md) text-sm',\n 'focus-within:border-focus transition-colors',\n this.isDisabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground placeholder:text-foreground-subtle flex-1 bg-transparent outline-none')\n );\n protected readonly triggerClass = computed(() =>\n xui(\n // 28px, which is what the control height leaves once its border is taken off. At 32px the\n // hover fill stood proud of the field it sits in, top and bottom.\n 'text-foreground-muted hover:bg-surface-raised hover:text-foreground flex size-7 items-center justify-center rounded'\n )\n );\n\n /** The input shows the live typing, else the formatted value. */\n protected readonly displayValue = computed(() => {\n const typed = this.typed();\n if (typed !== null) {\n return typed;\n }\n\n const value = this.value();\n return value == null ? '' : this.formatDate()(value, this.locale());\n });\n\n protected onType(event: Event): void {\n this.typed.set((event.target as HTMLInputElement).value);\n }\n\n protected onBlur(): void {\n this.commitTyped();\n this.cva.markTouched();\n }\n\n protected onOpenChange(open: boolean): void {\n this.open.set(open);\n if (!open) {\n this.cva.markTouched();\n }\n }\n\n protected commitTyped(): void {\n const typed = this.typed();\n if (typed === null) {\n return;\n }\n\n this.typed.set(null);\n if (typed.trim() === '') {\n this.setValue(null);\n return;\n }\n\n const parsed = this.parseDate()(typed);\n if (parsed != null) {\n this.setValue(parsed);\n }\n // On a parse failure, fall back to the formatted current value (display resets).\n }\n\n protected onPick(date: T | null): void {\n this.typed.set(null);\n this.setValue(date);\n if (this.closeOnSelection()) {\n // Closing from here bypasses the trigger's `openChange`, so touch explicitly.\n this.open.set(false);\n this.cva.markTouched();\n }\n }\n\n /** The single write path for user edits — typed text or a calendar pick. */\n private setValue(date: T | null): void {\n this.value.set(date);\n this.cva.notifyChange(date);\n }\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiDateInput } from './lib/date-input';\n\nexport * from './lib/date-input';\n\nexport const XuiDateInputImports = [XuiDateInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;;;AAMG;MAsDU,YAAY,CAAA;IACN,OAAO,GAAG,kBAAkB,EAAK;;IAGzC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAW,IAAI;8EAAC;;IAG7B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;;IAE3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;AACpC;;;AAGG;IACM,UAAU,GAAG,KAAK,CAAgC,IAAI;mFAAC;;IAEvD,cAAc,GAAG,KAAK,CAAsB,CAAC,sFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAG9E,WAAW,GAAG,KAAK,CAAS,YAAY;oFAAC;;IAEzC,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,gBAAgB,GAAG,KAAK,CAAwB,IAAI,wFAAI,SAAS,EAAE,gBAAgB,EAAA,CA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.0.0-alpha.21",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@angular/forms": "22",
|
|
42
42
|
"@ng-icons/core": "34",
|
|
43
43
|
"@ng-icons/material-icons": "34",
|
|
44
|
-
"@xui/core": "2.0.0-alpha.
|
|
45
|
-
"@xui/date-picker": "2.0.0-alpha.
|
|
46
|
-
"@xui/icon": "2.0.0-alpha.
|
|
47
|
-
"@xui/popover": "2.0.0-alpha.
|
|
44
|
+
"@xui/core": "2.0.0-alpha.21",
|
|
45
|
+
"@xui/date-picker": "2.0.0-alpha.21",
|
|
46
|
+
"@xui/icon": "2.0.0-alpha.21",
|
|
47
|
+
"@xui/popover": "2.0.0-alpha.21",
|
|
48
48
|
"clsx": "^2.1.1"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
@@ -13,16 +13,28 @@ import { ClassValue } from 'clsx';
|
|
|
13
13
|
*/
|
|
14
14
|
declare class XuiDateInput<T = Date> implements ControlValueAccessor {
|
|
15
15
|
private readonly adapter;
|
|
16
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
16
17
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
17
18
|
/** The selected date. Two-way bindable with `[(value)]`. */
|
|
18
19
|
readonly value: _angular_core.ModelSignal<T | null>;
|
|
20
|
+
/** Earliest selectable date. Dates before it are disabled in the calendar and rejected when typed. */
|
|
19
21
|
readonly min: _angular_core.InputSignal<T | null>;
|
|
22
|
+
/** Latest selectable date. Dates after it are disabled in the calendar and rejected when typed. */
|
|
20
23
|
readonly max: _angular_core.InputSignal<T | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Per-date predicate for holes that `min`/`max` cannot express — weekends, blackout days. Return `false` to disable
|
|
26
|
+
* a date.
|
|
27
|
+
*/
|
|
21
28
|
readonly dateFilter: _angular_core.InputSignal<((date: T) => boolean) | null>;
|
|
29
|
+
/** Which weekday the calendar starts on, `0` for Sunday through `6` for Saturday. */
|
|
22
30
|
readonly firstDayOfWeek: _angular_core.InputSignalWithTransform<number, NumberInput>;
|
|
31
|
+
/** Text shown in the empty field. Also the hint about the expected format, so keep it in step with `parseDate`. */
|
|
23
32
|
readonly placeholder: _angular_core.InputSignal<string>;
|
|
33
|
+
/** Block interaction and dim the field. */
|
|
24
34
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
35
|
+
/** Close the calendar as soon as a date is picked. Turn it off to leave it open for a second look. */
|
|
25
36
|
readonly closeOnSelection: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
37
|
+
/** BCP 47 tag used to format the displayed date and the calendar's labels. Defaults to the runtime locale. */
|
|
26
38
|
readonly locale: _angular_core.InputSignal<string | undefined>;
|
|
27
39
|
/** Format a value for the input. Defaults to a locale short date. */
|
|
28
40
|
readonly formatDate: _angular_core.InputSignal<(date: T, locale?: string) => string>;
|