@calendrix/angular 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +63 -2
- package/fesm2022/calendrix-angular.mjs +2190 -0
- package/fesm2022/calendrix-angular.mjs.map +1 -0
- package/package.json +52 -3
- package/styles.css +532 -0
- package/types/calendrix-angular.d.ts +477 -0
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import * as _calendrix_core from '@calendrix/core';
|
|
2
|
+
import { SelectionMode, SelectionValue, CalendarDate, ElementProps, CalendarSystem, PickerLabels, DateTimeMode, DateTimePickerValue, HourCycle, TimeValue, DateTimeValue, DateTimeRange, DateRange, TimeFieldLabels, TimeSegmentType } from '@calendrix/core';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { OnInit } from '@angular/core';
|
|
5
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
6
|
+
import { Placement } from '@floating-ui/dom';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A month calendar with the ARIA grid pattern. The month and the year in the header are buttons:
|
|
10
|
+
* they open a grid of months and a page of years. `visibleMonths` shows up to three months side
|
|
11
|
+
* by side, and `selection` picks one day, a range or many days. It has no styles of its own: use
|
|
12
|
+
* the `calendrix-*` classes and the `data-*` attributes. Use `[(value)]` to read and set the value.
|
|
13
|
+
*/
|
|
14
|
+
declare class CalendrixCalendar<M extends SelectionMode = 'single'> implements OnInit, ControlValueAccessor {
|
|
15
|
+
/** One day (default), a range with a start and an end, or any number of separate days. */
|
|
16
|
+
readonly selection: _angular_core.InputSignal<M>;
|
|
17
|
+
/** The selection. Use `[(value)]`. The type follows `selection`. */
|
|
18
|
+
readonly value: _angular_core.ModelSignal<SelectionValue<M> | undefined>;
|
|
19
|
+
readonly defaultValue: _angular_core.InputSignal<SelectionValue<M> | undefined>;
|
|
20
|
+
readonly system: _angular_core.InputSignal<_calendrix_core.CalendarSystem | undefined>;
|
|
21
|
+
readonly locale: _angular_core.InputSignal<string | undefined>;
|
|
22
|
+
readonly direction: _angular_core.InputSignal<_calendrix_core.Direction | undefined>;
|
|
23
|
+
readonly weekStart: _angular_core.InputSignal<_calendrix_core.WeekStart | undefined>;
|
|
24
|
+
readonly plugins: _angular_core.InputSignal<_calendrix_core.CalendarPlugin[] | undefined>;
|
|
25
|
+
readonly focusedDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
26
|
+
readonly focusedDateChange: _angular_core.OutputEmitterRef<CalendarDate>;
|
|
27
|
+
/** How many months are shown at once: 1 (default), 2 or 3. */
|
|
28
|
+
readonly visibleMonths: _angular_core.InputSignal<number | undefined>;
|
|
29
|
+
readonly allowUnavailableInRange: _angular_core.InputSignal<boolean | undefined>;
|
|
30
|
+
readonly maxSelected: _angular_core.InputSignal<number | undefined>;
|
|
31
|
+
readonly minDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
32
|
+
readonly maxDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
33
|
+
readonly isDateUnavailable: _angular_core.InputSignal<((date: CalendarDate) => boolean) | undefined>;
|
|
34
|
+
readonly labels: _angular_core.InputSignal<Partial<_calendrix_core.CalendarLabels & _calendrix_core.ViewLabels> | undefined>;
|
|
35
|
+
readonly timeZone: _angular_core.InputSignal<string | undefined>;
|
|
36
|
+
readonly now: _angular_core.InputSignal<(() => Date) | undefined>;
|
|
37
|
+
/** The user cannot change anything (ADR 0022). A form can also disable the calendar. */
|
|
38
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Created again in `ngOnInit`, when the inputs are known: the core reads some options (`now`,
|
|
41
|
+
* `timeZone`, `defaultValue`, `focusedDate`) only when it is created.
|
|
42
|
+
*/
|
|
43
|
+
protected calendar: _calendrix_core.Calendar<M>;
|
|
44
|
+
/** The snapshot of the core: the same object until something changes. */
|
|
45
|
+
protected readonly state: _angular_core.WritableSignal<_calendrix_core.CalendarState<M>>;
|
|
46
|
+
private unsubscribe;
|
|
47
|
+
private readonly host;
|
|
48
|
+
/** The last `focusRequest` of the core that this component has seen (see `CalendarState`). */
|
|
49
|
+
private seenFocusRequest;
|
|
50
|
+
private readonly handleChange;
|
|
51
|
+
private readonly handleFocusedDate;
|
|
52
|
+
private readonly options;
|
|
53
|
+
/** Everything the template needs, computed once for each state. */
|
|
54
|
+
protected readonly view: _angular_core.Signal<{
|
|
55
|
+
state: _calendrix_core.CalendarState<M>;
|
|
56
|
+
multi: boolean;
|
|
57
|
+
root: ElementProps<Record<string, never>>;
|
|
58
|
+
gridProps: ElementProps<{
|
|
59
|
+
keydown: (event: _calendrix_core.KeyEventLike) => void;
|
|
60
|
+
}>;
|
|
61
|
+
prev: ElementProps<{
|
|
62
|
+
click: () => void;
|
|
63
|
+
}>;
|
|
64
|
+
next: ElementProps<{
|
|
65
|
+
click: () => void;
|
|
66
|
+
}>;
|
|
67
|
+
monthButton: ElementProps<{
|
|
68
|
+
click: () => void;
|
|
69
|
+
}>;
|
|
70
|
+
yearButton: ElementProps<{
|
|
71
|
+
click: () => void;
|
|
72
|
+
}>;
|
|
73
|
+
grids: {
|
|
74
|
+
grid: _calendrix_core.MonthGrid;
|
|
75
|
+
index: number;
|
|
76
|
+
key: string;
|
|
77
|
+
props: ElementProps<{
|
|
78
|
+
keydown: (event: _calendrix_core.KeyEventLike) => void;
|
|
79
|
+
}>;
|
|
80
|
+
isLast: boolean;
|
|
81
|
+
weeks: {
|
|
82
|
+
cell: _calendrix_core.DayCell;
|
|
83
|
+
key: string;
|
|
84
|
+
props: ElementProps<{
|
|
85
|
+
click: () => void;
|
|
86
|
+
}> | null;
|
|
87
|
+
}[][];
|
|
88
|
+
}[];
|
|
89
|
+
monthRows: {
|
|
90
|
+
cell: _calendrix_core.MonthCell;
|
|
91
|
+
props: ElementProps<{
|
|
92
|
+
click: () => void;
|
|
93
|
+
}>;
|
|
94
|
+
}[][];
|
|
95
|
+
yearRows: {
|
|
96
|
+
cell: _calendrix_core.YearCell;
|
|
97
|
+
props: ElementProps<{
|
|
98
|
+
click: () => void;
|
|
99
|
+
}>;
|
|
100
|
+
}[][];
|
|
101
|
+
}>;
|
|
102
|
+
constructor();
|
|
103
|
+
ngOnInit(): void;
|
|
104
|
+
private onChangeFn;
|
|
105
|
+
private onTouchedFn;
|
|
106
|
+
private readonly formDisabled;
|
|
107
|
+
/** Disabled by the `disabled` input or by the form. */
|
|
108
|
+
protected readonly disabled: _angular_core.Signal<boolean>;
|
|
109
|
+
writeValue(value: unknown): void;
|
|
110
|
+
registerOnChange(fn: (value: SelectionValue<M>) => void): void;
|
|
111
|
+
registerOnTouched(fn: () => void): void;
|
|
112
|
+
setDisabledState(isDisabled: boolean): void;
|
|
113
|
+
/** The control is touched when the focus leaves the whole calendar, not between its cells. */
|
|
114
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
115
|
+
private focusFocusedCell;
|
|
116
|
+
protected onGridKeydown(event: KeyboardEvent): void;
|
|
117
|
+
/** Escape leaves the months or the years from anywhere in the calendar, also from a button. */
|
|
118
|
+
protected onRootKeydown(event: KeyboardEvent): void;
|
|
119
|
+
/** Buttons and cells that change the view: the core asks for the focus to move to the grid. */
|
|
120
|
+
protected switchView(props: ElementProps<{
|
|
121
|
+
click: () => void;
|
|
122
|
+
}>): void;
|
|
123
|
+
protected onPointerLeave(): void;
|
|
124
|
+
/** With several months a week of only other months' days has no cell: it is hidden from assistive technology. */
|
|
125
|
+
protected isEmptyWeek(week: readonly {
|
|
126
|
+
readonly props?: unknown;
|
|
127
|
+
}[]): boolean;
|
|
128
|
+
protected onGridPointerLeave(): void;
|
|
129
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixCalendar<any>, never>;
|
|
130
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalendrixCalendar<any>, "calendrix-calendar", never, { "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "system": { "alias": "system"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "plugins": { "alias": "plugins"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "focusedDate"; "required": false; "isSignal": true; }; "visibleMonths": { "alias": "visibleMonths"; "required": false; "isSignal": true; }; "allowUnavailableInRange": { "alias": "allowUnavailableInRange"; "required": false; "isSignal": true; }; "maxSelected": { "alias": "maxSelected"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "isDateUnavailable": { "alias": "isDateUnavailable"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "timeZone": { "alias": "timeZone"; "required": false; "isSignal": true; }; "now": { "alias": "now"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "focusedDateChange": "focusedDateChange"; }, never, never, true, never>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
type PopoverDismissReason = 'outside' | 'escape';
|
|
134
|
+
/**
|
|
135
|
+
* Turns an element into a popover anchored to another element:
|
|
136
|
+
* `<div [calendrixPopover]="anchorElement" (dismiss)="close()">…</div>`.
|
|
137
|
+
*
|
|
138
|
+
* It moves the element to the end of `<body>` (unless `[portal]="false"`), keeps it next to the
|
|
139
|
+
* anchor (flip, shift, size, auto update), keeps Tab inside it, moves the focus into it when it
|
|
140
|
+
* opens, and emits `dismiss` for a press outside and for Escape. It never closes by itself and
|
|
141
|
+
* never returns the focus: the owner does both (see ADR 0013).
|
|
142
|
+
*/
|
|
143
|
+
declare class CalendrixPopover implements OnInit {
|
|
144
|
+
/** The element the popover is placed next to. A press inside it is not an outside press. */
|
|
145
|
+
readonly anchor: _angular_core.InputSignal<HTMLElement>;
|
|
146
|
+
/** Move the popover to `<body>`. Default: true. */
|
|
147
|
+
readonly portal: _angular_core.InputSignal<boolean>;
|
|
148
|
+
readonly placement: _angular_core.InputSignal<Placement>;
|
|
149
|
+
readonly dismiss: _angular_core.OutputEmitterRef<PopoverDismissReason>;
|
|
150
|
+
private readonly element;
|
|
151
|
+
private readonly document;
|
|
152
|
+
private readonly destroyRef;
|
|
153
|
+
constructor();
|
|
154
|
+
ngOnInit(): void;
|
|
155
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
156
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixPopover, never>;
|
|
157
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CalendrixPopover, "[calendrixPopover]", never, { "anchor": { "alias": "calendrixPopover"; "required": true; "isSignal": true; }; "portal": { "alias": "portal"; "required": false; "isSignal": true; }; "placement": { "alias": "placement"; "required": false; "isSignal": true; }; }, { "dismiss": "dismiss"; }, never, never, true, never>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
type DatePickerLabels = Partial<PickerLabels> & {
|
|
161
|
+
/** The text of a long list of days in `multiple` mode. Default: "5 dates" (built in for en, fa, de). */
|
|
162
|
+
datesSelected?: (count: number) => string;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A text input and a popover with a calendar, for one day, a range or many days (no time: see
|
|
166
|
+
* `DateTimePicker`). A day or a range can be typed or picked; a list of days is picked, and the
|
|
167
|
+
* input shows it as text. It has no styles of its own, see the `calendrix-*` classes.
|
|
168
|
+
*
|
|
169
|
+
* Use `[(value)]`, or `[defaultValue]` and `(valueChange)`. The type of the value follows
|
|
170
|
+
* `selection`.
|
|
171
|
+
*/
|
|
172
|
+
declare class CalendrixDatePicker<M extends SelectionMode = 'single'> implements OnInit, ControlValueAccessor {
|
|
173
|
+
/** One day (default), a range with a start and an end, or any number of separate days. */
|
|
174
|
+
readonly selection: _angular_core.InputSignal<M>;
|
|
175
|
+
/** The selection. Use `[(value)]`. The type follows `selection`. */
|
|
176
|
+
readonly value: _angular_core.ModelSignal<SelectionValue<M> | undefined>;
|
|
177
|
+
readonly defaultValue: _angular_core.InputSignal<SelectionValue<M> | undefined>;
|
|
178
|
+
/** Calendar system shown and understood when typing. Default: 'gregory'. */
|
|
179
|
+
readonly system: _angular_core.InputSignal<CalendarSystem>;
|
|
180
|
+
/** BCP 47 locale for names, numerals and the order of a typed date. Default: 'en-US'. */
|
|
181
|
+
readonly locale: _angular_core.InputSignal<string>;
|
|
182
|
+
/** Plugins register calendar systems, for example `persianPlugin`. */
|
|
183
|
+
readonly plugins: _angular_core.InputSignal<_calendrix_core.CalendarPlugin[] | undefined>;
|
|
184
|
+
readonly minDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
185
|
+
readonly maxDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
186
|
+
readonly isDateUnavailable: _angular_core.InputSignal<((date: CalendarDate) => boolean) | undefined>;
|
|
187
|
+
/** First day of the week, 0 is Sunday. Default: from the locale. */
|
|
188
|
+
readonly weekStart: _angular_core.InputSignal<_calendrix_core.WeekStart | undefined>;
|
|
189
|
+
/** Default: from the locale. */
|
|
190
|
+
readonly direction: _angular_core.InputSignal<_calendrix_core.Direction | undefined>;
|
|
191
|
+
readonly timeZone: _angular_core.InputSignal<string | undefined>;
|
|
192
|
+
readonly now: _angular_core.InputSignal<(() => Date) | undefined>;
|
|
193
|
+
/** How many months the calendar shows. Default: 2 for `range`, 1 otherwise. */
|
|
194
|
+
readonly visibleMonths: _angular_core.InputSignal<number | undefined>;
|
|
195
|
+
/** Range: allow a range that contains unavailable days. Default: true. */
|
|
196
|
+
readonly allowUnavailableInRange: _angular_core.InputSignal<boolean | undefined>;
|
|
197
|
+
/** Multiple: the most days that can be selected. Default: no limit. */
|
|
198
|
+
readonly maxSelected: _angular_core.InputSignal<number | undefined>;
|
|
199
|
+
/**
|
|
200
|
+
* Close the popover when the selection is complete: a picked day, or the second day of a range.
|
|
201
|
+
* Default: true, except for `multiple`.
|
|
202
|
+
*/
|
|
203
|
+
readonly closeOnSelect: _angular_core.InputSignal<boolean | undefined>;
|
|
204
|
+
readonly labels: _angular_core.InputSignal<DatePickerLabels | undefined>;
|
|
205
|
+
readonly placeholder: _angular_core.InputSignal<string | undefined>;
|
|
206
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
207
|
+
/** The `id` of the text input, for a `<label for>`. */
|
|
208
|
+
readonly inputId: _angular_core.InputSignal<string | undefined>;
|
|
209
|
+
/** Render the popover in `<body>` (default). Use `[portal]="false"` to render it next to the input. */
|
|
210
|
+
readonly portal: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
211
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
212
|
+
protected readonly text: _angular_core.WritableSignal<string>;
|
|
213
|
+
private readonly touched;
|
|
214
|
+
protected readonly dialogId: string;
|
|
215
|
+
private readonly inputElement;
|
|
216
|
+
private readonly injector;
|
|
217
|
+
/** True while the value is changing because the user typed it: the text must stay as typed. */
|
|
218
|
+
private typing;
|
|
219
|
+
private readonly empty;
|
|
220
|
+
/** The value as the parent gave it, or the default (and the empty value) until a first change. */
|
|
221
|
+
private readonly current;
|
|
222
|
+
/** The selection in the calendar system on screen. */
|
|
223
|
+
protected readonly shown: _angular_core.Signal<SelectionValue<M>>;
|
|
224
|
+
private readonly valueKey;
|
|
225
|
+
protected readonly isEmpty: _angular_core.Signal<boolean>;
|
|
226
|
+
protected readonly texts: _angular_core.Signal<PickerLabels>;
|
|
227
|
+
protected readonly invalid: _angular_core.Signal<boolean>;
|
|
228
|
+
protected readonly samplePlaceholder: _angular_core.Signal<string>;
|
|
229
|
+
constructor();
|
|
230
|
+
ngOnInit(): void;
|
|
231
|
+
private onChangeFn;
|
|
232
|
+
private onTouchedFn;
|
|
233
|
+
private readonly formDisabled;
|
|
234
|
+
/** Disabled by the `disabled` input or by the form. */
|
|
235
|
+
protected readonly disabled: _angular_core.Signal<boolean>;
|
|
236
|
+
writeValue(value: unknown): void;
|
|
237
|
+
registerOnChange(fn: (value: SelectionValue<M>) => void): void;
|
|
238
|
+
registerOnTouched(fn: () => void): void;
|
|
239
|
+
setDisabledState(isDisabled: boolean): void;
|
|
240
|
+
/** Typing a date in a calendar from a plugin works before the popover has ever been opened. */
|
|
241
|
+
private registerPlugins;
|
|
242
|
+
private format;
|
|
243
|
+
/** A typed text: one date, or a range. A list of days is not typed. */
|
|
244
|
+
private parse;
|
|
245
|
+
private commit;
|
|
246
|
+
/** The flag only covers the render caused by typing. A later change from the parent updates the text. */
|
|
247
|
+
private markTyping;
|
|
248
|
+
protected onInput(event: Event): void;
|
|
249
|
+
private handleText;
|
|
250
|
+
protected handleBlur(): void;
|
|
251
|
+
protected onInputKeydown(event: KeyboardEvent): void;
|
|
252
|
+
protected resetValue(): void;
|
|
253
|
+
protected clearAndFocus(): void;
|
|
254
|
+
/** Close the popover, and give the focus back to the input when `returnFocus` is true. */
|
|
255
|
+
protected close(returnFocus: boolean): void;
|
|
256
|
+
protected onDismiss(reason: PopoverDismissReason): void;
|
|
257
|
+
protected onCalendarChange(next: SelectionValue<M> | undefined): void;
|
|
258
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixDatePicker<any>, never>;
|
|
259
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalendrixDatePicker<any>, "calendrix-date-picker", never, { "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "system": { "alias": "system"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "plugins": { "alias": "plugins"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "isDateUnavailable": { "alias": "isDateUnavailable"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "timeZone": { "alias": "timeZone"; "required": false; "isSignal": true; }; "now": { "alias": "now"; "required": false; "isSignal": true; }; "visibleMonths": { "alias": "visibleMonths"; "required": false; "isSignal": true; }; "allowUnavailableInRange": { "alias": "allowUnavailableInRange"; "required": false; "isSignal": true; }; "maxSelected": { "alias": "maxSelected"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "portal": { "alias": "portal"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* A text input and a popover with a calendar and a time field. The user can type a date and a
|
|
264
|
+
* time or pick them; the value is the same `{ date, time }` the core uses (no time zone: see
|
|
265
|
+
* `toInstant`). With `selection="range"` the value is `{ start, end }`, each with a date and a
|
|
266
|
+
* time, and the popover has two time fields (ADR 0023). It has no styles of its own, see the
|
|
267
|
+
* `calendrix-*` classes.
|
|
268
|
+
*
|
|
269
|
+
* Use `[(value)]`, or `[defaultValue]` and `(valueChange)`. The type of the value follows
|
|
270
|
+
* `selection`.
|
|
271
|
+
*/
|
|
272
|
+
declare class CalendrixDateTimePicker<M extends DateTimeMode = 'single'> implements OnInit, ControlValueAccessor {
|
|
273
|
+
/** One date and time (default), or a range with a start and an end, each with a time. */
|
|
274
|
+
readonly selection: _angular_core.InputSignal<M>;
|
|
275
|
+
/** The picked value. Use `[(value)]`. The type follows `selection`. `null` means nothing. */
|
|
276
|
+
readonly value: _angular_core.ModelSignal<DateTimePickerValue<M> | undefined>;
|
|
277
|
+
readonly defaultValue: _angular_core.InputSignal<DateTimePickerValue<M> | undefined>;
|
|
278
|
+
/** Calendar system shown and understood when typing. Default: 'gregory'. */
|
|
279
|
+
readonly system: _angular_core.InputSignal<CalendarSystem>;
|
|
280
|
+
/** BCP 47 locale for names, numerals and the order of a typed date. Default: 'en-US'. */
|
|
281
|
+
readonly locale: _angular_core.InputSignal<string>;
|
|
282
|
+
/** 12 or 24. Default: the locale's own habit. */
|
|
283
|
+
readonly hourCycle: _angular_core.InputSignal<HourCycle | undefined>;
|
|
284
|
+
readonly showSeconds: _angular_core.InputSignal<boolean | undefined>;
|
|
285
|
+
/** Step of the up and down arrows in the time field. Default: 1. */
|
|
286
|
+
readonly hourStep: _angular_core.InputSignal<number | undefined>;
|
|
287
|
+
readonly minuteStep: _angular_core.InputSignal<number | undefined>;
|
|
288
|
+
readonly secondStep: _angular_core.InputSignal<number | undefined>;
|
|
289
|
+
/** Times outside this range are rejected. A picked date starts at `minTime`. */
|
|
290
|
+
readonly minTime: _angular_core.InputSignal<TimeValue | undefined>;
|
|
291
|
+
readonly maxTime: _angular_core.InputSignal<TimeValue | undefined>;
|
|
292
|
+
readonly minDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
293
|
+
readonly maxDate: _angular_core.InputSignal<CalendarDate | undefined>;
|
|
294
|
+
/** First day of the week, 0 is Sunday. Default: from the locale. */
|
|
295
|
+
readonly weekStart: _angular_core.InputSignal<_calendrix_core.WeekStart | undefined>;
|
|
296
|
+
/** Default: from the locale. */
|
|
297
|
+
readonly direction: _angular_core.InputSignal<_calendrix_core.Direction | undefined>;
|
|
298
|
+
/** How many months the calendar shows: 1 (default; 2 for `range`), 2 or 3. */
|
|
299
|
+
readonly visibleMonths: _angular_core.InputSignal<number | undefined>;
|
|
300
|
+
readonly isDateUnavailable: _angular_core.InputSignal<((date: CalendarDate) => boolean) | undefined>;
|
|
301
|
+
/** Plugins register calendar systems, for example `persianPlugin`. */
|
|
302
|
+
readonly plugins: _angular_core.InputSignal<_calendrix_core.CalendarPlugin[] | undefined>;
|
|
303
|
+
readonly timeZone: _angular_core.InputSignal<string | undefined>;
|
|
304
|
+
readonly now: _angular_core.InputSignal<(() => Date) | undefined>;
|
|
305
|
+
readonly labels: _angular_core.InputSignal<Partial<PickerLabels> | undefined>;
|
|
306
|
+
readonly placeholder: _angular_core.InputSignal<string | undefined>;
|
|
307
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
308
|
+
/** The `id` of the text input, for a `<label for>`. */
|
|
309
|
+
readonly inputId: _angular_core.InputSignal<string | undefined>;
|
|
310
|
+
/**
|
|
311
|
+
* Render the popover in `<body>` (default). Use `[portal]="false"` to render it next to the
|
|
312
|
+
* input instead. The `data-theme` of an ancestor does not reach a portaled popover.
|
|
313
|
+
*/
|
|
314
|
+
readonly portal: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
315
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
316
|
+
protected readonly text: _angular_core.WritableSignal<string>;
|
|
317
|
+
/**
|
|
318
|
+
* A time chosen before any date. It becomes part of the value when a date is picked. In
|
|
319
|
+
* `single` mode `draftStart` is the only one; in `range` mode there is one for each end.
|
|
320
|
+
*/
|
|
321
|
+
protected readonly draftStart: _angular_core.WritableSignal<TimeValue | null>;
|
|
322
|
+
protected readonly draftEnd: _angular_core.WritableSignal<TimeValue | null>;
|
|
323
|
+
private readonly touched;
|
|
324
|
+
protected readonly dialogId: string;
|
|
325
|
+
private readonly inputElement;
|
|
326
|
+
private readonly injector;
|
|
327
|
+
/** True while the value is changing because the user typed it: the text must stay as typed. */
|
|
328
|
+
private typing;
|
|
329
|
+
protected readonly isRangeMode: _angular_core.Signal<boolean>;
|
|
330
|
+
/** The value as the parent gave it, or the default until a first change. */
|
|
331
|
+
private readonly current;
|
|
332
|
+
private inSystem;
|
|
333
|
+
/** The value in the calendar system on screen. */
|
|
334
|
+
private readonly shown;
|
|
335
|
+
protected readonly shownPoint: _angular_core.Signal<DateTimeValue | null>;
|
|
336
|
+
protected readonly shownRange: _angular_core.Signal<DateTimeRange | null>;
|
|
337
|
+
/** The dates of a complete range, for the calendar. */
|
|
338
|
+
protected readonly calendarRange: _angular_core.Signal<DateRange | null>;
|
|
339
|
+
private readonly valueKey;
|
|
340
|
+
protected readonly texts: _angular_core.Signal<PickerLabels>;
|
|
341
|
+
protected readonly startLabels: _angular_core.Signal<{
|
|
342
|
+
time: string;
|
|
343
|
+
}>;
|
|
344
|
+
protected readonly endLabels: _angular_core.Signal<{
|
|
345
|
+
time: string;
|
|
346
|
+
}>;
|
|
347
|
+
protected readonly hasValue: _angular_core.Signal<boolean>;
|
|
348
|
+
protected readonly invalid: _angular_core.Signal<boolean>;
|
|
349
|
+
protected readonly samplePlaceholder: _angular_core.Signal<string>;
|
|
350
|
+
constructor();
|
|
351
|
+
ngOnInit(): void;
|
|
352
|
+
private onChangeFn;
|
|
353
|
+
private onTouchedFn;
|
|
354
|
+
private readonly formDisabled;
|
|
355
|
+
/** Disabled by the `disabled` input or by the form. */
|
|
356
|
+
protected readonly disabled: _angular_core.Signal<boolean>;
|
|
357
|
+
writeValue(value: unknown): void;
|
|
358
|
+
registerOnChange(fn: (value: DateTimePickerValue<M>) => void): void;
|
|
359
|
+
registerOnTouched(fn: () => void): void;
|
|
360
|
+
setDisabledState(isDisabled: boolean): void;
|
|
361
|
+
/** Typing a date in a calendar from a plugin works before the popover has ever been opened. */
|
|
362
|
+
private registerPlugins;
|
|
363
|
+
private format;
|
|
364
|
+
private parse;
|
|
365
|
+
private commit;
|
|
366
|
+
/** The flag only covers the render caused by typing. A later change from the parent updates the text. */
|
|
367
|
+
private markTyping;
|
|
368
|
+
protected onInput(event: Event): void;
|
|
369
|
+
private handleText;
|
|
370
|
+
protected handleBlur(): void;
|
|
371
|
+
protected onInputKeydown(event: KeyboardEvent): void;
|
|
372
|
+
private defaultTime;
|
|
373
|
+
protected pickDate(date: CalendarDate | null | undefined): void;
|
|
374
|
+
/** The second day of a range: the times are the ones already chosen, or the default. */
|
|
375
|
+
protected pickRange(range: DateRange | null | undefined): void;
|
|
376
|
+
protected pickTime(which: 'start' | 'end', time: TimeValue | null | undefined): void;
|
|
377
|
+
protected clear(): void;
|
|
378
|
+
protected clearAndFocus(): void;
|
|
379
|
+
/** Close the popover, and give the focus back to the input when `returnFocus` is true. */
|
|
380
|
+
protected close(returnFocus: boolean): void;
|
|
381
|
+
protected onDismiss(reason: PopoverDismissReason): void;
|
|
382
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixDateTimePicker<any>, never>;
|
|
383
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalendrixDateTimePicker<any>, "calendrix-date-time-picker", never, { "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "system": { "alias": "system"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "hourCycle": { "alias": "hourCycle"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "hourStep": { "alias": "hourStep"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "minTime": { "alias": "minTime"; "required": false; "isSignal": true; }; "maxTime": { "alias": "maxTime"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "visibleMonths": { "alias": "visibleMonths"; "required": false; "isSignal": true; }; "isDateUnavailable": { "alias": "isDateUnavailable"; "required": false; "isSignal": true; }; "plugins": { "alias": "plugins"; "required": false; "isSignal": true; }; "timeZone": { "alias": "timeZone"; "required": false; "isSignal": true; }; "now": { "alias": "now"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "portal": { "alias": "portal"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Applies what a prop getter of the core returns (`{ attrs, handlers }`) to an element:
|
|
388
|
+
* the attributes, and the handlers as event listeners. Set `calendrixHandlers` to false to apply
|
|
389
|
+
* only the attributes, when the component handles the events itself.
|
|
390
|
+
*/
|
|
391
|
+
declare class CalendrixPropsDirective {
|
|
392
|
+
readonly props: _angular_core.InputSignal<ElementProps<object> | null | undefined>;
|
|
393
|
+
readonly handlers: _angular_core.InputSignal<boolean>;
|
|
394
|
+
private readonly element;
|
|
395
|
+
private readonly renderer;
|
|
396
|
+
private applied;
|
|
397
|
+
private latest;
|
|
398
|
+
private readonly listeners;
|
|
399
|
+
constructor();
|
|
400
|
+
private applyAttributes;
|
|
401
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixPropsDirective, never>;
|
|
402
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CalendrixPropsDirective, "[calendrixProps]", never, { "props": { "alias": "calendrixProps"; "required": false; "isSignal": true; }; "handlers": { "alias": "calendrixHandlers"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* A time input made of segments (hour, minute, optional seconds, AM/PM). Each segment is a
|
|
407
|
+
* spinbutton: type digits, or use the up and down arrow keys. It has no styles of its own: use the
|
|
408
|
+
* `calendrix-*` classes. Use `[(value)]` to read and set the time.
|
|
409
|
+
*/
|
|
410
|
+
declare class CalendrixTimeField implements OnInit, ControlValueAccessor {
|
|
411
|
+
/** The time. Use `[(value)]`. `null` means an empty field. */
|
|
412
|
+
readonly value: _angular_core.ModelSignal<TimeValue | null | undefined>;
|
|
413
|
+
readonly defaultValue: _angular_core.InputSignal<TimeValue | null | undefined>;
|
|
414
|
+
/** BCP 47 locale for numerals and the AM/PM text. Default: 'en-US'. */
|
|
415
|
+
readonly locale: _angular_core.InputSignal<string | undefined>;
|
|
416
|
+
/** 12 or 24. Default: the locale's own habit. */
|
|
417
|
+
readonly hourCycle: _angular_core.InputSignal<HourCycle | undefined>;
|
|
418
|
+
/** Show a seconds segment. Default: false. */
|
|
419
|
+
readonly showSeconds: _angular_core.InputSignal<boolean | undefined>;
|
|
420
|
+
/** Step of the up and down arrows. Default: 1. */
|
|
421
|
+
readonly hourStep: _angular_core.InputSignal<number | undefined>;
|
|
422
|
+
readonly minuteStep: _angular_core.InputSignal<number | undefined>;
|
|
423
|
+
readonly secondStep: _angular_core.InputSignal<number | undefined>;
|
|
424
|
+
/** Values outside this range are rejected. */
|
|
425
|
+
readonly minTime: _angular_core.InputSignal<TimeValue | undefined>;
|
|
426
|
+
readonly maxTime: _angular_core.InputSignal<TimeValue | undefined>;
|
|
427
|
+
readonly labels: _angular_core.InputSignal<Partial<TimeFieldLabels> | undefined>;
|
|
428
|
+
/** The user cannot change anything (ADR 0022). A form can also disable the field. */
|
|
429
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
430
|
+
/** Created again in `ngOnInit`: the core reads some options only when it is created. */
|
|
431
|
+
protected field: _calendrix_core.TimeField;
|
|
432
|
+
protected readonly state: _angular_core.WritableSignal<_calendrix_core.TimeFieldState>;
|
|
433
|
+
private unsubscribe;
|
|
434
|
+
private readonly host;
|
|
435
|
+
/** The last `focusRequest` of the core that this component has seen (see `TimeFieldState`). */
|
|
436
|
+
private seenFocusRequest;
|
|
437
|
+
private readonly handleChange;
|
|
438
|
+
private readonly options;
|
|
439
|
+
protected readonly view: _angular_core.Signal<{
|
|
440
|
+
root: _calendrix_core.ElementProps<Record<string, never>>;
|
|
441
|
+
segments: {
|
|
442
|
+
segment: _calendrix_core.TimeSegment;
|
|
443
|
+
props: _calendrix_core.ElementProps<{
|
|
444
|
+
keydown: (event: _calendrix_core.KeyEventLike) => void;
|
|
445
|
+
beforeinput: (event: _calendrix_core.InputEventLike) => void;
|
|
446
|
+
focus: () => void;
|
|
447
|
+
}>;
|
|
448
|
+
separator: boolean;
|
|
449
|
+
}[];
|
|
450
|
+
}>;
|
|
451
|
+
constructor();
|
|
452
|
+
ngOnInit(): void;
|
|
453
|
+
private onChangeFn;
|
|
454
|
+
private onTouchedFn;
|
|
455
|
+
private readonly formDisabled;
|
|
456
|
+
/** Disabled by the `disabled` input or by the form. */
|
|
457
|
+
protected readonly disabled: _angular_core.Signal<boolean>;
|
|
458
|
+
writeValue(value: unknown): void;
|
|
459
|
+
registerOnChange(fn: (value: TimeValue | null) => void): void;
|
|
460
|
+
registerOnTouched(fn: () => void): void;
|
|
461
|
+
setDisabledState(isDisabled: boolean): void;
|
|
462
|
+
/** The control is touched when the focus leaves the whole field, not between its segments. */
|
|
463
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
464
|
+
protected onKeydown(type: TimeSegmentType, event: KeyboardEvent): void;
|
|
465
|
+
/** Text from an on-screen keyboard (ADR 0024). */
|
|
466
|
+
protected onBeforeInput(type: TimeSegmentType, event: Event): void;
|
|
467
|
+
/**
|
|
468
|
+
* A composition cannot be cancelled: the browser has written into the segment. Write the text of
|
|
469
|
+
* the state back into the same text node (Angular keeps that node).
|
|
470
|
+
*/
|
|
471
|
+
protected onInput(type: TimeSegmentType, event: Event): void;
|
|
472
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalendrixTimeField, never>;
|
|
473
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalendrixTimeField, "calendrix-time-field", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "hourCycle": { "alias": "hourCycle"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "hourStep": { "alias": "hourStep"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "secondStep": { "alias": "secondStep"; "required": false; "isSignal": true; }; "minTime": { "alias": "minTime"; "required": false; "isSignal": true; }; "maxTime": { "alias": "maxTime"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export { CalendrixCalendar, CalendrixDatePicker, CalendrixDateTimePicker, CalendrixPopover, CalendrixPropsDirective, CalendrixTimeField };
|
|
477
|
+
export type { DatePickerLabels, PopoverDismissReason };
|