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
package/README.md
CHANGED
|
@@ -1,75 +1,127 @@
|
|
|
1
1
|
# Angular UI Controls
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
23 standalone Angular UI components built with Angular Material for Angular 20 forms and data-entry screens. Includes text and number inputs, searchable and grouped selects, date and time controls, file upload, a rich-text editor, and a PDF viewer. Form controls integrate with Angular Forms.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
In your Angular 20 application, install the current release candidate from npm. The peer dependency ranges are listed in the package manifest.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install angular-ui-controls@next
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Set up your app
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
Keep your existing Angular Material theme. If you need one, add a prebuilt theme to the application's `styles` array in `angular.json`, before your application stylesheet.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
"styles": [
|
|
19
|
+
"node_modules/@angular/material/prebuilt-themes/azure-blue.css",
|
|
20
|
+
"src/styles.scss"
|
|
21
|
+
]
|
|
15
22
|
```
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
Add the following providers to your standalone app configuration. Reuse any matching providers already configured by your app. If you already use ngx-translate, keep your current language and loader configuration.
|
|
18
25
|
|
|
19
26
|
```ts
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
|
|
27
|
+
// app.config.ts
|
|
28
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
29
|
+
import { ApplicationConfig } from '@angular/core';
|
|
30
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
31
|
+
import { provideTranslateService } from '@ngx-translate/core';
|
|
32
|
+
|
|
33
|
+
export const appConfig: ApplicationConfig = {
|
|
34
|
+
providers: [
|
|
35
|
+
provideHttpClient(),
|
|
36
|
+
provideAnimationsAsync(),
|
|
37
|
+
provideTranslateService({ lang: 'en', fallbackLang: 'en' }),
|
|
38
|
+
],
|
|
39
|
+
};
|
|
23
40
|
```
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
<ui-text-input inputId="first-name" label="First name" [(ngModel)]="firstName" />
|
|
27
|
-
```
|
|
42
|
+
## Quick start
|
|
28
43
|
|
|
29
|
-
|
|
44
|
+
Add a text input and searchable select to a standalone component. Use a unique `inputId` for each instance.
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
```ts
|
|
47
|
+
import { Component } from '@angular/core';
|
|
48
|
+
import { FormsModule } from '@angular/forms';
|
|
49
|
+
import { SearchableSelectComponent } from 'angular-ui-controls/forms';
|
|
50
|
+
import { TextInputComponent } from 'angular-ui-controls/text-input';
|
|
51
|
+
|
|
52
|
+
@Component({
|
|
53
|
+
selector: 'app-profile-form',
|
|
54
|
+
imports: [FormsModule, TextInputComponent, SearchableSelectComponent],
|
|
55
|
+
template: `
|
|
56
|
+
<ui-text-input inputId="full-name" label="Full name" [(ngModel)]="fullName" />
|
|
57
|
+
|
|
58
|
+
<ui-searchable-select
|
|
59
|
+
inputId="department"
|
|
60
|
+
label="Department"
|
|
61
|
+
[options]="departments"
|
|
62
|
+
[hideAllOption]="true"
|
|
63
|
+
[(ngModel)]="department"
|
|
64
|
+
/>
|
|
65
|
+
`,
|
|
66
|
+
})
|
|
67
|
+
export class ProfileFormComponent {
|
|
68
|
+
fullName = '';
|
|
69
|
+
departments = ['Engineering', 'Design', 'Support'];
|
|
70
|
+
department: string | null = null;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
32
73
|
|
|
33
|
-
|
|
34
|
-
- Prefer `ui-radio-group` / `RadioGroupComponent`; `ui-radio-button` / `RadioButtonComponent` remain compatible.
|
|
35
|
-
- Prefer `SegmentOption` and `LanguageService`; existing exports remain available.
|
|
36
|
-
- Textarea focus state is `isFocused`; counters use `characterCount`, `remainingCharacters` and `shouldShowRemainingCharacters`.
|
|
37
|
-
- `maxLength` takes precedence over the legacy character-limit input `wordsLimit`.
|
|
38
|
-
- Programmatic writes no longer emit user-change notifications or mark controls touched. Focus leaving the control marks it touched.
|
|
39
|
-
- Number-input user edits now emit `number | null`. Password entry preserves leading spaces.
|
|
40
|
-
- Date controls use the Moment date adapter; existing adapter-dependent values are preserved. Search-filter values retain `{searchVal, selectVal}` for compatibility.
|
|
74
|
+
For **reactive forms**, import `ReactiveFormsModule` and use `[formControl]` or `formControlName`. For standalone value binding, use `[(value)]`. Use one binding approach per control. When using `ngModel` inside a `<form>`, give the control a unique `name`.
|
|
41
75
|
|
|
42
|
-
##
|
|
76
|
+
## Component catalog
|
|
43
77
|
|
|
44
|
-
|
|
78
|
+
Import any component from `angular-ui-controls`. For a smaller entry point, use `angular-ui-controls/text-input` for the text input or `angular-ui-controls/forms` for the text input and searchable select.
|
|
45
79
|
|
|
46
|
-
|
|
80
|
+
| Component | Selector | Use | Reference |
|
|
81
|
+
| --------------------------- | ---------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
82
|
+
| `TextInputComponent` | `ui-text-input` | Single-line text | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/text-input.md) |
|
|
83
|
+
| `NumberInputComponent` | `ui-number-input` | Numeric values | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/number-input.md) |
|
|
84
|
+
| `PasswordInputComponent` | `ui-password-input` | Password entry with a visibility toggle | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/password-input.md) |
|
|
85
|
+
| `SearchInputComponent` | `ui-search-input` | Search box with a search action | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/search-input.md) |
|
|
86
|
+
| `SearchFilterComponent` | `ui-search-filter` | Search box with a category filter | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/search-filter.md) |
|
|
87
|
+
| `AutocompleteComponent` | `ui-autocomplete` | Suggestions while typing | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/autocomplete.md) |
|
|
88
|
+
| `SearchableSelectComponent` | `ui-searchable-select` | Searchable option list | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/searchable-select.md) |
|
|
89
|
+
| `AdvancedSelectComponent` | `ui-advanced-select` | Grouped options and multiple selection | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/advanced-select.md) |
|
|
90
|
+
| `DatePickerComponent` | `ui-date-picker` | Single date | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/date-picker.md) |
|
|
91
|
+
| `DateRangePickerComponent` | `ui-date-range-picker` | Start and end dates | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/date-range-picker.md) |
|
|
92
|
+
| `DateTimePickerComponent` | `ui-date-time-picker` | Date and time in one control | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/date-time-picker.md) |
|
|
93
|
+
| `TimePickerComponent` | `ui-time-picker` | Time of day | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/time-picker.md) |
|
|
94
|
+
| `TimeInputComponent` | `ui-time-input` | Separate hour and minute inputs | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/time-input.md) |
|
|
95
|
+
| `CheckboxComponent` | `ui-checkbox` | Boolean selection | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/checkbox.md) |
|
|
96
|
+
| `SlideToggleComponent` | `ui-slide-toggle` | On/off setting | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/slide-toggle.md) |
|
|
97
|
+
| `RadioGroupComponent` | `ui-radio-group` | One choice from a set | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/radio-group.md) |
|
|
98
|
+
| `SegmentedControlComponent` | `ui-segmented-control` | A compact row of choices | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/segmented-control.md) |
|
|
99
|
+
| `SelectionListComponent` | `ui-selection-list` | A list of selectable items | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/selection-list.md) |
|
|
100
|
+
| `FileUploadComponent` | `ui-file-upload` | Local file selection | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/file-upload.md) |
|
|
101
|
+
| `ActionMenuComponent` | `ui-action-menu` | A menu of actions | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/action-menu.md) |
|
|
102
|
+
| `TextAreaComponent` | `ui-text-area` | Multiline text with optional highlighting | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/text-area.md) |
|
|
103
|
+
| `RichTextEditorComponent` | `ui-rich-text-editor` | Editing formatted HTML | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/rich-text-editor.md) |
|
|
104
|
+
| `PdfViewerComponent` | `ui-pdf-viewer` | An embedded PDF preview | [API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/pdf-viewer.md) |
|
|
47
105
|
|
|
48
|
-
|
|
106
|
+
Each API page covers the component’s inputs, outputs, payloads, and public members. The same Markdown files are included in the npm package under `docs/api`. [Browse the complete API](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/docs/api/README.md)
|
|
49
107
|
|
|
50
|
-
|
|
108
|
+
### Select controls
|
|
51
109
|
|
|
52
|
-
|
|
110
|
+
For options shaped like `{ id: 1, name: 'Engineering' }`, set `labelKey="name"` and `valueKey="id"`. Use `[grouped]="true"`, `groupLabelKey`, and `groupChildrenKey` for grouped advanced-select data. Set `[multiple]="true"` for multi-selection. `[itemSize]` sets the fixed virtual row height in pixels.
|
|
53
111
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
112
|
+
### Rich-text editor
|
|
113
|
+
|
|
114
|
+
Add `node_modules/ckeditor5/ckeditor5.css` to your application's global styles. The control reads and writes HTML strings. Configure `[licenseKey]` for your CKEditor usage. CKEditor is licensed separately from this library. [CKEditor licensing](https://ckeditor.com/docs/ckeditor5/latest/getting-started/licensing/license-key-and-activation.html)
|
|
57
115
|
|
|
58
|
-
|
|
116
|
+
### PDF viewer
|
|
59
117
|
|
|
60
|
-
|
|
118
|
+
Pass a trusted document URL through `[pdfUrl]`. Supported schemes are HTTP, HTTPS, and blob. Relative paths resolve against your app's base URL. The viewer embeds the URL in an unsandboxed iframe and does not validate the response as a PDF.
|
|
61
119
|
|
|
62
|
-
|
|
63
|
-
| ----------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------- |
|
|
64
|
-
| Raw form value | `[(ngModel)]`, reactive forms, or `[(value)]` | Existing event-specific payloads remain available. |
|
|
65
|
-
| Group advanced options | `[grouped]`, `groupLabelKey`, `groupChildrenKey` | `isGroupingEnabled` forwards to the same setting. |
|
|
66
|
-
| Show the search toggle-all checkbox | `showToggleAllCheckbox` | `showSearchCheckbox` also enables it. |
|
|
67
|
-
| Include a selectable “All” item | `enableAllOption` on advanced select | This controls the list item independently of the search checkbox. |
|
|
68
|
-
| Select event metadata | `value`, `fieldName` | `modelValue`, `textFieldName` carry the same event values. |
|
|
69
|
-
| Panel state | `panelOpenChange.isOpen` | `selectionChange` on the panel event also carries the boolean. |
|
|
120
|
+
## Source and support
|
|
70
121
|
|
|
71
|
-
|
|
122
|
+
- [Source code and playground setup](https://github.com/Abhilash-A-S/angular-ui-controls)
|
|
123
|
+
- [Report an issue](https://github.com/Abhilash-A-S/angular-ui-controls/issues)
|
|
72
124
|
|
|
73
|
-
##
|
|
125
|
+
## License
|
|
74
126
|
|
|
75
|
-
|
|
127
|
+
MIT. Third-party dependencies retain their own licenses.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Angular UI Controls API
|
|
2
|
+
|
|
3
|
+
Choose a control to see its selector, import, example, inputs, outputs, and public TypeScript members. The input and output tables include bindings inherited from the base form control.
|
|
4
|
+
|
|
5
|
+
- [TextInputComponent](text-input.md)
|
|
6
|
+
- [NumberInputComponent](number-input.md)
|
|
7
|
+
- [PasswordInputComponent](password-input.md)
|
|
8
|
+
- [SearchInputComponent](search-input.md)
|
|
9
|
+
- [SearchFilterComponent](search-filter.md)
|
|
10
|
+
- [AutocompleteComponent](autocomplete.md)
|
|
11
|
+
- [SearchableSelectComponent](searchable-select.md)
|
|
12
|
+
- [AdvancedSelectComponent](advanced-select.md)
|
|
13
|
+
- [DatePickerComponent](date-picker.md)
|
|
14
|
+
- [DateRangePickerComponent](date-range-picker.md)
|
|
15
|
+
- [DateTimePickerComponent](date-time-picker.md)
|
|
16
|
+
- [TimePickerComponent](time-picker.md)
|
|
17
|
+
- [TimeInputComponent](time-input.md)
|
|
18
|
+
- [CheckboxComponent](checkbox.md)
|
|
19
|
+
- [SlideToggleComponent](slide-toggle.md)
|
|
20
|
+
- [RadioGroupComponent](radio-group.md)
|
|
21
|
+
- [SegmentedControlComponent](segmented-control.md)
|
|
22
|
+
- [SelectionListComponent](selection-list.md)
|
|
23
|
+
- [FileUploadComponent](file-upload.md)
|
|
24
|
+
- [ActionMenuComponent](action-menu.md)
|
|
25
|
+
- [TextAreaComponent](text-area.md)
|
|
26
|
+
- [RichTextEditorComponent](rich-text-editor.md)
|
|
27
|
+
- [PdfViewerComponent](pdf-viewer.md)
|
|
28
|
+
|
|
29
|
+
[AbbreviationTextareaComponent](abbreviation-textarea.md) is an additional exported helper used by the highlighted textarea.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# AbbreviationTextareaComponent
|
|
2
|
+
|
|
3
|
+
Standalone textarea with abbreviation and restricted-word highlighting.
|
|
4
|
+
|
|
5
|
+
Selector `ui-abbreviation-textarea`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AbbreviationTextareaComponent } from 'angular-ui-controls/forms';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `AbbreviationTextareaComponent` to the host component's imports.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-abbreviation-textarea [(value)]="notes" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Example fields in the host component.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
notes = '';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Inputs
|
|
26
|
+
|
|
27
|
+
| Input | Type | Required | Default | Description |
|
|
28
|
+
| ------------------ | ------------------------------------- | -------- | ----------------------------------------------------------- | ----------------------------- |
|
|
29
|
+
| `id` | `string` | No | `ui-abbreviation-${AbbreviationTextareaComponent.nextId++}` | — |
|
|
30
|
+
| `placeholder` | `string` | No | `''` | — |
|
|
31
|
+
| `accessibleLabel` | `string` | No | `''` | — |
|
|
32
|
+
| `disabled` | `boolean` | No | `false` | — |
|
|
33
|
+
| `required` | `boolean` | No | `false` | — |
|
|
34
|
+
| `readOnly` | `boolean` | No | `false` | **Deprecated.** Use readonly. |
|
|
35
|
+
| `readonly` | `boolean` | No | `false` | — |
|
|
36
|
+
| `maxLength` | `number \| null` | No | `null` | — |
|
|
37
|
+
| `minRows` | `number` | No | `3` | — |
|
|
38
|
+
| `maxRows` | `number` | No | `6` | — |
|
|
39
|
+
| `preventCopy` | `boolean` | No | `false` | — |
|
|
40
|
+
| `preventCut` | `boolean` | No | `false` | — |
|
|
41
|
+
| `preventPaste` | `boolean` | No | `false` | — |
|
|
42
|
+
| `abbreviationList` | `AbbreviationEntry[]` | No | `[]` | — |
|
|
43
|
+
| `restrictedWords` | `AbbreviationEntry[]` | No | `[]` | — |
|
|
44
|
+
| `mentionConfig` | `AbbreviationMentionConfig[] \| null` | No | `null` | — |
|
|
45
|
+
| `assistantFieldId` | `string` | No | `''` | — |
|
|
46
|
+
| `value` | `string` | No | `''` | — |
|
|
47
|
+
|
|
48
|
+
## Outputs
|
|
49
|
+
|
|
50
|
+
| Output | Payload | When it fires |
|
|
51
|
+
| ------------------- | ------------ | ------------- |
|
|
52
|
+
| `valueChange` | `string` | — |
|
|
53
|
+
| `controlTextChange` | `string` | — |
|
|
54
|
+
| `focusIn` | `FocusEvent` | — |
|
|
55
|
+
| `focusOut` | `FocusEvent` | — |
|
|
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 AbbreviationEntry extends HighlightEntry {}
|
|
63
|
+
|
|
64
|
+
export interface HighlightEntry {
|
|
65
|
+
abbreviation?: string;
|
|
66
|
+
word?: string;
|
|
67
|
+
text?: string;
|
|
68
|
+
remarks?: string;
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AbbreviationMentionConfig {
|
|
73
|
+
items: any[];
|
|
74
|
+
triggerChar?: string;
|
|
75
|
+
labelKey?: string;
|
|
76
|
+
isShortCut?: boolean;
|
|
77
|
+
mentionSelect?: (item: any) => string;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Public instance properties
|
|
82
|
+
|
|
83
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
84
|
+
|
|
85
|
+
| Property | Type | Description |
|
|
86
|
+
| ------------------ | --------------------------------- | ----------- |
|
|
87
|
+
| `input` | `ElementRef<HTMLTextAreaElement>` | — |
|
|
88
|
+
| `highlight` | `ElementRef<HTMLElement>` | — |
|
|
89
|
+
| `stateChanges` | `Subject<void>` | — |
|
|
90
|
+
| `controlType` | `"ui-abbreviation-textarea"` | — |
|
|
91
|
+
| `autofilled` | `false` | — |
|
|
92
|
+
| `focused` | `boolean` | — |
|
|
93
|
+
| `errorState` | `boolean` | — |
|
|
94
|
+
| `describedBy` | `string` | — |
|
|
95
|
+
| `tokens` | `HighlightToken[]` | — |
|
|
96
|
+
| `mentionOptions` | `any` | — |
|
|
97
|
+
| `empty` | `boolean` | — |
|
|
98
|
+
| `shouldLabelFloat` | `boolean` | — |
|
|
99
|
+
|
|
100
|
+
## Public instance methods
|
|
101
|
+
|
|
102
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
103
|
+
|
|
104
|
+
| Method | Signature | Description |
|
|
105
|
+
| ------------------- | ------------------------------------------------- | ----------- |
|
|
106
|
+
| `writeValue` | `(value: string \| null): void` | — |
|
|
107
|
+
| `registerOnChange` | `(fn: (value: string) => void): void` | — |
|
|
108
|
+
| `registerOnTouched` | `(fn: () => void): void` | — |
|
|
109
|
+
| `setDisabledState` | `(disabled: boolean): void` | — |
|
|
110
|
+
| `setDescribedByIds` | `(ids: string[]): void` | — |
|
|
111
|
+
| `onContainerClick` | `(): void` | — |
|
|
112
|
+
| `onInput` | `(event: Event): void` | — |
|
|
113
|
+
| `onFocus` | `(event: FocusEvent): void` | — |
|
|
114
|
+
| `onBlur` | `(event: FocusEvent): void` | — |
|
|
115
|
+
| `syncScroll` | `(): void` | — |
|
|
116
|
+
| `block` | `(event: ClipboardEvent, prevent: boolean): void` | — |
|
|
117
|
+
|
|
118
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/utilities/abbreviation-textarea.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# ActionMenuComponent
|
|
2
|
+
|
|
3
|
+
A menu of actions.
|
|
4
|
+
|
|
5
|
+
Selector `ui-action-menu`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { ActionMenuComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `ActionMenuComponent` to the host component's imports. Add `MatMenuModule` for the trigger.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<button type="button" [matMenuTriggerFor]="demoMenu.menuRef">Open actions</button>
|
|
17
|
+
<ui-action-menu
|
|
18
|
+
#demoMenu
|
|
19
|
+
menuTitle="Quick actions"
|
|
20
|
+
[menuItems]="menuItems"
|
|
21
|
+
(menuItemSelected)="lastAction = $event.label || ''"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Example fields in the host component.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
lastAction = '';
|
|
29
|
+
menuItems = [
|
|
30
|
+
{ label: 'Edit', action: 'edit' },
|
|
31
|
+
{ label: 'Duplicate', action: 'duplicate' },
|
|
32
|
+
{ label: 'Archive', action: 'archive', disabled: true },
|
|
33
|
+
];
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Inputs
|
|
37
|
+
|
|
38
|
+
| Input | Type | Required | Default | Description |
|
|
39
|
+
| ------------ | ------------ | -------- | ----------- | ------------------------------------------------------------------------------------ |
|
|
40
|
+
| `menuTitle` | `string` | No | `undefined` | Optional heading displayed in the action menu. |
|
|
41
|
+
| `menuItems` | `MenuItem[]` | No | `[]` | Menu entries rendered by the action menu; disabled entries are not emitted on click. |
|
|
42
|
+
| `rowData` | `unknown` | No | `undefined` | Consumer context attached to the emitted menu item as rowData. |
|
|
43
|
+
| `panelClass` | `string` | No | `''` | Additional CSS class or classes applied to the existing overlay panel. |
|
|
44
|
+
|
|
45
|
+
## Outputs
|
|
46
|
+
|
|
47
|
+
| Output | Payload | When it fires |
|
|
48
|
+
| ------------------ | ---------- | -------------------------------------------------- |
|
|
49
|
+
| `menuItemSelected` | `MenuItem` | Emits the enabled menu item with rowData attached. |
|
|
50
|
+
| `closed` | `void` | Emits when the action menu closes. |
|
|
51
|
+
|
|
52
|
+
## Local option and event types
|
|
53
|
+
|
|
54
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
export interface MenuItem {
|
|
58
|
+
label?: string;
|
|
59
|
+
value?: unknown;
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
svgIcon?: string;
|
|
62
|
+
classname?: string;
|
|
63
|
+
action?: unknown;
|
|
64
|
+
rowData?: unknown;
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Public instance properties
|
|
70
|
+
|
|
71
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
72
|
+
|
|
73
|
+
| Property | Type | Description |
|
|
74
|
+
| --------- | --------- | ----------- |
|
|
75
|
+
| `menuRef` | `MatMenu` | — |
|
|
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
|
+
| `onMenuItemClick` | `(item: MenuItem): void` | — |
|
|
84
|
+
| `onMenuClosed` | `(): void` | — |
|
|
85
|
+
|
|
86
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/action-menu/action-menu.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|