@nanahoshi/mona-ui 0.41.0 → 0.43.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 +2 -0
- package/docs/api/alert.json +1 -0
- package/docs/api/auto-complete.json +1 -0
- package/docs/api/auto-complete.md +2 -0
- package/docs/api/avatar.json +1 -0
- package/docs/api/badge.json +1 -0
- package/docs/api/breadcrumb.json +1 -0
- package/docs/api/button-group.json +1 -0
- package/docs/api/button.json +1 -0
- package/docs/api/calendar.json +1 -0
- package/docs/api/card.json +1 -0
- package/docs/api/chart.json +1 -0
- package/docs/api/check-box.json +1 -0
- package/docs/api/chip.json +1 -0
- package/docs/api/circular-progress-bar.json +1 -0
- package/docs/api/collapsible.json +1 -0
- package/docs/api/color-gradient.json +1 -0
- package/docs/api/color-palette.json +1 -0
- package/docs/api/color-picker.json +1 -0
- package/docs/api/combo-box.json +1 -0
- package/docs/api/combo-box.md +2 -0
- package/docs/api/command.json +1 -0
- package/docs/api/common.json +1 -0
- package/docs/api/contextmenu.json +1 -0
- package/docs/api/date-input.json +1 -0
- package/docs/api/date-picker.json +1 -0
- package/docs/api/date-range-picker.json +1 -0
- package/docs/api/datetime-picker.json +1 -0
- package/docs/api/dialog.json +1 -0
- package/docs/api/dropdown-button.json +1 -0
- package/docs/api/dropdown-list.json +1 -0
- package/docs/api/dropdown-tree.json +1 -0
- package/docs/api/dropdowns.json +1 -0
- package/docs/api/dropdowns.md +3 -1
- package/docs/api/editor.json +1 -0
- package/docs/api/expansion-panel.json +1 -0
- package/docs/api/fieldset.json +1 -0
- package/docs/api/file-upload.json +1 -0
- package/docs/api/filter.json +1 -0
- package/docs/api/form-field.json +1 -0
- package/docs/api/grid.json +1 -0
- package/docs/api/i18n.json +1 -0
- package/docs/api/i18n.md +20 -0
- package/docs/api/index.json +1 -0
- package/docs/api/kanban.json +1 -0
- package/docs/api/label.json +1 -0
- package/docs/api/list-box.json +1 -0
- package/docs/api/list-view.json +1 -0
- package/docs/api/list.json +1 -0
- package/docs/api/locales.json +1 -0
- package/docs/api/locales.md +14 -14
- package/docs/api/masked-text-box.json +1 -0
- package/docs/api/menubar.json +1 -0
- package/docs/api/multi-select-tree.json +1 -0
- package/docs/api/multi-select.json +1 -0
- package/docs/api/notification.json +1 -0
- package/docs/api/numeric-text-box.json +1 -0
- package/docs/api/otp-input.json +1 -0
- package/docs/api/pager.json +1 -0
- package/docs/api/placeholder.json +1 -0
- package/docs/api/popover.json +1 -0
- package/docs/api/popup-menu.json +1 -0
- package/docs/api/popup.json +1 -0
- package/docs/api/progress-bar.json +1 -0
- package/docs/api/qr-code.json +1 -0
- package/docs/api/query.json +1 -0
- package/docs/api/radio-button.json +1 -0
- package/docs/api/rating.json +1 -0
- package/docs/api/scroll-view.json +1 -0
- package/docs/api/segmented.json +1 -0
- package/docs/api/separator.json +1 -0
- package/docs/api/sheet.json +1 -0
- package/docs/api/sidebar.json +1 -0
- package/docs/api/skeleton.json +1 -0
- package/docs/api/slider.json +1 -0
- package/docs/api/sortable.json +1 -0
- package/docs/api/sparkline.json +1 -0
- package/docs/api/sparkline.md +85 -0
- package/docs/api/spinner.json +1 -0
- package/docs/api/split-button.json +1 -0
- package/docs/api/splitter.json +1 -0
- package/docs/api/stepper.json +1 -0
- package/docs/api/switch.json +1 -0
- package/docs/api/tabs.json +1 -0
- package/docs/api/text-area.json +1 -0
- package/docs/api/text-box.json +1 -0
- package/docs/api/theme.json +1 -0
- package/docs/api/time-picker.json +1 -0
- package/docs/api/time-selector.json +1 -0
- package/docs/api/toolbar.json +1 -0
- package/docs/api/tooltip.json +1 -0
- package/docs/api/tree-view.json +1 -0
- package/docs/api/window.json +1 -0
- package/docs/auto-complete.md +64 -0
- package/docs/combo-box.md +65 -0
- package/docs/installation.md +8 -0
- package/docs/manifest.json +1 -0
- package/docs/sparkline.md +303 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +95 -30
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +58 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +64 -29
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +25 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +25 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-sparkline.mjs +573 -0
- package/i18n/catalogs/en-US.messages.json +5 -0
- package/llms.txt +3 -1
- package/locales/ar-sa/ar-sa.messages.json +5 -0
- package/locales/de-de/de-de.messages.json +5 -0
- package/locales/es-es/es-es.messages.json +5 -0
- package/locales/fr-fr/fr-fr.messages.json +5 -0
- package/locales/id-id/id-id.messages.json +5 -0
- package/locales/it-it/it-it.messages.json +5 -0
- package/locales/ja-jp/ja-jp.messages.json +5 -0
- package/locales/ko-kr/ko-kr.messages.json +5 -0
- package/locales/pl-pl/pl-pl.messages.json +5 -0
- package/locales/pt-br/pt-br.messages.json +5 -0
- package/locales/ru-ru/ru-ru.messages.json +5 -0
- package/locales/tr-tr/tr-tr.messages.json +5 -0
- package/locales/zh-cn/zh-cn.messages.json +5 -0
- package/locales/zh-tw/zh-tw.messages.json +5 -0
- package/package.json +5 -1
- package/sparkline/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +42 -1
- package/types/nanahoshi-mona-ui-combo-box.d.ts +37 -1
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +54 -4
- package/types/nanahoshi-mona-ui-i18n.d.ts +12 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +5 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +5 -0
- package/types/nanahoshi-mona-ui-sparkline.d.ts +228 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from "@angular/common";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, linkedSignal, model, output, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { Component, DOCUMENT, DestroyRef, ElementRef, Injector, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, linkedSignal, model, output, untracked, viewChild } from "@angular/core";
|
|
4
4
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
5
5
|
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, rxTimeout, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
6
6
|
import { FilterChangeEvent } from "@nanahoshi/mona-ui/common";
|
|
7
7
|
import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
|
|
8
8
|
import { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
9
9
|
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
10
|
-
import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, DropdownSuffixTemplateDirective, dropdownPopupThemeVariants } from "@nanahoshi/mona-ui/dropdowns";
|
|
10
|
+
import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, DropdownSuffixTemplateDirective, dropdownPopupThemeVariants, dropdownSheetInputClasses, dropdownSheetInputContainerClasses, dropdownSheetSurfaceClasses, injectSmallScreen, matchesSmallScreen } from "@nanahoshi/mona-ui/dropdowns";
|
|
11
11
|
import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
|
|
12
12
|
import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
|
|
13
13
|
import { Subject, debounceTime, filter, identity, take, tap } from "rxjs";
|
|
@@ -78,17 +78,23 @@ const autoCompleteTextInputThemeVariants = cva(`
|
|
|
78
78
|
const autoCompleteAffixContainerThemeVariants = cva(`flex h-full flex-none items-center justify-center`);
|
|
79
79
|
var AutoCompleteComponent = class AutoCompleteComponent {
|
|
80
80
|
#destroyRef;
|
|
81
|
+
#document;
|
|
81
82
|
#dropdownService;
|
|
82
83
|
#hostElementRef;
|
|
83
84
|
#i18n;
|
|
85
|
+
#injector;
|
|
84
86
|
#label;
|
|
85
87
|
#listService;
|
|
86
88
|
#popupRef;
|
|
89
|
+
#smallScreen;
|
|
90
|
+
#closingSheet;
|
|
87
91
|
constructor() {
|
|
88
92
|
this.#destroyRef = inject(DestroyRef);
|
|
93
|
+
this.#document = inject(DOCUMENT);
|
|
89
94
|
this.#dropdownService = inject(DropdownService);
|
|
90
95
|
this.#hostElementRef = inject(ElementRef);
|
|
91
96
|
this.#i18n = inject(MonaI18nService);
|
|
97
|
+
this.#injector = inject(Injector);
|
|
92
98
|
this.#label = injectLabelAssociation({
|
|
93
99
|
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
94
100
|
ariaLabel: () => this.ariaLabel(),
|
|
@@ -97,6 +103,8 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
97
103
|
});
|
|
98
104
|
this.#listService = inject(ListService);
|
|
99
105
|
this.#popupRef = this.#dropdownService.popupRef;
|
|
106
|
+
this.#smallScreen = injectSmallScreen();
|
|
107
|
+
this.#closingSheet = false;
|
|
100
108
|
this.activeDescendant = computed(() => {
|
|
101
109
|
const highlightedItem = this.#listService.highlightedItem();
|
|
102
110
|
return highlightedItem ? highlightedItem.uid : null;
|
|
@@ -144,6 +152,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
144
152
|
const rounded = this.rounded();
|
|
145
153
|
return autoCompleteTextInputThemeVariants({ rounded });
|
|
146
154
|
}, ...ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []);
|
|
155
|
+
this.inputMode = computed(() => this.adaptiveMode() === "auto" && this.#smallScreen() ? "none" : null, ...ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []);
|
|
147
156
|
this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
148
157
|
this.isEmpty = computed(() => !this.#listService.viewItems().any(), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
149
158
|
this.itemTemplate = contentChild(DropdownItemTemplateDirective, {
|
|
@@ -161,8 +170,10 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
161
170
|
size
|
|
162
171
|
});
|
|
163
172
|
const heightClass = this.popupHeight() ? "max-h-none" : "";
|
|
164
|
-
|
|
173
|
+
const sheetClass = this.sheet() ? dropdownSheetSurfaceClasses : "";
|
|
174
|
+
return twMerge(variantClass, heightClass, sheetClass, userClass);
|
|
165
175
|
}, ...ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []);
|
|
176
|
+
this.listSize = computed(() => this.sheet() ? "large" : this.size(), ...ngDevMode ? [{ debugName: "listSize" }] : /* istanbul ignore next */ []);
|
|
166
177
|
this.messages = this.#i18n.componentMessages("autoComplete", AUTO_COMPLETE_DEFAULT_MESSAGES);
|
|
167
178
|
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, {
|
|
168
179
|
...ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {},
|
|
@@ -178,10 +189,16 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
178
189
|
mode: "single",
|
|
179
190
|
toggleable: false
|
|
180
191
|
};
|
|
192
|
+
this.sheet = this.#dropdownService.sheet.asReadonly();
|
|
193
|
+
this.sheetInputClass = dropdownSheetInputClasses;
|
|
194
|
+
this.sheetInputContainerClass = dropdownSheetInputContainerClasses;
|
|
195
|
+
this.sheetTitleId = this.#dropdownService.sheetTitleId.asReadonly();
|
|
181
196
|
this.suffixTemplate = contentChild(DropdownSuffixTemplateDirective, {
|
|
182
197
|
...ngDevMode ? { debugName: "suffixTemplate" } : /* istanbul ignore next */ {},
|
|
183
198
|
read: TemplateRef
|
|
184
199
|
});
|
|
200
|
+
this.adaptiveMode = input("none", ...ngDevMode ? [{ debugName: "adaptiveMode" }] : /* istanbul ignore next */ []);
|
|
201
|
+
this.adaptiveTitle = input("", ...ngDevMode ? [{ debugName: "adaptiveTitle" }] : /* istanbul ignore next */ []);
|
|
185
202
|
this.ariaDescribedBy = input("", {
|
|
186
203
|
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
187
204
|
alias: "aria-describedby"
|
|
@@ -277,6 +294,12 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
277
294
|
this.autoCompleteValue.set(text);
|
|
278
295
|
this.autoCompleteValue$.next(text);
|
|
279
296
|
}
|
|
297
|
+
onInputClick() {
|
|
298
|
+
if (this.adaptiveMode() !== "auto" || this.#popupRef() || !matchesSmallScreen(this.#document)) return;
|
|
299
|
+
const text = this.autoCompleteValue();
|
|
300
|
+
if (text) this.applyText(text);
|
|
301
|
+
if (!this.#popupRef()) this.#dropdownService.triggerPopupOpen$.next({});
|
|
302
|
+
}
|
|
280
303
|
onItemSelect(event) {
|
|
281
304
|
const itemText = this.#listService.getItemText(event.item);
|
|
282
305
|
this.updateValue(itemText);
|
|
@@ -287,12 +310,41 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
287
310
|
onPopupPointerDown(event) {
|
|
288
311
|
if (event.target?.tagName !== "INPUT") event.preventDefault();
|
|
289
312
|
}
|
|
313
|
+
onSheetKeydown(event) {
|
|
314
|
+
this.#injector.get(DropdownListPopupHandlerDirective).handleKeyDown(event);
|
|
315
|
+
}
|
|
290
316
|
onValueClear(event) {
|
|
291
317
|
if (this.effectiveDisabled() || this.readonly() || event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ") return;
|
|
292
318
|
event.stopImmediatePropagation();
|
|
293
319
|
this.clear(true);
|
|
294
320
|
this.closePopup();
|
|
295
321
|
}
|
|
322
|
+
applyText(value) {
|
|
323
|
+
if (this.#listService.isFilteringEnabled()) {
|
|
324
|
+
if (this.notifyFilterChange(value).isDefaultPrevented()) return;
|
|
325
|
+
if (value) this.#listService.setFilter(value);
|
|
326
|
+
}
|
|
327
|
+
if (!value) {
|
|
328
|
+
const popupRef = this.#popupRef();
|
|
329
|
+
if (popupRef && this.#dropdownService.sheet()) this.clear(false);
|
|
330
|
+
else if (popupRef) {
|
|
331
|
+
popupRef.closed.pipe(take(1)).subscribe(() => this.clear(false));
|
|
332
|
+
this.closePopup();
|
|
333
|
+
} else this.clear(false);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (!this.#popupRef()) this.#dropdownService.triggerPopupOpen$.next({});
|
|
337
|
+
this.autoCompleteValue.set(value);
|
|
338
|
+
const item = this.#listService.getMatchingFilteredItem(value);
|
|
339
|
+
if (this.highlightFirst()) {
|
|
340
|
+
this.#listService.clearSelections();
|
|
341
|
+
this.#listService.highlightedItem.set(item);
|
|
342
|
+
if (item) this.#listService.scrollToItem$.next({
|
|
343
|
+
item,
|
|
344
|
+
focus: false
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
296
348
|
clear(notify) {
|
|
297
349
|
this.autoCompleteValue.set("");
|
|
298
350
|
this.#listService.clearSelections();
|
|
@@ -300,6 +352,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
300
352
|
if (notify) this.updateValue(null);
|
|
301
353
|
}
|
|
302
354
|
closePopup() {
|
|
355
|
+
this.autoCompleteValue$.next(null);
|
|
303
356
|
this.#popupRef()?.close();
|
|
304
357
|
}
|
|
305
358
|
initialize() {
|
|
@@ -310,6 +363,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
310
363
|
this.#listService.setSelectableOptions(this.selectableOptions);
|
|
311
364
|
this.#listService.filterInputVisible.set(false);
|
|
312
365
|
this.#dropdownService.restoreFocus.set(false);
|
|
366
|
+
this.#dropdownService.sheetFillsHeight.set(true);
|
|
313
367
|
}
|
|
314
368
|
notifyFilterChange(filter) {
|
|
315
369
|
const event = new FilterChangeEvent(filter);
|
|
@@ -328,31 +382,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
328
382
|
}
|
|
329
383
|
setAutoCompleteValueChangeSubscription() {
|
|
330
384
|
const debounceDuration = this.#listService.getFilterDebounceDuration();
|
|
331
|
-
this.autoCompleteValue$.pipe(takeUntilDestroyed(this.#destroyRef),
|
|
332
|
-
if (this.#listService.isFilteringEnabled()) {
|
|
333
|
-
if (this.notifyFilterChange(value).isDefaultPrevented()) return;
|
|
334
|
-
if (value) this.#listService.setFilter(value);
|
|
335
|
-
}
|
|
336
|
-
if (!value) {
|
|
337
|
-
const popupRef = this.#popupRef();
|
|
338
|
-
if (popupRef) {
|
|
339
|
-
popupRef.closed.pipe(take(1)).subscribe(() => this.clear(false));
|
|
340
|
-
this.closePopup();
|
|
341
|
-
} else this.clear(false);
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
if (!this.#popupRef()) this.#dropdownService.triggerPopupOpen$.next({});
|
|
345
|
-
this.autoCompleteValue.set(value);
|
|
346
|
-
const item = this.#listService.getMatchingFilteredItem(value);
|
|
347
|
-
if (this.highlightFirst()) {
|
|
348
|
-
this.#listService.clearSelections();
|
|
349
|
-
this.#listService.highlightedItem.set(item);
|
|
350
|
-
if (item) this.#listService.scrollToItem$.next({
|
|
351
|
-
item,
|
|
352
|
-
focus: false
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
});
|
|
385
|
+
this.autoCompleteValue$.pipe(takeUntilDestroyed(this.#destroyRef), debounceDuration > 0 ? debounceTime(debounceDuration) : identity, filter((value) => value !== null)).subscribe((value) => this.applyText(value));
|
|
356
386
|
}
|
|
357
387
|
setEnterKeySubscription() {
|
|
358
388
|
this.#dropdownService.beforeKeydown$.pipe(filter((e) => e.originalEvent?.key === "Enter"), takeUntilDestroyed(this.#destroyRef), tap((e) => e.preventDefault())).subscribe(() => {
|
|
@@ -382,8 +412,13 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
382
412
|
});
|
|
383
413
|
}
|
|
384
414
|
setPopupCloseSubscriptions() {
|
|
415
|
+
this.#dropdownService.popupCloseStart$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
416
|
+
this.#closingSheet = this.#dropdownService.sheet();
|
|
417
|
+
});
|
|
385
418
|
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
386
419
|
this.autoCompleteValue$.next(null);
|
|
420
|
+
if (this.#closingSheet && this.#dropdownService.focusCanReturn()) this.focus();
|
|
421
|
+
this.#closingSheet = false;
|
|
387
422
|
});
|
|
388
423
|
}
|
|
389
424
|
setSpaceKeySubscription() {
|
|
@@ -419,6 +454,20 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
419
454
|
isStandalone: true,
|
|
420
455
|
selector: "mona-auto-complete",
|
|
421
456
|
inputs: {
|
|
457
|
+
adaptiveMode: {
|
|
458
|
+
classPropertyName: "adaptiveMode",
|
|
459
|
+
publicName: "adaptiveMode",
|
|
460
|
+
isSignal: true,
|
|
461
|
+
isRequired: false,
|
|
462
|
+
transformFunction: null
|
|
463
|
+
},
|
|
464
|
+
adaptiveTitle: {
|
|
465
|
+
classPropertyName: "adaptiveTitle",
|
|
466
|
+
publicName: "adaptiveTitle",
|
|
467
|
+
isSignal: true,
|
|
468
|
+
isRequired: false,
|
|
469
|
+
transformFunction: null
|
|
470
|
+
},
|
|
422
471
|
ariaDescribedBy: {
|
|
423
472
|
classPropertyName: "ariaDescribedBy",
|
|
424
473
|
publicName: "aria-describedby",
|
|
@@ -694,7 +743,7 @@ var AutoCompleteComponent = class AutoCompleteComponent {
|
|
|
694
743
|
{ directive: i1.DropdownLiveRegionDirective }
|
|
695
744
|
],
|
|
696
745
|
ngImport: i0,
|
|
697
|
-
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]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"
|
|
746
|
+
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]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.inputmode]=\"inputMode()\"\n (click)=\"onInputClick()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<ng-template #popupTemplate>\n @if (sheet()) {\n <div [class]=\"sheetInputContainerClass\" (pointerdown)=\"onPopupPointerDown($event)\">\n <input\n monaTextBox\n autocomplete=\"off\"\n data-mona-sheet-autofocus\n role=\"combobox\"\n size=\"large\"\n [class]=\"sheetInputClass\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-labelledby]=\"sheetTitleId()\"\n (input)=\"onInput(sheetInput.value)\"\n (keydown)=\"onSheetKeydown($event)\"\n #sheetInput />\n </div>\n }\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"listSize()\" [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",
|
|
698
747
|
dependencies: [
|
|
699
748
|
{
|
|
700
749
|
kind: "directive",
|
|
@@ -838,7 +887,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
838
887
|
"[class]": "baseClass()",
|
|
839
888
|
"(focusout)": "onFocusOut($event)"
|
|
840
889
|
},
|
|
841
|
-
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]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"
|
|
890
|
+
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]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.inputmode]=\"inputMode()\"\n (click)=\"onInputClick()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<ng-template #popupTemplate>\n @if (sheet()) {\n <div [class]=\"sheetInputContainerClass\" (pointerdown)=\"onPopupPointerDown($event)\">\n <input\n monaTextBox\n autocomplete=\"off\"\n data-mona-sheet-autofocus\n role=\"combobox\"\n size=\"large\"\n [class]=\"sheetInputClass\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [value]=\"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]=\"describedBy()\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-labelledby]=\"sheetTitleId()\"\n (input)=\"onInput(sheetInput.value)\"\n (keydown)=\"onSheetKeydown($event)\"\n #sheetInput />\n </div>\n }\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"listSize()\" [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"
|
|
842
891
|
}]
|
|
843
892
|
}],
|
|
844
893
|
ctorParameters: () => [],
|
|
@@ -896,6 +945,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
896
945
|
isSignal: true
|
|
897
946
|
}]
|
|
898
947
|
}],
|
|
948
|
+
adaptiveMode: [{
|
|
949
|
+
type: i0.Input,
|
|
950
|
+
args: [{
|
|
951
|
+
isSignal: true,
|
|
952
|
+
alias: "adaptiveMode",
|
|
953
|
+
required: false
|
|
954
|
+
}]
|
|
955
|
+
}],
|
|
956
|
+
adaptiveTitle: [{
|
|
957
|
+
type: i0.Input,
|
|
958
|
+
args: [{
|
|
959
|
+
isSignal: true,
|
|
960
|
+
alias: "adaptiveTitle",
|
|
961
|
+
required: false
|
|
962
|
+
}]
|
|
963
|
+
}],
|
|
899
964
|
ariaDescribedBy: [{
|
|
900
965
|
type: i0.Input,
|
|
901
966
|
args: [{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from "@angular/common";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { Component, DOCUMENT, DestroyRef, ElementRef, Injector, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
4
4
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
5
5
|
import { FilterChangeEvent } from "@nanahoshi/mona-ui/common";
|
|
6
6
|
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
7
|
-
import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, dropdownPopupThemeVariants } from "@nanahoshi/mona-ui/dropdowns";
|
|
7
|
+
import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, dropdownPopupThemeVariants, dropdownSheetInputClasses, dropdownSheetInputContainerClasses, dropdownSheetSurfaceClasses, injectSmallScreen, matchesSmallScreen } from "@nanahoshi/mona-ui/dropdowns";
|
|
8
8
|
import { FIELD_ASSOCIATION_BOUNDARY, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
9
9
|
import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
|
|
10
10
|
import { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
@@ -75,20 +75,25 @@ const comboBoxTextInputThemeVariants = cva(`
|
|
|
75
75
|
const comboBoxAffixContainerThemeVariants = cva(`flex h-full flex-none items-center justify-center`);
|
|
76
76
|
var ComboBoxComponent = class ComboBoxComponent {
|
|
77
77
|
#destroyRef;
|
|
78
|
+
#document;
|
|
78
79
|
#dropdownListService;
|
|
79
80
|
#dropdownService;
|
|
80
81
|
#hostElementRef;
|
|
81
82
|
#i18n;
|
|
83
|
+
#injector;
|
|
82
84
|
#label;
|
|
83
85
|
#listService;
|
|
84
86
|
#popupRef;
|
|
87
|
+
#smallScreen;
|
|
85
88
|
#userNavigatedViaArrows;
|
|
86
89
|
constructor() {
|
|
87
90
|
this.#destroyRef = inject(DestroyRef);
|
|
91
|
+
this.#document = inject(DOCUMENT);
|
|
88
92
|
this.#dropdownListService = inject(DropdownListService);
|
|
89
93
|
this.#dropdownService = inject(DropdownService);
|
|
90
94
|
this.#hostElementRef = inject(ElementRef);
|
|
91
95
|
this.#i18n = inject(MonaI18nService);
|
|
96
|
+
this.#injector = inject(Injector);
|
|
92
97
|
this.#label = injectLabelAssociation({
|
|
93
98
|
ariaDescribedBy: () => this.ariaDescribedBy(),
|
|
94
99
|
ariaLabel: () => this.ariaLabel(),
|
|
@@ -97,6 +102,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
97
102
|
});
|
|
98
103
|
this.#listService = inject(ListService);
|
|
99
104
|
this.#popupRef = this.#dropdownService.popupRef;
|
|
105
|
+
this.#smallScreen = injectSmallScreen();
|
|
100
106
|
this.#userNavigatedViaArrows = signal(false, ...ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []);
|
|
101
107
|
this.activeDescendant = computed(() => {
|
|
102
108
|
const highlightedItem = this.#listService.highlightedItem();
|
|
@@ -143,6 +149,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
143
149
|
const rounded = this.rounded();
|
|
144
150
|
return comboBoxTextInputThemeVariants({ rounded });
|
|
145
151
|
}, ...ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []);
|
|
152
|
+
this.inputMode = computed(() => this.adaptiveMode() === "auto" && this.#smallScreen() ? "none" : null, ...ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []);
|
|
146
153
|
this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && this.value() == null), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
147
154
|
this.itemTemplate = contentChild(DropdownItemTemplateDirective, {
|
|
148
155
|
...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
|
|
@@ -159,8 +166,10 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
159
166
|
size
|
|
160
167
|
});
|
|
161
168
|
const heightClass = this.popupHeight() ? "max-h-none" : "";
|
|
162
|
-
|
|
169
|
+
const sheetClass = this.sheet() ? dropdownSheetSurfaceClasses : "";
|
|
170
|
+
return twMerge(variantClass, heightClass, sheetClass, userClass);
|
|
163
171
|
}, ...ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []);
|
|
172
|
+
this.listSize = computed(() => this.sheet() ? "large" : this.size(), ...ngDevMode ? [{ debugName: "listSize" }] : /* istanbul ignore next */ []);
|
|
164
173
|
this.messages = this.#i18n.componentMessages("comboBox", COMBO_BOX_DEFAULT_MESSAGES);
|
|
165
174
|
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, {
|
|
166
175
|
...ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {},
|
|
@@ -179,11 +188,17 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
179
188
|
this.selectedListItem = computed(() => {
|
|
180
189
|
return this.#listService.selectedListItems().firstOrDefault();
|
|
181
190
|
}, ...ngDevMode ? [{ debugName: "selectedListItem" }] : /* istanbul ignore next */ []);
|
|
191
|
+
this.sheet = this.#dropdownService.sheet.asReadonly();
|
|
192
|
+
this.sheetInputClass = dropdownSheetInputClasses;
|
|
193
|
+
this.sheetInputContainerClass = dropdownSheetInputContainerClasses;
|
|
194
|
+
this.sheetTitleId = this.#dropdownService.sheetTitleId.asReadonly();
|
|
182
195
|
this.valueText = computed(() => {
|
|
183
196
|
const listItem = this.selectedListItem();
|
|
184
197
|
if (!listItem) return "";
|
|
185
198
|
return this.#listService.getItemText(listItem);
|
|
186
199
|
}, ...ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []);
|
|
200
|
+
this.adaptiveMode = input("none", ...ngDevMode ? [{ debugName: "adaptiveMode" }] : /* istanbul ignore next */ []);
|
|
201
|
+
this.adaptiveTitle = input("", ...ngDevMode ? [{ debugName: "adaptiveTitle" }] : /* istanbul ignore next */ []);
|
|
187
202
|
this.allowCustomValue = input(false, {
|
|
188
203
|
...ngDevMode ? { debugName: "allowCustomValue" } : /* istanbul ignore next */ {},
|
|
189
204
|
transform: booleanAttribute
|
|
@@ -302,6 +317,9 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
302
317
|
this.comboBoxValue.set(text);
|
|
303
318
|
this.comboBoxValue$.next(text);
|
|
304
319
|
}
|
|
320
|
+
onInputClick() {
|
|
321
|
+
if (this.adaptiveMode() === "auto" && !this.#popupRef() && matchesSmallScreen(this.#document)) this.#dropdownService.triggerPopupOpen$.next({});
|
|
322
|
+
}
|
|
305
323
|
onItemSelect(event) {
|
|
306
324
|
if (this.#listService.filterableOptions().enabled && event.source.via === "keyboard" && event.source.key !== "Enter") return;
|
|
307
325
|
this.updateValue(this.getControlValue(event.item.data));
|
|
@@ -310,6 +328,9 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
310
328
|
onPopupPointerDown(event) {
|
|
311
329
|
if (event.target?.tagName !== "INPUT") event.preventDefault();
|
|
312
330
|
}
|
|
331
|
+
onSheetKeydown(event) {
|
|
332
|
+
this.#injector.get(DropdownListPopupHandlerDirective).handleKeyDown(event);
|
|
333
|
+
}
|
|
313
334
|
onValueClear(event) {
|
|
314
335
|
if (this.effectiveDisabled() || this.readonly() || event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ") return;
|
|
315
336
|
event.preventDefault();
|
|
@@ -326,6 +347,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
326
347
|
this.#listService.clearFilter();
|
|
327
348
|
}
|
|
328
349
|
closePopup() {
|
|
350
|
+
this.comboBoxValue$.next(null);
|
|
329
351
|
this.#popupRef()?.close();
|
|
330
352
|
}
|
|
331
353
|
getControlValue(dataItem) {
|
|
@@ -363,6 +385,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
363
385
|
});
|
|
364
386
|
this.#listService.setSelectableOptions(this.selectableOptions);
|
|
365
387
|
this.#listService.filterInputVisible.set(false);
|
|
388
|
+
this.#dropdownService.sheetFillsHeight.set(true);
|
|
366
389
|
this.comboBoxValue.set(this.valueText());
|
|
367
390
|
}
|
|
368
391
|
notifyFilterChange(filter) {
|
|
@@ -502,6 +525,20 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
502
525
|
isStandalone: true,
|
|
503
526
|
selector: "mona-combo-box",
|
|
504
527
|
inputs: {
|
|
528
|
+
adaptiveMode: {
|
|
529
|
+
classPropertyName: "adaptiveMode",
|
|
530
|
+
publicName: "adaptiveMode",
|
|
531
|
+
isSignal: true,
|
|
532
|
+
isRequired: false,
|
|
533
|
+
transformFunction: null
|
|
534
|
+
},
|
|
535
|
+
adaptiveTitle: {
|
|
536
|
+
classPropertyName: "adaptiveTitle",
|
|
537
|
+
publicName: "adaptiveTitle",
|
|
538
|
+
isSignal: true,
|
|
539
|
+
isRequired: false,
|
|
540
|
+
transformFunction: null
|
|
541
|
+
},
|
|
505
542
|
allowCustomValue: {
|
|
506
543
|
classPropertyName: "allowCustomValue",
|
|
507
544
|
publicName: "allowCustomValue",
|
|
@@ -781,7 +818,7 @@ var ComboBoxComponent = class ComboBoxComponent {
|
|
|
781
818
|
{ directive: i1.DropdownLiveRegionDirective }
|
|
782
819
|
],
|
|
783
820
|
ngImport: i0,
|
|
784
|
-
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"
|
|
821
|
+
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.inputmode]=\"inputMode()\"\n role=\"combobox\"\n (click)=\"onInputClick()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (sheet()) {\n <div [class]=\"sheetInputContainerClass\" (pointerdown)=\"onPopupPointerDown($event)\">\n <input\n monaTextBox\n autocomplete=\"off\"\n data-mona-sheet-autofocus\n role=\"combobox\"\n size=\"large\"\n [class]=\"sheetInputClass\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-labelledby]=\"sheetTitleId()\"\n (input)=\"onInput(sheetInput.value)\"\n (keydown)=\"onSheetKeydown($event)\"\n #sheetInput />\n </div>\n }\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"listSize()\" [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",
|
|
785
822
|
dependencies: [
|
|
786
823
|
{
|
|
787
824
|
kind: "directive",
|
|
@@ -927,7 +964,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
927
964
|
"(focusout)": "onFocusOut($event)",
|
|
928
965
|
"(pointerdown)": "onHostPointerDown($event)"
|
|
929
966
|
},
|
|
930
|
-
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"
|
|
967
|
+
template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.inputmode]=\"inputMode()\"\n role=\"combobox\"\n (click)=\"onInputClick()\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().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<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (sheet()) {\n <div [class]=\"sheetInputContainerClass\" (pointerdown)=\"onPopupPointerDown($event)\">\n <input\n monaTextBox\n autocomplete=\"off\"\n data-mona-sheet-autofocus\n role=\"combobox\"\n size=\"large\"\n [class]=\"sheetInputClass\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-expanded]=\"true\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-labelledby]=\"sheetTitleId()\"\n (input)=\"onInput(sheetInput.value)\"\n (keydown)=\"onSheetKeydown($event)\"\n #sheetInput />\n </div>\n }\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"listSize()\" [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"
|
|
931
968
|
}]
|
|
932
969
|
}],
|
|
933
970
|
ctorParameters: () => [],
|
|
@@ -978,6 +1015,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
978
1015
|
isSignal: true
|
|
979
1016
|
}]
|
|
980
1017
|
}],
|
|
1018
|
+
adaptiveMode: [{
|
|
1019
|
+
type: i0.Input,
|
|
1020
|
+
args: [{
|
|
1021
|
+
isSignal: true,
|
|
1022
|
+
alias: "adaptiveMode",
|
|
1023
|
+
required: false
|
|
1024
|
+
}]
|
|
1025
|
+
}],
|
|
1026
|
+
adaptiveTitle: [{
|
|
1027
|
+
type: i0.Input,
|
|
1028
|
+
args: [{
|
|
1029
|
+
isSignal: true,
|
|
1030
|
+
alias: "adaptiveTitle",
|
|
1031
|
+
required: false
|
|
1032
|
+
}]
|
|
1033
|
+
}],
|
|
981
1034
|
allowCustomValue: [{
|
|
982
1035
|
type: i0.Input,
|
|
983
1036
|
args: [{
|