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,93 @@
|
|
|
1
|
+
# SegmentedControlComponent
|
|
2
|
+
|
|
3
|
+
A compact row of choices.
|
|
4
|
+
|
|
5
|
+
Selector `ui-segmented-control`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SegmentedControlComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `SegmentedControlComponent` to the host component's imports. Add `FormsModule` for this example. Import `SegmentOption` from `angular-ui-controls` for the example options.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-segmented-control [options]="segmentOptions" [(ngModel)]="segment" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Example fields in the host component.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
segment = 'daily';
|
|
23
|
+
segmentOptions: SegmentOption[] = [
|
|
24
|
+
{ label: 'Daily', value: 'daily' },
|
|
25
|
+
{ label: 'Weekly', value: 'weekly' },
|
|
26
|
+
{ label: 'Monthly', value: 'monthly' },
|
|
27
|
+
];
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
|
|
31
|
+
|
|
32
|
+
## Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Required | Default | Description |
|
|
35
|
+
| ---------- | -------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `options` | `TabOption[]` | No | `[]` | Options rendered by the control; use the label/value key inputs for object options. |
|
|
37
|
+
| `size` | `'md' \| 'lg'` | No | `'md'` | Segmented-control size: md or lg. |
|
|
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` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
41
|
+
|
|
42
|
+
## Outputs
|
|
43
|
+
|
|
44
|
+
| Output | Payload | When it fires |
|
|
45
|
+
| ----------------- | ---------- | ----------------------------------------------------------------------- |
|
|
46
|
+
| `selectionChange` | `any` | Emits when the selection handler processes a selection. |
|
|
47
|
+
| `widthCalculated` | `number[]` | Emits measured segment widths in pixels, in option order. |
|
|
48
|
+
| `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
49
|
+
|
|
50
|
+
## Local option and event types
|
|
51
|
+
|
|
52
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
export interface TabOption {
|
|
56
|
+
label: string;
|
|
57
|
+
value: any;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Public instance properties
|
|
63
|
+
|
|
64
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
65
|
+
|
|
66
|
+
| Property | Type | Description |
|
|
67
|
+
| ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
|
|
68
|
+
| `buttons` | `QueryList<ElementRef>` | — |
|
|
69
|
+
| `buttonWidths` | `number[]` | — |
|
|
70
|
+
| `activeIndex` | `number` | — |
|
|
71
|
+
| `activeOffset` | `number` | — |
|
|
72
|
+
| `activeWidth` | `number` | — |
|
|
73
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
74
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
75
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
76
|
+
|
|
77
|
+
## Public instance methods
|
|
78
|
+
|
|
79
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
80
|
+
|
|
81
|
+
| Method | Signature | Description |
|
|
82
|
+
| ------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
|
|
83
|
+
| `calculateWidths` | `(): void` | — |
|
|
84
|
+
| `select` | `(value: any): void` | — |
|
|
85
|
+
| `configureId` | `(): void` | — |
|
|
86
|
+
| `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
87
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
88
|
+
| `writeValue` | `(value: any \| null): void` | Writes a new value from the form model to the view. |
|
|
89
|
+
| `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
90
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
91
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
92
|
+
|
|
93
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/segmented-control/segmented-control.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# SelectionListComponent
|
|
2
|
+
|
|
3
|
+
A list of selectable items.
|
|
4
|
+
|
|
5
|
+
Selector `ui-selection-list`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SelectionListComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `SelectionListComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-selection-list
|
|
17
|
+
inputId="features"
|
|
18
|
+
label="Features"
|
|
19
|
+
[(ngModel)]="selectedFeatures"
|
|
20
|
+
[options]="featureOptions"
|
|
21
|
+
labelKey="name"
|
|
22
|
+
valueKey="id"
|
|
23
|
+
[multiple]="true"
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Example fields in the host component.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
selectedFeatures: string[] = ['dark-mode'];
|
|
31
|
+
featureOptions = [
|
|
32
|
+
{ id: 'dark-mode', name: 'Dark mode' },
|
|
33
|
+
{ id: 'email-digest', name: 'Email digest' },
|
|
34
|
+
{ id: 'audit-log', name: 'Audit log' },
|
|
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
|
+
| `tooltip` | `string` | No | `''` | Tooltip text displayed on hover. |
|
|
46
|
+
| `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
|
|
47
|
+
| `errorMessage` | `string` | No | `''` | Error message displayed for validation. |
|
|
48
|
+
| `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
|
|
49
|
+
| `multiple` | `boolean` | No | `true` | Enables the existing multiple-selection mode. |
|
|
50
|
+
| `options` | `any[]` | No | `[]` | Options rendered by the control; use the label/value key inputs for object options. |
|
|
51
|
+
| `labelKey` | `string` | No | `''` | Property name read from an option object to obtain its visible label. |
|
|
52
|
+
| `valueKey` | `string` | No | `''` | Property name used to identify or extract an option value. |
|
|
53
|
+
| `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
|
|
54
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
55
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
56
|
+
| `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
57
|
+
|
|
58
|
+
## Outputs
|
|
59
|
+
|
|
60
|
+
| Output | Payload | When it fires |
|
|
61
|
+
| ----------------- | ----------------------------------- | ----------------------------------------------------------------------- |
|
|
62
|
+
| `selectionChange` | `SelectionListSelectionChangeEvent` | Emits when the selection handler processes a selection. |
|
|
63
|
+
| `modelChange` | `SelectionListModelChangeEvent` | Emits a model-change event with field metadata. |
|
|
64
|
+
| `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
65
|
+
|
|
66
|
+
## Local option and event types
|
|
67
|
+
|
|
68
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
export interface SelectionListSelectionChangeEvent extends SelectionListFieldInfo {
|
|
72
|
+
selectionChangeEvent: MatSelectionListChange;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface SelectionListFieldInfo {
|
|
76
|
+
/** Native input element reference (if inputId is provided) */
|
|
77
|
+
inputRef?: Element | null;
|
|
78
|
+
|
|
79
|
+
/** Current selected value(s) bound to the model */
|
|
80
|
+
modelValue: any;
|
|
81
|
+
|
|
82
|
+
/** Field name identifier provided by parent */
|
|
83
|
+
textFieldName: string | number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface SelectionListModelChangeEvent extends SelectionListFieldInfo {
|
|
87
|
+
modelChangeEvent: any;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Public instance properties
|
|
92
|
+
|
|
93
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
94
|
+
|
|
95
|
+
| Property | Type | Description |
|
|
96
|
+
| ------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
97
|
+
| `modelValue` | `any` | Internal model getter/setter backed by the shared control value. |
|
|
98
|
+
| `inputModelValue` | `any` | **Deprecated.** Use value for direct component access. |
|
|
99
|
+
| `trackByFn` | `(index: number, item: any) => any` | Track by function for performance optimization. |
|
|
100
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
101
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
102
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
103
|
+
|
|
104
|
+
## Public instance methods
|
|
105
|
+
|
|
106
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
107
|
+
|
|
108
|
+
| Method | Signature | Description |
|
|
109
|
+
| ------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
110
|
+
| `modelValueChange` | `(val: any): void` | Emits updated model value when ngModel changes. |
|
|
111
|
+
| `selectionChanged` | `(changeValue: MatSelectionListChange): void` | Handles selection change event. |
|
|
112
|
+
| `configureId` | `(): void` | — |
|
|
113
|
+
| `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
114
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
115
|
+
| `writeValue` | `(value: any \| null): void` | Writes a new value from the form model to the view. |
|
|
116
|
+
| `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
117
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
118
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
119
|
+
|
|
120
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/selection-list/selection-list.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# SlideToggleComponent
|
|
2
|
+
|
|
3
|
+
On/off setting.
|
|
4
|
+
|
|
5
|
+
Selector `ui-slide-toggle`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SlideToggleComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `SlideToggleComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-slide-toggle
|
|
17
|
+
inputId="notifications"
|
|
18
|
+
label="Enable notifications"
|
|
19
|
+
[(ngModel)]="notificationsEnabled"
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Example fields in the host component.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
notificationsEnabled = true;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
|
|
30
|
+
|
|
31
|
+
## Inputs
|
|
32
|
+
|
|
33
|
+
| Input | Type | Required | Default | Description |
|
|
34
|
+
| ---------------------- | --------------------------------- | -------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
|
|
36
|
+
| `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
|
|
37
|
+
| `disableRipple` | `boolean` | No | `false` | Disable ripple animation effect. |
|
|
38
|
+
| `color` | `'primary' \| 'accent' \| 'warn'` | No | `'primary'` | Theme color: 'primary' \| 'accent' \| 'warn'. |
|
|
39
|
+
| `labelPosition` | `'before' \| 'after'` | No | `'after'` | Label position: 'before' \| 'after'. |
|
|
40
|
+
| `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
|
|
41
|
+
| `errorMessage` | `string` | No | `''` | Optional error message when required validation fails. |
|
|
42
|
+
| `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
|
|
43
|
+
| `preventToggleOnClick` | `boolean` | No | `false` | Whether to prevent the slide toggle from changing its value on click. |
|
|
44
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
45
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
46
|
+
| `value` | `boolean \| null` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
47
|
+
|
|
48
|
+
## Outputs
|
|
49
|
+
|
|
50
|
+
| Output | Payload | When it fires |
|
|
51
|
+
| -------------- | ---------------------- | ----------------------------------------------------------------------- |
|
|
52
|
+
| `stateChange` | `SlideToggleFieldInfo` | Emits when a permitted toggle state change is processed. |
|
|
53
|
+
| `toggleChange` | `SlideToggleFieldInfo` | Emits when a permitted toggle action is processed. |
|
|
54
|
+
| `clicked` | `SlideToggleFieldInfo` | Emits when the existing click handler runs. |
|
|
55
|
+
| `valueChange` | `boolean \| null` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
56
|
+
|
|
57
|
+
## Local option and event types
|
|
58
|
+
|
|
59
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
export interface SlideToggleFieldInfo {
|
|
63
|
+
/** Currently selected slider value */
|
|
64
|
+
modelValue: boolean;
|
|
65
|
+
|
|
66
|
+
/** Field identifier used by parent component */
|
|
67
|
+
textFieldName: string | number;
|
|
68
|
+
|
|
69
|
+
/** Optional native input element reference */
|
|
70
|
+
inputRef?: Element | null;
|
|
71
|
+
changeEvent?: MouseEvent;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Public instance properties
|
|
76
|
+
|
|
77
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
78
|
+
|
|
79
|
+
| Property | Type | Description |
|
|
80
|
+
| ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
|
|
81
|
+
| `isChecked` | `boolean` | Internal two-way bound value for the toggle (true/false). |
|
|
82
|
+
| `inputModelValue` | `boolean` | **Deprecated.** Use isChecked for direct component access. |
|
|
83
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
84
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
85
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
86
|
+
|
|
87
|
+
## Public instance methods
|
|
88
|
+
|
|
89
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
90
|
+
|
|
91
|
+
| Method | Signature | Description |
|
|
92
|
+
| --------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
93
|
+
| `onToggleValueChange` | `(event: MatSlideToggleChange): void` | Handles the Material change event. |
|
|
94
|
+
| `onToggleChange` | `(): void` | Called when the toggle is toggled. |
|
|
95
|
+
| `handleOnClick` | `(changeValue: MouseEvent): void` | Called when the toggle is clicked. |
|
|
96
|
+
| `handleOverlayClick` | `(event: MouseEvent): void` | Handles click on the overlay blocker when toggle clicks are prevented. |
|
|
97
|
+
| `configureId` | `(): void` | — |
|
|
98
|
+
| `commitValue` | `(value?: boolean \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
99
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
100
|
+
| `writeValue` | `(value: boolean \| null): void` | Writes a new value from the form model to the view. |
|
|
101
|
+
| `registerOnChange` | `(fn: (value: boolean \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
102
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
103
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
104
|
+
|
|
105
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/slide-toggle/slide-toggle.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# TextAreaComponent
|
|
2
|
+
|
|
3
|
+
Multiline text with optional highlighting.
|
|
4
|
+
|
|
5
|
+
Selector `ui-text-area`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { TextAreaComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `TextAreaComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-text-area
|
|
17
|
+
inputId="notes"
|
|
18
|
+
label="Notes"
|
|
19
|
+
[(ngModel)]="notes"
|
|
20
|
+
[useAbbreviationHighlight]="true"
|
|
21
|
+
[abbreviationList]="abbreviations"
|
|
22
|
+
[restrictedWords]="restricted"
|
|
23
|
+
[maxLength]="300"
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Example fields in the host component.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
notes = 'API integration';
|
|
31
|
+
abbreviations = [{ abbreviation: 'API', remarks: 'Application Programming Interface' }];
|
|
32
|
+
restricted = [{ word: 'restricted' }];
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
|
|
36
|
+
|
|
37
|
+
## Inputs
|
|
38
|
+
|
|
39
|
+
| Input | Type | Required | Default | Description |
|
|
40
|
+
| --------------------------- | ------------------------------------- | -------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
|
|
42
|
+
| `showExpandButton` | `boolean` | No | `false` | Show the optional inline editor expansion action. |
|
|
43
|
+
| `resize` | `boolean` | No | `false` | Enables or disables textarea resize. |
|
|
44
|
+
| `preventCopyPasteCut` | `boolean` | No | `false` | Blocks copy, cut, and paste on the field when enabled. |
|
|
45
|
+
| `minRows` | `number` | No | `3` | Minimum visible textarea rows passed to the existing textarea configuration. |
|
|
46
|
+
| `maxRows` | `number` | No | `6` | Maximum textarea rows passed to the existing textarea configuration. |
|
|
47
|
+
| `columns` | `number` | No | `0` | Textarea column count passed to the native cols attribute. |
|
|
48
|
+
| `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
|
|
49
|
+
| `maxLength` | `number` | No | `0` | Maximum allowed characters. |
|
|
50
|
+
| `showCharacterCount` | `boolean` | No | `true` | Controls display of the existing character-count indicator. |
|
|
51
|
+
| `errorMessage` | `string` | No | `''` | Error message or translation key displayed when validation fails. |
|
|
52
|
+
| `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
|
|
53
|
+
| `showRemainingCharacters` | `boolean` | No | `false` | Shows the remaining-character indicator when the existing focus/maxLength conditions allow it. |
|
|
54
|
+
| `fieldName` | `string \| number \| undefined` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
|
|
55
|
+
| `placeholder` | `string` | No | `''` | Hint text or translation key displayed while the control is empty. |
|
|
56
|
+
| `readonly` | `boolean` | No | `false` | Requests the existing read-only behavior without disabling the parent form control. |
|
|
57
|
+
| `mentionsList` | `any` | No | `[]` | Mention list for @ mentions. |
|
|
58
|
+
| `mentionConfig` | `MentionConfig` | No | `{ labelKey: 'abbreviation', mentionSelect: this.onMentionSelect, }` | Mention configuration. |
|
|
59
|
+
| `useAbbreviationHighlight` | `boolean` | No | `false` | Enables abbreviation highlight textarea. |
|
|
60
|
+
| `abbreviationList` | `AbbreviationEntry[]` | No | `[]` | Allowed abbreviations. |
|
|
61
|
+
| `enableArabicInput` | `boolean` | No | `false` | Passes the Arabic typing flag to the existing utility directive. |
|
|
62
|
+
| `restrictedWords` | `AbbreviationEntry[]` | No | `[]` | Restricted words list. |
|
|
63
|
+
| `abbreviationMentionConfig` | `AbbreviationMentionConfig[] \| null` | No | `null` | Optional replacement configuration for abbreviation mentions; null uses the component-built configuration. |
|
|
64
|
+
| `trimOnBlur` | `boolean` | No | `false` | Trims leading and trailing whitespace when the textarea loses focus. |
|
|
65
|
+
| `assistantFieldId` | `string` | No | `''` | Value written to the existing ChatGptAttr DOM attribute for field discovery. |
|
|
66
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
67
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
68
|
+
| `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
69
|
+
|
|
70
|
+
## Outputs
|
|
71
|
+
|
|
72
|
+
| Output | Payload | When it fires |
|
|
73
|
+
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| `valueChanged` | `any` | Emits the existing value-change payload; remains separate from modelChange. Emits `{ value: any; textFieldName: string \| number \| undefined; labelField: string; }`. |
|
|
75
|
+
| `expandRequested` | `any` | Emits when the expand or collapse action changes the textarea size. Payload `{ expanded: boolean; value: any; }`. |
|
|
76
|
+
| `inputChanged` | `any` | Emits when the user edits the field. Emits `{ changeEvent: Event; modelValue: any; fieldName: string \| number \| undefined; }`. |
|
|
77
|
+
| `itemSelected` | `any` | Emits when an abbreviation is picked from the mention list. |
|
|
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 AbbreviationEntry extends HighlightEntry {}
|
|
86
|
+
|
|
87
|
+
export interface HighlightEntry {
|
|
88
|
+
abbreviation?: string;
|
|
89
|
+
word?: string;
|
|
90
|
+
text?: string;
|
|
91
|
+
remarks?: string;
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface AbbreviationMentionConfig {
|
|
96
|
+
items: any[];
|
|
97
|
+
triggerChar?: string;
|
|
98
|
+
labelKey?: string;
|
|
99
|
+
isShortCut?: boolean;
|
|
100
|
+
mentionSelect?: (item: any) => string;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Public instance properties
|
|
105
|
+
|
|
106
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
107
|
+
|
|
108
|
+
| Property | Type | Description |
|
|
109
|
+
| ---------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------ |
|
|
110
|
+
| `container` | `ViewContainerRef` | — |
|
|
111
|
+
| `expandInput` | `boolean` | Indicates whether expandable view is active. |
|
|
112
|
+
| `modelValue` | `any` | Internal model getter/setter backed by the shared control value. |
|
|
113
|
+
| `selectedLanguage` | `Language` | — |
|
|
114
|
+
| `arabicLanguage` | `string` | — |
|
|
115
|
+
| `isFocused` | `boolean` | — |
|
|
116
|
+
| `showWordsLimitLabel` | `boolean` | **Deprecated.** Use isFocused when inspecting focus state. |
|
|
117
|
+
| `shouldShowRemainingCharacters` | `boolean` | — |
|
|
118
|
+
| `characterCount` | `number` | — |
|
|
119
|
+
| `remainingCharacters` | `number` | — |
|
|
120
|
+
| `abbreviationHighlightMentionList` | `AbbreviationMentionConfig[]` | — |
|
|
121
|
+
| `onChange` | `(value: any) => void` | — |
|
|
122
|
+
| `onTouched` | `() => void` | — |
|
|
123
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
124
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
125
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
126
|
+
|
|
127
|
+
## Public instance methods
|
|
128
|
+
|
|
129
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
130
|
+
|
|
131
|
+
| Method | Signature | Description |
|
|
132
|
+
| ------------------------ | ------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
133
|
+
| `updateChanges` | `(): void` | Emits value changes and updates form control. |
|
|
134
|
+
| `changeTextareaValue` | `(e: Event): void` | Handles native textarea input change. |
|
|
135
|
+
| `writeValue` | `(value: any): void` | Writes value from form control. |
|
|
136
|
+
| `onTextAreaFocus` | `(): void` | Shows remaining characters on focus. |
|
|
137
|
+
| `onTextAreaBlur` | `(): void` | Hides remaining characters on blur. |
|
|
138
|
+
| `openExpandableTextArea` | `(): void` | Toggle the inline expanded editor and notify consumers. |
|
|
139
|
+
| `expandButton` | `(): void` | — |
|
|
140
|
+
| `onMentionSelect` | `(selection: { remarks: string; }): string` | Handles mention selection. |
|
|
141
|
+
| `configureId` | `(): void` | — |
|
|
142
|
+
| `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
143
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
144
|
+
| `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
145
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
146
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
147
|
+
|
|
148
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/text-area/text-area.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|