@nanahoshi/mona-ui 0.1.0
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 +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# MonaUi
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.1.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project mona-ui` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project mona-ui`.
|
|
8
|
+
|
|
9
|
+
> Note: Don't forget to add `--project mona-ui` or else it will be added to the default project in your `angular.json` file.
|
|
10
|
+
|
|
11
|
+
## Build
|
|
12
|
+
|
|
13
|
+
Run `ng build mona-ui` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
14
|
+
|
|
15
|
+
## Publishing
|
|
16
|
+
|
|
17
|
+
After building your library with `ng build mona-ui`, go to the dist folder `cd dist/mona-ui` and run `npm publish`.
|
|
18
|
+
|
|
19
|
+
## Running unit tests
|
|
20
|
+
|
|
21
|
+
Run `ng test mona-ui` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
22
|
+
|
|
23
|
+
## Further help
|
|
24
|
+
|
|
25
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, DestroyRef, ElementRef, computed, linkedSignal, contentChild, TemplateRef, viewChild, input, output, model, afterNextRender, effect, untracked, forwardRef, Component } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import { createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
8
|
+
import { FilterChangeEvent } from '@nanahoshi/mona-ui/common';
|
|
9
|
+
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
10
|
+
import { ListService, ListComponent, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective, ListItemTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
11
|
+
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
12
|
+
import { DropdownService, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, dropdownPopupThemeVariants, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownSuffixTemplateDirective, DropdownLiveRegionDirective, DropdownDataInputToken, DropdownPopupInputToken, DropdownDataHandlerDirective, DropdownListPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
13
|
+
import { TextBoxDirective } from '@nanahoshi/mona-ui/text-box';
|
|
14
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
15
|
+
import { Subject, filter, debounceTime, identity, take, tap } from 'rxjs';
|
|
16
|
+
import { twMerge } from 'tailwind-merge';
|
|
17
|
+
import { cva } from 'class-variance-authority';
|
|
18
|
+
|
|
19
|
+
const autoCompleteBaseVariants = cva(`
|
|
20
|
+
flex
|
|
21
|
+
border border-input-border outline-none
|
|
22
|
+
bg-background shadow-xs
|
|
23
|
+
focus-within:ring-1 focus-within:ring-primary/40
|
|
24
|
+
transition-[color,box-shadow,border] ease-in-out duration-300
|
|
25
|
+
`, {
|
|
26
|
+
variants: {
|
|
27
|
+
disabled: {
|
|
28
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed"
|
|
29
|
+
},
|
|
30
|
+
expanded: {
|
|
31
|
+
true: "ring-1 ring-primary/40"
|
|
32
|
+
},
|
|
33
|
+
focused: {
|
|
34
|
+
true: "ring-1 ring-primary/40"
|
|
35
|
+
},
|
|
36
|
+
invalid: {
|
|
37
|
+
true: "border-error ring-1 ring-error/40",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
rounded: {
|
|
41
|
+
none: "rounded-none",
|
|
42
|
+
small: "rounded-sm",
|
|
43
|
+
medium: "rounded-md",
|
|
44
|
+
large: "rounded-lg",
|
|
45
|
+
full: "rounded-full"
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
large: "h-10 text-md",
|
|
49
|
+
medium: "h-9 text-sm",
|
|
50
|
+
small: "h-8 text-xs"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
disabled: false,
|
|
55
|
+
focused: false,
|
|
56
|
+
invalid: false,
|
|
57
|
+
rounded: "medium",
|
|
58
|
+
size: "medium"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const autoCompleteTextInputVariants = cva(`
|
|
62
|
+
border-none outline-none
|
|
63
|
+
bg-transparent shadow-none
|
|
64
|
+
px-2 h-full w-full text-ellipsis
|
|
65
|
+
focus-within:ring-0 focus-visible:ring-0
|
|
66
|
+
`, {
|
|
67
|
+
variants: {
|
|
68
|
+
rounded: {
|
|
69
|
+
none: "rounded-none",
|
|
70
|
+
small: "rounded-sm",
|
|
71
|
+
medium: "rounded-md",
|
|
72
|
+
large: "rounded-lg",
|
|
73
|
+
full: "rounded-full px-3"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const autoCompleteAffixContainerVariants = cva(`h-full flex flex-none items-center justify-center`);
|
|
78
|
+
|
|
79
|
+
const autoCompleteBaseThemeVariants = (theme) => {
|
|
80
|
+
switch (theme) {
|
|
81
|
+
case "mona":
|
|
82
|
+
return autoCompleteBaseVariants;
|
|
83
|
+
default:
|
|
84
|
+
return autoCompleteBaseVariants;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const autoCompleteTextInputThemeVariants = (theme) => {
|
|
88
|
+
switch (theme) {
|
|
89
|
+
case "mona":
|
|
90
|
+
return autoCompleteTextInputVariants;
|
|
91
|
+
default:
|
|
92
|
+
return autoCompleteTextInputVariants;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const autoCompleteAffixContainerThemeVariants = (theme) => {
|
|
96
|
+
switch (theme) {
|
|
97
|
+
case "mona":
|
|
98
|
+
return autoCompleteAffixContainerVariants;
|
|
99
|
+
default:
|
|
100
|
+
return autoCompleteAffixContainerVariants;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
class AutoCompleteComponent {
|
|
105
|
+
#destroyRef;
|
|
106
|
+
#dropdownService;
|
|
107
|
+
#hostElementRef;
|
|
108
|
+
#listService;
|
|
109
|
+
#popupRef;
|
|
110
|
+
#themeService;
|
|
111
|
+
constructor() {
|
|
112
|
+
this.#destroyRef = inject(DestroyRef);
|
|
113
|
+
this.#dropdownService = inject(DropdownService);
|
|
114
|
+
this.#hostElementRef = inject((ElementRef));
|
|
115
|
+
this.#listService = inject(ListService);
|
|
116
|
+
this.#popupRef = this.#dropdownService.popupRef;
|
|
117
|
+
this.#themeService = inject(ThemeService);
|
|
118
|
+
this.activeDescendant = computed(() => {
|
|
119
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
120
|
+
return highlightedItem ? highlightedItem.uid : null;
|
|
121
|
+
}, /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
123
|
+
this.affixClass = computed(() => {
|
|
124
|
+
const theme = this.#themeService.theme();
|
|
125
|
+
return autoCompleteAffixContainerThemeVariants(theme)();
|
|
126
|
+
}, /* @ts-ignore */
|
|
127
|
+
...(ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []));
|
|
128
|
+
this.autoCompleteValue = linkedSignal(() => this.value() ?? "", /* @ts-ignore */
|
|
129
|
+
...(ngDevMode ? [{ debugName: "autoCompleteValue" }] : /* istanbul ignore next */ []));
|
|
130
|
+
this.autoCompleteValue$ = new Subject();
|
|
131
|
+
this.baseClass = computed(() => {
|
|
132
|
+
const theme = this.#themeService.theme();
|
|
133
|
+
const disabled = this.disabled();
|
|
134
|
+
const expanded = this.expanded();
|
|
135
|
+
const focused = this.#popupRef() !== null;
|
|
136
|
+
const invalid = this.invalidState();
|
|
137
|
+
const rounded = this.rounded();
|
|
138
|
+
const size = this.size();
|
|
139
|
+
const variantClass = autoCompleteBaseThemeVariants(theme)({
|
|
140
|
+
disabled,
|
|
141
|
+
expanded,
|
|
142
|
+
focused,
|
|
143
|
+
invalid,
|
|
144
|
+
rounded,
|
|
145
|
+
size
|
|
146
|
+
});
|
|
147
|
+
const userClass = this.userClass();
|
|
148
|
+
return twMerge(variantClass, userClass);
|
|
149
|
+
}, /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
151
|
+
this.effectiveAriaLabel = computed(() => this.ariaLabel() || (this.ariaLabelledBy() ? "" : this.placeholder()), /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
|
|
153
|
+
this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
|
|
154
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
155
|
+
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
156
|
+
this.groupHeaderTemplate = contentChild(DropdownGroupHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
157
|
+
this.headerTemplate = contentChild(DropdownHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
158
|
+
this.id = createElementControlId();
|
|
159
|
+
this.inputClass = computed(() => {
|
|
160
|
+
const theme = this.#themeService.theme();
|
|
161
|
+
const rounded = this.rounded();
|
|
162
|
+
return autoCompleteTextInputThemeVariants(theme)({ rounded });
|
|
163
|
+
}, /* @ts-ignore */
|
|
164
|
+
...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
|
|
165
|
+
this.itemTemplate = contentChild(DropdownItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
166
|
+
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.value()), /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
168
|
+
this.isEmpty = computed(() => !this.#listService.viewItems().any(), /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
170
|
+
this.listId = createElementControlId();
|
|
171
|
+
this.listPopupClass = computed(() => {
|
|
172
|
+
const theme = this.#themeService.theme();
|
|
173
|
+
const rounded = this.rounded();
|
|
174
|
+
const size = this.size();
|
|
175
|
+
const userClass = this.popupClass();
|
|
176
|
+
const variantClass = dropdownPopupThemeVariants(theme)({ rounded, size });
|
|
177
|
+
return twMerge(variantClass, userClass);
|
|
178
|
+
}, /* @ts-ignore */
|
|
179
|
+
...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
|
|
180
|
+
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
181
|
+
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
182
|
+
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
183
|
+
this.prefixTemplate = contentChild(DropdownPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
184
|
+
this.selectableOptions = {
|
|
185
|
+
enabled: true,
|
|
186
|
+
mode: "single",
|
|
187
|
+
toggleable: false
|
|
188
|
+
};
|
|
189
|
+
this.suffixTemplate = contentChild(DropdownSuffixTemplateDirective, { ...(ngDevMode ? { debugName: "suffixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
190
|
+
/**
|
|
191
|
+
* @description ID of an element that provides an extended description for the input.
|
|
192
|
+
* Use this to associate error messages or help text with the input.
|
|
193
|
+
* @default ""
|
|
194
|
+
*/
|
|
195
|
+
this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
|
|
196
|
+
/**
|
|
197
|
+
* @description Accessible name for the input. Describe what the autocomplete represents.
|
|
198
|
+
* Falls back to {@link placeholder} when neither this nor {@link ariaLabelledBy} is set.
|
|
199
|
+
* @default ""
|
|
200
|
+
*/
|
|
201
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
202
|
+
/**
|
|
203
|
+
* @description ID of an external element that provides the accessible name for the input.
|
|
204
|
+
* @default ""
|
|
205
|
+
*/
|
|
206
|
+
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
207
|
+
/**
|
|
208
|
+
* @description Emits when the popup is about to close. This event is preventable.
|
|
209
|
+
*/
|
|
210
|
+
this.close = output();
|
|
211
|
+
/**
|
|
212
|
+
* @description Emits after the popup is closed.
|
|
213
|
+
*/
|
|
214
|
+
this.closed = output();
|
|
215
|
+
/**
|
|
216
|
+
* @description Collection of items to render.
|
|
217
|
+
* @default []
|
|
218
|
+
*/
|
|
219
|
+
this.data = input([], /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
221
|
+
/**
|
|
222
|
+
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
223
|
+
* @default false
|
|
224
|
+
*/
|
|
225
|
+
this.disabled = model(false, /* @ts-ignore */
|
|
226
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
227
|
+
/**
|
|
228
|
+
* @description Predicate or field name used to determine whether an individual item is disabled.
|
|
229
|
+
* @default undefined
|
|
230
|
+
*/
|
|
231
|
+
this.itemDisabled = input(/* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [undefined, { debugName: "itemDisabled" }] : /* istanbul ignore next */ []));
|
|
233
|
+
/**
|
|
234
|
+
* @description Marks the autocomplete as invalid. When bound to a signal form field via `[formField]`,
|
|
235
|
+
* this is written by the `FormField` directive.
|
|
236
|
+
* @default false
|
|
237
|
+
*/
|
|
238
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
239
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
240
|
+
/**
|
|
241
|
+
* @description Defines whether the first matching item should be highlighted while typing.
|
|
242
|
+
* @default true
|
|
243
|
+
*/
|
|
244
|
+
this.highlightFirst = input(true, /* @ts-ignore */
|
|
245
|
+
...(ngDevMode ? [{ debugName: "highlightFirst" }] : /* istanbul ignore next */ []));
|
|
246
|
+
/**
|
|
247
|
+
* @description Displays a loading indicator and prevents interaction while an operation is in progress.
|
|
248
|
+
* @default false
|
|
249
|
+
*/
|
|
250
|
+
this.loading = input(false, /* @ts-ignore */
|
|
251
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
252
|
+
/**
|
|
253
|
+
* @description Emits when the popup is about to open. This event is preventable.
|
|
254
|
+
*/
|
|
255
|
+
this.open = output();
|
|
256
|
+
/**
|
|
257
|
+
* @description Emits after the popup is opened.
|
|
258
|
+
*/
|
|
259
|
+
this.opened = output();
|
|
260
|
+
/**
|
|
261
|
+
* @description Placeholder text shown when no value is selected or entered.
|
|
262
|
+
* @default ""
|
|
263
|
+
*/
|
|
264
|
+
this.placeholder = input("", /* @ts-ignore */
|
|
265
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
266
|
+
/**
|
|
267
|
+
* @description Additional CSS classes applied to the popup element.
|
|
268
|
+
* @default ""
|
|
269
|
+
*/
|
|
270
|
+
this.popupClass = input("", /* @ts-ignore */
|
|
271
|
+
...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
|
|
272
|
+
/**
|
|
273
|
+
* @description Height of the popup element.
|
|
274
|
+
* @default null
|
|
275
|
+
*/
|
|
276
|
+
this.popupHeight = input(null, /* @ts-ignore */
|
|
277
|
+
...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
|
|
278
|
+
/**
|
|
279
|
+
* @description Width of the popup element.
|
|
280
|
+
* @default null
|
|
281
|
+
*/
|
|
282
|
+
this.popupWidth = input(null, /* @ts-ignore */
|
|
283
|
+
...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
|
|
284
|
+
/**
|
|
285
|
+
* @description Prevents value changes while preserving the component's visual state.
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
this.readonly = input(false, /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
290
|
+
/**
|
|
291
|
+
* @description Marks the field as required for form validation.
|
|
292
|
+
* @default false
|
|
293
|
+
*/
|
|
294
|
+
this.required = input(false, /* @ts-ignore */
|
|
295
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
296
|
+
/**
|
|
297
|
+
* @description Border-radius preset applied to the component.
|
|
298
|
+
* @default "medium"
|
|
299
|
+
*/
|
|
300
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
302
|
+
/**
|
|
303
|
+
* @description Displays a button that clears the current value when clicked.
|
|
304
|
+
* @default true
|
|
305
|
+
*/
|
|
306
|
+
this.showClearButton = input(true, /* @ts-ignore */
|
|
307
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
308
|
+
/**
|
|
309
|
+
* @description Size preset controlling the component's dimensions.
|
|
310
|
+
* @default "medium"
|
|
311
|
+
*/
|
|
312
|
+
this.size = input("medium", /* @ts-ignore */
|
|
313
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
314
|
+
/**
|
|
315
|
+
* @description Property name or accessor used to derive the display text from a data item.
|
|
316
|
+
* If null, the item itself is used as the display text.
|
|
317
|
+
* @default null
|
|
318
|
+
*/
|
|
319
|
+
this.textField = input(null, /* @ts-ignore */
|
|
320
|
+
...(ngDevMode ? [{ debugName: "textField" }] : /* istanbul ignore next */ []));
|
|
321
|
+
/**
|
|
322
|
+
* @description Emitted when the autocomplete is interacted with on blur, selection, clear, or committed input.
|
|
323
|
+
* The `FormField` directive listens to this to mark the field as touched.
|
|
324
|
+
*/
|
|
325
|
+
this.touch = output();
|
|
326
|
+
/**
|
|
327
|
+
* @description Sets the touched state of the autocomplete. When bound to a signal form field via `[formField]`,
|
|
328
|
+
* this is written by the `FormField` directive.
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
this.touched = input(false, /* @ts-ignore */
|
|
332
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
333
|
+
/**
|
|
334
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
335
|
+
* @default ""
|
|
336
|
+
*/
|
|
337
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
338
|
+
/**
|
|
339
|
+
* @description Property name or accessor used to derive the value from a data item.
|
|
340
|
+
* If null, the item itself is used as the value.
|
|
341
|
+
* @default null
|
|
342
|
+
*/
|
|
343
|
+
this.valueField = input(null, /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "valueField" }] : /* istanbul ignore next */ []));
|
|
345
|
+
/**
|
|
346
|
+
* @description Two-way bindable current autocomplete value. Implements `FormValueControl<string | null>`,
|
|
347
|
+
* enabling signal forms `[formField]` binding.
|
|
348
|
+
* @default null
|
|
349
|
+
*/
|
|
350
|
+
this.value = model(null, /* @ts-ignore */
|
|
351
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
352
|
+
afterNextRender({
|
|
353
|
+
read: () => {
|
|
354
|
+
this.initialize();
|
|
355
|
+
this.setSubscriptions();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
effect(() => {
|
|
359
|
+
const popupTemplate = this.popupTemplate();
|
|
360
|
+
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
onInputBlur() {
|
|
364
|
+
this.touch.emit();
|
|
365
|
+
if (this.value() !== this.autoCompleteValue() && !this.#popupRef()) {
|
|
366
|
+
this.updateValue(this.autoCompleteValue());
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
onItemSelect(event) {
|
|
370
|
+
const itemText = this.#listService.getItemText(event.item);
|
|
371
|
+
this.updateValue(itemText);
|
|
372
|
+
this.autoCompleteValue.set(itemText);
|
|
373
|
+
this.closePopup();
|
|
374
|
+
rxTimeout(this.#destroyRef, () => this.focus());
|
|
375
|
+
}
|
|
376
|
+
onValueClear(event) {
|
|
377
|
+
if (this.readonly() || (event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ")) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
event.stopImmediatePropagation();
|
|
381
|
+
this.clear(true);
|
|
382
|
+
this.closePopup();
|
|
383
|
+
}
|
|
384
|
+
clear(notify) {
|
|
385
|
+
this.autoCompleteValue.set("");
|
|
386
|
+
this.#listService.clearSelections();
|
|
387
|
+
this.#listService.clearFilter();
|
|
388
|
+
if (notify) {
|
|
389
|
+
this.updateValue(null);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
closePopup() {
|
|
393
|
+
this.#popupRef()?.close();
|
|
394
|
+
}
|
|
395
|
+
focus() {
|
|
396
|
+
const input = this.#hostElementRef.nativeElement.querySelector("input");
|
|
397
|
+
if (input) {
|
|
398
|
+
input.focus();
|
|
399
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
initialize() {
|
|
403
|
+
this.#listService.setNavigableOptions({ enabled: true, mode: "highlight" });
|
|
404
|
+
this.#listService.setSelectableOptions(this.selectableOptions);
|
|
405
|
+
this.#listService.filterInputVisible.set(false);
|
|
406
|
+
this.#dropdownService.restoreFocus.set(false);
|
|
407
|
+
}
|
|
408
|
+
notifyFilterChange(filter) {
|
|
409
|
+
const event = new FilterChangeEvent(filter);
|
|
410
|
+
this.#listService.filterChange$.next(event);
|
|
411
|
+
return event;
|
|
412
|
+
}
|
|
413
|
+
setArrowKeyNavigationSubscription() {
|
|
414
|
+
this.#dropdownService.beforeNavigate$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
415
|
+
const keyboardEvent = event.originalEvent;
|
|
416
|
+
if (!keyboardEvent.altKey) {
|
|
417
|
+
event.preventDefault();
|
|
418
|
+
}
|
|
419
|
+
if (this.#dropdownService.popupRef() && !keyboardEvent.altKey) {
|
|
420
|
+
const direction = keyboardEvent.key === "ArrowDown" ? "next" : "previous";
|
|
421
|
+
this.#listService.navigate(direction, "highlight", false);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
setAutoCompleteValueChangeSubscription() {
|
|
426
|
+
const debounceDuration = this.#listService.getFilterDebounceDuration();
|
|
427
|
+
this.autoCompleteValue$
|
|
428
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(value => value !== null), debounceDuration > 0 ? debounceTime(debounceDuration) : identity)
|
|
429
|
+
.subscribe((value) => {
|
|
430
|
+
if (this.#listService.isFilteringEnabled()) {
|
|
431
|
+
const event = this.notifyFilterChange(value);
|
|
432
|
+
if (event.isDefaultPrevented()) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (value) {
|
|
436
|
+
this.#listService.setFilter(value);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (!value) {
|
|
440
|
+
this.#popupRef()
|
|
441
|
+
?.closed.pipe(take(1))
|
|
442
|
+
.subscribe(() => this.clear(false));
|
|
443
|
+
this.closePopup();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (!this.#popupRef()) {
|
|
447
|
+
this.#dropdownService.triggerPopupOpen$.next({});
|
|
448
|
+
}
|
|
449
|
+
this.autoCompleteValue.set(value);
|
|
450
|
+
const item = this.#listService.getMatchingFilteredItem(value);
|
|
451
|
+
if (this.highlightFirst()) {
|
|
452
|
+
this.#listService.clearSelections();
|
|
453
|
+
this.#listService.highlightedItem.set(item);
|
|
454
|
+
if (item) {
|
|
455
|
+
this.#listService.scrollToItem$.next({ item, focus: false });
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
setEnterKeySubscription() {
|
|
461
|
+
this.#dropdownService.beforeKeydown$
|
|
462
|
+
.pipe(filter(e => e.originalEvent?.key === "Enter"), takeUntilDestroyed(this.#destroyRef), tap(e => e.preventDefault()))
|
|
463
|
+
.subscribe(() => {
|
|
464
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
465
|
+
const autoCompleteValue = this.autoCompleteValue();
|
|
466
|
+
if (highlightedItem) {
|
|
467
|
+
const highlightedItemText = this.#listService.getItemText(highlightedItem);
|
|
468
|
+
this.autoCompleteValue.set(highlightedItemText);
|
|
469
|
+
this.updateValue(highlightedItemText);
|
|
470
|
+
this.closePopup();
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (this.value() !== autoCompleteValue) {
|
|
474
|
+
this.updateValue(autoCompleteValue);
|
|
475
|
+
}
|
|
476
|
+
this.closePopup();
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
setEscapeKeySubscription() {
|
|
480
|
+
this.#dropdownService.beforeKeydown$
|
|
481
|
+
.pipe(filter(e => e.originalEvent?.key === "Escape"), takeUntilDestroyed(this.#destroyRef), tap(e => {
|
|
482
|
+
e.preventDefault();
|
|
483
|
+
e.originalEvent?.stopImmediatePropagation();
|
|
484
|
+
}))
|
|
485
|
+
.subscribe(() => {
|
|
486
|
+
if (this.#popupRef()) {
|
|
487
|
+
this.closePopup();
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (this.autoCompleteValue()) {
|
|
491
|
+
this.clear(false);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
setSpaceKeySubscription() {
|
|
496
|
+
this.#dropdownService.beforeKeydown$
|
|
497
|
+
.pipe(filter(e => e.originalEvent?.key === " "), takeUntilDestroyed(this.#destroyRef), tap(e => e.preventDefault()))
|
|
498
|
+
.subscribe();
|
|
499
|
+
}
|
|
500
|
+
setPopupCloseSubscriptions() {
|
|
501
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
502
|
+
this.autoCompleteValue$.next(null);
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
setSubscriptions() {
|
|
506
|
+
this.setAutoCompleteValueChangeSubscription();
|
|
507
|
+
this.setArrowKeyNavigationSubscription();
|
|
508
|
+
this.setEnterKeySubscription();
|
|
509
|
+
this.setEscapeKeySubscription();
|
|
510
|
+
this.setPopupCloseSubscriptions();
|
|
511
|
+
this.setSpaceKeySubscription();
|
|
512
|
+
}
|
|
513
|
+
updateValue(value, notify = true) {
|
|
514
|
+
const oldValue = this.value();
|
|
515
|
+
if (notify && oldValue !== value) {
|
|
516
|
+
const notifyValue = value === "" || value == null ? null : value;
|
|
517
|
+
this.value.set(notifyValue);
|
|
518
|
+
this.touch.emit();
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
this.value.set(value);
|
|
522
|
+
}
|
|
523
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AutoCompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
524
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AutoCompleteComponent, isStandalone: true, selector: "mona-auto-complete", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, highlightFirst: { classPropertyName: "highlightFirst", publicName: "highlightFirst", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", disabled: "disabledChange", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { properties: { "attr.aria-disabled": "disabled() ? true : undefined", "attr.aria-haspopup": "'listbox'", "attr.aria-invalid": "invalidState() ? true : undefined", "attr.aria-readonly": "readonly() ? true : undefined", "attr.aria-required": "required() ? true : undefined", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.tabindex": "-1", "class": "baseClass()" } }, providers: [
|
|
525
|
+
ListService,
|
|
526
|
+
DropdownService,
|
|
527
|
+
{
|
|
528
|
+
provide: DropdownDataInputToken,
|
|
529
|
+
useExisting: forwardRef(() => AutoCompleteComponent),
|
|
530
|
+
multi: false
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
provide: DropdownPopupInputToken,
|
|
534
|
+
useExisting: forwardRef(() => AutoCompleteComponent),
|
|
535
|
+
multi: false
|
|
536
|
+
}
|
|
537
|
+
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplate", first: true, predicate: DropdownSuffixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"disabled()\"\n [id]=\"id\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [ngModel]=\"autoCompleteValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"effectiveAriaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n (ngModelChange)=\"autoCompleteValue$.next($event)\"\n (blur)=\"onInputBlur()\" />\n\n@if (showClearButton() && autoCompleteValue() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n label=\"Clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n@if (suffixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"suffixTemplate()\"></ng-container>\n </span>\n}\n\n<span monaDropdownLiveRegion></span>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: TextBoxDirective, selector: "input[monaTextBox]", inputs: ["rounded", "size", "class"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemSelect"] }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "directive", type: DropdownLiveRegionDirective, selector: "span[monaDropdownLiveRegion]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
538
|
+
}
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AutoCompleteComponent, decorators: [{
|
|
540
|
+
type: Component,
|
|
541
|
+
args: [{ selector: "mona-auto-complete", hostDirectives: [DropdownDataHandlerDirective, DropdownListPopupHandlerDirective], providers: [
|
|
542
|
+
ListService,
|
|
543
|
+
DropdownService,
|
|
544
|
+
{
|
|
545
|
+
provide: DropdownDataInputToken,
|
|
546
|
+
useExisting: forwardRef(() => AutoCompleteComponent),
|
|
547
|
+
multi: false
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
provide: DropdownPopupInputToken,
|
|
551
|
+
useExisting: forwardRef(() => AutoCompleteComponent),
|
|
552
|
+
multi: false
|
|
553
|
+
}
|
|
554
|
+
], imports: [
|
|
555
|
+
TextBoxDirective,
|
|
556
|
+
FormsModule,
|
|
557
|
+
NgTemplateOutlet,
|
|
558
|
+
ListComponent,
|
|
559
|
+
ListGroupHeaderTemplateDirective,
|
|
560
|
+
ListFooterTemplateDirective,
|
|
561
|
+
ListHeaderTemplateDirective,
|
|
562
|
+
ListNoDataTemplateDirective,
|
|
563
|
+
ListItemTemplateDirective,
|
|
564
|
+
DropdownLiveRegionDirective,
|
|
565
|
+
IndicatorIconComponent
|
|
566
|
+
], host: {
|
|
567
|
+
"[attr.aria-disabled]": "disabled() ? true : undefined",
|
|
568
|
+
"[attr.aria-haspopup]": "'listbox'",
|
|
569
|
+
"[attr.aria-invalid]": "invalidState() ? true : undefined",
|
|
570
|
+
"[attr.aria-readonly]": "readonly() ? true : undefined",
|
|
571
|
+
"[attr.aria-required]": "required() ? true : undefined",
|
|
572
|
+
"[attr.data-disabled]": "disabled()",
|
|
573
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
574
|
+
"[attr.tabindex]": "-1",
|
|
575
|
+
"[class]": "baseClass()"
|
|
576
|
+
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n role=\"combobox\"\n [class]=\"inputClass()\"\n [disabled]=\"disabled()\"\n [id]=\"id\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [ngModel]=\"autoCompleteValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"effectiveAriaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n (ngModelChange)=\"autoCompleteValue$.next($event)\"\n (blur)=\"onInputBlur()\" />\n\n@if (showClearButton() && autoCompleteValue() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n label=\"Clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n@if (suffixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"suffixTemplate()\"></ng-container>\n </span>\n}\n\n<span monaDropdownLiveRegion></span>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n" }]
|
|
577
|
+
}], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{
|
|
578
|
+
read: TemplateRef
|
|
579
|
+
}, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], suffixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownSuffixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], itemDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemDisabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], highlightFirst: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightFirst", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
580
|
+
|
|
581
|
+
/*
|
|
582
|
+
* Public API Surface of @nanahoshi/mona-ui/auto-complete
|
|
583
|
+
*/
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Generated bundle index. Do not edit.
|
|
587
|
+
*/
|
|
588
|
+
|
|
589
|
+
export { AutoCompleteComponent };
|
|
590
|
+
//# sourceMappingURL=nanahoshi-mona-ui-auto-complete.mjs.map
|