@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
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, DestroyRef, ElementRef, linkedSignal, signal, computed, contentChild, TemplateRef, viewChild, input, output, model, effect, untracked, afterNextRender, 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 { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
8
|
+
import { createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
9
|
+
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
10
|
+
import { DropdownListService, DropdownService, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, dropdownPopupThemeVariants, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownLiveRegionDirective, DropdownDataInputToken, DropdownPopupInputToken, DropdownDataHandlerDirective, DropdownListPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
11
|
+
import { FilterChangeEvent } from '@nanahoshi/mona-ui/common';
|
|
12
|
+
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
13
|
+
import { ListService, ListComponent, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective, ListItemTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
14
|
+
import { TextBoxDirective } from '@nanahoshi/mona-ui/text-box';
|
|
15
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
16
|
+
import { Subject, fromEvent, filter, debounceTime, take, tap } from 'rxjs';
|
|
17
|
+
import { twMerge } from 'tailwind-merge';
|
|
18
|
+
import { cva } from 'class-variance-authority';
|
|
19
|
+
|
|
20
|
+
const comboBoxBaseVariants = cva(`
|
|
21
|
+
flex items-center
|
|
22
|
+
border border-input-border outline-none
|
|
23
|
+
bg-background shadow-xs
|
|
24
|
+
cursor-pointer
|
|
25
|
+
focus-within:ring-1 focus-within:ring-primary/40
|
|
26
|
+
transition-[color,box-shadow,border] ease-in-out duration-300
|
|
27
|
+
`, {
|
|
28
|
+
variants: {
|
|
29
|
+
disabled: {
|
|
30
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed"
|
|
31
|
+
},
|
|
32
|
+
focused: {
|
|
33
|
+
true: "ring-1 ring-primary/40"
|
|
34
|
+
},
|
|
35
|
+
invalid: {
|
|
36
|
+
true: "border-error ring-1 ring-error/40",
|
|
37
|
+
false: ""
|
|
38
|
+
},
|
|
39
|
+
rounded: {
|
|
40
|
+
none: "rounded-none",
|
|
41
|
+
small: "rounded-sm",
|
|
42
|
+
medium: "rounded-md",
|
|
43
|
+
large: "rounded-lg",
|
|
44
|
+
full: "rounded-full"
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
small: "h-8 text-xs",
|
|
48
|
+
medium: "h-9 text-sm",
|
|
49
|
+
large: "h-10 text-md"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
disabled: false,
|
|
54
|
+
focused: false,
|
|
55
|
+
invalid: false,
|
|
56
|
+
rounded: "medium",
|
|
57
|
+
size: "medium"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const comboBoxTextInputVariants = cva(`
|
|
61
|
+
border-none outline-none
|
|
62
|
+
bg-transparent shadow-none
|
|
63
|
+
px-2 h-full w-full text-ellipsis
|
|
64
|
+
focus-within:ring-0 focus-within:shadow-none
|
|
65
|
+
focus-visible:ring-0 focus-visible:shadow-none
|
|
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 comboBoxAffixContainerVariants = cva(`h-full flex flex-none items-center justify-center`);
|
|
78
|
+
|
|
79
|
+
const comboBoxBaseThemeVariants = (theme) => {
|
|
80
|
+
switch (theme) {
|
|
81
|
+
case "mona":
|
|
82
|
+
return comboBoxBaseVariants;
|
|
83
|
+
default:
|
|
84
|
+
return comboBoxBaseVariants;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const comboBoxTextInputThemeVariants = (theme) => {
|
|
88
|
+
switch (theme) {
|
|
89
|
+
case "mona":
|
|
90
|
+
return comboBoxTextInputVariants;
|
|
91
|
+
default:
|
|
92
|
+
return comboBoxTextInputVariants;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const comboBoxAffixContainerThemeVariants = (theme) => {
|
|
96
|
+
switch (theme) {
|
|
97
|
+
case "mona":
|
|
98
|
+
return comboBoxAffixContainerVariants;
|
|
99
|
+
default:
|
|
100
|
+
return comboBoxAffixContainerVariants;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
class ComboBoxComponent {
|
|
105
|
+
#destroyRef;
|
|
106
|
+
#dropdownListService;
|
|
107
|
+
#dropdownService;
|
|
108
|
+
#hostElementRef;
|
|
109
|
+
#listService;
|
|
110
|
+
#navigatedValue;
|
|
111
|
+
#popupRef;
|
|
112
|
+
#themeService;
|
|
113
|
+
#userNavigatedViaArrows;
|
|
114
|
+
constructor() {
|
|
115
|
+
this.#destroyRef = inject(DestroyRef);
|
|
116
|
+
this.#dropdownListService = inject(DropdownListService);
|
|
117
|
+
this.#dropdownService = inject(DropdownService);
|
|
118
|
+
this.#hostElementRef = inject(ElementRef);
|
|
119
|
+
this.#listService = inject(ListService);
|
|
120
|
+
this.#navigatedValue = linkedSignal(() => this.value(), /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "#navigatedValue" }] : /* istanbul ignore next */ []));
|
|
122
|
+
this.#popupRef = this.#dropdownService.popupRef;
|
|
123
|
+
this.#themeService = inject(ThemeService);
|
|
124
|
+
this.#userNavigatedViaArrows = signal(false, /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []));
|
|
126
|
+
this.activeDescendant = computed(() => {
|
|
127
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
128
|
+
return highlightedItem ? highlightedItem.uid : null;
|
|
129
|
+
}, /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
131
|
+
this.affixClass = computed(() => {
|
|
132
|
+
const theme = this.#themeService.theme();
|
|
133
|
+
return comboBoxAffixContainerThemeVariants(theme)();
|
|
134
|
+
}, /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []));
|
|
136
|
+
this.baseClass = computed(() => {
|
|
137
|
+
const theme = this.#themeService.theme();
|
|
138
|
+
const disabled = this.disabled();
|
|
139
|
+
const focused = this.#popupRef() != null;
|
|
140
|
+
const invalid = this.invalidState();
|
|
141
|
+
const rounded = this.rounded();
|
|
142
|
+
const size = this.size();
|
|
143
|
+
const variantClass = comboBoxBaseThemeVariants(theme)({ disabled, focused, invalid, rounded, size });
|
|
144
|
+
const userClass = this.userClass();
|
|
145
|
+
return twMerge(variantClass, userClass);
|
|
146
|
+
}, /* @ts-ignore */
|
|
147
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
148
|
+
this.comboBoxValue$ = new Subject();
|
|
149
|
+
this.comboBoxValue = signal("", /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "comboBoxValue" }] : /* 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 comboBoxTextInputThemeVariants(theme)({ rounded });
|
|
163
|
+
}, /* @ts-ignore */
|
|
164
|
+
...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
|
|
165
|
+
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && this.value() == null), /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
167
|
+
this.itemTemplate = contentChild(DropdownItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
168
|
+
this.listId = createElementControlId();
|
|
169
|
+
this.listPopupClass = computed(() => {
|
|
170
|
+
const theme = this.#themeService.theme();
|
|
171
|
+
const rounded = this.rounded();
|
|
172
|
+
const size = this.size();
|
|
173
|
+
const userClass = this.popupClass();
|
|
174
|
+
const variantClass = dropdownPopupThemeVariants(theme)({ rounded, size });
|
|
175
|
+
return twMerge(variantClass, userClass);
|
|
176
|
+
}, /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
|
|
178
|
+
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
179
|
+
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
180
|
+
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
181
|
+
this.prefixTemplate = contentChild(DropdownPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
182
|
+
this.selectableOptions = {
|
|
183
|
+
enabled: true,
|
|
184
|
+
mode: "single",
|
|
185
|
+
toggleable: false
|
|
186
|
+
};
|
|
187
|
+
this.selectedListItem = computed(() => {
|
|
188
|
+
return this.#listService.selectedListItems().firstOrDefault();
|
|
189
|
+
}, /* @ts-ignore */
|
|
190
|
+
...(ngDevMode ? [{ debugName: "selectedListItem" }] : /* istanbul ignore next */ []));
|
|
191
|
+
this.valueText = computed(() => {
|
|
192
|
+
const listItem = this.selectedListItem();
|
|
193
|
+
if (!listItem) {
|
|
194
|
+
return "";
|
|
195
|
+
}
|
|
196
|
+
return this.#listService.getItemText(listItem);
|
|
197
|
+
}, /* @ts-ignore */
|
|
198
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
199
|
+
/**
|
|
200
|
+
* @description Allows a custom value to be committed when it doesn't match any item in {@link data}.
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
this.allowCustomValue = input(false, /* @ts-ignore */
|
|
204
|
+
...(ngDevMode ? [{ debugName: "allowCustomValue" }] : /* istanbul ignore next */ []));
|
|
205
|
+
/**
|
|
206
|
+
* @description ID of an element that provides an extended description for the input.
|
|
207
|
+
* @default ""
|
|
208
|
+
*/
|
|
209
|
+
this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
|
|
210
|
+
/**
|
|
211
|
+
* @description Accessible name for the input. Describe what the combo box represents.
|
|
212
|
+
* Falls back to {@link placeholder} when neither this nor {@link ariaLabelledBy} is set.
|
|
213
|
+
* @default ""
|
|
214
|
+
*/
|
|
215
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
216
|
+
/**
|
|
217
|
+
* @description ID of an external element that provides the accessible name for the input.
|
|
218
|
+
* @default ""
|
|
219
|
+
*/
|
|
220
|
+
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
221
|
+
/**
|
|
222
|
+
* @description Emitted when the popup is about to close. This event is preventable.
|
|
223
|
+
*/
|
|
224
|
+
this.close = output();
|
|
225
|
+
/**
|
|
226
|
+
* @description Emitted after the popup is closed.
|
|
227
|
+
*/
|
|
228
|
+
this.closed = output();
|
|
229
|
+
/**
|
|
230
|
+
* @description Collection of items to render.
|
|
231
|
+
* @default []
|
|
232
|
+
*/
|
|
233
|
+
this.data = input([], /* @ts-ignore */
|
|
234
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
235
|
+
/**
|
|
236
|
+
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
237
|
+
* @default false
|
|
238
|
+
*/
|
|
239
|
+
this.disabled = model(false, /* @ts-ignore */
|
|
240
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
241
|
+
/**
|
|
242
|
+
* @description A predicate function or the name of the field that determines whether an item is disabled.
|
|
243
|
+
* @default undefined
|
|
244
|
+
*/
|
|
245
|
+
this.itemDisabled = input(/* @ts-ignore */
|
|
246
|
+
...(ngDevMode ? [undefined, { debugName: "itemDisabled" }] : /* istanbul ignore next */ []));
|
|
247
|
+
/**
|
|
248
|
+
* @description Marks the combo box as invalid. When bound to a signal form field via `[formField]`,
|
|
249
|
+
* this is written by the `FormField` directive.
|
|
250
|
+
* @default false
|
|
251
|
+
*/
|
|
252
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
254
|
+
/**
|
|
255
|
+
* @description Displays a loading indicator and prevents interaction while an operation is in progress.
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
this.loading = input(false, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
260
|
+
/**
|
|
261
|
+
* @description Emitted when the popup is about to open. This event is preventable.
|
|
262
|
+
*/
|
|
263
|
+
this.open = output();
|
|
264
|
+
/**
|
|
265
|
+
* @description Emitted after the popup is opened.
|
|
266
|
+
*/
|
|
267
|
+
this.opened = output();
|
|
268
|
+
/**
|
|
269
|
+
* @description Placeholder text shown when no value is selected or entered.
|
|
270
|
+
* @default ""
|
|
271
|
+
*/
|
|
272
|
+
this.placeholder = input("", /* @ts-ignore */
|
|
273
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
274
|
+
/**
|
|
275
|
+
* @description Sets the class of the popup element.
|
|
276
|
+
* @default ""
|
|
277
|
+
*/
|
|
278
|
+
this.popupClass = input("", /* @ts-ignore */
|
|
279
|
+
...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
|
|
280
|
+
/**
|
|
281
|
+
* @description Sets the height of the popup element.
|
|
282
|
+
* @default null
|
|
283
|
+
*/
|
|
284
|
+
this.popupHeight = input(null, /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
|
|
286
|
+
/**
|
|
287
|
+
* @description Sets the width of the popup element.
|
|
288
|
+
* @default null
|
|
289
|
+
*/
|
|
290
|
+
this.popupWidth = input(null, /* @ts-ignore */
|
|
291
|
+
...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
|
|
292
|
+
/**
|
|
293
|
+
* @description Prevents value changes while preserving the component's visual state.
|
|
294
|
+
* @default false
|
|
295
|
+
*/
|
|
296
|
+
this.readonly = input(false, /* @ts-ignore */
|
|
297
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
298
|
+
/**
|
|
299
|
+
* @description Sets the required state of the combo box component.
|
|
300
|
+
* @default false
|
|
301
|
+
*/
|
|
302
|
+
this.required = input(false, /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
304
|
+
/**
|
|
305
|
+
* @description Border-radius preset applied to the component.
|
|
306
|
+
* @default "medium"
|
|
307
|
+
*/
|
|
308
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
310
|
+
/**
|
|
311
|
+
* @description Displays a button that resets the value to empty when an item is selected.
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
this.showClearButton = input(false, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
316
|
+
/**
|
|
317
|
+
* @description Size preset controlling the component's dimensions.
|
|
318
|
+
* @default "medium"
|
|
319
|
+
*/
|
|
320
|
+
this.size = input("medium", /* @ts-ignore */
|
|
321
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
322
|
+
/**
|
|
323
|
+
* @description Property name or accessor used to derive the display text from a data item.
|
|
324
|
+
* If not set, the item itself is used as the text representation.
|
|
325
|
+
* @default undefined
|
|
326
|
+
*/
|
|
327
|
+
this.textField = input(/* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [undefined, { debugName: "textField" }] : /* istanbul ignore next */ []));
|
|
329
|
+
/**
|
|
330
|
+
* @description Emitted when the combo box is interacted with on blur, selection, clear, or committed input.
|
|
331
|
+
* The `FormField` directive listens to this to mark the field as touched.
|
|
332
|
+
*/
|
|
333
|
+
this.touch = output();
|
|
334
|
+
/**
|
|
335
|
+
* @description Sets the touched state of the combo box. When bound to a signal form field via `[formField]`,
|
|
336
|
+
* this is written by the `FormField` directive.
|
|
337
|
+
* @default false
|
|
338
|
+
*/
|
|
339
|
+
this.touched = input(false, /* @ts-ignore */
|
|
340
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
341
|
+
/**
|
|
342
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
343
|
+
* @default ""
|
|
344
|
+
*/
|
|
345
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
346
|
+
/**
|
|
347
|
+
* @description Emitted with the entered text when the user presses Enter on unmatched input.
|
|
348
|
+
* Only emitted when {@link allowCustomValue} is true.
|
|
349
|
+
*/
|
|
350
|
+
this.valueAdd = output();
|
|
351
|
+
/**
|
|
352
|
+
* @description Property name or accessor used to derive the value from a data item.
|
|
353
|
+
* If not set, the item itself is used as the value representation.
|
|
354
|
+
* @default undefined
|
|
355
|
+
*/
|
|
356
|
+
this.valueField = input(/* @ts-ignore */
|
|
357
|
+
...(ngDevMode ? [undefined, { debugName: "valueField" }] : /* istanbul ignore next */ []));
|
|
358
|
+
/**
|
|
359
|
+
* @description Two-way bindable current selected value. Implements `FormValueControl<TData | null>`,
|
|
360
|
+
* enabling signal forms `[formField]` binding. When `valueField` is set, primitive field values can be
|
|
361
|
+
* written into this model to restore a matching selected item.
|
|
362
|
+
* @default null
|
|
363
|
+
*/
|
|
364
|
+
this.value = model(null, /* @ts-ignore */
|
|
365
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
366
|
+
effect(() => {
|
|
367
|
+
const popupTemplate = this.popupTemplate();
|
|
368
|
+
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
369
|
+
});
|
|
370
|
+
effect(() => {
|
|
371
|
+
const value = this.value();
|
|
372
|
+
const valueField = this.valueField();
|
|
373
|
+
untracked(() => {
|
|
374
|
+
this.#listService.setValueField(valueField ?? "");
|
|
375
|
+
if (value != null) {
|
|
376
|
+
this.#listService.setSelectedDataItems([value]);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.#listService.clearSelections();
|
|
380
|
+
}
|
|
381
|
+
this.comboBoxValue.set(this.valueText());
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
afterNextRender({
|
|
385
|
+
read: () => {
|
|
386
|
+
this.initialize();
|
|
387
|
+
this.setSubscriptions();
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
fromEvent(this.#hostElementRef.nativeElement, "focusin")
|
|
391
|
+
.pipe(takeUntilDestroyed(), filter(() => !this.readonly()))
|
|
392
|
+
.subscribe(() => this.focus());
|
|
393
|
+
}
|
|
394
|
+
onInputBlur() {
|
|
395
|
+
this.touch.emit();
|
|
396
|
+
}
|
|
397
|
+
onItemSelect(event) {
|
|
398
|
+
if (this.#listService.filterableOptions().enabled &&
|
|
399
|
+
event.source.via === "keyboard" &&
|
|
400
|
+
event.source.key !== "Enter") {
|
|
401
|
+
this.#navigatedValue.set(event.item.data);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.updateValue(event.item.data, true);
|
|
405
|
+
this.closePopup();
|
|
406
|
+
}
|
|
407
|
+
onValueClear(event) {
|
|
408
|
+
if (this.readonly() || (event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ")) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
event.preventDefault();
|
|
412
|
+
event.stopImmediatePropagation();
|
|
413
|
+
this.updateValue(null);
|
|
414
|
+
this.#listService.clearSelections();
|
|
415
|
+
this.comboBoxValue.set("");
|
|
416
|
+
this.focus();
|
|
417
|
+
}
|
|
418
|
+
clear() {
|
|
419
|
+
this.#navigatedValue.set(null);
|
|
420
|
+
this.updateValue(null);
|
|
421
|
+
this.comboBoxValue.set("");
|
|
422
|
+
this.#listService.clearSelections();
|
|
423
|
+
this.#listService.clearFilter();
|
|
424
|
+
}
|
|
425
|
+
closePopup() {
|
|
426
|
+
this.#popupRef()?.close();
|
|
427
|
+
}
|
|
428
|
+
focus() {
|
|
429
|
+
rxTimeout(this.#destroyRef, () => {
|
|
430
|
+
const input = this.#hostElementRef.nativeElement.querySelector("input");
|
|
431
|
+
if (input && !this.readonly()) {
|
|
432
|
+
input.focus();
|
|
433
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
initialize() {
|
|
438
|
+
this.#listService.setNavigableOptions({ enabled: true, mode: "highlight" });
|
|
439
|
+
this.#listService.setSelectableOptions(this.selectableOptions);
|
|
440
|
+
this.#listService.filterInputVisible.set(false);
|
|
441
|
+
this.comboBoxValue.set(this.valueText());
|
|
442
|
+
}
|
|
443
|
+
notifyFilterChange(filter) {
|
|
444
|
+
const event = new FilterChangeEvent(filter);
|
|
445
|
+
this.#listService.filterChange$.next(event);
|
|
446
|
+
return event;
|
|
447
|
+
}
|
|
448
|
+
setArrowNavigationSubscription() {
|
|
449
|
+
this.#dropdownListService.navigate$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(({ item }) => {
|
|
450
|
+
if (!this.expanded()) {
|
|
451
|
+
this.#listService.selectItem(item);
|
|
452
|
+
this.updateValue(item.data, true);
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
this.#navigatedValue.set(item.data);
|
|
456
|
+
this.#userNavigatedViaArrows.set(true);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
setComboboxValueSubscription() {
|
|
461
|
+
this.comboBoxValue$
|
|
462
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), debounceTime(this.#listService.getFilterDebounceDuration()), filter(value => value !== null))
|
|
463
|
+
.subscribe(value => {
|
|
464
|
+
this.#userNavigatedViaArrows.set(false);
|
|
465
|
+
if (this.#listService.isFilteringEnabled()) {
|
|
466
|
+
const event = this.notifyFilterChange(value);
|
|
467
|
+
if (event.isDefaultPrevented()) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (value) {
|
|
471
|
+
this.#listService.setFilter(value);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
this.#listService.clearFilter();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (!this.#popupRef()) {
|
|
478
|
+
this.#dropdownService.triggerPopupOpen$.next({});
|
|
479
|
+
}
|
|
480
|
+
this.comboBoxValue.set(value ?? "");
|
|
481
|
+
const item = this.#listService.getMatchingFilteredItem(value);
|
|
482
|
+
if (item) {
|
|
483
|
+
this.#navigatedValue.set(item.data);
|
|
484
|
+
this.#listService.highlightedItem.set(item);
|
|
485
|
+
if (this.#popupRef()) {
|
|
486
|
+
this.#listService.scrollToItem$.next({ item, focus: false });
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
this.#dropdownService.popupOpenComplete$.pipe(take(1)).subscribe(() => {
|
|
490
|
+
this.#listService.scrollToItem$.next({ item, focus: false });
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
handleEnterKey() {
|
|
497
|
+
const comboBoxText = this.comboBoxValue();
|
|
498
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
499
|
+
if (this.#userNavigatedViaArrows() && highlightedItem) {
|
|
500
|
+
this.selectItem(highlightedItem);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (!this.allowCustomValue()) {
|
|
504
|
+
if (highlightedItem) {
|
|
505
|
+
const highlightedText = this.#listService.getItemText(highlightedItem);
|
|
506
|
+
if (highlightedText.toLowerCase() === comboBoxText.toLowerCase()) {
|
|
507
|
+
this.selectItem(highlightedItem);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
|
|
511
|
+
if (matchingItem) {
|
|
512
|
+
this.selectItem(matchingItem);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
this.clear();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
|
|
521
|
+
if (matchingItem) {
|
|
522
|
+
this.selectItem(matchingItem);
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
this.clear();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
if (highlightedItem) {
|
|
531
|
+
const highlightedText = this.#listService.getItemText(highlightedItem);
|
|
532
|
+
if (highlightedText.toLowerCase() === comboBoxText.toLowerCase()) {
|
|
533
|
+
this.selectItem(highlightedItem);
|
|
534
|
+
}
|
|
535
|
+
else if (comboBoxText) {
|
|
536
|
+
this.valueAdd.emit(comboBoxText);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else if (comboBoxText) {
|
|
540
|
+
this.valueAdd.emit(comboBoxText);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
selectItem(item) {
|
|
545
|
+
this.#listService.selectItem(item);
|
|
546
|
+
this.updateValue(item.data);
|
|
547
|
+
}
|
|
548
|
+
setEscapeKeySubscription() {
|
|
549
|
+
this.#dropdownService.beforeKeydown$
|
|
550
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.originalEvent?.key === "Escape"), tap(e => e.preventDefault()))
|
|
551
|
+
.subscribe(() => {
|
|
552
|
+
if (this.#popupRef()) {
|
|
553
|
+
const selectedItem = this.selectedListItem();
|
|
554
|
+
if (selectedItem) {
|
|
555
|
+
this.comboBoxValue.set(this.#listService.getItemText(selectedItem));
|
|
556
|
+
this.#navigatedValue.set(selectedItem.data);
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
this.clear();
|
|
560
|
+
}
|
|
561
|
+
this.closePopup();
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
this.clear();
|
|
565
|
+
this.focus();
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
setKeydownSubscription() {
|
|
570
|
+
this.#dropdownService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
571
|
+
if (event.key === "Enter") {
|
|
572
|
+
event.preventDefault();
|
|
573
|
+
this.handleEnterKey();
|
|
574
|
+
this.closePopup();
|
|
575
|
+
}
|
|
576
|
+
else if (event.key === "Tab") {
|
|
577
|
+
this.closePopup();
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
setNavigatedItemSubscription() {
|
|
582
|
+
this.#listService.navigatedItem$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(e => {
|
|
583
|
+
this.#navigatedValue.set(e?.data ?? null);
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
setPopupCloseSubscriptions() {
|
|
587
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
588
|
+
this.#userNavigatedViaArrows.set(false);
|
|
589
|
+
this.focus();
|
|
590
|
+
window.setTimeout(() => {
|
|
591
|
+
this.comboBoxValue$.next(null);
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
setSpaceKeySubscription() {
|
|
596
|
+
this.#dropdownService.beforeKeydown$
|
|
597
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.originalEvent?.key === " "), tap(e => e.preventDefault()))
|
|
598
|
+
.subscribe();
|
|
599
|
+
}
|
|
600
|
+
setSubscriptions() {
|
|
601
|
+
this.setArrowNavigationSubscription();
|
|
602
|
+
this.setComboboxValueSubscription();
|
|
603
|
+
this.setEscapeKeySubscription();
|
|
604
|
+
this.setKeydownSubscription();
|
|
605
|
+
this.setNavigatedItemSubscription();
|
|
606
|
+
this.setPopupCloseSubscriptions();
|
|
607
|
+
this.setSpaceKeySubscription();
|
|
608
|
+
}
|
|
609
|
+
updateValue(value, notify = true) {
|
|
610
|
+
const oldValue = this.value();
|
|
611
|
+
if (oldValue !== value) {
|
|
612
|
+
this.value.set(value);
|
|
613
|
+
}
|
|
614
|
+
this.comboBoxValue.set(this.valueText());
|
|
615
|
+
if (notify && oldValue !== value) {
|
|
616
|
+
this.touch.emit();
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ComboBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
620
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ComboBoxComponent, isStandalone: true, selector: "mona-combo-box", inputs: { allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, 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 }, 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", valueAdd: "valueAdd", value: "valueChange" }, host: { properties: { "attr.aria-disabled": "disabled() ? true : undefined", "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: [
|
|
621
|
+
ListService,
|
|
622
|
+
DropdownService,
|
|
623
|
+
DropdownListService,
|
|
624
|
+
{
|
|
625
|
+
provide: DropdownDataInputToken,
|
|
626
|
+
useExisting: forwardRef(() => ComboBoxComponent),
|
|
627
|
+
multi: false
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
provide: DropdownPopupInputToken,
|
|
631
|
+
useExisting: forwardRef(() => ComboBoxComponent),
|
|
632
|
+
multi: false
|
|
633
|
+
}
|
|
634
|
+
], 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 }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\r\n <span [class]=\"affixClass()\">\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </span>\r\n}\r\n\r\n<input\r\n monaTextBox\r\n [class]=\"inputClass()\"\r\n [disabled]=\"disabled()\"\r\n [id]=\"id\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly()\"\r\n [required]=\"required()\"\r\n [ngModel]=\"comboBoxValue()\"\r\n [attr.aria-activedescendant]=\"activeDescendant()\"\r\n [attr.aria-autocomplete]=\"'list'\"\r\n [attr.aria-busy]=\"loading()\"\r\n [attr.aria-controls]=\"listId\"\r\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-invalid]=\"invalidState() || undefined\"\r\n [attr.aria-label]=\"effectiveAriaLabel() || undefined\"\r\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\r\n role=\"combobox\"\r\n (ngModelChange)=\"comboBoxValue$.next($event)\"\r\n (blur)=\"onInputBlur()\" />\r\n\r\n@if (showClearButton() && selectedListItem() && !loading()) {\r\n <mona-indicator-icon\r\n preset=\"clear\"\r\n [interactive]=\"true\"\r\n label=\"Clear\"\r\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\r\n}\r\n\r\n@if (loading()) {\r\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\r\n}\r\n\r\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\r\n\r\n<span monaDropdownLiveRegion></span>\r\n\r\n<ng-template #popupTemplate>\r\n <div [class]=\"listPopupClass()\">\r\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\r\n @if (footerTemplate()) {\r\n <ng-template monaListFooterTemplate>\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (groupHeaderTemplate()) {\r\n <ng-template monaListGroupHeaderTemplate let-group>\r\n <ng-container\r\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (headerTemplate()) {\r\n <ng-template monaListHeaderTemplate>\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (itemTemplate()) {\r\n <ng-template monaListItemTemplate let-dataItem>\r\n <ng-container\r\n [ngTemplateOutlet]=\"itemTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (noDataTemplate()) {\r\n <ng-template monaListNoDataTemplate>\r\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-list>\r\n </div>\r\n</ng-template>\r\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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: FontAwesomeModule }, { 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"] }] }); }
|
|
635
|
+
}
|
|
636
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ComboBoxComponent, decorators: [{
|
|
637
|
+
type: Component,
|
|
638
|
+
args: [{ selector: "mona-combo-box", providers: [
|
|
639
|
+
ListService,
|
|
640
|
+
DropdownService,
|
|
641
|
+
DropdownListService,
|
|
642
|
+
{
|
|
643
|
+
provide: DropdownDataInputToken,
|
|
644
|
+
useExisting: forwardRef(() => ComboBoxComponent),
|
|
645
|
+
multi: false
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
provide: DropdownPopupInputToken,
|
|
649
|
+
useExisting: forwardRef(() => ComboBoxComponent),
|
|
650
|
+
multi: false
|
|
651
|
+
}
|
|
652
|
+
], imports: [
|
|
653
|
+
TextBoxDirective,
|
|
654
|
+
FormsModule,
|
|
655
|
+
FontAwesomeModule,
|
|
656
|
+
NgTemplateOutlet,
|
|
657
|
+
ListComponent,
|
|
658
|
+
ListGroupHeaderTemplateDirective,
|
|
659
|
+
ListFooterTemplateDirective,
|
|
660
|
+
ListHeaderTemplateDirective,
|
|
661
|
+
ListNoDataTemplateDirective,
|
|
662
|
+
ListItemTemplateDirective,
|
|
663
|
+
DropdownLiveRegionDirective,
|
|
664
|
+
IndicatorIconComponent
|
|
665
|
+
], hostDirectives: [DropdownDataHandlerDirective, DropdownListPopupHandlerDirective], host: {
|
|
666
|
+
"[attr.aria-disabled]": "disabled() ? true : undefined",
|
|
667
|
+
"[attr.aria-invalid]": "invalidState() ? true : undefined",
|
|
668
|
+
"[attr.aria-readonly]": "readonly() ? true : undefined",
|
|
669
|
+
"[attr.aria-required]": "required() ? true : undefined",
|
|
670
|
+
"[attr.data-disabled]": "disabled()",
|
|
671
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
672
|
+
"[attr.tabindex]": "-1",
|
|
673
|
+
"[class]": "baseClass()"
|
|
674
|
+
}, template: "@if (prefixTemplate()) {\r\n <span [class]=\"affixClass()\">\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </span>\r\n}\r\n\r\n<input\r\n monaTextBox\r\n [class]=\"inputClass()\"\r\n [disabled]=\"disabled()\"\r\n [id]=\"id\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly()\"\r\n [required]=\"required()\"\r\n [ngModel]=\"comboBoxValue()\"\r\n [attr.aria-activedescendant]=\"activeDescendant()\"\r\n [attr.aria-autocomplete]=\"'list'\"\r\n [attr.aria-busy]=\"loading()\"\r\n [attr.aria-controls]=\"listId\"\r\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-invalid]=\"invalidState() || undefined\"\r\n [attr.aria-label]=\"effectiveAriaLabel() || undefined\"\r\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\r\n role=\"combobox\"\r\n (ngModelChange)=\"comboBoxValue$.next($event)\"\r\n (blur)=\"onInputBlur()\" />\r\n\r\n@if (showClearButton() && selectedListItem() && !loading()) {\r\n <mona-indicator-icon\r\n preset=\"clear\"\r\n [interactive]=\"true\"\r\n label=\"Clear\"\r\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\r\n}\r\n\r\n@if (loading()) {\r\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\r\n}\r\n\r\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\r\n\r\n<span monaDropdownLiveRegion></span>\r\n\r\n<ng-template #popupTemplate>\r\n <div [class]=\"listPopupClass()\">\r\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\r\n @if (footerTemplate()) {\r\n <ng-template monaListFooterTemplate>\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (groupHeaderTemplate()) {\r\n <ng-template monaListGroupHeaderTemplate let-group>\r\n <ng-container\r\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (headerTemplate()) {\r\n <ng-template monaListHeaderTemplate>\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (itemTemplate()) {\r\n <ng-template monaListItemTemplate let-dataItem>\r\n <ng-container\r\n [ngTemplateOutlet]=\"itemTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (noDataTemplate()) {\r\n <ng-template monaListNoDataTemplate>\r\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-list>\r\n </div>\r\n</ng-template>\r\n" }]
|
|
675
|
+
}], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, 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 }] }], allowCustomValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustomValue", required: false }] }], 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 }] }], 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 }] }], valueAdd: [{ type: i0.Output, args: ["valueAdd"] }], 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"] }] } });
|
|
676
|
+
|
|
677
|
+
/*
|
|
678
|
+
* Public API Surface of @nanahoshi/mona-ui/combo-box
|
|
679
|
+
*/
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Generated bundle index. Do not edit.
|
|
683
|
+
*/
|
|
684
|
+
|
|
685
|
+
export { ComboBoxComponent };
|
|
686
|
+
//# sourceMappingURL=nanahoshi-mona-ui-combo-box.mjs.map
|