angular-ui-controls 0.0.0-stage → 0.1.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -2
  3. package/docs/api/README.md +29 -0
  4. package/docs/api/abbreviation-textarea.md +118 -0
  5. package/docs/api/action-menu.md +86 -0
  6. package/docs/api/advanced-select.md +214 -0
  7. package/docs/api/autocomplete.md +134 -0
  8. package/docs/api/checkbox.md +98 -0
  9. package/docs/api/date-picker.md +152 -0
  10. package/docs/api/date-range-picker.md +175 -0
  11. package/docs/api/date-time-picker.md +159 -0
  12. package/docs/api/file-upload.md +85 -0
  13. package/docs/api/number-input.md +162 -0
  14. package/docs/api/password-input.md +142 -0
  15. package/docs/api/pdf-viewer.md +50 -0
  16. package/docs/api/radio-group.md +126 -0
  17. package/docs/api/rich-text-editor.md +86 -0
  18. package/docs/api/search-filter.md +192 -0
  19. package/docs/api/search-input.md +160 -0
  20. package/docs/api/searchable-select.md +195 -0
  21. package/docs/api/segmented-control.md +93 -0
  22. package/docs/api/selection-list.md +120 -0
  23. package/docs/api/slide-toggle.md +105 -0
  24. package/docs/api/text-area.md +148 -0
  25. package/docs/api/text-input.md +159 -0
  26. package/docs/api/time-input.md +99 -0
  27. package/docs/api/time-picker.md +130 -0
  28. package/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs +2 -0
  29. package/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs.map +1 -0
  30. package/fesm2022/angular-ui-controls-forms.mjs +865 -0
  31. package/fesm2022/angular-ui-controls-forms.mjs.map +1 -0
  32. package/fesm2022/angular-ui-controls-text-input.mjs +1210 -0
  33. package/fesm2022/angular-ui-controls-text-input.mjs.map +1 -0
  34. package/fesm2022/angular-ui-controls.mjs +7181 -0
  35. package/fesm2022/angular-ui-controls.mjs.map +1 -0
  36. package/forms/index.d.ts +425 -0
  37. package/forms/index.d.ts.map +1 -0
  38. package/index.d.ts +4345 -0
  39. package/index.d.ts.map +1 -0
  40. package/package.json +82 -3
  41. package/text-input/index.d.ts +609 -0
  42. package/text-input/index.d.ts.map +1 -0
