angular-ui-controls 0.1.0-rc.2 → 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.
- package/README.md +98 -46
- package/docs/api/README.md +29 -0
- package/docs/api/abbreviation-textarea.md +118 -0
- package/docs/api/action-menu.md +86 -0
- package/docs/api/advanced-select.md +214 -0
- package/docs/api/autocomplete.md +134 -0
- package/docs/api/checkbox.md +98 -0
- package/docs/api/date-picker.md +152 -0
- package/docs/api/date-range-picker.md +175 -0
- package/docs/api/date-time-picker.md +159 -0
- package/docs/api/file-upload.md +85 -0
- package/docs/api/number-input.md +162 -0
- package/docs/api/password-input.md +142 -0
- package/docs/api/pdf-viewer.md +50 -0
- package/docs/api/radio-group.md +126 -0
- package/docs/api/rich-text-editor.md +86 -0
- package/docs/api/search-filter.md +192 -0
- package/docs/api/search-input.md +160 -0
- package/docs/api/searchable-select.md +195 -0
- package/docs/api/segmented-control.md +93 -0
- package/docs/api/selection-list.md +120 -0
- package/docs/api/slide-toggle.md +105 -0
- package/docs/api/text-area.md +148 -0
- package/docs/api/text-input.md +159 -0
- package/docs/api/time-input.md +99 -0
- package/docs/api/time-picker.md +130 -0
- package/package.json +20 -4
|
@@ -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)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# DateTimePickerComponent
|
|
2
|
+
|
|
3
|
+
Date and time in one control.
|
|
4
|
+
|
|
5
|
+
Selector `ui-date-time-picker`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { DateTimePickerComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `DateTimePickerComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-date-time-picker inputId="dateTime" label="Date & time" [(ngModel)]="dateTime" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Example fields in the host component.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
dateTime: 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
|
+
| `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
|
|
32
|
+
| `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
|
|
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-time. |
|
|
39
|
+
| `minDate` | `Date` | No | `undefined` | Minimum selectable date-time. |
|
|
40
|
+
| `maxDate` | `Date` | No | `undefined` | Maximum selectable date-time. |
|
|
41
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
42
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
43
|
+
| `value` | `Date \| null` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
44
|
+
|
|
45
|
+
## Outputs
|
|
46
|
+
|
|
47
|
+
| Output | Payload | When it fires |
|
|
48
|
+
| ----------------- | -------------------------------- | ----------------------------------------------------------------------- |
|
|
49
|
+
| `dateChange` | `DateTimePickerDateChangeEvent` | Emits when the date-selection handler runs. |
|
|
50
|
+
| `modelChange` | `DateTimePickerModelChangeEvent` | Emits a model-change event with field metadata. |
|
|
51
|
+
| `changeCommitted` | `DateTimePickerChangeEvent` | Emits from the existing change handler. |
|
|
52
|
+
| `inputChanged` | `DateTimePickerInputEvent` | Emits when the user edits the field. |
|
|
53
|
+
| `focusGained` | `DateTimePickerFocusEvent` | Emits when the inner field gains focus. |
|
|
54
|
+
| `focusLost` | `DateTimePickerBlurEvent` | Emits when the inner field loses focus. |
|
|
55
|
+
| `keyPressed` | `DateTimePickerKeydownEvent` | Emits on the inner field keydown event. |
|
|
56
|
+
| `keyReleased` | `DateTimePickerKeyupEvent` | Emits on the inner field keyup event. |
|
|
57
|
+
| `enterPressed` | `DateTimePickerKeyEnter` | Emits when Enter is released in the inner field. |
|
|
58
|
+
| `valueChange` | `Date \| null` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
59
|
+
|
|
60
|
+
## Local option and event types
|
|
61
|
+
|
|
62
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
export interface DateTimePickerDateChangeEvent extends DateTimePickerFieldInfo {
|
|
66
|
+
/** Date-time picker change value */
|
|
67
|
+
dateChangeEvent: NgxMatDatepickerInputEvent<any, any>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface DateTimePickerFieldInfo {
|
|
71
|
+
/** Current date-time value */
|
|
72
|
+
modelValue: Date;
|
|
73
|
+
|
|
74
|
+
/** Field name provided by parent */
|
|
75
|
+
textFieldName: string | number;
|
|
76
|
+
|
|
77
|
+
/** Native input element reference (if inputId provided) */
|
|
78
|
+
inputRef?: Element | null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface DateTimePickerModelChangeEvent extends DateTimePickerFieldInfo {
|
|
82
|
+
/** Updated model value */
|
|
83
|
+
modelChangeEvent: Date;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface DateTimePickerChangeEvent extends DateTimePickerFieldInfo {
|
|
87
|
+
/** Native change event */
|
|
88
|
+
changeEvent: Event;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface DateTimePickerInputEvent extends DateTimePickerFieldInfo {
|
|
92
|
+
/** Native input event */
|
|
93
|
+
inputChangeEvent: Event;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface DateTimePickerFocusEvent extends DateTimePickerFieldInfo {
|
|
97
|
+
/** Native focus event */
|
|
98
|
+
focusEvent: FocusEvent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface DateTimePickerBlurEvent extends DateTimePickerFieldInfo {
|
|
102
|
+
/** Native blur event */
|
|
103
|
+
blurEvent: FocusEvent;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface DateTimePickerKeydownEvent extends DateTimePickerFieldInfo {
|
|
107
|
+
/** Native keyboard event */
|
|
108
|
+
keyDownEvent: KeyboardEvent;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface DateTimePickerKeyupEvent extends DateTimePickerFieldInfo {
|
|
112
|
+
/** Native keyboard event */
|
|
113
|
+
keyUpEvent: KeyboardEvent;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface DateTimePickerKeyEnter extends DateTimePickerFieldInfo {
|
|
117
|
+
/** Native keyboard event */
|
|
118
|
+
keyDownEvent: KeyboardEvent;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Public instance properties
|
|
123
|
+
|
|
124
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
125
|
+
|
|
126
|
+
| Property | Type | Description |
|
|
127
|
+
| ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
|
|
128
|
+
| `pickerWithActions` | `NgxMatDatetimepicker<any>` | — |
|
|
129
|
+
| `modelValue` | `Date` | Internal model getter/setter backed by the shared control value. |
|
|
130
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
131
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
132
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
133
|
+
|
|
134
|
+
## Public instance methods
|
|
135
|
+
|
|
136
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
137
|
+
|
|
138
|
+
| Method | Signature | Description |
|
|
139
|
+
| ------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
140
|
+
| `isApplyDisabled` | `(_picker?: unknown): boolean` | Compatibility helper. The picker input validates min/max through its public API. |
|
|
141
|
+
| `handleDateChange` | `(dateChange: NgxMatDatepickerInputEvent<any, any>): void` | Handles date-time picker change event. |
|
|
142
|
+
| `handleModelChange` | `(modelValueChange: Date): void` | Handles ngModel value change. |
|
|
143
|
+
| `onFocus` | `(onFocus: FocusEvent): void` | Handles focus event. |
|
|
144
|
+
| `onBlur` | `(onBlur: FocusEvent): void` | Handles blur event. |
|
|
145
|
+
| `onKeyUp` | `(onKeyUp: KeyboardEvent): void` | Handles keyup event. |
|
|
146
|
+
| `onKeyDown` | `(onKeyDown: KeyboardEvent): void` | Handles keydown event. |
|
|
147
|
+
| `onInput` | `(onInputChange: Event): void` | Handles input event. |
|
|
148
|
+
| `onChangeHandler` | `(changeEvent: Event): void` | Handles change event. |
|
|
149
|
+
| `onPickerOpened` | `(): void` | Kept for callers; defaultTime and startAt configure the public picker API. |
|
|
150
|
+
| `onEnter` | `(event: Event): void` | — |
|
|
151
|
+
| `configureId` | `(): void` | — |
|
|
152
|
+
| `commitValue` | `(value?: Date \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
153
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
154
|
+
| `writeValue` | `(value: Date \| null): void` | Writes a new value from the form model to the view. |
|
|
155
|
+
| `registerOnChange` | `(fn: (value: Date \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
156
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
157
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
158
|
+
|
|
159
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/date-time-picker/date-time-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,85 @@
|
|
|
1
|
+
# FileUploadComponent
|
|
2
|
+
|
|
3
|
+
Local file selection.
|
|
4
|
+
|
|
5
|
+
Selector `ui-file-upload`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { FileUploadComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `FileUploadComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-file-upload inputId="attachment" [(ngModel)]="uploadedFiles" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Example fields in the host component.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
uploadedFiles: FileList | 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
|
+
| `placeholder` | `string` | No | `'Select File'` | Hint text or translation key displayed while the control is empty. |
|
|
33
|
+
| `errorMessage` | `string` | No | `''` | Validation error message for empty/required fields. |
|
|
34
|
+
| `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
|
|
35
|
+
| `accept` | `string` | No | `''` | File types allowed (e.g. '.csv, .xlsx', 'image/\*', '.pdf'). |
|
|
36
|
+
| `showClearIcon` | `boolean` | No | `true` | Shows the clear button when a file is selected. |
|
|
37
|
+
| `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
|
|
38
|
+
| `showDropZone` | `boolean` | No | `false` | Uses the existing drag/drop presentation with multiple file selection; false uses the single-file browse presentation. |
|
|
39
|
+
| `multiple` | `boolean \| null` | No | `null` | Allow multiple files independently of the visual drop zone. |
|
|
40
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
41
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
42
|
+
| `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
43
|
+
|
|
44
|
+
## Outputs
|
|
45
|
+
|
|
46
|
+
| Output | Payload | When it fires |
|
|
47
|
+
| ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `fileSelected` | `any` | Emits after selected files pass the configured extension/MIME checks. Emits `{ files: FileList; fileName: string; fieldName: string \| number; }`. |
|
|
49
|
+
| `cleared` | `void` | Emits after the selected file is cleared. |
|
|
50
|
+
| `validationError` | `string` | Emits the validation message when a selected file fails the configured format check. |
|
|
51
|
+
| `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
52
|
+
|
|
53
|
+
## Public instance properties
|
|
54
|
+
|
|
55
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
56
|
+
|
|
57
|
+
| Property | Type | Description |
|
|
58
|
+
| ------------------------ | ---------------------------- | ------------------------------------------------------------------------------------------ |
|
|
59
|
+
| `fileName` | `string` | — |
|
|
60
|
+
| `selectedFiles` | `FileList \| null` | — |
|
|
61
|
+
| `isInvalidFile` | `boolean` | — |
|
|
62
|
+
| `fileFormatErrorMessage` | `string` | — |
|
|
63
|
+
| `acceptedFiles` | `string` | — |
|
|
64
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
65
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
66
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
67
|
+
|
|
68
|
+
## Public instance methods
|
|
69
|
+
|
|
70
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
71
|
+
|
|
72
|
+
| Method | Signature | Description |
|
|
73
|
+
| ------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
|
|
74
|
+
| `writeValue` | `(value: any): void` | — |
|
|
75
|
+
| `validateFile` | `(file: File): boolean` | — |
|
|
76
|
+
| `onFileChange` | `(event: Event): void` | — |
|
|
77
|
+
| `clearFile` | `(event: MouseEvent): void` | — |
|
|
78
|
+
| `configureId` | `(): void` | — |
|
|
79
|
+
| `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
80
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
81
|
+
| `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
82
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
83
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
84
|
+
|
|
85
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/file-upload/file-upload.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|