angular-ui-controls 0.0.0-stage → 0.1.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +126 -2
- 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/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs +2 -0
- package/fesm2022/angular-ui-controls-editor-build-Cm2HSXEy.mjs.map +1 -0
- package/fesm2022/angular-ui-controls-forms.mjs +865 -0
- package/fesm2022/angular-ui-controls-forms.mjs.map +1 -0
- package/fesm2022/angular-ui-controls-text-input.mjs +1210 -0
- package/fesm2022/angular-ui-controls-text-input.mjs.map +1 -0
- package/fesm2022/angular-ui-controls.mjs +7181 -0
- package/fesm2022/angular-ui-controls.mjs.map +1 -0
- package/forms/index.d.ts +425 -0
- package/forms/index.d.ts.map +1 -0
- package/index.d.ts +4345 -0
- package/index.d.ts.map +1 -0
- package/package.json +82 -3
- package/text-input/index.d.ts +609 -0
- package/text-input/index.d.ts.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abhilash A S
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +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
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
In your Angular 20 application, install the current release candidate from npm. The peer dependency ranges are listed in the package manifest.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install angular-ui-controls@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Set up your app
|
|
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
|
+
]
|
|
22
|
+
```
|
|
23
|
+
|
|
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.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
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
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
Add a text input and searchable select to a standalone component. Use a unique `inputId` for each instance.
|
|
45
|
+
|
|
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
|
+
```
|
|
73
|
+
|
|
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`.
|
|
75
|
+
|
|
76
|
+
## Component catalog
|
|
77
|
+
|
|
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.
|
|
79
|
+
|
|
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) |
|
|
105
|
+
|
|
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)
|
|
107
|
+
|
|
108
|
+
### Select controls
|
|
109
|
+
|
|
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.
|
|
111
|
+
|
|
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)
|
|
115
|
+
|
|
116
|
+
### PDF viewer
|
|
117
|
+
|
|
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.
|
|
119
|
+
|
|
120
|
+
## Source and support
|
|
121
|
+
|
|
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)
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
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)
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# AdvancedSelectComponent
|
|
2
|
+
|
|
3
|
+
Grouped options and multiple selection.
|
|
4
|
+
|
|
5
|
+
Selector `ui-advanced-select`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AdvancedSelectComponent } from 'angular-ui-controls';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `AdvancedSelectComponent` to the host component's imports. Add `FormsModule` for this example.
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ui-advanced-select
|
|
17
|
+
inputId="advancedDepartments"
|
|
18
|
+
label="Roles (grouped)"
|
|
19
|
+
[(ngModel)]="advancedDepartments"
|
|
20
|
+
[options]="groupedRoles"
|
|
21
|
+
[grouped]="true"
|
|
22
|
+
groupLabelKey="groupName"
|
|
23
|
+
groupChildrenKey="items"
|
|
24
|
+
labelKey="name"
|
|
25
|
+
valueKey="id"
|
|
26
|
+
[multiple]="true"
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Example fields in the host component.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
advancedDepartments: number[] = [];
|
|
34
|
+
groupedRoles = [
|
|
35
|
+
{
|
|
36
|
+
groupName: 'Engineering',
|
|
37
|
+
items: [
|
|
38
|
+
{ id: 101, name: 'Frontend' },
|
|
39
|
+
{ id: 102, name: 'Backend' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
groupName: 'Product',
|
|
44
|
+
items: [
|
|
45
|
+
{ id: 201, name: 'Designer' },
|
|
46
|
+
{ id: 202, name: 'PM' },
|
|
47
|
+
...Array.from({ length: 75 }, (_, index) => ({
|
|
48
|
+
id: 203 + index,
|
|
49
|
+
name: `Product role ${index + 1}`,
|
|
50
|
+
})),
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use Angular Forms or `[(value)]` for binding. The tables include inherited bindings. The Required column refers to whether the template must supply the input.
|
|
57
|
+
|
|
58
|
+
## Inputs
|
|
59
|
+
|
|
60
|
+
| Input | Type | Required | Default | Description |
|
|
61
|
+
| --------------------------------- | --------------------- | -------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `itemSize` | `number` | No | `36` | Height in pixels of each option for virtual scrolling (defaults to 36px). |
|
|
63
|
+
| `inputId` | `string` | Yes | — | Identifier assigned to the inner control. Set `idPrefix` to add a prefix. |
|
|
64
|
+
| `label` | `string` | No | `''` | Label text or translation key displayed for this control. |
|
|
65
|
+
| `showSearch` | `boolean` | No | `true` | Enable the search in the option. |
|
|
66
|
+
| `errorMessage` | `string` | No | `''` | Error message shown when validation fails. |
|
|
67
|
+
| `required` | `boolean` | No | `false` | Marks the control as required. Configure any parent-form validators separately. |
|
|
68
|
+
| `fieldName` | `string \| number` | No | `undefined` | Consumer-defined field identifier included in event metadata. |
|
|
69
|
+
| `selectPlaceholder` | `string` | No | `''` | Placeholder text for the select field. |
|
|
70
|
+
| `searchPlaceholder` | `string` | No | `''` | Placeholder text for search input. |
|
|
71
|
+
| `readonly` | `boolean` | No | `false` | Requests the existing read-only behavior without disabling the parent form control. |
|
|
72
|
+
| `showToggleAllCheckbox` | `boolean` | No | `false` | Displays "Select All" checkbox. |
|
|
73
|
+
| `noEntriesFoundLabel` | `string` | No | `'No records found'` | Label shown when no entries are found. |
|
|
74
|
+
| `toggleAllCheckboxTooltipMessage` | `string` | No | `''` | Tooltip message for select-all checkbox. |
|
|
75
|
+
| `showSearchCheckbox` | `boolean` | No | `false` | **Deprecated.** Use showToggleAllCheckbox. |
|
|
76
|
+
| `multiple` | `boolean` | No | `false` | Enables the existing multiple-selection mode. |
|
|
77
|
+
| `options` | `any[]` | No | `[]` | Options rendered by the control; use the label/value key inputs for object options. |
|
|
78
|
+
| `labelKey` | `string` | No | `''` | Property name read from an option object to obtain its visible label. |
|
|
79
|
+
| `valueKey` | `string` | No | `''` | Property name used to identify or extract an option value. |
|
|
80
|
+
| `hiddenKey` | `string` | No | `'isHidden'` | Key in option object used to determine if the option should be hidden from dropdown. Defaults to 'isHidden'. |
|
|
81
|
+
| `grouped` | `boolean` | No | `false` | Enables grouped select display. |
|
|
82
|
+
| `isGroupingEnabled` | `boolean` | No | `false` | **Deprecated.** Use grouped. |
|
|
83
|
+
| `groupLabelKey` | `string` | No | `''` | Property key for group label (defaults to ''). |
|
|
84
|
+
| `groupChildrenKey` | `string` | No | `''` | Property key for group child options array (defaults to ''). |
|
|
85
|
+
| `enableAllOption` | `boolean` | No | `false` | Key used to map model value to option. |
|
|
86
|
+
| `enableSorting` | `boolean` | No | `false` | Key used to enable / disable sorting. |
|
|
87
|
+
| `sortAscending` | `boolean` | No | `true` | Defines whether the list should be sorted in ascending order. |
|
|
88
|
+
| `sortKey` | `string` | No | `''` | Key used to sort the array. |
|
|
89
|
+
| `showClearIcon` | `boolean` | No | `false` | To clear the selected dropdown list. |
|
|
90
|
+
| `displayFields` | `string[]` | No | `[]` | Conatins the multiple options. |
|
|
91
|
+
| `layoutMode` | `'split' \| 'inline'` | No | `'inline'` | Option text layout: inline joins the display fields; split separates primary and secondary fields. |
|
|
92
|
+
| `serverSideSearch` | `boolean` | No | `false` | Enables server-side/external search by bypassing local pipe filtering. |
|
|
93
|
+
| `singleLineOption` | `boolean` | No | `false` | Keeps each option on a single line with ellipsis; full text is shown in a tooltip on hover when truncated. |
|
|
94
|
+
| `searchStartsWith` | `boolean` | No | `false` | Configuration for search starts with. |
|
|
95
|
+
| `disabled` | `boolean` | No | `false` | Disables the control. Angular Forms can also update this state through setDisabledState. Uses Angular boolean attribute coercion. |
|
|
96
|
+
| `idPrefix` | `string` | No | `''` | Optional namespace prepended to inner control IDs to distinguish repeated instances. |
|
|
97
|
+
| `value` | `any` | No | `null` | Canonical value binding. Programmatic writes never emit user change events. |
|
|
98
|
+
|
|
99
|
+
## Outputs
|
|
100
|
+
|
|
101
|
+
| Output | Payload | When it fires |
|
|
102
|
+
| ------------------ | -------------------------------------- | ----------------------------------------------------------------------- |
|
|
103
|
+
| `selectAllChange` | `SearchableSelectToggleAllEvent` | Emits when the select-all action runs. |
|
|
104
|
+
| `selectionChange` | `SearchableSelectSelectionChangeEvent` | Emits when the selection handler processes a selection. |
|
|
105
|
+
| `panelOpenChange` | `SearchableSelectOpenCloseEvent` | Emits when the select panel open state changes. |
|
|
106
|
+
| `panelOpened` | `SearchableSelectFieldInfo` | Emits when the select panel opens. |
|
|
107
|
+
| `panelClosed` | `SearchableSelectFieldInfo` | Emits when the select panel closes. |
|
|
108
|
+
| `blurred` | `SearchableSelectFieldInfo` | Emits when the control loses focus. |
|
|
109
|
+
| `optionClicked` | `SearchableSelectOptionClickEvent` | Emits when an option is clicked. |
|
|
110
|
+
| `searchTextChange` | `string` | Emits the updated search string for consumer filtering. |
|
|
111
|
+
| `valueChange` | `any` | Emits the raw value once per committed user edit. Supports `[(value)]`. |
|
|
112
|
+
|
|
113
|
+
## Local option and event types
|
|
114
|
+
|
|
115
|
+
These declarations describe the payload and option shapes. Import availability depends on the package entry point.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
export interface SearchableSelectToggleAllEvent extends SearchableSelectFieldInfo {
|
|
119
|
+
/** True if all options are selected, false if cleared */
|
|
120
|
+
selectAllValue: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface SearchableSelectFieldInfo {
|
|
124
|
+
/** Current value(s) bound to the select */
|
|
125
|
+
value: any;
|
|
126
|
+
/** @deprecated Use value. */
|
|
127
|
+
modelValue: any;
|
|
128
|
+
|
|
129
|
+
/** Field identifier used in parent component */
|
|
130
|
+
fieldName: string | number;
|
|
131
|
+
/** @deprecated Use fieldName. */
|
|
132
|
+
textFieldName: string | number;
|
|
133
|
+
|
|
134
|
+
/** Optional reference to native input element */
|
|
135
|
+
inputRef?: Element | null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface SearchableSelectSelectionChangeEvent extends SearchableSelectFieldInfo {
|
|
139
|
+
/** MatSelect change event containing selected value(s) */
|
|
140
|
+
selectionChange: MatSelectChange | null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface SearchableSelectOpenCloseEvent extends SearchableSelectFieldInfo {
|
|
144
|
+
/** Boolean indicating whether the dropdown is opened or closed */
|
|
145
|
+
isOpen: boolean;
|
|
146
|
+
/** @deprecated Use isOpen. */
|
|
147
|
+
selectionChange: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface SearchableSelectOptionClickEvent {
|
|
151
|
+
/** The clicked option */
|
|
152
|
+
activeOption: SearchableSelectOption;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type SearchableSelectOption = any;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Public instance properties
|
|
159
|
+
|
|
160
|
+
These TypeScript properties include state exposed by the class. Use the Inputs and Outputs tables for Angular template bindings.
|
|
161
|
+
|
|
162
|
+
| Property | Type | Description |
|
|
163
|
+
| -------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
164
|
+
| `internalSelectList` | `any[]` | — |
|
|
165
|
+
| `rawOptionsList` | `any[]` | — |
|
|
166
|
+
| `hasNoMatchingEntries` | `boolean` | — |
|
|
167
|
+
| `searchText` | `string` | Search text entered by the user. |
|
|
168
|
+
| `hasSelectedValue` | `boolean` | Internal model bound to mat-select. |
|
|
169
|
+
| `selectedValue` | `any` | — |
|
|
170
|
+
| `inputModelValue` | `any` | **Deprecated.** Use selectedValue for direct component access. |
|
|
171
|
+
| `modelValue` | `any` | Internal model getter/setter backed by the shared control value. |
|
|
172
|
+
| `filterConditionStartWith` | `boolean` | Enable/disable search in the starting/conatin mode. |
|
|
173
|
+
| `hiddenOptions` | `Signal<any[]>` | — |
|
|
174
|
+
| `trackByFn` | `(index: number, item: any) => any` | — |
|
|
175
|
+
| `compareObjects` | `(option1: any, option2: any) => boolean` | — |
|
|
176
|
+
| `secondaryFields` | `string[]` | Secondary fields for split layout (excludes primary display key). |
|
|
177
|
+
| `onChangeCallback` | `(value: T \| null) => void` | Standard change and touch callbacks. |
|
|
178
|
+
| `onTouchedCallback` | `() => void` | — |
|
|
179
|
+
| `effectiveId` | `string` | Plain string property bound in template [id]="effectiveId" (zero function or CD overhead). |
|
|
180
|
+
|
|
181
|
+
## Public instance methods
|
|
182
|
+
|
|
183
|
+
The list includes Angular Forms plumbing and component event handlers as well as methods called directly by consumers.
|
|
184
|
+
|
|
185
|
+
| Method | Signature | Description |
|
|
186
|
+
| ----------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
187
|
+
| `writeValue` | `(newValue: any): void` | — |
|
|
188
|
+
| `handleOpenedChange` | `(isOpen: boolean): void` | — |
|
|
189
|
+
| `getSelectedModelValue` | `(selectedValue: any): any` | — |
|
|
190
|
+
| `applyFilter` | `(): void` | — |
|
|
191
|
+
| `getTriggerText` | `(): string` | Formats the trigger display text for the closed select input. |
|
|
192
|
+
| `configureModelValue` | `(newValue: any): void` | Maps the incoming model value to a matching option from the select list using the configured valueKey. |
|
|
193
|
+
| `optionSelectionChange` | `(event: any, option: any): void` | — |
|
|
194
|
+
| `handleSelectionChange` | `(selectionChange: MatSelectChange): void` | Emits when the selected value changes in the dropdown. |
|
|
195
|
+
| `toggleSelectAll` | `(selectAllValue: boolean): void` | Handles select-all toggle action from search checkbox. |
|
|
196
|
+
| `openedChange` | `(opened: boolean): void` | Emits when the open state of the dropdown changes. |
|
|
197
|
+
| `opened` | `(): void` | Emits when the dropdown panel is opened. |
|
|
198
|
+
| `closed` | `(): void` | Emits when the dropdown panel is closed. |
|
|
199
|
+
| `blur` | `(): void` | Emits when the select element loses focus. |
|
|
200
|
+
| `optionClick` | `(selectedOption: any): void` | Emits when a select option is clicked. |
|
|
201
|
+
| `rebuildGroupedList` | `(): void` | — |
|
|
202
|
+
| `searchTextModelChange` | `(changedSearchText: string): void` | — |
|
|
203
|
+
| `getOptionText` | `(option: any): string` | Formats option text for tooltip and display matching the rendered layout. |
|
|
204
|
+
| `isTooltipDisabled` | `(optionRef: unknown, text: string): boolean` | — |
|
|
205
|
+
| `open` | `(): void` | Opens the dropdown panel programmatically. |
|
|
206
|
+
| `clearSelect` | `(): void` | — |
|
|
207
|
+
| `configureId` | `(): void` | — |
|
|
208
|
+
| `commitValue` | `(value?: any \| null): void` | Commit a view edit after the inner control has updated its local model. |
|
|
209
|
+
| `handleFocusOut` | `(event: FocusEvent): void` | Touch the outer control only when focus leaves the whole composite control. |
|
|
210
|
+
| `registerOnChange` | `(fn: (value: any \| null) => void): void` | Registers a callback function that is called when the control's value changes in the UI. |
|
|
211
|
+
| `registerOnTouched` | `(fn: () => void): void` | Registers a callback function that is called when the control is touched. |
|
|
212
|
+
| `setDisabledState` | `(isDisabled: boolean): void` | Updates the disabled state from the form model. |
|
|
213
|
+
|
|
214
|
+
[Component source](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/ui-controls/src/lib/component/advanced-select/advanced-select.component.ts) · [Playground example](https://github.com/Abhilash-A-S/angular-ui-controls/blob/develop/projects/demo/src/app.component.html)
|