@@ -0,0 +1,134 @@
1
+ # AutocompleteComponent
2
+
3
+ Suggestions while typing.
4
+
5
+ Selector `ui-autocomplete`.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { AutocompleteComponent } from 'angular-ui-controls';
11
+ ```
12
+
13
+ Add `AutocompleteComponent` to the host component's imports. Add `FormsModule` for this example.
14
+
15
+ ```html
16
+ <ui-autocomplete
17
+ inputId="country"
18
+ label="Country"
19
+ [(ngModel)]="country"
20
+ [options]="countries"
21
+ labelKey="label"
22
+ valueKey="code"
23
+ />
24
+ ```
25
+
26
+ Example fields in the host component.
27
+
28
+ ```ts
29
+ country: string | null = null;
30
+ countries = [
31
+ { code: 'IN', label: 'India' },
32
+ { code: 'US', label: 'United States' },
33
+ { code: 'DE', label: 'Germany' },
34
+ { code: 'JP', label: 'Japan' },
35
+ ];
36
+ ```
37
+
38
+ Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
39
+
40
+ ## Inputs
41
+
42
+ | Input | Type | Required | Default | Description |
43
+ | ------------------------ | ------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
44
+ | `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
45
+ | `readonly` | `boolean` | No | `false` | Requests the existing read-only behavior without disabling the parent form control. |
46
+ | `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
47
+ | `options` | `any[]` | No | `[]` | Options rendered by the control; use the label/value key inputs for object options. |
48
+ | `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
49
+ | `maxLength` | `number` | No | `0` | Maximum character length for the autocomplete input. |
50
+ | `labelKey` | `string` | No | `''` | Property name read from an option object to obtain its visible label. |
51
+ | `valueKey` | `string` | No | `''` | Property name used to identify or extract an option value. |
52
+ | `optionNgClass` | `\| ((option: any) => string \| string[] \| Set<string> \| Record<string, boolean>) \| null` | No | `null` | Optional resolver returning an ngClass value for each option (conditional coloring/styling). Receives the raw option and may return a string, string[] or { className: boolean } map. |
53
+ | `panelClass` | `string \| string[]` | No | `''` | Additional CSS class or classes applied to the existing overlay panel. |
54
+ | `errorMessage` | `string` | No | `''` | to show error message. |
55
+ | `virtualScroll` | `boolean` | No | `false` | Renders the options inside a cdk virtual scroll viewport (use for large lists). |
56
+ | `singleLineOption` | `boolean` | No | `false` | Keeps each option on a single line with ellipsis; full text is shown in a tooltip on hover when truncated. |
57
+ | `virtualScrollItemSize` | `number` | No | `48` | Height (px) of a single option row; must match the rendered mat-option height when virtualScroll is on. |
58
+ | `virtualScrollMaxHeight` | `number` | No | `256` | Maximum height (px) of the virtual scroll viewport (mat-autocomplete panel max-height is 256px). |
59
+ | `autocompleteModel` | `AutocompleteModel` | No | `{ value: '', fieldId: '', fieldName: '' }` | Autocomplete value and field metadata object; its value is synchronized with the shared control value. |
60
+ | `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
61
+ | `placeholder` | `string` | No | `''` | Hint text or translation key displayed while the control is empty. |
62
+ | `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
63
+ | `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
64
+ | `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
65
+
66
+ ## Outputs
67
+
68
+ | Output | Payload | When it fires |
69
+ | -------------- | ------- | --------------------------------------------------------------------------- |
70
+ | `valueChanged` | `any` | Emits the existing value-change payload; remains separate from modelChange. |
71
+ | `modelChange` | `any` | Emits a model-change event with field metadata. |
72
+ | `inputChanged` | `any` | Emits when the user edits the field. |
73
+ | `focusGained` | `any` | Emits when the inner field gains focus. |
74
+ | `focusLost` | `any` | Emits when the inner field loses focus. |
75
+ | `keyPressed` | `any` | Emits on the inner field keydown event. |
76
+ | `keyReleased` | `any` | Emits on the inner field keyup event. |
77
+ | `enterPressed` | `any` | Emits when Enter is released in the inner field. |
78
+ | `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
79
+
80
+ ## Local option and event types
81
+
82
+ These declarations describe the payload and option shapes. Import availability depends on the package entry point.
83
+
84
+ ```ts
85
+ export interface AutocompleteModel {
86
+ value?: any;
87
+ fieldId?: string | number;
88
+ fieldName?: string | number;
89
+ textFieldName?: string | number;
90
+ }
91
+ ```
92
+
93
+ ## Public instance properties
94
+
95
+ These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
96
+
97
+ | Property | Type | Description |
98
+ | ----------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
+ | `searchText` | `string` | — |
100
+ | `panelClassList` | `string` | — |
101
+ | `autoComplete` | `NgModel` | — |
102
+ | `autoCompleteBindvalue` | `(autocompleteOption: any) => string` | Determines the display value for an autocomplete option. Priority: 1. labelKey of the list item matching a bound primitive value (e.g. an id) 2. valueKey 3. labelKey 4. fallback to the option itself. |
103
+ | `trackByFn` | `(index: number, option: any) => any` | Track function for cdkVirtualFor. |
104
+ | `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
105
+ | `onTouchedCallback` | `() => void` | — |
106
+ | `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
107
+
108
+ ## Public instance methods
109
+
110
+ The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
111
+
112
+ | Method | Signature | Description |
113
+ | ------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | `searchTextChanges` | `(changeEvent: Event): void` | Handles changes in the input text field. Updates the local searchText value. If the input is cleared, resets the autocomplete model and emits a selection change event. |
115
+ | `modelValueChange` | `(): void` | Emits an event whenever the bound model value changes. Typically triggered by Angular's ngModelChange. |
116
+ | `inputChange` | `(): void` | Emits an event on every input value change (typing). Used for live search or filtering behaviors. |
117
+ | `focusChange` | `(): void` | Emits an event when the input field gains focus. |
118
+ | `blurChange` | `(): void` | Emits an event when the input field loses focus. |
119
+ | `keydownHandle` | `(event: KeyboardEvent): void` | Emits the raw keyboard event when a key is pressed down. |
120
+ | `keyupHandle` | `(event: KeyboardEvent): void` | Emits the raw keyboard event when a key is released. |
121
+ | `keyEnterHandle` | `(event: Event): void` | Emits an event when the Enter key is pressed. |
122
+ | `onSelectionChange` | `(): void` | Handles selection changes from the autocomplete dropdown. Emits the selected value and resets the search text. |
123
+ | `getViewportHeight` | `(count?: number): number` | Calculates the virtual scroll viewport height so short lists don't leave empty space and long lists are capped. |
124
+ | `onPanelOpened` | `(): void` | The viewport is measured while the overlay is being attached, so re-measure once the panel is rendered to avoid a blank list. |
125
+ | `onPanelClosed` | `(): void` | Reset the virtual scroll position so the next open starts from the top. |
126
+ | `configureId` | `(): void` | — |
127
+ | `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
128
+ | `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
129
+ | `writeValue` | `(value: any \| null): void` | Writes a new value from the form model to the view. |
130
+ | `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
131
+ | `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
132
+ | `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
133
+
134
+ [Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/autocomplete/autocomplete.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
@@ -0,0 +1,98 @@
1
+ # CheckboxComponent
2
+
3
+ Boolean selection.
4
+
5
+ Selector `ui-checkbox`.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { CheckboxComponent } from 'angular-ui-controls';
11
+ ```
12
+
13
+ Add `CheckboxComponent` to the host component's imports. Add `FormsModule` for this example.
14
+
15
+ ```html
16
+ <ui-checkbox inputId="updates" label="Receive updates" [(ngModel)]="updates" />
17
+ ```
18
+
19
+ Example fields in the host component.
20
+
21
+ ```ts
22
+ updates = false;
23
+ ```
24
+
25
+ Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
26
+
27
+ ## Inputs
28
+
29
+ | Input | Type | Required | Default | Description |
30
+ | --------------- | ------------------ | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
31
+ | `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
32
+ | `tooltip` | `string` | No | `''` | Tooltip text displayed on hover. |
33
+ | `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
34
+ | `errorMessage` | `string` | No | `''` | Error message displayed for validation. |
35
+ | `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
36
+ | `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
37
+ | `indeterminate` | `boolean` | No | `false` | The indeterminate state is typically used in a "select all" scenario, where it indicates that some but not all child items are selected. |
38
+ | `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
39
+ | `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
40
+ | `value` | `boolean \| null` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
41
+
42
+ ## Outputs
43
+
44
+ | Output | Payload | When it fires |
45
+ | -------------- | -------------------------- | ----------------------------------------------------------------------- |
46
+ | `clicked` | `MouseEvent` | Emits when the existing click handler runs. |
47
+ | `modelChange` | `CheckboxFieldInfo` | Emits a model-change event with field metadata. |
48
+ | `inputChanged` | `CheckboxInputChangeEvent` | Emits when the user edits the field. |
49
+ | `valueChange` | `boolean \| null` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
50
+
51
+ ## Local option and event types
52
+
53
+ These declarations describe the payload and option shapes. Import availability depends on the package entry point.
54
+
55
+ ```ts
56
+ export interface CheckboxFieldInfo {
57
+ inputRef?: Element | null;
58
+ modelValue: boolean;
59
+ textFieldName: string | number;
60
+ }
61
+
62
+ export interface CheckboxInputChangeEvent extends CheckboxFieldInfo {
63
+ changeEvent: Event | MatCheckboxChange;
64
+ }
65
+ ```
66
+
67
+ ## Public instance properties
68
+
69
+ These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
70
+
71
+ | Property | Type | Description |
72
+ | ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
73
+ | `isChecked` | `boolean` | Internal model bound to checkbox. |
74
+ | `inputModelValue` | `boolean` | **Deprecated.** Use isChecked for direct component access. |
75
+ | `modelValue` | `boolean` | Internal model alias for template/fieldInfo compatibility. |
76
+ | `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
77
+ | `onTouchedCallback` | `() => void` | — |
78
+ | `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
79
+
80
+ ## Public instance methods
81
+
82
+ The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
83
+
84
+ | Method | Signature | Description |
85
+ | ------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
86
+ | `modelValueChange` | `(): void` | Emits updated model value when ngModel changes. |
87
+ | `inputChange` | `(changeValue: Event, typeofChange: string): void` | Emits input event details along with field info. |
88
+ | `onChangeHandle` | `(changeValue: MatCheckboxChange, typeofChange: string): void` | Handles checkbox change event. |
89
+ | `onCheckboxClick` | `(event: MouseEvent): void` | Emits click event when checkbox is clicked. |
90
+ | `configureId` | `(): void` | — |
91
+ | `commitValue` | `(value?: boolean \| null): void` | Commit a view edit after the inner control has updated its local model. |
92
+ | `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
93
+ | `writeValue` | `(value: boolean \| null): void` | Writes a new value from the form model to the view. |
94
+ | `registerOnChange` | `(fn: (value: boolean \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
95
+ | `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
96
+ | `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
97
+
98
+ [Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/checkbox/checkbox.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
@@ -0,0 +1,152 @@
1
+ # DatePickerComponent
2
+
3
+ Single date.
4
+
5
+ Selector `ui-date-picker`.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { DatePickerComponent } from 'angular-ui-controls';
11
+ ```
12
+
13
+ Add `DatePickerComponent` to the host component's imports. Add `FormsModule` for this example.
14
+
15
+ ```html
16
+ <ui-date-picker inputId="date" label="Choose a date" [(ngModel)]="date" />
17
+ ```
18
+
19
+ Example fields in the host component.
20
+
21
+ ```ts
22
+ date: Date | null = null;
23
+ ```
24
+
25
+ Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
26
+
27
+ ## Inputs
28
+
29
+ | Input | Type | Required | Default | Description |
30
+ | ---------------------- | ------------------ | -------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
31
+ | `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
32
+ | `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
33
+ | `errorMessage` | `string` | No | `''` | Error message displayed for validation. |
34
+ | `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
35
+ | `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
36
+ | `placeholder` | `string` | No | `''` | Hint text or translation key displayed while the control is empty. |
37
+ | `readonly` | `boolean` | No | `false` | Requests the existing read-only behavior without disabling the parent form control. |
38
+ | `autoPopulateDateTime` | `boolean` | No | `true` | Automatically populate current date on load. |
39
+ | `minDate` | `Date` | No | `undefined` | Minimum selectable date. |
40
+ | `maxDate` | `Date` | No | `undefined` | Maximum selectable date. |
41
+ | `showTodayDate` | `boolean` | No | `false` | Flag to control whether today's date should be displayed in the UI. |
42
+ | `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
43
+ | `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
44
+ | `value` | `Date \| null` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
45
+
46
+ ## Outputs
47
+
48
+ | Output | Payload | When it fires |
49
+ | ----------------- | ---------------------------- | ----------------------------------------------------------------------- |
50
+ | `modelChange` | `DatePickerModelChangeEvent` | Emits a model-change event with field metadata. |
51
+ | `changeCommitted` | `DatePickerChangeEvent` | Emits from the existing change handler. |
52
+ | `inputChanged` | `DatePickerInputEvent` | Emits when the user edits the field. |
53
+ | `focusGained` | `DatePickerFocusEvent` | Emits when the inner field gains focus. |
54
+ | `focusLost` | `DatePickerBlurEvent` | Emits when the inner field loses focus. |
55
+ | `keyPressed` | `DatePickerKeyDownEvent` | Emits on the inner field keydown event. |
56
+ | `keyReleased` | `DatePickerKeyUpEvent` | Emits on the inner field keyup event. |
57
+ | `enterPressed` | `DatePickerEnterEvent` | Reserved for compatibility. This component currently does not emit it. |
58
+ | `dateChange` | `DatePickerDateChangeEvent` | Emits when the date-selection handler runs. |
59
+ | `valueChange` | `Date \| null` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
60
+
61
+ ## Local option and event types
62
+
63
+ These declarations describe the payload and option shapes. Import availability depends on the package entry point.
64
+
65
+ ```ts
66
+ export interface DatePickerModelChangeEvent extends DatePickerFieldInfo {
67
+ modelChangeEvent: Date | null;
68
+ }
69
+
70
+ export interface DatePickerFieldInfo {
71
+ /** Native input reference (available when inputId is provided) */
72
+ inputRef?: HTMLElement | null;
73
+
74
+ /** Current selected date value */
75
+ modelValue: Date | null;
76
+
77
+ /** Field identifier from parent component */
78
+ textFieldName: string | number;
79
+ }
80
+
81
+ export interface DatePickerChangeEvent extends DatePickerFieldInfo {
82
+ onChangeEvent: Event;
83
+ }
84
+
85
+ export interface DatePickerInputEvent extends DatePickerFieldInfo {
86
+ changeEvent: Event;
87
+ }
88
+
89
+ export interface DatePickerFocusEvent extends DatePickerFieldInfo {
90
+ onFocusEvent: FocusEvent;
91
+ }
92
+
93
+ export interface DatePickerBlurEvent extends DatePickerFieldInfo {
94
+ onBlurEvent: FocusEvent;
95
+ }
96
+
97
+ export interface DatePickerKeyDownEvent extends DatePickerFieldInfo {
98
+ onkeyDownEvent: KeyboardEvent;
99
+ }
100
+
101
+ export interface DatePickerKeyUpEvent extends DatePickerFieldInfo {
102
+ onKeyUpEvent: KeyboardEvent;
103
+ }
104
+
105
+ export interface DatePickerEnterEvent extends DatePickerFieldInfo {
106
+ onKeyUpEvent: KeyboardEvent;
107
+ }
108
+
109
+ export interface DatePickerDateChangeEvent extends DatePickerFieldInfo {
110
+ dateChangeEvent: MatDatepickerInputEvent<Date>;
111
+ }
112
+ ```
113
+
114
+ ## Public instance properties
115
+
116
+ These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
117
+
118
+ | Property | Type | Description |
119
+ | ------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
+ | `modelValue` | `Date` | Internal model getter/setter backed by the shared control value. |
121
+ | `datePickerFooter` | `ElementRef` | ViewChild reference to the custom footer DOM element. This element is appended manually to the mat-calendar rendered inside the Angular Material datepicker overlay. |
122
+ | `datePicker` | `MatDatepicker<any>` | ViewChild reference to the MatDatepicker component. Used to detect when the datepicker opens so overlay DOM manipulation can be safely performed. |
123
+ | `todayDate` | `string` | — |
124
+ | `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
125
+ | `onTouchedCallback` | `() => void` | — |
126
+ | `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
127
+
128
+ ## Public instance methods
129
+
130
+ The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
131
+
132
+ | Method | Signature | Description |
133
+ | -------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
134
+ | `handleDateChange` | `(onDateChangeEvent: MatDatepickerInputEvent<Date>): void` | Handles date picker change event. |
135
+ | `handleModelChange` | `(modelChange: Date \| null): void` | Handles ngModel change event. |
136
+ | `onFocus` | `(onFocus: FocusEvent): void` | Handles focus event. |
137
+ | `onBlur` | `(onBlur: FocusEvent): void` | Handles blur event. |
138
+ | `onKeyUp` | `(onkeyUp: KeyboardEvent): void` | Handles keyup event. |
139
+ | `onKeyDown` | `(onkeyDown: KeyboardEvent): void` | Handles keydown event. |
140
+ | `onInput` | `(event: Event): void` | Handles keydown event. |
141
+ | `onChangeHandler` | `(event: any): void` | Handles change event. |
142
+ | `calendarOpen` | `(): void` | Retained for compatibility; Material owns overlay rendering. |
143
+ | `todayDateSelection` | `(): void` | — |
144
+ | `configureId` | `(): void` | — |
145
+ | `commitValue` | `(value?: Date \| null): void` | Commit a view edit after the inner control has updated its local model. |
146
+ | `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
147
+ | `writeValue` | `(value: Date \| null): void` | Writes a new value from the form model to the view. |
148
+ | `registerOnChange` | `(fn: (value: Date \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
149
+ | `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
150
+ | `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
151
+
152
+ [Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/date-picker/date-picker.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
@@ -0,0 +1,175 @@
1
+ # DateRangePickerComponent
2
+
3
+ Start and end dates.
4
+
5
+ Selector `ui-date-range-picker`.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { DateRangePickerComponent } from 'angular-ui-controls';
11
+ ```
12
+
13
+ Add `DateRangePickerComponent` to the host component's imports. Add `FormsModule` for this example.
14
+
15
+ ```html
16
+ <ui-date-range-picker
17
+ startInputId="rangeStart"
18
+ endInputId="rangeEnd"
19
+ label="Date range (start – end)"
20
+ startPlaceholder="Start date"
21
+ endPlaceholder="End date"
22
+ [(ngModel)]="dateRange"
23
+ />
24
+ ```
25
+
26
+ Example fields in the host component.
27
+
28
+ ```ts
29
+ dateRange: { start: Date | null; end: Date | null } = { start: null, end: null };
30
+ ```
31
+
32
+ Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
33
+
34
+ ## Inputs
35
+
36
+ | Input | Type | Required | Default | Description |
37
+ | ---------------------- | ------------------ | -------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
38
+ | `startInputId` | `string` | Yes | — | Identifier for the range start input, combined with idPrefix when supplied. |
39
+ | `endInputId` | `string` | Yes | — | Identifier for the range end input, combined with idPrefix when supplied. |
40
+ | `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
41
+ | `errorMessage` | `string` | No | `''` | Error message displayed for validation. |
42
+ | `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
43
+ | `startDisabled` | `boolean` | No | `false` | Disable start date input. |
44
+ | `endDisabled` | `boolean` | No | `false` | Disable end date input. |
45
+ | `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
46
+ | `startPlaceholder` | `string` | No | `''` | Placeholder for start date input. |
47
+ | `endPlaceholder` | `string` | No | `''` | Placeholder for end date input. |
48
+ | `endReadonly` | `boolean` | No | `false` | Makes end date input read-only. |
49
+ | `startReadonly` | `boolean` | No | `false` | Makes start date input read-only. |
50
+ | `autoPopulateDateTime` | `boolean` | No | `true` | Automatically populate current date. |
51
+ | `startMinDate` | `Date` | No | `undefined` | Minimum allowed start date. |
52
+ | `startMaxDate` | `Date` | No | `undefined` | Maximum allowed start date. |
53
+ | `endMinDate` | `Date` | No | `undefined` | Minimum allowed end date. |
54
+ | `endMaxDate` | `Date` | No | `undefined` | Maximum allowed end date. |
55
+ | `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
56
+ | `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
57
+ | `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
58
+
59
+ ## Outputs
60
+
61
+ | Output | Payload | When it fires |
62
+ | ----------------- | --------------------------- | ----------------------------------------------------------------------- |
63
+ | `modelChange` | `DateRangeModelChangeEvent` | Emits a model-change event with field metadata. |
64
+ | `changeCommitted` | `DateRangeChangeEvent` | Emits from the existing change handler. |
65
+ | `inputChanged` | `DateRangeInputEvent` | Emits when the user edits the field. |
66
+ | `focusGained` | `DateRangeFocusEvent` | Emits when the inner field gains focus. |
67
+ | `focusLost` | `DateRangeBlurEvent` | Emits when the inner field loses focus. |
68
+ | `keyPressed` | `DateRangeKeydownEvent` | Emits on the inner field keydown event. |
69
+ | `keyReleased` | `DateRangeKeyupEvent` | Emits on the inner field keyup event. |
70
+ | `enterPressed` | `DateRangeEnterEvent` | Reserved for compatibility. This component currently does not emit it. |
71
+ | `dateChange` | `DateRangeDateChangeEvent` | Emits when the date-selection handler runs. |
72
+ | `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
73
+
74
+ ## Local option and event types
75
+
76
+ These declarations describe the payload and option shapes. Import availability depends on the package entry point.
77
+
78
+ ```ts
79
+ export interface DateRangeModelChangeEvent extends DateRangeFieldInfo {
80
+ dateType: DateType;
81
+ modelChangeEvent: Date;
82
+ }
83
+
84
+ export interface DateRangeFieldInfo {
85
+ /** Start date value */
86
+ startDate: Date | null;
87
+
88
+ /** End date value */
89
+ endDate: Date | null;
90
+
91
+ /** Field name provided by parent */
92
+ fieldName: string | number;
93
+ }
94
+
95
+ export type DateType = 'START_DATE' | 'END_DATE';
96
+
97
+ export interface DateRangeChangeEvent extends DateRangeFieldInfo {
98
+ dateType: DateType;
99
+ changeEvent: Event;
100
+ }
101
+
102
+ export interface DateRangeInputEvent extends DateRangeFieldInfo {
103
+ dateType: DateType;
104
+ inputChangeEvent: Event;
105
+ }
106
+
107
+ export interface DateRangeFocusEvent extends DateRangeFieldInfo {
108
+ dateType: DateType;
109
+ onFocusEvent: FocusEvent;
110
+ }
111
+
112
+ export interface DateRangeBlurEvent extends DateRangeFieldInfo {
113
+ dateType: DateType;
114
+ blurEvent: FocusEvent;
115
+ }
116
+
117
+ export interface DateRangeKeydownEvent extends DateRangeFieldInfo {
118
+ dateType: DateType;
119
+ keyDownEvent: KeyboardEvent;
120
+ }
121
+
122
+ export interface DateRangeKeyupEvent extends DateRangeFieldInfo {
123
+ dateType: DateType;
124
+ keyUpEvent: KeyboardEvent;
125
+ }
126
+
127
+ export interface DateRangeEnterEvent extends DateRangeFieldInfo {
128
+ dateType: DateType;
129
+ keyUpEvent: KeyboardEvent;
130
+ }
131
+
132
+ export interface DateRangeDateChangeEvent extends DateRangeFieldInfo {
133
+ dateType: DateType;
134
+ dateChangeEvent: any;
135
+ }
136
+ ```
137
+
138
+ ## Public instance properties
139
+
140
+ These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
141
+
142
+ | Property | Type | Description |
143
+ | ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
144
+ | `dateRangePicker` | `MatDateRangePicker<any>` | — |
145
+ | `effectiveIdFrom` | `string` | — |
146
+ | `effectiveIdTo` | `string` | — |
147
+ | `startModelValue` | `Date \| null` | — |
148
+ | `endModelValue` | `Date \| null` | — |
149
+ | `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
150
+ | `onTouchedCallback` | `() => void` | — |
151
+ | `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
152
+
153
+ ## Public instance methods
154
+
155
+ The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
156
+
157
+ | Method | Signature | Description |
158
+ | ------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------- |
159
+ | `configureId` | `(): void` | — |
160
+ | `handleDateChange` | `(event: any, dateType: DateType): void` | Handles date change for start or end date. |
161
+ | `handleModelChange` | `(event: Date, dateType: DateType): void` | Handles ngModel change for start or end date. |
162
+ | `onFocus` | `(event: FocusEvent, dateType: DateType): void` | Handles focus event for start or end date input. |
163
+ | `onBlur` | `(event: FocusEvent, dateType: DateType): void` | Handles blur event for start or end date input. |
164
+ | `onKeyUp` | `(event: KeyboardEvent, dateType: DateType): void` | Handles keyup event for start or end date input. |
165
+ | `onKeyDown` | `(event: KeyboardEvent, dateType: DateType): void` | Handles keydown event for start or end date input. |
166
+ | `onInput` | `(event: Event, dateType: DateType): void` | Handles input event for start or end date input. |
167
+ | `onChangeHandler` | `(event: any, dateType: DateType): void` | Handles change event for start or end date input. |
168
+ | `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
169
+ | `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
170
+ | `writeValue` | `(value: any \| null): void` | Writes a new value from the form model to the view. |
171
+ | `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
172
+ | `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
173
+ | `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
174
+
175
+ [Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/date-range-picker/date-range-picker.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)