@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,615 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, inject, DestroyRef, ElementRef, linkedSignal, 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 { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
6
|
+
import { createElementControlId, isTypeaheadKey, setupTypeahead } from '@nanahoshi/mona-ui/internal';
|
|
7
|
+
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
8
|
+
import { DropdownListService, DropdownService, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, dropdownPopupThemeVariants, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownLiveRegionDirective, DropdownDataInputToken, DropdownPopupInputToken, DropdownDataHandlerDirective, DropdownListPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
9
|
+
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
10
|
+
import { ListService, ListComponent, ListItemTemplateDirective, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
11
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
12
|
+
import { Subject } from 'rxjs';
|
|
13
|
+
import { twMerge } from 'tailwind-merge';
|
|
14
|
+
import { cva } from 'class-variance-authority';
|
|
15
|
+
|
|
16
|
+
class DropdownListValueTemplateDirective {
|
|
17
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListValueTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
18
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownListValueTemplateDirective, isStandalone: true, selector: "ng-template[monaDropDownListValueTemplate]", ngImport: i0 }); }
|
|
19
|
+
}
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListValueTemplateDirective, decorators: [{
|
|
21
|
+
type: Directive,
|
|
22
|
+
args: [{
|
|
23
|
+
selector: "ng-template[monaDropDownListValueTemplate]"
|
|
24
|
+
}]
|
|
25
|
+
}] });
|
|
26
|
+
|
|
27
|
+
const dropdownListInputVariants = cva(`
|
|
28
|
+
inline-flex items-center
|
|
29
|
+
|
|
30
|
+
border border-input-border
|
|
31
|
+
bg-background outline-none
|
|
32
|
+
shadow-xs
|
|
33
|
+
cursor-pointer select-none
|
|
34
|
+
|
|
35
|
+
hover:bg-accent hover:text-accent-foreground
|
|
36
|
+
transition-[color,box-shadow,border] ease-in-out duration-300
|
|
37
|
+
focus-within:ring-1 focus-within:ring-primary/40
|
|
38
|
+
`, {
|
|
39
|
+
variants: {
|
|
40
|
+
disabled: {
|
|
41
|
+
true: "pointer-events-none cursor-not-allowed opacity-50",
|
|
42
|
+
false: ""
|
|
43
|
+
},
|
|
44
|
+
expanded: {
|
|
45
|
+
true: "ring-1 ring-primary/40",
|
|
46
|
+
false: ""
|
|
47
|
+
},
|
|
48
|
+
hasPrefix: {
|
|
49
|
+
false: "ps-2"
|
|
50
|
+
},
|
|
51
|
+
invalid: {
|
|
52
|
+
true: "border-error ring-1 ring-error/40",
|
|
53
|
+
false: ""
|
|
54
|
+
},
|
|
55
|
+
rounded: {
|
|
56
|
+
none: "rounded-none",
|
|
57
|
+
small: "rounded-sm",
|
|
58
|
+
medium: "rounded-md",
|
|
59
|
+
large: "rounded-lg",
|
|
60
|
+
full: "rounded-full px-3"
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
large: "h-10 text-md",
|
|
64
|
+
medium: "h-9 text-sm",
|
|
65
|
+
small: "h-8 text-xs"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const dropdownListValueContainerVariants = cva(`overflow-hidden h-full w-full flex items-center`, {
|
|
70
|
+
variants: {
|
|
71
|
+
hasTemplate: {
|
|
72
|
+
false: "[&>span]:truncate [&>span]:items-center [&>span]:inline-block"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const dropdownListAffixContainerVariants = cva(`h-full flex flex-none items-center justify-center`);
|
|
77
|
+
|
|
78
|
+
const dropdownListAffixContainerThemeVariants = (theme) => {
|
|
79
|
+
switch (theme) {
|
|
80
|
+
case "mona":
|
|
81
|
+
return dropdownListAffixContainerVariants;
|
|
82
|
+
default:
|
|
83
|
+
return dropdownListAffixContainerVariants;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const dropdownListInputThemeVariants = (theme) => {
|
|
87
|
+
switch (theme) {
|
|
88
|
+
case "mona":
|
|
89
|
+
return dropdownListInputVariants;
|
|
90
|
+
default:
|
|
91
|
+
return dropdownListInputVariants;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const dropdownListValueContainerThemeVariants = (theme) => {
|
|
95
|
+
switch (theme) {
|
|
96
|
+
case "mona":
|
|
97
|
+
return dropdownListValueContainerVariants;
|
|
98
|
+
default:
|
|
99
|
+
return dropdownListValueContainerVariants;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
class DropdownListComponent {
|
|
104
|
+
#destroyRef;
|
|
105
|
+
#dropdownListService;
|
|
106
|
+
#dropdownService;
|
|
107
|
+
#hostElementRef;
|
|
108
|
+
#navigatedValue;
|
|
109
|
+
#listService;
|
|
110
|
+
#themeService;
|
|
111
|
+
#typeaheadKey;
|
|
112
|
+
constructor() {
|
|
113
|
+
this.#destroyRef = inject(DestroyRef);
|
|
114
|
+
this.#dropdownListService = inject(DropdownListService);
|
|
115
|
+
this.#dropdownService = inject(DropdownService);
|
|
116
|
+
this.#hostElementRef = inject((ElementRef));
|
|
117
|
+
this.#navigatedValue = linkedSignal(() => this.value(), /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "#navigatedValue" }] : /* istanbul ignore next */ []));
|
|
119
|
+
this.#listService = inject(ListService);
|
|
120
|
+
this.#themeService = inject(ThemeService);
|
|
121
|
+
this.#typeaheadKey = new Subject();
|
|
122
|
+
this.activeDescendant = computed(() => {
|
|
123
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
124
|
+
return highlightedItem ? highlightedItem.uid : null;
|
|
125
|
+
}, /* @ts-ignore */
|
|
126
|
+
...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
127
|
+
this.affixClass = computed(() => {
|
|
128
|
+
const theme = this.#themeService.theme();
|
|
129
|
+
return dropdownListAffixContainerThemeVariants(theme)();
|
|
130
|
+
}, /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []));
|
|
132
|
+
this.baseClass = computed(() => {
|
|
133
|
+
const theme = this.#themeService.theme();
|
|
134
|
+
const disabled = this.disabled();
|
|
135
|
+
const expanded = this.expanded();
|
|
136
|
+
const hasPrefix = this.prefixTemplate() != null;
|
|
137
|
+
const invalid = this.invalidState();
|
|
138
|
+
const rounded = this.rounded();
|
|
139
|
+
const size = this.size();
|
|
140
|
+
const classes = dropdownListInputThemeVariants(theme)({
|
|
141
|
+
disabled,
|
|
142
|
+
expanded,
|
|
143
|
+
hasPrefix,
|
|
144
|
+
invalid,
|
|
145
|
+
rounded,
|
|
146
|
+
size
|
|
147
|
+
});
|
|
148
|
+
const userClass = this.userClass();
|
|
149
|
+
return twMerge(classes, userClass);
|
|
150
|
+
}, /* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
152
|
+
this.effectiveAriaLabel = computed(() => this.ariaLabel() || (this.ariaLabelledBy() ? "" : this.placeholder()), /* @ts-ignore */
|
|
153
|
+
...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
|
|
154
|
+
this.expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
|
|
155
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
156
|
+
this.footerTemplate = contentChild(DropdownFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
157
|
+
this.groupHeaderTemplate = contentChild(DropdownGroupHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
158
|
+
this.headerTemplate = contentChild(DropdownHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
159
|
+
this.itemTemplate = contentChild(DropdownItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
160
|
+
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && this.value() == null), /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
162
|
+
this.isEmpty = computed(() => !this.#listService.viewItems().any(), /* @ts-ignore */
|
|
163
|
+
...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
164
|
+
this.listId = createElementControlId();
|
|
165
|
+
this.listPopupClass = computed(() => {
|
|
166
|
+
const theme = this.#themeService.theme();
|
|
167
|
+
const rounded = this.rounded();
|
|
168
|
+
const size = this.size();
|
|
169
|
+
const userClass = this.popupClass();
|
|
170
|
+
const variantClass = dropdownPopupThemeVariants(theme)({ rounded, size });
|
|
171
|
+
return twMerge(variantClass, userClass);
|
|
172
|
+
}, /* @ts-ignore */
|
|
173
|
+
...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
|
|
174
|
+
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
175
|
+
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
177
|
+
this.prefixTemplate = contentChild(DropdownPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
178
|
+
this.selectableOptions = {
|
|
179
|
+
enabled: true,
|
|
180
|
+
mode: "single",
|
|
181
|
+
toggleable: false
|
|
182
|
+
};
|
|
183
|
+
this.selectedDataItem = computed(() => {
|
|
184
|
+
return this.selectedListItem()?.data ?? null;
|
|
185
|
+
}, /* @ts-ignore */
|
|
186
|
+
...(ngDevMode ? [{ debugName: "selectedDataItem" }] : /* istanbul ignore next */ []));
|
|
187
|
+
this.selectedListItem = computed(() => {
|
|
188
|
+
return this.#listService.selectedListItems().firstOrDefault();
|
|
189
|
+
}, /* @ts-ignore */
|
|
190
|
+
...(ngDevMode ? [{ debugName: "selectedListItem" }] : /* istanbul ignore next */ []));
|
|
191
|
+
this.valueContainerClass = computed(() => {
|
|
192
|
+
const theme = this.#themeService.theme();
|
|
193
|
+
const hasTemplate = this.valueTemplate() != null;
|
|
194
|
+
return dropdownListValueContainerThemeVariants(theme)({ hasTemplate });
|
|
195
|
+
}, /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "valueContainerClass" }] : /* istanbul ignore next */ []));
|
|
197
|
+
this.valueTemplate = contentChild(DropdownListValueTemplateDirective, { ...(ngDevMode ? { debugName: "valueTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
198
|
+
this.valueText = computed(() => {
|
|
199
|
+
const listItem = this.selectedListItem();
|
|
200
|
+
if (!listItem) {
|
|
201
|
+
return "";
|
|
202
|
+
}
|
|
203
|
+
return this.#listService.getItemText(listItem);
|
|
204
|
+
}, /* @ts-ignore */
|
|
205
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
206
|
+
/**
|
|
207
|
+
* @description Accessible name for the host element. Describe what the component represents.
|
|
208
|
+
* When empty, falls back to the placeholder text.
|
|
209
|
+
* @default ""
|
|
210
|
+
*/
|
|
211
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
212
|
+
/**
|
|
213
|
+
* @description ID of an external element that provides the accessible name for the host element.
|
|
214
|
+
* @default ""
|
|
215
|
+
*/
|
|
216
|
+
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
217
|
+
/**
|
|
218
|
+
* @description Emitted when the popup is about to close. This event is preventable.
|
|
219
|
+
*/
|
|
220
|
+
this.close = output();
|
|
221
|
+
/**
|
|
222
|
+
* @description Emitted after the popup closes.
|
|
223
|
+
*/
|
|
224
|
+
this.closed = output();
|
|
225
|
+
/**
|
|
226
|
+
* @description Collection of items to render.
|
|
227
|
+
* @default []
|
|
228
|
+
*/
|
|
229
|
+
this.data = input([], /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
231
|
+
/**
|
|
232
|
+
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
233
|
+
* @default false
|
|
234
|
+
*/
|
|
235
|
+
this.disabled = model(false, /* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
237
|
+
/**
|
|
238
|
+
* @description Predicate or field name used to determine whether an individual item is disabled.
|
|
239
|
+
* @default undefined
|
|
240
|
+
*/
|
|
241
|
+
this.itemDisabled = input(/* @ts-ignore */
|
|
242
|
+
...(ngDevMode ? [undefined, { debugName: "itemDisabled" }] : /* istanbul ignore next */ []));
|
|
243
|
+
/**
|
|
244
|
+
* @description Marks the field as invalid. Set automatically by the `FormField` directive when bound via `[formField]`.
|
|
245
|
+
* @default false
|
|
246
|
+
*/
|
|
247
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
248
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
249
|
+
/**
|
|
250
|
+
* @description Displays a loading indicator and prevents interaction while an operation is in progress.
|
|
251
|
+
* @default false
|
|
252
|
+
*/
|
|
253
|
+
this.loading = input(false, /* @ts-ignore */
|
|
254
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
255
|
+
/**
|
|
256
|
+
* @description Emitted when the popup is about to open. This event is preventable.
|
|
257
|
+
*/
|
|
258
|
+
this.open = output();
|
|
259
|
+
/**
|
|
260
|
+
* @description Emitted after the popup opens.
|
|
261
|
+
*/
|
|
262
|
+
this.opened = output();
|
|
263
|
+
/**
|
|
264
|
+
* @description Placeholder text shown when no value is selected or entered.
|
|
265
|
+
* @default ""
|
|
266
|
+
*/
|
|
267
|
+
this.placeholder = input("", /* @ts-ignore */
|
|
268
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
269
|
+
/**
|
|
270
|
+
* @description Additional CSS classes applied to the popup element.
|
|
271
|
+
* @default ""
|
|
272
|
+
*/
|
|
273
|
+
this.popupClass = input("", /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
|
|
275
|
+
/**
|
|
276
|
+
* @description Height of the popup element.
|
|
277
|
+
* @default null
|
|
278
|
+
*/
|
|
279
|
+
this.popupHeight = input(null, /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
|
|
281
|
+
/**
|
|
282
|
+
* @description Width of the popup element.
|
|
283
|
+
* @default null
|
|
284
|
+
*/
|
|
285
|
+
this.popupWidth = input(null, /* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
|
|
287
|
+
/**
|
|
288
|
+
* @description Prevents value changes while preserving the component's visual state.
|
|
289
|
+
* @default false
|
|
290
|
+
*/
|
|
291
|
+
this.readonly = input(false, /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
293
|
+
/**
|
|
294
|
+
* @description Marks the field as required for form validation.
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
297
|
+
this.required = input(false, /* @ts-ignore */
|
|
298
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
299
|
+
/**
|
|
300
|
+
* @description Border-radius preset applied to the component.
|
|
301
|
+
* @default "medium"
|
|
302
|
+
*/
|
|
303
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
304
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
305
|
+
/**
|
|
306
|
+
* @description Shows a clear button that resets the selected value when clicked.
|
|
307
|
+
* @default false
|
|
308
|
+
*/
|
|
309
|
+
this.showClearButton = input(false, /* @ts-ignore */
|
|
310
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
311
|
+
/**
|
|
312
|
+
* @description Size preset controlling the component's dimensions.
|
|
313
|
+
* @default "medium"
|
|
314
|
+
*/
|
|
315
|
+
this.size = input("medium", /* @ts-ignore */
|
|
316
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
317
|
+
/**
|
|
318
|
+
* @description Property name or accessor used to derive the display text from a data item.
|
|
319
|
+
* If omitted, the item itself is used as the display text.
|
|
320
|
+
* @default undefined
|
|
321
|
+
*/
|
|
322
|
+
this.textField = input(/* @ts-ignore */
|
|
323
|
+
...(ngDevMode ? [undefined, { debugName: "textField" }] : /* istanbul ignore next */ []));
|
|
324
|
+
/**
|
|
325
|
+
* @description Emitted when the control is interacted with via blur, selection, or clear.
|
|
326
|
+
* The `FormField` directive listens to this to mark the field as touched.
|
|
327
|
+
*/
|
|
328
|
+
this.touch = output();
|
|
329
|
+
/**
|
|
330
|
+
* @description Marks the control as touched. Set automatically by the `FormField` directive when bound via `[formField]`.
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
this.touched = input(false, /* @ts-ignore */
|
|
334
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
335
|
+
/**
|
|
336
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
337
|
+
* @default ""
|
|
338
|
+
*/
|
|
339
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
340
|
+
/**
|
|
341
|
+
* @description Property name or accessor used to derive the value from a data item.
|
|
342
|
+
* If omitted, the item itself is used as the value.
|
|
343
|
+
* @default undefined
|
|
344
|
+
*/
|
|
345
|
+
this.valueField = input(/* @ts-ignore */
|
|
346
|
+
...(ngDevMode ? [undefined, { debugName: "valueField" }] : /* istanbul ignore next */ []));
|
|
347
|
+
/**
|
|
348
|
+
* @description Currently selected value, two-way bindable and compatible with Signal Forms via `[formField]`.
|
|
349
|
+
* When `valueField` is set, this may hold the primitive field value instead of the full data item.
|
|
350
|
+
* @default null
|
|
351
|
+
*/
|
|
352
|
+
this.value = model(null, /* @ts-ignore */
|
|
353
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
354
|
+
effect(() => {
|
|
355
|
+
const value = this.value();
|
|
356
|
+
const valueField = this.valueField();
|
|
357
|
+
untracked(() => {
|
|
358
|
+
this.#listService.setValueField(valueField ?? "");
|
|
359
|
+
if (value != null) {
|
|
360
|
+
this.#listService.setSelectedDataItems([value]);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
this.#listService.clearSelections();
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
effect(() => {
|
|
368
|
+
const popupTemplate = this.popupTemplate();
|
|
369
|
+
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
370
|
+
});
|
|
371
|
+
afterNextRender({
|
|
372
|
+
read: () => {
|
|
373
|
+
this.initialize();
|
|
374
|
+
this.setSubscriptions();
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
effect(() => {
|
|
378
|
+
const filterableOptions = this.#listService.filterableOptions();
|
|
379
|
+
untracked(() => {
|
|
380
|
+
if (filterableOptions.enabled) {
|
|
381
|
+
this.#listService.setNavigableOptions({ mode: "highlight" });
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
this.#listService.setNavigableOptions({ mode: "select" });
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
setValue(value) {
|
|
390
|
+
this.updateValue(value);
|
|
391
|
+
}
|
|
392
|
+
onBlur() {
|
|
393
|
+
this.touch.emit();
|
|
394
|
+
}
|
|
395
|
+
onItemSelect(event) {
|
|
396
|
+
if (this.#listService.filterableOptions().enabled &&
|
|
397
|
+
event.source.via === "keyboard" &&
|
|
398
|
+
event.source.key !== "Enter") {
|
|
399
|
+
this.#navigatedValue.set(event.item.data);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this.updateValue(event.item.data, true);
|
|
403
|
+
if (event.source.via === "mouse" || event.source.key === "Enter" || event.source.key === "NumpadEnter") {
|
|
404
|
+
this.closePopup();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
onValueClear(event) {
|
|
408
|
+
if (this.readonly() || (event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ")) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
event.stopImmediatePropagation();
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
this.updateValue(null);
|
|
414
|
+
this.#listService.clearSelections();
|
|
415
|
+
this.focus();
|
|
416
|
+
}
|
|
417
|
+
closePopup() {
|
|
418
|
+
this.#dropdownService.popupRef()?.close();
|
|
419
|
+
}
|
|
420
|
+
cycleThroughMatchedItems(buffer) {
|
|
421
|
+
const nextItem = this.#listService.cycleThroughMatchedItems(buffer);
|
|
422
|
+
if (!nextItem) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const selectedItems = this.#listService.selectedListItems();
|
|
426
|
+
if (selectedItems.contains(nextItem)) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
this.#listService.selectItem(nextItem);
|
|
430
|
+
const expanded = this.expanded();
|
|
431
|
+
if (!expanded) {
|
|
432
|
+
this.updateValue(nextItem.data, true);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
this.scrollToSelectedItem();
|
|
436
|
+
this.#navigatedValue.set(nextItem.data);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
focus() {
|
|
440
|
+
this.#hostElementRef.nativeElement?.focus();
|
|
441
|
+
}
|
|
442
|
+
handleEnterKey() {
|
|
443
|
+
if (!this.expanded()) {
|
|
444
|
+
this.#dropdownService.triggerPopupOpen$.next({});
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
if (this.expanded() && this.value() !== this.#navigatedValue()) {
|
|
448
|
+
this.updateValue(this.#navigatedValue(), true);
|
|
449
|
+
}
|
|
450
|
+
this.closePopup();
|
|
451
|
+
}
|
|
452
|
+
handleHomeEndKeys(event) {
|
|
453
|
+
const itemToSelect = event.key === "Home"
|
|
454
|
+
? this.#listService.viewItems().firstOrDefault()
|
|
455
|
+
: this.#listService.viewItems().lastOrDefault();
|
|
456
|
+
if (!itemToSelect) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
this.#listService.selectItem(itemToSelect, true, false);
|
|
460
|
+
if (!this.expanded()) {
|
|
461
|
+
this.updateValue(itemToSelect.data, true);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.#navigatedValue.set(itemToSelect.data);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
initialize() {
|
|
468
|
+
this.#listService.setNavigableOptions({ enabled: true, mode: "select" });
|
|
469
|
+
this.#listService.setSelectableOptions(this.selectableOptions);
|
|
470
|
+
}
|
|
471
|
+
scrollToSelectedItem() {
|
|
472
|
+
const item = this.selectedListItem();
|
|
473
|
+
if (!item) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
window.setTimeout(() => this.#listService.scrollToItem(item, false));
|
|
477
|
+
}
|
|
478
|
+
setArrowKeyNavigationSubscription() {
|
|
479
|
+
this.#dropdownListService.navigate$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(({ item }) => {
|
|
480
|
+
if (!this.expanded()) {
|
|
481
|
+
this.updateValue(item.data, true);
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
this.#navigatedValue.set(item.data);
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
setFilterChangeSubscription() {
|
|
489
|
+
this.#listService.filterChange$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
490
|
+
if (event.filter) {
|
|
491
|
+
const item = this.#listService.getMatchingFilteredItem(event.filter);
|
|
492
|
+
if (item) {
|
|
493
|
+
this.#listService.highlightedItem.set(item);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
setKeydownSubscription() {
|
|
499
|
+
this.#dropdownService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
500
|
+
if (event.key === "Enter") {
|
|
501
|
+
event.preventDefault();
|
|
502
|
+
this.handleEnterKey();
|
|
503
|
+
}
|
|
504
|
+
else if (event.key === "Home" || event.key === "End") {
|
|
505
|
+
event.preventDefault();
|
|
506
|
+
this.handleHomeEndKeys(event);
|
|
507
|
+
}
|
|
508
|
+
else if (isTypeaheadKey(event.key)) {
|
|
509
|
+
this.#typeaheadKey.next(event.key);
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
setPopupCloseSubscriptions() {
|
|
514
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
515
|
+
this.updateValue(this.#navigatedValue(), true);
|
|
516
|
+
window.setTimeout(() => this.focus());
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
setSubscriptions() {
|
|
520
|
+
this.setArrowKeyNavigationSubscription();
|
|
521
|
+
this.setKeydownSubscription();
|
|
522
|
+
this.setFilterChangeSubscription();
|
|
523
|
+
this.setPopupCloseSubscriptions();
|
|
524
|
+
this.setTypeaheadSubscription();
|
|
525
|
+
}
|
|
526
|
+
setTypeaheadSubscription() {
|
|
527
|
+
setupTypeahead(this.#typeaheadKey)
|
|
528
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
529
|
+
.subscribe(buffer => this.cycleThroughMatchedItems(buffer));
|
|
530
|
+
}
|
|
531
|
+
updateValue(value, notify = true) {
|
|
532
|
+
const oldValue = this.value();
|
|
533
|
+
if (oldValue !== value) {
|
|
534
|
+
this.value.set(value);
|
|
535
|
+
}
|
|
536
|
+
if (notify && oldValue !== value) {
|
|
537
|
+
this.touch.emit();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
541
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DropdownListComponent, isStandalone: true, selector: "mona-dropdown-list", inputs: { 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", value: "valueChange" }, host: { listeners: { "blur": "onBlur()" }, properties: { "attr.aria-activedescendant": "activeDescendant()", "attr.aria-busy": "loading() ? 'true' : undefined", "attr.aria-controls": "listId", "attr.aria-disabled": "disabled() ? true : undefined", "attr.aria-expanded": "expanded()", "attr.aria-haspopup": "'listbox'", "attr.aria-invalid": "invalidState() ? true : undefined", "attr.aria-label": "effectiveAriaLabel() || null", "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-readonly": "readonly() ? true : undefined", "attr.aria-required": "required() ? true : undefined", "attr.data-invalid": "invalidState() || null", "attr.role": "'combobox'", "attr.tabindex": "disabled() ? null : 0", "class": "baseClass()" } }, providers: [
|
|
542
|
+
ListService,
|
|
543
|
+
DropdownService,
|
|
544
|
+
DropdownListService,
|
|
545
|
+
{
|
|
546
|
+
provide: DropdownDataInputToken,
|
|
547
|
+
useExisting: forwardRef(() => DropdownListComponent),
|
|
548
|
+
multi: false
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
provide: DropdownPopupInputToken,
|
|
552
|
+
useExisting: forwardRef(() => DropdownListComponent),
|
|
553
|
+
multi: false
|
|
554
|
+
}
|
|
555
|
+
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "valueTemplate", first: true, predicate: DropdownListValueTemplateDirective, 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<span [class]=\"valueContainerClass()\">\r\n @if (!valueTemplate()) {\r\n <span>\r\n @if (selectedListItem()) {\r\n <span>{{ valueText() }}</span>\r\n } @else {\r\n <span>{{ placeholder() }}</span>\r\n }\r\n </span>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"valueTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\r\n }\r\n</span>\r\n\r\n@if (selectedListItem() && showClearButton() && !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 [listId]=\"listId\" [focusOnMount]=\"false\" [size]=\"size()\" (itemSelect)=\"onItemSelect($event)\">\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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FontAwesomeModule }, { 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: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { 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: DropdownLiveRegionDirective, selector: "span[monaDropdownLiveRegion]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
556
|
+
}
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListComponent, decorators: [{
|
|
558
|
+
type: Component,
|
|
559
|
+
args: [{ selector: "mona-dropdown-list", hostDirectives: [DropdownDataHandlerDirective, DropdownListPopupHandlerDirective], providers: [
|
|
560
|
+
ListService,
|
|
561
|
+
DropdownService,
|
|
562
|
+
DropdownListService,
|
|
563
|
+
{
|
|
564
|
+
provide: DropdownDataInputToken,
|
|
565
|
+
useExisting: forwardRef(() => DropdownListComponent),
|
|
566
|
+
multi: false
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
provide: DropdownPopupInputToken,
|
|
570
|
+
useExisting: forwardRef(() => DropdownListComponent),
|
|
571
|
+
multi: false
|
|
572
|
+
}
|
|
573
|
+
], imports: [
|
|
574
|
+
NgTemplateOutlet,
|
|
575
|
+
FontAwesomeModule,
|
|
576
|
+
ListComponent,
|
|
577
|
+
ListItemTemplateDirective,
|
|
578
|
+
ListGroupHeaderTemplateDirective,
|
|
579
|
+
ListFooterTemplateDirective,
|
|
580
|
+
ListHeaderTemplateDirective,
|
|
581
|
+
ListNoDataTemplateDirective,
|
|
582
|
+
DropdownLiveRegionDirective,
|
|
583
|
+
IndicatorIconComponent
|
|
584
|
+
], host: {
|
|
585
|
+
"[attr.aria-activedescendant]": "activeDescendant()",
|
|
586
|
+
"[attr.aria-busy]": "loading() ? 'true' : undefined",
|
|
587
|
+
"[attr.aria-controls]": "listId",
|
|
588
|
+
"[attr.aria-disabled]": "disabled() ? true : undefined",
|
|
589
|
+
"[attr.aria-expanded]": "expanded()",
|
|
590
|
+
"[attr.aria-haspopup]": "'listbox'",
|
|
591
|
+
"[attr.aria-invalid]": "invalidState() ? true : undefined",
|
|
592
|
+
"[attr.aria-label]": "effectiveAriaLabel() || null",
|
|
593
|
+
"[attr.aria-labelledby]": "ariaLabelledBy()",
|
|
594
|
+
"[attr.aria-readonly]": "readonly() ? true : undefined",
|
|
595
|
+
"[attr.aria-required]": "required() ? true : undefined",
|
|
596
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
597
|
+
"[attr.role]": "'combobox'",
|
|
598
|
+
"[attr.tabindex]": "disabled() ? null : 0",
|
|
599
|
+
"[class]": "baseClass()",
|
|
600
|
+
"(blur)": "onBlur()"
|
|
601
|
+
}, 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<span [class]=\"valueContainerClass()\">\r\n @if (!valueTemplate()) {\r\n <span>\r\n @if (selectedListItem()) {\r\n <span>{{ valueText() }}</span>\r\n } @else {\r\n <span>{{ placeholder() }}</span>\r\n }\r\n </span>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"valueTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\r\n }\r\n</span>\r\n\r\n@if (selectedListItem() && showClearButton() && !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 [listId]=\"listId\" [focusOnMount]=\"false\" [size]=\"size()\" (itemSelect)=\"onItemSelect($event)\">\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" }]
|
|
602
|
+
}], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{
|
|
603
|
+
read: TemplateRef
|
|
604
|
+
}, 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 }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownListValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], 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 }] }], 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"] }] } });
|
|
605
|
+
|
|
606
|
+
/*
|
|
607
|
+
* Public API Surface of @nanahoshi/mona-ui/dropdown-list
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Generated bundle index. Do not edit.
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
export { DropdownListComponent, DropdownListValueTemplateDirective };
|
|
615
|
+
//# sourceMappingURL=nanahoshi-mona-ui-dropdown-list.mjs.map
|