@xui/date-range-input 2.0.0-alpha.19 → 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.
|
@@ -19,25 +19,40 @@ import { XuiPopoverImports } from '@xui/popover';
|
|
|
19
19
|
*/
|
|
20
20
|
class XuiDateRangeInput {
|
|
21
21
|
adapter = injectXDateAdapter();
|
|
22
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
22
23
|
class = input('', /* @ts-ignore */
|
|
23
24
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
24
25
|
/** The chosen range. Two-way bindable with `[(value)]`. */
|
|
25
26
|
value = model({ start: null, end: null }, /* @ts-ignore */
|
|
26
27
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** Earliest selectable date, for both ends of the range. */
|
|
27
29
|
min = input(null, /* @ts-ignore */
|
|
28
30
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** Latest selectable date, for both ends of the range. */
|
|
29
32
|
max = input(null, /* @ts-ignore */
|
|
30
33
|
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/**
|
|
35
|
+
* Accept a range that starts and ends on the same day. Off by default, so picking one date leaves the range open.
|
|
36
|
+
*/
|
|
31
37
|
allowSingleDayRange = input(false, { ...(ngDevMode ? { debugName: "allowSingleDayRange" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
38
|
+
/** Block interaction and dim both fields. */
|
|
32
39
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
40
|
+
/** Text shown in the empty start field. */
|
|
33
41
|
startPlaceholder = input('Start date', /* @ts-ignore */
|
|
34
42
|
...(ngDevMode ? [{ debugName: "startPlaceholder" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Text shown in the empty end field. */
|
|
35
44
|
endPlaceholder = input('End date', /* @ts-ignore */
|
|
36
45
|
...(ngDevMode ? [{ debugName: "endPlaceholder" }] : /* istanbul ignore next */ []));
|
|
46
|
+
/** BCP 47 tag passed to `formatDate` and used for the calendar's labels. Defaults to the runtime locale. */
|
|
37
47
|
locale = input(undefined, /* @ts-ignore */
|
|
38
48
|
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/**
|
|
50
|
+
* Turns a date into the text shown in the field. Defaults to the date adapter's own format; override it together
|
|
51
|
+
* with `parseDate` so the two agree.
|
|
52
|
+
*/
|
|
39
53
|
formatDate = input(defaultXDateFormat(this.adapter), /* @ts-ignore */
|
|
40
54
|
...(ngDevMode ? [{ debugName: "formatDate" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** Turns typed text back into a date, or `null` when it does not parse. The inverse of `formatDate`. */
|
|
41
56
|
parseDate = input(defaultXDateParse, /* @ts-ignore */
|
|
42
57
|
...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
|
|
43
58
|
open = model(false, /* @ts-ignore */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-date-range-input.mjs","sources":["../../../../../../libs/ui/date-range-input/xui/src/lib/date-range-input.ts","../../../../../../libs/ui/date-range-input/xui/src/index.ts","../../../../../../libs/ui/date-range-input/xui/src/xui-date-range-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matArrowForwardRound } 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 { XuiDateRangePickerImports, type XuiDateRange } from '@xui/date-range-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\ntype Boundary = 'start' | 'end';\n\n/**\n * A date-range field: two text inputs (start → end) that share one popover\n * calendar. Focusing either field opens the range picker; typing a boundary\n * parses just that end. `[(value)]` two-way binding. It is a full\n * `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.\n */\n@Component({\n selector: 'xui-date-range-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDateRangePickerImports],\n providers: [provideXValueAccessor(() => XuiDateRangeInput)],\n template: `\n <div\n [class]=\"groupClass()\"\n [xuiPopover]=\"panel\"\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [role]=\"'dialog'\"\n [bare]=\"true\"\n [disabled]=\"isDisabled()\"\n placement=\"bottom-start\"\n >\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('start')\"\n (input)=\"onType('start', $event)\"\n (blur)=\"onBlur('start')\"\n (keydown.enter)=\"commitTyped('start')\"\n />\n <ng-icon xui name=\"matArrowForwardRound\" size=\"sm\" class=\"text-foreground-muted shrink-0\" />\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('end')\"\n (input)=\"onType('end', $event)\"\n (blur)=\"onBlur('end')\"\n (keydown.enter)=\"commitTyped('end')\"\n />\n </div>\n\n <ng-template #panel>\n <xui-date-range-picker\n [value]=\"value()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [allowSingleDayRange]=\"allowSingleDayRange()\"\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({ matArrowForwardRound })]\n})\nexport class XuiDateRangeInput<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n\n readonly class = input<ClassValue>('');\n\n /** The chosen range. Two-way bindable with `[(value)]`. */\n readonly value = model<XuiDateRange<T>>({ start: null, end: null });\n\n readonly min = input<T | null>(null);\n readonly max = input<T | null>(null);\n readonly allowSingleDayRange = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly startPlaceholder = input<string>('Start date');\n readonly endPlaceholder = input<string>('End date');\n readonly locale = input<string | undefined>(undefined);\n\n readonly formatDate = input<(date: T, locale?: string) => string>(defaultXDateFormat(this.adapter));\n\n readonly parseDate = input<(text: string) => T | null>(defaultXDateParse);\n\n protected readonly open = model(false);\n private readonly typed = signal<{ start: string | null; end: string | null }>({ start: null, end: null });\n\n protected readonly cva = createXValueAccessor<XuiDateRange<T> | null>({\n onWrite: range => {\n // A form write replaces any half-typed text — the display must show it.\n this.typed.set({ start: null, end: null });\n this.value.set(range ?? { start: null, end: 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-72 items-center gap-2 rounded-lg border px-(--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 w-28 flex-1 bg-transparent text-center outline-none')\n );\n\n protected displayValue(boundary: Boundary): string {\n const typed = this.typed()[boundary];\n if (typed !== null) {\n return typed;\n }\n\n const value = this.value()[boundary];\n return value == null ? '' : this.formatDate()(value, this.locale());\n }\n\n protected onType(boundary: Boundary, event: Event): void {\n this.typed.update(state => ({ ...state, [boundary]: (event.target as HTMLInputElement).value }));\n }\n\n protected onBlur(boundary: Boundary): void {\n this.commitTyped(boundary);\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(boundary: Boundary): void {\n const text = this.typed()[boundary];\n if (text === null) {\n return;\n }\n\n this.typed.update(state => ({ ...state, [boundary]: null }));\n\n const next = text.trim() === '' ? null : this.parseDate()(text);\n // An unparseable value leaves the boundary as-is (display resets to it).\n if (text.trim() !== '' && next == null) {\n return;\n }\n\n this.commit({ ...this.value(), [boundary]: next });\n }\n\n protected onPick(range: XuiDateRange<T>): void {\n this.typed.set({ start: null, end: null });\n this.commit(range);\n }\n\n /** The single write path for user edits — typed boundaries or a calendar pick. */\n private commit(range: XuiDateRange<T>): void {\n this.value.set(range);\n this.cva.notifyChange(range);\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 { XuiDateRangeInput } from './lib/date-range-input';\n\nexport * from './lib/date-range-input';\n\nexport const XuiDateRangeInputImports = [XuiDateRangeInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA;;;;;AAKG;MAwDU,iBAAiB,CAAA;IACX,OAAO,GAAG,kBAAkB,EAAK;IAEzC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;8EAAC;IAE1D,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;IAC3B,mBAAmB,GAAG,KAAK,CAAwB,KAAK,2FAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC1F,QAAQ,GAAG,KAAK,CAAwB,K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AC;AACvD,iBAAA;;;AChFM,MAAM,wBAAwB,GAAG,CAAC,iBAAiB;;ACJ1D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-date-range-input.mjs","sources":["../../../../../../libs/ui/date-range-input/xui/src/lib/date-range-input.ts","../../../../../../libs/ui/date-range-input/xui/src/index.ts","../../../../../../libs/ui/date-range-input/xui/src/xui-date-range-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matArrowForwardRound } 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 { XuiDateRangePickerImports, type XuiDateRange } from '@xui/date-range-picker';\nimport { XuiIcon } from '@xui/icon';\nimport { XuiPopoverImports } from '@xui/popover';\nimport type { ClassValue } from 'clsx';\n\ntype Boundary = 'start' | 'end';\n\n/**\n * A date-range field: two text inputs (start → end) that share one popover\n * calendar. Focusing either field opens the range picker; typing a boundary\n * parses just that end. `[(value)]` two-way binding. It is a full\n * `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.\n */\n@Component({\n selector: 'xui-date-range-input',\n imports: [NgIcon, XuiIcon, XuiPopoverImports, XuiDateRangePickerImports],\n providers: [provideXValueAccessor(() => XuiDateRangeInput)],\n template: `\n <div\n [class]=\"groupClass()\"\n [xuiPopover]=\"panel\"\n [open]=\"open()\"\n (openChange)=\"onOpenChange($event)\"\n [role]=\"'dialog'\"\n [bare]=\"true\"\n [disabled]=\"isDisabled()\"\n placement=\"bottom-start\"\n >\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"startPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('start')\"\n (input)=\"onType('start', $event)\"\n (blur)=\"onBlur('start')\"\n (keydown.enter)=\"commitTyped('start')\"\n />\n <ng-icon xui name=\"matArrowForwardRound\" size=\"sm\" class=\"text-foreground-muted shrink-0\" />\n <input\n type=\"text\"\n [class]=\"fieldClass()\"\n [placeholder]=\"endPlaceholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"displayValue('end')\"\n (input)=\"onType('end', $event)\"\n (blur)=\"onBlur('end')\"\n (keydown.enter)=\"commitTyped('end')\"\n />\n </div>\n\n <ng-template #panel>\n <xui-date-range-picker\n [value]=\"value()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [allowSingleDayRange]=\"allowSingleDayRange()\"\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({ matArrowForwardRound })]\n})\nexport class XuiDateRangeInput<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 chosen range. Two-way bindable with `[(value)]`. */\n readonly value = model<XuiDateRange<T>>({ start: null, end: null });\n\n /** Earliest selectable date, for both ends of the range. */\n readonly min = input<T | null>(null);\n /** Latest selectable date, for both ends of the range. */\n readonly max = input<T | null>(null);\n /**\n * Accept a range that starts and ends on the same day. Off by default, so picking one date leaves the range open.\n */\n readonly allowSingleDayRange = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Block interaction and dim both fields. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Text shown in the empty start field. */\n readonly startPlaceholder = input<string>('Start date');\n /** Text shown in the empty end field. */\n readonly endPlaceholder = input<string>('End date');\n /** BCP 47 tag passed to `formatDate` and used for the calendar's labels. Defaults to the runtime locale. */\n readonly locale = input<string | undefined>(undefined);\n\n /**\n * Turns a date into the text shown in the field. Defaults to the date adapter's own format; override it together\n * with `parseDate` so the two agree.\n */\n readonly formatDate = input<(date: T, locale?: string) => string>(defaultXDateFormat(this.adapter));\n\n /** Turns typed text back into a date, or `null` when it does not parse. The inverse of `formatDate`. */\n readonly parseDate = input<(text: string) => T | null>(defaultXDateParse);\n\n protected readonly open = model(false);\n private readonly typed = signal<{ start: string | null; end: string | null }>({ start: null, end: null });\n\n protected readonly cva = createXValueAccessor<XuiDateRange<T> | null>({\n onWrite: range => {\n // A form write replaces any half-typed text — the display must show it.\n this.typed.set({ start: null, end: null });\n this.value.set(range ?? { start: null, end: 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-72 items-center gap-2 rounded-lg border px-(--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 w-28 flex-1 bg-transparent text-center outline-none')\n );\n\n protected displayValue(boundary: Boundary): string {\n const typed = this.typed()[boundary];\n if (typed !== null) {\n return typed;\n }\n\n const value = this.value()[boundary];\n return value == null ? '' : this.formatDate()(value, this.locale());\n }\n\n protected onType(boundary: Boundary, event: Event): void {\n this.typed.update(state => ({ ...state, [boundary]: (event.target as HTMLInputElement).value }));\n }\n\n protected onBlur(boundary: Boundary): void {\n this.commitTyped(boundary);\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(boundary: Boundary): void {\n const text = this.typed()[boundary];\n if (text === null) {\n return;\n }\n\n this.typed.update(state => ({ ...state, [boundary]: null }));\n\n const next = text.trim() === '' ? null : this.parseDate()(text);\n // An unparseable value leaves the boundary as-is (display resets to it).\n if (text.trim() !== '' && next == null) {\n return;\n }\n\n this.commit({ ...this.value(), [boundary]: next });\n }\n\n protected onPick(range: XuiDateRange<T>): void {\n this.typed.set({ start: null, end: null });\n this.commit(range);\n }\n\n /** The single write path for user edits — typed boundaries or a calendar pick. */\n private commit(range: XuiDateRange<T>): void {\n this.value.set(range);\n this.cva.notifyChange(range);\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 { XuiDateRangeInput } from './lib/date-range-input';\n\nexport * from './lib/date-range-input';\n\nexport const XuiDateRangeInputImports = [XuiDateRangeInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA;;;;;AAKG;MAwDU,iBAAiB,CAAA;IACX,OAAO,GAAG,kBAAkB,EAAK;;IAGzC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;8EAAC;;IAG1D,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;;IAE3B,GAAG,GAAG,KAAK,CAAW,IAAI;4EAAC;AACpC;;AAEG;IACM,mBAAmB,GAAG,KAAK,CAAwB,KAAK,2FAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE1F,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,gBAAgB,GAAG,KAAK,CAAS,YAAY;yFAAC;;IAE9C,cAAc,GAAG,KAAK,CAAS,UAAU;uFAAC;;IAE1C,MAAM,GAAG,KAAK,CAAqB,SAAS;+EAAC;AAEtD;;;AAGG;IACM,UAAU,GAAG,KAAK,CAAuC,kBAAkB,CAAC,IAAI,CAAC,O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|
"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-range-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-range-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": {
|
|
@@ -14,17 +14,32 @@ type Boundary = 'start' | 'end';
|
|
|
14
14
|
*/
|
|
15
15
|
declare class XuiDateRangeInput<T = Date> implements ControlValueAccessor {
|
|
16
16
|
private readonly adapter;
|
|
17
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
17
18
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
18
19
|
/** The chosen range. Two-way bindable with `[(value)]`. */
|
|
19
20
|
readonly value: _angular_core.ModelSignal<XuiDateRange<T>>;
|
|
21
|
+
/** Earliest selectable date, for both ends of the range. */
|
|
20
22
|
readonly min: _angular_core.InputSignal<T | null>;
|
|
23
|
+
/** Latest selectable date, for both ends of the range. */
|
|
21
24
|
readonly max: _angular_core.InputSignal<T | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Accept a range that starts and ends on the same day. Off by default, so picking one date leaves the range open.
|
|
27
|
+
*/
|
|
22
28
|
readonly allowSingleDayRange: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
29
|
+
/** Block interaction and dim both fields. */
|
|
23
30
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
31
|
+
/** Text shown in the empty start field. */
|
|
24
32
|
readonly startPlaceholder: _angular_core.InputSignal<string>;
|
|
33
|
+
/** Text shown in the empty end field. */
|
|
25
34
|
readonly endPlaceholder: _angular_core.InputSignal<string>;
|
|
35
|
+
/** BCP 47 tag passed to `formatDate` and used for the calendar's labels. Defaults to the runtime locale. */
|
|
26
36
|
readonly locale: _angular_core.InputSignal<string | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Turns a date into the text shown in the field. Defaults to the date adapter's own format; override it together
|
|
39
|
+
* with `parseDate` so the two agree.
|
|
40
|
+
*/
|
|
27
41
|
readonly formatDate: _angular_core.InputSignal<(date: T, locale?: string) => string>;
|
|
42
|
+
/** Turns typed text back into a date, or `null` when it does not parse. The inverse of `formatDate`. */
|
|
28
43
|
readonly parseDate: _angular_core.InputSignal<(text: string) => T | null>;
|
|
29
44
|
protected readonly open: _angular_core.ModelSignal<boolean>;
|
|
30
45
|
private readonly typed;
|