@nanahoshi/mona-ui 0.25.1 → 0.26.1
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 +2 -0
- package/chart/README.md +2 -2
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart-bar.md +714 -0
- package/docs/chart-financial.md +567 -0
- package/docs/chart-funnel.md +546 -0
- package/docs/chart-heatmap.md +535 -0
- package/docs/chart-line-area.md +462 -0
- package/docs/chart-pie.md +645 -0
- package/docs/chart-radar.md +518 -0
- package/docs/chart-radial.md +658 -0
- package/docs/chart-scatter.md +479 -0
- package/docs/chart-treemap.md +651 -0
- package/docs/chart.md +2465 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
- package/i18n/catalogs/en-US.messages.json +10 -0
- package/internal/popup-menu/package.json +4 -0
- package/llms.txt +133 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +250 -20
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
# Multi Select
|
|
2
|
+
|
|
3
|
+
> A control that shows selected options as removable tags.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/multi-select`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-multi-select`
|
|
8
|
+
|
|
9
|
+
`MultiSelectComponent` is a combobox that displays selected values as removable tags and expands a listbox popup for the consumer to select any number of options from a fixed collection.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Multi Select renders every selected item as a removable chip inside the host element, and opens a listbox popup for the consumer to add or remove selections. Unlike Combo Box or Auto Complete, the value area is not a text input — there is no free-text entry. The host shows the selected tags, or the `placeholder` when nothing is selected.
|
|
14
|
+
|
|
15
|
+
Filtering, grouping, and virtual scrolling are opt-in through companion attribute directives applied to the `<mona-multi-select>` host element, the same pattern used by Dropdown List:
|
|
16
|
+
|
|
17
|
+
- `monaDropDownFilterable` — renders a filter input inside the popup and narrows visible options by text.
|
|
18
|
+
- `monaDropDownGroupable` — groups options under a header row.
|
|
19
|
+
- `monaDropDownVirtualScroll` — renders only the options currently in view.
|
|
20
|
+
|
|
21
|
+
**Use Multi Select when:**
|
|
22
|
+
|
|
23
|
+
- The consumer can select any number of values from a known, bounded set of options.
|
|
24
|
+
|
|
25
|
+
**Use `DropDownList` instead when:**
|
|
26
|
+
|
|
27
|
+
- Only one value can be selected at a time.
|
|
28
|
+
|
|
29
|
+
**Use `ComboBox` or `AutoComplete` instead when:**
|
|
30
|
+
|
|
31
|
+
- Free-text entry into the value area is needed, or only a single value is selected.
|
|
32
|
+
|
|
33
|
+
## Import & Quick Start
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
protected readonly countries = [
|
|
41
|
+
{ id: 1, name: "United States" },
|
|
42
|
+
{ id: 2, name: "Canada" },
|
|
43
|
+
{ id: 3, name: "Mexico" }
|
|
44
|
+
];
|
|
45
|
+
protected readonly selectedCountries = signal<{ id: number; name: string }[]>([]);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
|
|
50
|
+
<mona-multi-select
|
|
51
|
+
[data]="countries"
|
|
52
|
+
textField="name"
|
|
53
|
+
valueField="id"
|
|
54
|
+
[(value)]="selectedCountries">
|
|
55
|
+
</mona-multi-select>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`textField` and `valueField` each accept a property name or an accessor function. `valueField` identifies each item for selection matching and, when `valuePrimitive` is enabled, is also what gets read from and written into `value` instead of the full items — see [Primitive value binding](#primitive-value-binding).
|
|
59
|
+
|
|
60
|
+
## Anatomy
|
|
61
|
+
|
|
62
|
+
Each structural directive below is an `ng-template` placed as projected content inside `<mona-multi-select>...</mona-multi-select>`, or (for the summary tag directives) applied alongside `monaMultiSelectSummaryTag` on the host element itself. There is no value-template directive — each selected item renders as a `mona-chip`, not a rendered data item you fully control.
|
|
63
|
+
|
|
64
|
+
| Directive | Selector | Template context | Replaces |
|
|
65
|
+
|------------------------------------------|--------------------------------------------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
|
|
66
|
+
| `DropdownItemTemplateDirective` | `ng-template[monaDropDownItemTemplate]` | `{ $implicit: TData }` (the option's data item) | Each option's default text rendering inside the popup |
|
|
67
|
+
| `MultiSelectTagTemplateDirective` | `ng-template[monaMultiSelectTagTemplate]` | `{ $implicit: TData }` (the selected item's data item) | The default tag text rendered inside each selected item's chip |
|
|
68
|
+
| `MultiSelectSummaryTagTemplateDirective` | `ng-template[monaMultiSelectSummaryTagTemplate]` | `{ $implicit: Iterable<TData>, tagCount: number }` (all selected items, and the configured `tagCount`) | The default "+N items" text rendered inside the summary chip — see [Collapsing tags into a summary](#collapsing-tags-into-a-summary) |
|
|
69
|
+
| `DropdownGroupHeaderTemplateDirective` | `ng-template[monaDropDownGroupHeaderTemplate]` | `{ $implicit: group }` | The default group header row, when grouping is enabled |
|
|
70
|
+
| `DropdownHeaderTemplateDirective` | `ng-template[monaDropDownHeaderTemplate]` | None | No default — renders above the option list inside the popup |
|
|
71
|
+
| `DropdownFooterTemplateDirective` | `ng-template[monaDropDownFooterTemplate]` | None | No default — renders below the option list inside the popup |
|
|
72
|
+
| `DropdownNoDataTemplateDirective` | `ng-template[monaDropDownNoDataTemplate]` | None | The popup's default empty-state content |
|
|
73
|
+
| `DropdownPrefixTemplateDirective` | `ng-template[monaDropdownPrefixTemplate]` | None | No default — projected content rendered before the tags |
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
|
|
77
|
+
<mona-multi-select [data]="countries" textField="name" valueField="id">
|
|
78
|
+
<ng-template monaDropDownItemTemplate let-dataItem>
|
|
79
|
+
<span>{{ dataItem.name }}</span>
|
|
80
|
+
</ng-template>
|
|
81
|
+
<ng-template monaMultiSelectTagTemplate let-dataItem>
|
|
82
|
+
<span>{{ dataItem.name }}</span>
|
|
83
|
+
</ng-template>
|
|
84
|
+
</mona-multi-select>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
### Checkboxes in the popup
|
|
90
|
+
|
|
91
|
+
`checkboxes` renders a checkbox next to each option in the popup, in addition to the default selected-state styling. By default the popup stays open after selecting or deselecting an item, so the consumer can pick several options in a row. `monaDropDownFilterable` adds a filter input inside the popup.
|
|
92
|
+
|
|
93
|
+
`checkboxes-example.component.ts`
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { Component, signal } from "@angular/core";
|
|
97
|
+
import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
98
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
99
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
100
|
+
|
|
101
|
+
@Component({
|
|
102
|
+
selector: "app-multi-select-checkboxes-example",
|
|
103
|
+
imports: [DropdownFilterableDirective, LabelDirective, MultiSelectComponent],
|
|
104
|
+
templateUrl: "./checkboxes-example.component.html"
|
|
105
|
+
})
|
|
106
|
+
export class MultiSelectCheckboxesExampleComponent {
|
|
107
|
+
protected readonly chosen = signal<string[]>(["Basil"]);
|
|
108
|
+
protected readonly toppings = ["Basil", "Mushrooms", "Olives", "Onions", "Peppers", "Pineapple", "Spinach"];
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`checkboxes-example.component.html`
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<div class="flex max-w-sm flex-col gap-1">
|
|
116
|
+
<label id="multi-select-checkboxes-label" monaLabel [for]="toppingList">Toppings</label>
|
|
117
|
+
<mona-multi-select
|
|
118
|
+
#toppingList
|
|
119
|
+
aria-labelledby="multi-select-checkboxes-label"
|
|
120
|
+
monaDropDownFilterable
|
|
121
|
+
[checkboxes]="true"
|
|
122
|
+
[data]="toppings"
|
|
123
|
+
[showClearButton]="true"
|
|
124
|
+
[(value)]="chosen" />
|
|
125
|
+
<span aria-live="polite" class="text-sm">{{ chosen().length }} chosen</span>
|
|
126
|
+
</div>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Collapsing tags into a summary
|
|
130
|
+
|
|
131
|
+
Apply `monaMultiSelectSummaryTag` to collapse tags beyond `tagCount` into a single summary chip (default text: "+N items"). A negative `tagCount` (the default) shows every selected item as its own tag and never renders the summary chip. `monaMultiSelectSummaryTagTemplate` replaces the summary chip's text.
|
|
132
|
+
|
|
133
|
+
`summary-example.component.ts`
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { Component, signal } from "@angular/core";
|
|
137
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
138
|
+
import {
|
|
139
|
+
MultiSelectComponent,
|
|
140
|
+
MultiSelectSummaryTagDirective,
|
|
141
|
+
MultiSelectSummaryTagTemplateDirective
|
|
142
|
+
} from "@nanahoshi/mona-ui/multi-select";
|
|
143
|
+
|
|
144
|
+
interface Person {
|
|
145
|
+
id: number;
|
|
146
|
+
name: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const PEOPLE: Person[] = [
|
|
150
|
+
{ id: 1, name: "Ada Lovelace" },
|
|
151
|
+
{ id: 2, name: "Grace Hopper" },
|
|
152
|
+
{ id: 3, name: "Alan Turing" },
|
|
153
|
+
{ id: 4, name: "Katherine Johnson" },
|
|
154
|
+
{ id: 5, name: "Edsger Dijkstra" }
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
@Component({
|
|
158
|
+
selector: "app-multi-select-summary-example",
|
|
159
|
+
imports: [
|
|
160
|
+
LabelDirective,
|
|
161
|
+
MultiSelectComponent,
|
|
162
|
+
MultiSelectSummaryTagDirective,
|
|
163
|
+
MultiSelectSummaryTagTemplateDirective
|
|
164
|
+
],
|
|
165
|
+
templateUrl: "./summary-example.component.html"
|
|
166
|
+
})
|
|
167
|
+
export class MultiSelectSummaryExampleComponent {
|
|
168
|
+
protected readonly people = PEOPLE;
|
|
169
|
+
protected readonly reviewers = signal<Person[]>(PEOPLE.slice(0, 4));
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`summary-example.component.html`
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<div class="flex max-w-sm flex-col gap-1">
|
|
177
|
+
<label id="multi-select-summary-label" monaLabel [for]="memberList">Reviewers</label>
|
|
178
|
+
<mona-multi-select
|
|
179
|
+
#memberList
|
|
180
|
+
aria-labelledby="multi-select-summary-label"
|
|
181
|
+
textField="name"
|
|
182
|
+
valueField="id"
|
|
183
|
+
[data]="people"
|
|
184
|
+
[monaMultiSelectSummaryTag]="2"
|
|
185
|
+
[(value)]="reviewers">
|
|
186
|
+
<ng-template let-items let-tagCount="tagCount" monaMultiSelectSummaryTagTemplate>
|
|
187
|
+
+{{ items.length - tagCount }} more
|
|
188
|
+
</ng-template>
|
|
189
|
+
</mona-multi-select>
|
|
190
|
+
</div>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Primitive value binding
|
|
194
|
+
|
|
195
|
+
By default `value` holds the complete selected data items. Set `valuePrimitive` to `true` to have `value` hold an array of the values resolved through `valueField` instead — useful for storing just ids rather than the whole objects. Setting `value` to an array of matching field values (for example, restoring it from a signal forms field) also selects the corresponding items.
|
|
196
|
+
|
|
197
|
+
`primitive-example.component.ts`
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { Component, signal } from "@angular/core";
|
|
201
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
202
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
203
|
+
|
|
204
|
+
@Component({
|
|
205
|
+
selector: "app-multi-select-primitive-example",
|
|
206
|
+
imports: [LabelDirective, MultiSelectComponent],
|
|
207
|
+
templateUrl: "./primitive-example.component.html"
|
|
208
|
+
})
|
|
209
|
+
export class MultiSelectPrimitiveExampleComponent {
|
|
210
|
+
protected readonly dayIds = signal<number[]>([1, 3]);
|
|
211
|
+
protected readonly days = [
|
|
212
|
+
{ id: 1, name: "Monday" },
|
|
213
|
+
{ id: 2, name: "Tuesday" },
|
|
214
|
+
{ id: 3, name: "Wednesday" },
|
|
215
|
+
{ id: 4, name: "Thursday" },
|
|
216
|
+
{ id: 5, name: "Friday" }
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`primitive-example.component.html`
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<div class="flex max-w-sm flex-col gap-1">
|
|
225
|
+
<label id="multi-select-primitive-label" monaLabel [for]="dayList">Working days</label>
|
|
226
|
+
<mona-multi-select
|
|
227
|
+
#dayList
|
|
228
|
+
aria-labelledby="multi-select-primitive-label"
|
|
229
|
+
textField="name"
|
|
230
|
+
valueField="id"
|
|
231
|
+
[data]="days"
|
|
232
|
+
[valuePrimitive]="true"
|
|
233
|
+
[(value)]="dayIds" />
|
|
234
|
+
<span aria-live="polite" class="text-sm">Value: [{{ dayIds().join(", ") }}]</span>
|
|
235
|
+
</div>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`valueField` should resolve to a stable, unique scalar; without it, the item itself is used as the value, which naturally supports primitive data such as `["One", "Two", "Three"]`.
|
|
239
|
+
|
|
240
|
+
### Signal Forms integration
|
|
241
|
+
|
|
242
|
+
Binding `[formField]` synchronizes `value`, `disabled`, `readonly`, `required`, `invalid`, and `touched` with a signal forms field automatically. Signal Forms' `required` doesn't treat an empty array as missing, so use `minLength(path, 1)` to require a selection.
|
|
243
|
+
|
|
244
|
+
`forms-example.component.ts`
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
import { Component, signal } from "@angular/core";
|
|
248
|
+
import { form, FormField, minLength } from "@angular/forms/signals";
|
|
249
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
250
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
251
|
+
|
|
252
|
+
interface ProfileModel {
|
|
253
|
+
skills: string[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@Component({
|
|
257
|
+
selector: "app-multi-select-forms-example",
|
|
258
|
+
imports: [FormField, LabelDirective, MultiSelectComponent],
|
|
259
|
+
templateUrl: "./forms-example.component.html"
|
|
260
|
+
})
|
|
261
|
+
export class MultiSelectFormsExampleComponent {
|
|
262
|
+
readonly #model = signal<ProfileModel>({ skills: [] });
|
|
263
|
+
protected readonly profile = form(this.#model, path => {
|
|
264
|
+
minLength(path.skills, 1);
|
|
265
|
+
});
|
|
266
|
+
protected readonly skills = ["Angular", "CSS", "Node.js", "SQL", "TypeScript"];
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
`forms-example.component.html`
|
|
271
|
+
|
|
272
|
+
```html
|
|
273
|
+
<div class="flex max-w-sm flex-col gap-1">
|
|
274
|
+
<label id="multi-select-forms-label" monaLabel [for]="skillList">Skills</label>
|
|
275
|
+
<mona-multi-select
|
|
276
|
+
#skillList
|
|
277
|
+
aria-describedby="multi-select-forms-hint"
|
|
278
|
+
aria-labelledby="multi-select-forms-label"
|
|
279
|
+
[data]="skills"
|
|
280
|
+
[formField]="profile.skills" />
|
|
281
|
+
<p id="multi-select-forms-hint" class="text-sm">Choose at least one.</p>
|
|
282
|
+
@if (profile.skills().touched() && profile.skills().invalid()) {
|
|
283
|
+
<p class="text-error text-sm" role="alert">Choose at least one skill.</p>
|
|
284
|
+
}
|
|
285
|
+
</div>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Closing the popup after each selection
|
|
289
|
+
|
|
290
|
+
Set `autoClose` to `true` to close the popup after each selection instead of keeping it open.
|
|
291
|
+
|
|
292
|
+
```html
|
|
293
|
+
|
|
294
|
+
<mona-multi-select [data]="countries" textField="name" valueField="id" [autoClose]="true"></mona-multi-select>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Disabled, readonly, loading, and required states
|
|
298
|
+
|
|
299
|
+
`disabled` renders the component with reduced visual emphasis, prevents the popup from opening, and blocks tag removal. `readonly` prevents value changes while preserving the visual state. `loading` shows a loading indicator in place of the clear button. `required` marks the field for form validation and affects the invalid state once the control is touched.
|
|
300
|
+
|
|
301
|
+
```html
|
|
302
|
+
|
|
303
|
+
<mona-multi-select
|
|
304
|
+
[data]="countries"
|
|
305
|
+
textField="name"
|
|
306
|
+
valueField="id"
|
|
307
|
+
[disabled]="isDisabled()"
|
|
308
|
+
[readonly]="isReadonly()"
|
|
309
|
+
[loading]="isLoading()"
|
|
310
|
+
[required]="true"
|
|
311
|
+
[showClearButton]="true">
|
|
312
|
+
</mona-multi-select>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Grouping
|
|
316
|
+
|
|
317
|
+
`monaDropDownGroupable` groups options under a header row, driven by `groupBy`.
|
|
318
|
+
|
|
319
|
+
```html
|
|
320
|
+
|
|
321
|
+
<mona-multi-select [data]="countries" textField="name" valueField="id" monaDropDownGroupable groupBy="region"></mona-multi-select>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Virtual scrolling
|
|
325
|
+
|
|
326
|
+
`monaDropDownVirtualScroll` renders only the options currently in view, for large collections.
|
|
327
|
+
|
|
328
|
+
```html
|
|
329
|
+
|
|
330
|
+
<mona-multi-select
|
|
331
|
+
[data]="countries"
|
|
332
|
+
textField="name"
|
|
333
|
+
valueField="id"
|
|
334
|
+
monaDropDownVirtualScroll
|
|
335
|
+
[monaDropDownVirtualScroll]="{ height: 32 }">
|
|
336
|
+
</mona-multi-select>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Behavior
|
|
340
|
+
|
|
341
|
+
### Placeholder
|
|
342
|
+
|
|
343
|
+
`placeholder` shows while nothing is selected. It also names the control when neither `aria-label` nor `aria-labelledby` is set.
|
|
344
|
+
|
|
345
|
+
### `showClearButton` clears every selection
|
|
346
|
+
|
|
347
|
+
`showClearButton` renders a single clear button that removes all selected items at once, not one at a time.
|
|
348
|
+
|
|
349
|
+
### `open` and `close` are cancelable
|
|
350
|
+
|
|
351
|
+
`open` and `close` emit event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` in an `open` handler stops the popup from opening; calling it in a `close` handler stops the popup from closing. `close`'s event object also exposes `via`, describing what triggered the close attempt.
|
|
352
|
+
|
|
353
|
+
### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
|
|
354
|
+
|
|
355
|
+
`textField`, `valueField`, `itemDisabled`, `popupHeight`, and `popupWidth` are typed with these generic aliases internally, but none of the three types are re-exported from `@nanahoshi/mona-ui`. Inline values (as in the examples above) still type-check structurally; only a standalone typed variable would require an import.
|
|
356
|
+
`TODO(owner-review): confirm whether these types should be added to the public barrel export.`
|
|
357
|
+
|
|
358
|
+
## Forms Integration
|
|
359
|
+
|
|
360
|
+
`MultiSelectComponent` implements the signal forms `FormValueControl<Iterable<TValue>>` interface (`TValue` defaults to `TData`, or the `valueField` type when `valuePrimitive` is `true`) and synchronizes with a field bound through `[formField]` (see [Signal Forms integration](#signal-forms-integration)). It has no `ControlValueAccessor`, but `[(ngModel)]`, `[formControl]` and `formControlName` work too, because Angular binds a control's `value` and `touch` directly when it has no accessor. Prefer `[formField]`, which also hands it `disabled`, `readonly`, `required` and validation state. A `null` value, which NgModel writes first and a cleared form control holds, means nothing is selected.
|
|
361
|
+
|
|
362
|
+
## Accessibility
|
|
363
|
+
|
|
364
|
+
### Keyboard
|
|
365
|
+
|
|
366
|
+
| Key | Action |
|
|
367
|
+
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
368
|
+
| `ArrowDown` / `ArrowUp` | Highlight the next or previous option. Wraps from the last option back to the first (and vice versa). Never selects by itself. |
|
|
369
|
+
| `Alt+ArrowDown` | Open the popup. |
|
|
370
|
+
| `Alt+ArrowUp` | Close the popup. |
|
|
371
|
+
| `Enter` | Open the popup when closed. When open, toggles the highlighted option's selected state; closes the popup afterward only if `autoClose` is `true`. |
|
|
372
|
+
| `Space` | Toggle the popup open or closed. |
|
|
373
|
+
| `Backspace` | Remove the most recently selected tag. |
|
|
374
|
+
| `Escape` / `Tab` | Close the popup. |
|
|
375
|
+
|
|
376
|
+
### Focus
|
|
377
|
+
|
|
378
|
+
The host element is the only Tab stop; DOM focus does not move into the popup's option list, and tags are not individually focusable (`tabindex="-1"` on each chip). Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the host element, instead.
|
|
379
|
+
|
|
380
|
+
### ARIA
|
|
381
|
+
|
|
382
|
+
| Attribute | When present | Value |
|
|
383
|
+
|-------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
|
384
|
+
| `role` | Always | `"combobox"` |
|
|
385
|
+
| `aria-haspopup` | Always | `"listbox"` |
|
|
386
|
+
| `aria-expanded` | Always | Reflects the popup's open state |
|
|
387
|
+
| `aria-activedescendant` | While an option is highlighted | The highlighted option's element id |
|
|
388
|
+
| `aria-controls` | Always | The popup listbox's element id |
|
|
389
|
+
| `aria-label` | A name is set | `aria-label`, or else `placeholder` when `aria-labelledby` isn't set |
|
|
390
|
+
| `aria-labelledby` | `aria-labelledby` is set | The `aria-labelledby` value |
|
|
391
|
+
| `aria-disabled` | `disabled` is `true` | `"true"` |
|
|
392
|
+
| `aria-readonly` | `readonly` is `true` | `"true"` |
|
|
393
|
+
| `aria-required` | `required` is `true` | `"true"` |
|
|
394
|
+
| `aria-invalid` | `invalid` is `true`, or `required` is `true` and the control is `touched` with no items selected | `"true"` |
|
|
395
|
+
| `aria-busy` | `loading` is `true` | `"true"` |
|
|
396
|
+
|
|
397
|
+
Name the control with `aria-label` or `aria-labelledby`. A `placeholder` names it when neither is set, but it disappears once something is selected, so a visible label is better.
|
|
398
|
+
|
|
399
|
+
The control also renders a visually hidden live region that announces the highlighted or selected option's text and position to screen reader users as the consumer navigates the popup.
|
|
400
|
+
|
|
401
|
+
## API
|
|
402
|
+
|
|
403
|
+
Everything below is imported from `@nanahoshi/mona-ui/multi-select`, `@nanahoshi/mona-ui/dropdowns`, as noted.
|
|
404
|
+
|
|
405
|
+
### `MultiSelectComponent`
|
|
406
|
+
|
|
407
|
+
**Selector:** `mona-multi-select`
|
|
408
|
+
**Type parameters:** `TData = unknown`, `TValue = TData`
|
|
409
|
+
**Implements:** `FormValueControl<Iterable<TValue>>`
|
|
410
|
+
|
|
411
|
+
#### Inputs
|
|
412
|
+
|
|
413
|
+
| Name | Type | Default | Description |
|
|
414
|
+
| --- | --- | --- | --- |
|
|
415
|
+
| `aria-describedby` | `string` | `""` | ID of an element that describes the multi select, such as help text or an error message. |
|
|
416
|
+
| `aria-label` | `string` | `""` | Accessible name for the multi select. Describe what it represents. Falls back to `placeholder` when neither this nor `aria-labelledby` is set. |
|
|
417
|
+
| `aria-labelledby` | `string` | `""` | Sets the aria-labelledby attribute of the multi select component. |
|
|
418
|
+
| `autoClose` | `boolean` | `false` | Closes the popup automatically after an item is selected or deselected. |
|
|
419
|
+
| `checkboxes` | `boolean` | `false` | Renders a checkbox next to each item in the popup list to indicate its selected state. |
|
|
420
|
+
| `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
421
|
+
| `data` | `Iterable<TData>` | `[]` | Collection of items rendered in the popup list. |
|
|
422
|
+
| `disabled` | `boolean` | `false` | Disables the component, preventing the popup from opening and blocking tag removal. |
|
|
423
|
+
| `invalid` | `boolean` | `false` | Marks the multi select as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
424
|
+
| `itemDisabled` | `DropdownFieldPredicateType<TData>` | — | A predicate function or the name of the field that determines whether an item is disabled. |
|
|
425
|
+
| `loading` | `boolean` | `false` | Shows a loading indicator, in place of the clear button, and marks the field busy. It doesn't block interaction: the field stays usable while data loads. |
|
|
426
|
+
| `placeholder` | `string` | `""` | Text shown when nothing is selected. It also names the multi select when neither `aria-label` nor `aria-labelledby` is set. |
|
|
427
|
+
| `popupClass` | `string` | `""` | Sets the class of the popup element. |
|
|
428
|
+
| `popupHeight` | `ListSizeInputType` | `null` | Maximum height of the popup, in pixels or as a CSS length. Shorter lists shrink to fit. When unset, the popup is at most 200 pixels tall. |
|
|
429
|
+
| `popupWidth` | `ListSizeInputType` | `null` | Sets the width of the popup element. |
|
|
430
|
+
| `readonly` | `boolean` | `false` | Sets the readonly state of the multi select component. |
|
|
431
|
+
| `required` | `boolean` | `false` | Sets the required state of the multi select component. |
|
|
432
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the border radius of the multi select component. |
|
|
433
|
+
| `showClearButton` | `boolean` | `false` | Renders a button that clears all selected items when at least one item is selected. |
|
|
434
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | The size of the multi select component. |
|
|
435
|
+
| `textField` | `DropdownFieldSelectorType<TData, string>` | `null` | Sets the text field of the multi select component. It can be null, string, or a function that takes an item and returns a string. If null, the item itself will be used as the text representation. |
|
|
436
|
+
| `touched` | `boolean` | `false` | Sets the touched state of the multi select. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
437
|
+
| `value` (two-way) | `Iterable<TValue>` | `[]` | Two-way bindable current selected values. Implements `FormValueControl<Iterable<TValue>>`, enabling signal forms `[formField]` binding. Object mode contains selected data items; primitive mode (see `valuePrimitive`) contains values resolved through `valueField`. An empty selection is represented by an empty iterable/array. |
|
|
438
|
+
| `valueField` | `DropdownFieldSelectorType<TData, unknown>` | `null` | Sets the value field of the multi select component. It is used for stable item identity, matching externally supplied values, and primitive value projection when `valuePrimitive` is enabled. It can be null, string, or a function that takes an item and returns a value. If null, the item itself will be used as the value representation. Should resolve to a stable, unique scalar. |
|
|
439
|
+
| `valuePrimitive` | `boolean` | `false` | Determines whether the bound value contains complete data items or values extracted through `valueField`. When `false`, selecting an item writes the complete data item. When `true`, selecting an item writes the value resolved through `valueField`. |
|
|
440
|
+
|
|
441
|
+
#### Outputs
|
|
442
|
+
|
|
443
|
+
| Name | Type | Description |
|
|
444
|
+
| --- | --- | --- |
|
|
445
|
+
| `close` | `PopupCloseEvent<unknown>` | Emits when the popup is about to close. This event is preventable. |
|
|
446
|
+
| `closed` | `void` | Emits after the popup is closed. |
|
|
447
|
+
| `open` | `PreventableEvent<Event>` | Emits when the popup is about to open. This event is preventable. |
|
|
448
|
+
| `opened` | `void` | Emits after the popup is opened. |
|
|
449
|
+
| `touch` | `void` | Emitted when focus leaves the multi select. Moving between it, its chips, its clear button and its popup doesn't count. The `FormField` directive listens to this to mark the field as touched. |
|
|
450
|
+
| `valueChange` | `Iterable<TValue>` | Emitted when `value` changes. |
|
|
451
|
+
|
|
452
|
+
#### Methods
|
|
453
|
+
|
|
454
|
+
| Signature | Description |
|
|
455
|
+
| --- | --- |
|
|
456
|
+
| `focus(options?: FocusOptions): void` | Moves focus to the multi select. |
|
|
457
|
+
|
|
458
|
+
### `DropdownFilterableDirective`
|
|
459
|
+
|
|
460
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
461
|
+
|
|
462
|
+
**Selector:** `mona-auto-complete[monaDropDownFilterable], mona-dropdown-list[monaDropDownFilterable], mona-combo-box[monaDropDownFilterable], mona-multi-select[monaDropDownFilterable]`
|
|
463
|
+
|
|
464
|
+
#### Inputs
|
|
465
|
+
|
|
466
|
+
| Name | Type | Default | Description |
|
|
467
|
+
| --- | --- | --- | --- |
|
|
468
|
+
| `filter` | `string` | `""` | Current filter text used to narrow the visible options. |
|
|
469
|
+
| `filterPlaceholder` | `string` | `""` | Placeholder text in the popup's filter row. Auto Complete has no filter row, since its own input is the filter, so it ignores this. |
|
|
470
|
+
| `monaDropDownFilterable` | `Partial<FilterableOptions> \| ""` | `""` | Filter operator, case sensitivity, and debounce delay. An empty string enables filtering with default settings (`operator: "contains"`, `caseSensitive: false`, `debounce: 0`); pass an object to override any field. |
|
|
471
|
+
|
|
472
|
+
#### Outputs
|
|
473
|
+
|
|
474
|
+
| Name | Type | Description |
|
|
475
|
+
| --- | --- | --- |
|
|
476
|
+
| `filterChange` | `FilterChangeEvent` | Emitted when the filter value changes. Cancelable. |
|
|
477
|
+
|
|
478
|
+
### `DropdownGroupableDirective`
|
|
479
|
+
|
|
480
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
481
|
+
|
|
482
|
+
**Selector:** `mona-auto-complete[monaDropDownGroupable], mona-combo-box[monaDropDownGroupable], mona-dropdown-list[monaDropDownGroupable], mona-multi-select[monaDropDownGroupable]`
|
|
483
|
+
**Type parameters:** `TData`
|
|
484
|
+
|
|
485
|
+
#### Inputs
|
|
486
|
+
|
|
487
|
+
| Name | Type | Default | Description |
|
|
488
|
+
| --- | --- | --- | --- |
|
|
489
|
+
| `groupBy` | `string \| Selector<TData, unknown> \| null \| undefined` | `""` | Property name, or accessor, used to derive an option's group. |
|
|
490
|
+
| `monaDropDownGroupable` | `GroupableOptions<TData, unknown> \| ""` | `""` | Group header order, and optional per-group item ordering. An empty string enables grouping with default settings (`headerOrder: "asc"`); pass an object to override any field. |
|
|
491
|
+
|
|
492
|
+
### `DropdownVirtualScrollDirective`
|
|
493
|
+
|
|
494
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
495
|
+
|
|
496
|
+
**Selector:** `mona-auto-complete[monaDropDownVirtualScroll], mona-dropdown-list[monaDropDownVirtualScroll], mona-combo-box[monaDropDownVirtualScroll], mona-multi-select[monaDropDownVirtualScroll]`
|
|
497
|
+
|
|
498
|
+
#### Inputs
|
|
499
|
+
|
|
500
|
+
| Name | Type | Default | Description |
|
|
501
|
+
| --- | --- | --- | --- |
|
|
502
|
+
| `monaDropDownVirtualScroll` | `Partial<VirtualScrollOptions> \| ""` | `""` | Whether virtual scrolling is enabled and the pixel height of a single option row. An empty string enables virtual scrolling with default settings (`height: 28`); pass an object to override either field. |
|
|
503
|
+
|
|
504
|
+
### `MultiSelectSummaryTagDirective`
|
|
505
|
+
|
|
506
|
+
**Selector:** `mona-multi-select[monaMultiSelectSummaryTag]`
|
|
507
|
+
|
|
508
|
+
#### Inputs
|
|
509
|
+
|
|
510
|
+
| Name | Type | Default | Description |
|
|
511
|
+
| --- | --- | --- | --- |
|
|
512
|
+
| `monaMultiSelectSummaryTag` | `number` | `-1` | Number of selected item tags to display before collapsing the rest into a summary tag. A negative value shows every selected item as its own tag and never renders the summary tag. |
|
|
513
|
+
|
|
514
|
+
### `DropdownDataHandlerDirective`
|
|
515
|
+
|
|
516
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
517
|
+
|
|
518
|
+
**Selector:** `[monaDropdownDataHandler]`
|
|
519
|
+
|
|
520
|
+
### `DropdownFooterTemplateDirective`
|
|
521
|
+
|
|
522
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
523
|
+
|
|
524
|
+
**Selector:** `ng-template[monaDropDownFooterTemplate], ng-template[monaAutoCompleteFooterTemplate], ng-template[monaDropDownListFooterTemplate], ng-template[monaDropDownTreeFooterTemplate], ng-template[monaComboBoxFooterTemplate], ng-template[monaMultiSelectFooterTemplate]`
|
|
525
|
+
|
|
526
|
+
### `DropdownGroupHeaderTemplateDirective`
|
|
527
|
+
|
|
528
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
529
|
+
|
|
530
|
+
**Selector:** `ng-template[monaDropDownGroupHeaderTemplate], ng-template[monaAutoCompleteGroupHeaderTemplate], ng-template[monaDropDownListGroupHeaderTemplate], ng-template[monaComboBoxGroupHeaderTemplate], ng-template[monaMultiSelectGroupHeaderTemplate]`
|
|
531
|
+
|
|
532
|
+
### `DropdownHeaderTemplateDirective`
|
|
533
|
+
|
|
534
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
535
|
+
|
|
536
|
+
**Selector:** `ng-template[monaDropDownHeaderTemplate], ng-template[monaAutoCompleteHeaderTemplate], ng-template[monaDropDownListHeaderTemplate], ng-template[monaDropDownTreeHeaderTemplate], ng-template[monaComboBoxHeaderTemplate], ng-template[monaMultiSelectHeaderTemplate]`
|
|
537
|
+
|
|
538
|
+
### `DropdownItemTemplateDirective`
|
|
539
|
+
|
|
540
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
541
|
+
|
|
542
|
+
**Selector:** `ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate]`
|
|
543
|
+
|
|
544
|
+
### `DropdownListPopupHandlerDirective`
|
|
545
|
+
|
|
546
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
547
|
+
|
|
548
|
+
**Selector:** `[monaDropdownListPopupHandler]`
|
|
549
|
+
|
|
550
|
+
### `DropdownLiveRegionDirective`
|
|
551
|
+
|
|
552
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
553
|
+
|
|
554
|
+
Announces how many results a dropdown shows after its list is filtered, or after its items change, while the
|
|
555
|
+
popup is open ("3 results available", "No results found").
|
|
556
|
+
|
|
557
|
+
The announcement goes through the CDK `LiveAnnouncer`, whose live region lives at the end of the document, so it
|
|
558
|
+
never becomes part of the combobox's content. The highlighted option isn't announced here:
|
|
559
|
+
`aria-activedescendant` already does that.
|
|
560
|
+
|
|
561
|
+
**Selector:** `[monaDropdownLiveRegion]`
|
|
562
|
+
|
|
563
|
+
### `DropdownNoDataTemplateDirective`
|
|
564
|
+
|
|
565
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
566
|
+
|
|
567
|
+
**Selector:** `ng-template[monaDropDownNoDataTemplate], ng-template[monaAutoCompleteNoDataTemplate], ng-template[monaDropDownListNoDataTemplate], ng-template[monaDropDownTreeNoDataTemplate], ng-template[monaComboBoxNoDataTemplate], ng-template[monaMultiSelectNoDataTemplate]`
|
|
568
|
+
|
|
569
|
+
### `DropdownPopupHandlerDirective`
|
|
570
|
+
|
|
571
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
572
|
+
|
|
573
|
+
**Selector:** `[monaDropdownPopupHandler]`
|
|
574
|
+
|
|
575
|
+
### `DropdownPrefixTemplateDirective`
|
|
576
|
+
|
|
577
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
578
|
+
|
|
579
|
+
**Selector:** `ng-template[monaDropdownPrefixTemplate]`
|
|
580
|
+
|
|
581
|
+
### `DropdownSuffixTemplateDirective`
|
|
582
|
+
|
|
583
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
584
|
+
|
|
585
|
+
**Selector:** `ng-template[monaDropdownSuffixTemplate]`
|
|
586
|
+
|
|
587
|
+
### `MultiSelectSummaryTagTemplateDirective`
|
|
588
|
+
|
|
589
|
+
**Selector:** `ng-template[monaMultiSelectSummaryTagTemplate]`
|
|
590
|
+
|
|
591
|
+
### `MultiSelectTagTemplateDirective`
|
|
592
|
+
|
|
593
|
+
**Selector:** `ng-template[monaMultiSelectTagTemplate]`
|
|
594
|
+
|
|
595
|
+
### `DropdownListService`
|
|
596
|
+
|
|
597
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
598
|
+
|
|
599
|
+
**Type parameters:** `TData = unknown`
|
|
600
|
+
|
|
601
|
+
#### Properties
|
|
602
|
+
|
|
603
|
+
| Name | Type |
|
|
604
|
+
| --- | --- |
|
|
605
|
+
| `navigate$` (read-only) | `Subject<{ item: ListItem<TData>; }>` |
|
|
606
|
+
|
|
607
|
+
### Types
|
|
608
|
+
|
|
609
|
+
#### `DROPDOWN_DATA_INPUT_TOKEN`
|
|
610
|
+
|
|
611
|
+
```typescript
|
|
612
|
+
const DROPDOWN_DATA_INPUT_TOKEN: InjectionToken<DropdownDataInput<unknown>>;
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
#### `DROPDOWN_POPUP_INPUT_TOKEN`
|
|
616
|
+
|
|
617
|
+
```typescript
|
|
618
|
+
const DROPDOWN_POPUP_INPUT_TOKEN: InjectionToken<DropdownPopupInput>;
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
#### `DropdownDataInputToken`
|
|
622
|
+
|
|
623
|
+
**Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`.
|
|
624
|
+
|
|
625
|
+
```typescript
|
|
626
|
+
const DropdownDataInputToken: InjectionToken<DropdownDataInput<unknown>>;
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
#### `dropdownPopupThemeVariants`
|
|
630
|
+
|
|
631
|
+
```typescript
|
|
632
|
+
const dropdownPopupThemeVariants: (props?: ({ rounded?: "none" | "small" | "medium" | "large" | "full" | null | undefined; size?: "small" | "medium" | "large" | null | undefined; } & ClassProp) | undefined) => string;
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
#### `DROPDOWNS_DEFAULT_MESSAGES`
|
|
636
|
+
|
|
637
|
+
```typescript
|
|
638
|
+
const DROPDOWNS_DEFAULT_MESSAGES: MonaDropdownsMessages;
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
#### `MULTI_SELECT_DEFAULT_MESSAGES`
|
|
642
|
+
|
|
643
|
+
```typescript
|
|
644
|
+
const MULTI_SELECT_DEFAULT_MESSAGES: MonaMultiSelectMessages;
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
#### `DropdownDataInput`
|
|
648
|
+
|
|
649
|
+
**Type parameters:** `TData`
|
|
650
|
+
|
|
651
|
+
| Name | Type |
|
|
652
|
+
| --- | --- |
|
|
653
|
+
| `data` (read-only) | `InputSignal<Iterable<TData>>` |
|
|
654
|
+
| `itemDisabled` (read-only) | `InputSignal<DropdownFieldPredicateType<TData>>` |
|
|
655
|
+
| `textField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, string>>` |
|
|
656
|
+
| `valueField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, unknown>>` |
|
|
657
|
+
|
|
658
|
+
#### `DropdownPopupInput`
|
|
659
|
+
|
|
660
|
+
| Name | Type |
|
|
661
|
+
| --- | --- |
|
|
662
|
+
| `close` (read-only) | `OutputEmitterRef<PopupCloseEvent>` |
|
|
663
|
+
| `closed` (read-only) | `OutputEmitterRef<void>` |
|
|
664
|
+
| `disabled` (read-only) | `Signal<boolean>` |
|
|
665
|
+
| `open` (read-only) | `OutputEmitterRef<PreventableEvent>` |
|
|
666
|
+
| `opened` (read-only) | `OutputEmitterRef<void>` |
|
|
667
|
+
| `popupHeight` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
668
|
+
| `popupWidth` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
669
|
+
| `readonly` (read-only) | `Signal<boolean>` |
|
|
670
|
+
| `touch` (read-only) | `OutputEmitterRef<void>` |
|
|
671
|
+
|
|
672
|
+
#### `DropdownFieldPredicateType`
|
|
673
|
+
|
|
674
|
+
```typescript
|
|
675
|
+
type DropdownFieldPredicateType<TData> = string | Predicate<TData> | null | undefined;
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
#### `DropdownFieldSelectorType`
|
|
679
|
+
|
|
680
|
+
```typescript
|
|
681
|
+
type DropdownFieldSelectorType<TData, TResult = unknown> = string | Selector<TData, TResult> | null | undefined;
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
#### `FilterChangeEvent`
|
|
685
|
+
|
|
686
|
+
From `@nanahoshi/mona-ui/common`.
|
|
687
|
+
|
|
688
|
+
**Extends:** `PreventableEvent`
|
|
689
|
+
|
|
690
|
+
| Name | Type |
|
|
691
|
+
| --- | --- |
|
|
692
|
+
| `filter` (read-only) | `string` |
|
|
693
|
+
|
|
694
|
+
#### `ListItem`
|
|
695
|
+
|
|
696
|
+
From `@nanahoshi/mona-ui/list`.
|
|
697
|
+
|
|
698
|
+
An item of a list, wrapping its data item.
|
|
699
|
+
|
|
700
|
+
**Type parameters:** `TData`
|
|
701
|
+
|
|
702
|
+
| Name | Type |
|
|
703
|
+
| --- | --- |
|
|
704
|
+
| `data` (read-only) | `TData` |
|
|
705
|
+
| `header` (read-only) | `string` |
|
|
706
|
+
| `isHeader` (read-only) | `boolean` |
|
|
707
|
+
| `uid` (read-only) | `string` |
|
|
708
|
+
|
|
709
|
+
#### `ListSizeInputType`
|
|
710
|
+
|
|
711
|
+
From `@nanahoshi/mona-ui/list`.
|
|
712
|
+
|
|
713
|
+
```typescript
|
|
714
|
+
type ListSizeInputType = ListSizeType | number;
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
#### `ListSizeType`
|
|
718
|
+
|
|
719
|
+
From `@nanahoshi/mona-ui/list`.
|
|
720
|
+
|
|
721
|
+
A CSS length, or nothing to leave it to the stylesheet.
|
|
722
|
+
|
|
723
|
+
```typescript
|
|
724
|
+
type ListSizeType = string | null | undefined;
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
#### `MonaDropdownsMessages`
|
|
728
|
+
|
|
729
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
730
|
+
|
|
731
|
+
| Name | Type |
|
|
732
|
+
| --- | --- |
|
|
733
|
+
| `itemPosition` (read-only) | `(text: string, position: number, total: number) => string` |
|
|
734
|
+
| `noResultsFound` (read-only) | `string` |
|
|
735
|
+
| `resultsAvailable` (read-only) | `(count: number) => string` |
|
|
736
|
+
|
|
737
|
+
#### `MonaMultiSelectMessages`
|
|
738
|
+
|
|
739
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
740
|
+
|
|
741
|
+
| Name | Type |
|
|
742
|
+
| --- | --- |
|
|
743
|
+
| `clear` (read-only) | `string` |
|
|
744
|
+
| `itemsCount` (read-only) | `(count: number) => string` |
|
|
745
|
+
| `removeMoreItems` (read-only) | `(count: number) => string` |
|
|
746
|
+
|
|
747
|
+
#### `PreventableEvent`
|
|
748
|
+
|
|
749
|
+
From `@nanahoshi/mona-ui/common`.
|
|
750
|
+
|
|
751
|
+
**Type parameters:** `E extends Event = Event`
|
|
752
|
+
|
|
753
|
+
| Name | Type | Description |
|
|
754
|
+
| --- | --- | --- |
|
|
755
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
756
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
757
|
+
|
|
758
|
+
**Methods**
|
|
759
|
+
|
|
760
|
+
| Signature | Description |
|
|
761
|
+
| --- | --- |
|
|
762
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
763
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
764
|
+
|
|
765
|
+
**Documented elsewhere:** [`FilterableOptions`](grid.md), [`GroupableOptions`](grid.md), [`PopupCloseEvent`](popup.md), [`VirtualScrollOptions`](list-view.md)
|