@nanahoshi/mona-ui 0.37.0 → 0.39.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/docs/api/common.md +1 -1
- package/docs/api/date-picker.md +2 -0
- package/docs/api/date-range-picker.md +2 -0
- package/docs/api/datetime-picker.md +2 -0
- package/docs/api/dropdown-list.md +2 -0
- package/docs/api/dropdown-tree.md +81 -0
- package/docs/api/dropdowns.md +34 -8
- package/docs/api/i18n.md +33 -4
- package/docs/api/list.md +1 -1
- package/docs/api/locales.md +14 -14
- package/docs/api/multi-select-tree.md +75 -0
- package/docs/api/multi-select.md +3 -1
- package/docs/api/popup.md +1 -1
- package/docs/api/time-picker.md +2 -0
- package/docs/api/tree-view.md +2 -2
- package/docs/auto-complete.md +2 -0
- package/docs/combo-box.md +2 -0
- package/docs/date-picker.md +5 -1
- package/docs/date-range-picker.md +5 -1
- package/docs/datetime-picker.md +5 -1
- package/docs/dropdown-list.md +52 -0
- package/docs/dropdown-tree.md +427 -0
- package/docs/multi-select-tree.md +353 -0
- package/docs/multi-select.md +6 -0
- package/docs/time-picker.md +5 -1
- package/dropdown-tree/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +36 -2
- package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +37 -3
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +52 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +40 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-tree.mjs +1061 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +730 -60
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +8 -2
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +4 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-S2iCn8TV.mjs → nanahoshi-mona-ui-grid-grid-list.component-BoSXXLKQ.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-BUJvgihp.mjs → nanahoshi-mona-ui-grid-grid-row.component-Df2gfS0X.mjs} +3 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Wndy-_Bt.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-xjrcCXXF.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +8 -4
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +80 -37
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +17 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +17 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +7 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select-tree.mjs +1179 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +42 -7
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +39 -4
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -1
- package/i18n/catalogs/en-US.messages.json +9 -0
- package/llms.txt +6 -2
- package/locales/ar-sa/ar-sa.messages.json +9 -0
- package/locales/de-de/de-de.messages.json +9 -0
- package/locales/es-es/es-es.messages.json +9 -0
- package/locales/fr-fr/fr-fr.messages.json +9 -0
- package/locales/id-id/id-id.messages.json +9 -0
- package/locales/it-it/it-it.messages.json +9 -0
- package/locales/ja-jp/ja-jp.messages.json +9 -0
- package/locales/ko-kr/ko-kr.messages.json +9 -0
- package/locales/pl-pl/pl-pl.messages.json +9 -0
- package/locales/pt-br/pt-br.messages.json +9 -0
- package/locales/ru-ru/ru-ru.messages.json +9 -0
- package/locales/tr-tr/tr-tr.messages.json +9 -0
- package/locales/zh-cn/zh-cn.messages.json +9 -0
- package/locales/zh-tw/zh-tw.messages.json +9 -0
- package/multi-select-tree/package.json +4 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-date-picker.d.ts +25 -1
- package/types/nanahoshi-mona-ui-date-range-picker.d.ts +26 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +34 -1
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +33 -5
- package/types/nanahoshi-mona-ui-dropdown-tree.d.ts +414 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +218 -9
- package/types/nanahoshi-mona-ui-i18n.d.ts +12 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +36 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +9 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +9 -0
- package/types/nanahoshi-mona-ui-multi-select-tree.d.ts +456 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +43 -7
- package/types/nanahoshi-mona-ui-time-picker.d.ts +29 -2
|
@@ -1,22 +1,454 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { DOCUMENT, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, afterNextRender, effect, inject, input, output, signal, untracked } from "@angular/core";
|
|
2
|
+
import { Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, afterNextRender, computed, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { LucideX } from "@lucide/angular";
|
|
5
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
6
|
+
import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
7
|
+
import { PopupCloseEvent, PopupCloseSource, PopupDataInjectionToken, PopupRef, PopupService, dropdownPopupAnimation, slideFromBottomPopupAnimation } from "@nanahoshi/mona-ui/popup";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
import { focusCanReturn, setupTypeahead, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
10
|
+
import { FilterInputComponent } from "@nanahoshi/mona-ui/internal/filter-input";
|
|
11
|
+
import { injectLiveAnnouncer } from "@nanahoshi/mona-ui/internal/live-announcer";
|
|
12
|
+
import { TREE_DEFAULT_MESSAGES, TreeComponent, TreeNodeTemplateDirective, TreeService, handleTreeNavigationKey } from "@nanahoshi/mona-ui/internal/tree";
|
|
13
|
+
import { PlaceholderComponent } from "@nanahoshi/mona-ui/placeholder";
|
|
3
14
|
import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
|
|
4
15
|
import { ListService } from "@nanahoshi/mona-ui/internal/list";
|
|
5
16
|
import { PreventableEvent } from "@nanahoshi/mona-ui/common";
|
|
6
|
-
import {
|
|
7
|
-
import { Subject, filter, fromEvent, switchMap, take, takeUntil } from "rxjs";
|
|
17
|
+
import { Subject, filter, fromEvent, merge, switchMap, take, takeUntil } from "rxjs";
|
|
8
18
|
import { ConnectionPositionPair } from "@angular/cdk/overlay";
|
|
9
|
-
import { focusCanReturn, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
10
|
-
import { MonaI18nService, formatNumber } from "@nanahoshi/mona-ui/i18n";
|
|
11
|
-
import { injectLiveAnnouncer } from "@nanahoshi/mona-ui/internal/live-announcer";
|
|
12
|
-
import { cva } from "class-variance-authority";
|
|
13
19
|
const DROPDOWN_DATA_INPUT_TOKEN = new InjectionToken("DROPDOWN_DATA_INPUT");
|
|
14
20
|
const DropdownDataInputToken = DROPDOWN_DATA_INPUT_TOKEN;
|
|
15
21
|
const DROPDOWN_POPUP_INPUT_TOKEN = new InjectionToken("DROPDOWN_POPUP_INPUT");
|
|
22
|
+
function localizeNumber(value, options) {
|
|
23
|
+
return formatNumber(value, "en-US", options);
|
|
24
|
+
}
|
|
25
|
+
const DROPDOWNS_DEFAULT_MESSAGES = {
|
|
26
|
+
close: "Close",
|
|
27
|
+
itemPosition: (text, position, total) => `${text}, ${localizeNumber(position)} of ${localizeNumber(total)}`,
|
|
28
|
+
noResultsFound: "No results found",
|
|
29
|
+
resultsAvailable: (count) => count === 1 ? `${localizeNumber(count)} result available` : `${localizeNumber(count)} results available`
|
|
30
|
+
};
|
|
31
|
+
const dropdownSheetThemeVariants = cva(`
|
|
32
|
+
flex h-full max-h-[inherit] min-h-0 w-full flex-col overflow-clip
|
|
33
|
+
rounded-t-xl border-t border-border
|
|
34
|
+
pb-[env(safe-area-inset-bottom)] ps-[env(safe-area-inset-left)] pe-[env(safe-area-inset-right)]
|
|
35
|
+
rtl:ps-[env(safe-area-inset-right)] rtl:pe-[env(safe-area-inset-left)]
|
|
36
|
+
${themeOverlaySurfaceClasses} text-foreground shadow-(--shadow-overlay)
|
|
37
|
+
`);
|
|
38
|
+
const dropdownSheetSurfaceClasses = `
|
|
39
|
+
h-full max-h-none flex-1 rounded-none border-0 shadow-none text-base
|
|
40
|
+
[&_[role=option]]:min-h-11 [&_mona-tree-node>div]:py-2.5
|
|
41
|
+
`;
|
|
42
|
+
const dropdownSheetPickerClasses = `
|
|
43
|
+
h-full max-h-none min-h-0 w-full max-w-none flex-1 rounded-none border-0 shadow-none
|
|
44
|
+
[--mona-calendar-cell-size:min(2.75rem,calc((100dvw_-_3rem)/8))]
|
|
45
|
+
[&_mona-calendar]:w-full [&_mona-calendar]:shrink-0
|
|
46
|
+
[&_mona-calendar]:min-h-[calc(4.5rem_+_7_*_var(--mona-calendar-cell-size))]
|
|
47
|
+
`;
|
|
48
|
+
var DropdownSheetComponent = class DropdownSheetComponent {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.#popupRef = inject(PopupRef);
|
|
51
|
+
this.content = viewChild.required("content", ...ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []);
|
|
52
|
+
this.data = inject(PopupDataInjectionToken);
|
|
53
|
+
this.messages = inject(MonaI18nService).componentMessages("dropdowns", DROPDOWNS_DEFAULT_MESSAGES);
|
|
54
|
+
this.sheetClass = dropdownSheetThemeVariants();
|
|
55
|
+
}
|
|
56
|
+
#popupRef;
|
|
57
|
+
closeSheet() {
|
|
58
|
+
this.#popupRef.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
|
|
59
|
+
}
|
|
60
|
+
onPointerDown(event) {
|
|
61
|
+
const content = this.content().nativeElement;
|
|
62
|
+
const target = event.target;
|
|
63
|
+
if (target instanceof Node && target !== content && content.contains(target)) return;
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
}
|
|
66
|
+
static {
|
|
67
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
68
|
+
minVersion: "12.0.0",
|
|
69
|
+
version: "22.2.6",
|
|
70
|
+
ngImport: i0,
|
|
71
|
+
type: DropdownSheetComponent,
|
|
72
|
+
deps: [],
|
|
73
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static {
|
|
77
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
78
|
+
minVersion: "17.2.0",
|
|
79
|
+
version: "22.2.6",
|
|
80
|
+
type: DropdownSheetComponent,
|
|
81
|
+
isStandalone: true,
|
|
82
|
+
selector: "mona-dropdown-sheet",
|
|
83
|
+
host: { classAttribute: "contents max-h-[inherit]" },
|
|
84
|
+
viewQueries: [{
|
|
85
|
+
propertyName: "content",
|
|
86
|
+
first: true,
|
|
87
|
+
predicate: ["content"],
|
|
88
|
+
descendants: true,
|
|
89
|
+
isSignal: true
|
|
90
|
+
}],
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
template: "<section [class]=\"sheetClass\" (pointerdown)=\"onPointerDown($event)\">\n <span aria-hidden=\"true\" class=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-border\"></span>\n <header class=\"flex shrink-0 items-center gap-3 ps-4 pe-2\">\n <span class=\"min-w-0 flex-1 truncate text-base font-semibold\">{{ data.title() }}</span>\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n size=\"small\"\n tabindex=\"-1\"\n class=\"min-h-11 min-w-11 shrink-0\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().close\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </header>\n <div #content class=\"flex min-h-0 flex-1 flex-col\">\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n </div>\n</section>\n",
|
|
93
|
+
dependencies: [
|
|
94
|
+
{
|
|
95
|
+
kind: "directive",
|
|
96
|
+
type: ButtonDirective,
|
|
97
|
+
selector: "button[monaButton]",
|
|
98
|
+
inputs: [
|
|
99
|
+
"aria-haspopup",
|
|
100
|
+
"disabled",
|
|
101
|
+
"iconOnly",
|
|
102
|
+
"loading",
|
|
103
|
+
"look",
|
|
104
|
+
"rounded",
|
|
105
|
+
"selected",
|
|
106
|
+
"size",
|
|
107
|
+
"tabindex",
|
|
108
|
+
"toggleable",
|
|
109
|
+
"type",
|
|
110
|
+
"class",
|
|
111
|
+
"value"
|
|
112
|
+
],
|
|
113
|
+
outputs: ["lookChange", "selectedChange"]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
kind: "component",
|
|
117
|
+
type: LucideX,
|
|
118
|
+
selector: "svg[lucideX]"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
kind: "directive",
|
|
122
|
+
type: NgTemplateOutlet,
|
|
123
|
+
selector: "[ngTemplateOutlet]",
|
|
124
|
+
inputs: [
|
|
125
|
+
"ngTemplateOutletContext",
|
|
126
|
+
"ngTemplateOutlet",
|
|
127
|
+
"ngTemplateOutletInjector"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
135
|
+
minVersion: "12.0.0",
|
|
136
|
+
version: "22.2.6",
|
|
137
|
+
ngImport: i0,
|
|
138
|
+
type: DropdownSheetComponent,
|
|
139
|
+
decorators: [{
|
|
140
|
+
type: Component,
|
|
141
|
+
args: [{
|
|
142
|
+
selector: "mona-dropdown-sheet",
|
|
143
|
+
imports: [
|
|
144
|
+
ButtonDirective,
|
|
145
|
+
LucideX,
|
|
146
|
+
NgTemplateOutlet
|
|
147
|
+
],
|
|
148
|
+
host: { class: "contents max-h-[inherit]" },
|
|
149
|
+
template: "<section [class]=\"sheetClass\" (pointerdown)=\"onPointerDown($event)\">\n <span aria-hidden=\"true\" class=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-border\"></span>\n <header class=\"flex shrink-0 items-center gap-3 ps-4 pe-2\">\n <span class=\"min-w-0 flex-1 truncate text-base font-semibold\">{{ data.title() }}</span>\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n size=\"small\"\n tabindex=\"-1\"\n class=\"min-h-11 min-w-11 shrink-0\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().close\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </header>\n <div #content class=\"flex min-h-0 flex-1 flex-col\">\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n </div>\n</section>\n"
|
|
150
|
+
}]
|
|
151
|
+
}],
|
|
152
|
+
propDecorators: { content: [{
|
|
153
|
+
type: i0.ViewChild,
|
|
154
|
+
args: ["content", { isSignal: true }]
|
|
155
|
+
}] }
|
|
156
|
+
});
|
|
157
|
+
var DropdownTreePopupComponent = class DropdownTreePopupComponent {
|
|
158
|
+
#announcer;
|
|
159
|
+
#i18n;
|
|
160
|
+
constructor() {
|
|
161
|
+
this.#announcer = injectLiveAnnouncer();
|
|
162
|
+
this.#i18n = inject(MonaI18nService);
|
|
163
|
+
this.activeDescendant = computed(() => {
|
|
164
|
+
const node = this.treeService.navigatedNode();
|
|
165
|
+
return node ? this.treeService.getNodeElementId(node.uid) : null;
|
|
166
|
+
}, ...ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []);
|
|
167
|
+
this.empty = computed(() => this.treeService.viewNodeSet().isEmpty(), ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
|
|
168
|
+
this.emptyText = computed(() => this.treeService.isTreeFiltered() ? this.messages().noMatches : this.messages().noData, ...ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []);
|
|
169
|
+
this.filterAriaLabel = computed(() => {
|
|
170
|
+
const name = this.ariaLabel().trim();
|
|
171
|
+
return name ? this.messages().filterLabel(name) : this.messages().filterTree;
|
|
172
|
+
}, ...ngDevMode ? [{ debugName: "filterAriaLabel" }] : /* istanbul ignore next */ []);
|
|
173
|
+
this.messages = this.#i18n.componentMessages("treeView", TREE_DEFAULT_MESSAGES);
|
|
174
|
+
this.noDataId = computed(() => `${this.treeId()}-no-data`, ...ngDevMode ? [{ debugName: "noDataId" }] : /* istanbul ignore next */ []);
|
|
175
|
+
this.treeService = inject(TreeService);
|
|
176
|
+
this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
177
|
+
this.ariaLabelledBy = input("", ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
|
|
178
|
+
this.footerTemplate = input(null, ...ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []);
|
|
179
|
+
this.headerTemplate = input(null, ...ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []);
|
|
180
|
+
this.itemTemplate = input(null, ...ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []);
|
|
181
|
+
this.noDataTemplate = input(null, ...ngDevMode ? [{ debugName: "noDataTemplate" }] : /* istanbul ignore next */ []);
|
|
182
|
+
this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
|
|
183
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
184
|
+
this.treeId = input.required(...ngDevMode ? [{ debugName: "treeId" }] : /* istanbul ignore next */ []);
|
|
185
|
+
let opening = true;
|
|
186
|
+
effect(() => {
|
|
187
|
+
const filterText = this.treeService.filterText();
|
|
188
|
+
const matchCount = this.treeService.matchCount();
|
|
189
|
+
untracked(() => {
|
|
190
|
+
if (opening) {
|
|
191
|
+
opening = false;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (!filterText) return;
|
|
195
|
+
const messages = this.messages();
|
|
196
|
+
this.#announcer.announce(matchCount === 0 ? messages.noMatches : messages.results(matchCount), "polite");
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
onFilterChange(event) {
|
|
201
|
+
this.treeService.filterChange$.next(event);
|
|
202
|
+
if (!event.isDefaultPrevented()) this.treeService.filter$.next(event.filter);
|
|
203
|
+
}
|
|
204
|
+
onPointerDown(event) {
|
|
205
|
+
if (event.target?.tagName !== "INPUT") event.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
static {
|
|
208
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
209
|
+
minVersion: "12.0.0",
|
|
210
|
+
version: "22.2.6",
|
|
211
|
+
ngImport: i0,
|
|
212
|
+
type: DropdownTreePopupComponent,
|
|
213
|
+
deps: [],
|
|
214
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
static {
|
|
218
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
219
|
+
minVersion: "17.0.0",
|
|
220
|
+
version: "22.2.6",
|
|
221
|
+
type: DropdownTreePopupComponent,
|
|
222
|
+
isStandalone: true,
|
|
223
|
+
selector: "mona-dropdown-tree-popup",
|
|
224
|
+
inputs: {
|
|
225
|
+
ariaLabel: {
|
|
226
|
+
classPropertyName: "ariaLabel",
|
|
227
|
+
publicName: "ariaLabel",
|
|
228
|
+
isSignal: true,
|
|
229
|
+
isRequired: false,
|
|
230
|
+
transformFunction: null
|
|
231
|
+
},
|
|
232
|
+
ariaLabelledBy: {
|
|
233
|
+
classPropertyName: "ariaLabelledBy",
|
|
234
|
+
publicName: "ariaLabelledBy",
|
|
235
|
+
isSignal: true,
|
|
236
|
+
isRequired: false,
|
|
237
|
+
transformFunction: null
|
|
238
|
+
},
|
|
239
|
+
footerTemplate: {
|
|
240
|
+
classPropertyName: "footerTemplate",
|
|
241
|
+
publicName: "footerTemplate",
|
|
242
|
+
isSignal: true,
|
|
243
|
+
isRequired: false,
|
|
244
|
+
transformFunction: null
|
|
245
|
+
},
|
|
246
|
+
headerTemplate: {
|
|
247
|
+
classPropertyName: "headerTemplate",
|
|
248
|
+
publicName: "headerTemplate",
|
|
249
|
+
isSignal: true,
|
|
250
|
+
isRequired: false,
|
|
251
|
+
transformFunction: null
|
|
252
|
+
},
|
|
253
|
+
itemTemplate: {
|
|
254
|
+
classPropertyName: "itemTemplate",
|
|
255
|
+
publicName: "itemTemplate",
|
|
256
|
+
isSignal: true,
|
|
257
|
+
isRequired: false,
|
|
258
|
+
transformFunction: null
|
|
259
|
+
},
|
|
260
|
+
noDataTemplate: {
|
|
261
|
+
classPropertyName: "noDataTemplate",
|
|
262
|
+
publicName: "noDataTemplate",
|
|
263
|
+
isSignal: true,
|
|
264
|
+
isRequired: false,
|
|
265
|
+
transformFunction: null
|
|
266
|
+
},
|
|
267
|
+
popupClass: {
|
|
268
|
+
classPropertyName: "popupClass",
|
|
269
|
+
publicName: "popupClass",
|
|
270
|
+
isSignal: true,
|
|
271
|
+
isRequired: false,
|
|
272
|
+
transformFunction: null
|
|
273
|
+
},
|
|
274
|
+
size: {
|
|
275
|
+
classPropertyName: "size",
|
|
276
|
+
publicName: "size",
|
|
277
|
+
isSignal: true,
|
|
278
|
+
isRequired: false,
|
|
279
|
+
transformFunction: null
|
|
280
|
+
},
|
|
281
|
+
treeId: {
|
|
282
|
+
classPropertyName: "treeId",
|
|
283
|
+
publicName: "treeId",
|
|
284
|
+
isSignal: true,
|
|
285
|
+
isRequired: true,
|
|
286
|
+
transformFunction: null
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
host: { classAttribute: "contents" },
|
|
290
|
+
ngImport: i0,
|
|
291
|
+
template: "<div [class]=\"popupClass()\" (pointerdown)=\"onPointerDown($event)\">\n @if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n }\n @if (treeService.filterableOptions().enabled) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"treeService.filterText()\"\n [debounce]=\"treeService.filterableOptions().debounce\"\n [placeholder]=\"treeService.filterPlaceholder()\"\n [ariaLabel]=\"filterAriaLabel()\"\n [controls]=\"treeId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n }\n <!-- An empty tree keeps its named tree element, lying over the \"No data\" or \"No matching items\" text that describes it. -->\n <div class=\"relative min-h-0 flex-1 overflow-auto [scrollbar-width:thin] [&>mona-tree]:text-[length:inherit]\">\n @if (empty()) {\n @if (noDataTemplate()) {\n <div [id]=\"noDataId()\" class=\"contents\">\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </div>\n } @else {\n <mona-placeholder\n [id]=\"noDataId()\"\n [text]=\"emptyText()\"\n class=\"flex w-full items-center justify-center py-4\"></mona-placeholder>\n }\n }\n <mona-tree\n [id]=\"treeId()\"\n [focusable]=\"false\"\n [class.absolute]=\"empty()\"\n [class.inset-0]=\"empty()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [ariaDescribedBy]=\"empty() ? noDataId() : ''\">\n @if (itemTemplate()) {\n <ng-template monaTreeNodeTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n </mona-tree>\n </div>\n @if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n }\n</div>\n",
|
|
292
|
+
dependencies: [
|
|
293
|
+
{
|
|
294
|
+
kind: "component",
|
|
295
|
+
type: FilterInputComponent,
|
|
296
|
+
selector: "mona-filter-input",
|
|
297
|
+
inputs: [
|
|
298
|
+
"activeDescendant",
|
|
299
|
+
"ariaControls",
|
|
300
|
+
"ariaLabel",
|
|
301
|
+
"autoFocus",
|
|
302
|
+
"controls",
|
|
303
|
+
"debounce",
|
|
304
|
+
"filter",
|
|
305
|
+
"placeholder",
|
|
306
|
+
"size"
|
|
307
|
+
],
|
|
308
|
+
outputs: [
|
|
309
|
+
"filterChange",
|
|
310
|
+
"inputBlur",
|
|
311
|
+
"inputFocus"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
kind: "directive",
|
|
316
|
+
type: NgTemplateOutlet,
|
|
317
|
+
selector: "[ngTemplateOutlet]",
|
|
318
|
+
inputs: [
|
|
319
|
+
"ngTemplateOutletContext",
|
|
320
|
+
"ngTemplateOutlet",
|
|
321
|
+
"ngTemplateOutletInjector"
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
kind: "component",
|
|
326
|
+
type: PlaceholderComponent,
|
|
327
|
+
selector: "mona-placeholder",
|
|
328
|
+
inputs: ["text", "class"]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
kind: "component",
|
|
332
|
+
type: TreeComponent,
|
|
333
|
+
selector: "mona-tree",
|
|
334
|
+
inputs: [
|
|
335
|
+
"ariaDescribedBy",
|
|
336
|
+
"ariaLabel",
|
|
337
|
+
"ariaLabelledBy",
|
|
338
|
+
"data",
|
|
339
|
+
"focusable"
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
kind: "directive",
|
|
344
|
+
type: TreeNodeTemplateDirective,
|
|
345
|
+
selector: "ng-template[monaTreeNodeTemplate]"
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
352
|
+
minVersion: "12.0.0",
|
|
353
|
+
version: "22.2.6",
|
|
354
|
+
ngImport: i0,
|
|
355
|
+
type: DropdownTreePopupComponent,
|
|
356
|
+
decorators: [{
|
|
357
|
+
type: Component,
|
|
358
|
+
args: [{
|
|
359
|
+
selector: "mona-dropdown-tree-popup",
|
|
360
|
+
imports: [
|
|
361
|
+
FilterInputComponent,
|
|
362
|
+
NgTemplateOutlet,
|
|
363
|
+
PlaceholderComponent,
|
|
364
|
+
TreeComponent,
|
|
365
|
+
TreeNodeTemplateDirective
|
|
366
|
+
],
|
|
367
|
+
host: { class: "contents" },
|
|
368
|
+
template: "<div [class]=\"popupClass()\" (pointerdown)=\"onPointerDown($event)\">\n @if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate() ?? null\"></ng-container>\n }\n @if (treeService.filterableOptions().enabled) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"treeService.filterText()\"\n [debounce]=\"treeService.filterableOptions().debounce\"\n [placeholder]=\"treeService.filterPlaceholder()\"\n [ariaLabel]=\"filterAriaLabel()\"\n [controls]=\"treeId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n }\n <!-- An empty tree keeps its named tree element, lying over the \"No data\" or \"No matching items\" text that describes it. -->\n <div class=\"relative min-h-0 flex-1 overflow-auto [scrollbar-width:thin] [&>mona-tree]:text-[length:inherit]\">\n @if (empty()) {\n @if (noDataTemplate()) {\n <div [id]=\"noDataId()\" class=\"contents\">\n <ng-container [ngTemplateOutlet]=\"noDataTemplate() ?? null\"></ng-container>\n </div>\n } @else {\n <mona-placeholder\n [id]=\"noDataId()\"\n [text]=\"emptyText()\"\n class=\"flex w-full items-center justify-center py-4\"></mona-placeholder>\n }\n }\n <mona-tree\n [id]=\"treeId()\"\n [focusable]=\"false\"\n [class.absolute]=\"empty()\"\n [class.inset-0]=\"empty()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [ariaDescribedBy]=\"empty() ? noDataId() : ''\">\n @if (itemTemplate()) {\n <ng-template monaTreeNodeTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n </mona-tree>\n </div>\n @if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate() ?? null\"></ng-container>\n }\n</div>\n"
|
|
369
|
+
}]
|
|
370
|
+
}],
|
|
371
|
+
ctorParameters: () => [],
|
|
372
|
+
propDecorators: {
|
|
373
|
+
ariaLabel: [{
|
|
374
|
+
type: i0.Input,
|
|
375
|
+
args: [{
|
|
376
|
+
isSignal: true,
|
|
377
|
+
alias: "ariaLabel",
|
|
378
|
+
required: false
|
|
379
|
+
}]
|
|
380
|
+
}],
|
|
381
|
+
ariaLabelledBy: [{
|
|
382
|
+
type: i0.Input,
|
|
383
|
+
args: [{
|
|
384
|
+
isSignal: true,
|
|
385
|
+
alias: "ariaLabelledBy",
|
|
386
|
+
required: false
|
|
387
|
+
}]
|
|
388
|
+
}],
|
|
389
|
+
footerTemplate: [{
|
|
390
|
+
type: i0.Input,
|
|
391
|
+
args: [{
|
|
392
|
+
isSignal: true,
|
|
393
|
+
alias: "footerTemplate",
|
|
394
|
+
required: false
|
|
395
|
+
}]
|
|
396
|
+
}],
|
|
397
|
+
headerTemplate: [{
|
|
398
|
+
type: i0.Input,
|
|
399
|
+
args: [{
|
|
400
|
+
isSignal: true,
|
|
401
|
+
alias: "headerTemplate",
|
|
402
|
+
required: false
|
|
403
|
+
}]
|
|
404
|
+
}],
|
|
405
|
+
itemTemplate: [{
|
|
406
|
+
type: i0.Input,
|
|
407
|
+
args: [{
|
|
408
|
+
isSignal: true,
|
|
409
|
+
alias: "itemTemplate",
|
|
410
|
+
required: false
|
|
411
|
+
}]
|
|
412
|
+
}],
|
|
413
|
+
noDataTemplate: [{
|
|
414
|
+
type: i0.Input,
|
|
415
|
+
args: [{
|
|
416
|
+
isSignal: true,
|
|
417
|
+
alias: "noDataTemplate",
|
|
418
|
+
required: false
|
|
419
|
+
}]
|
|
420
|
+
}],
|
|
421
|
+
popupClass: [{
|
|
422
|
+
type: i0.Input,
|
|
423
|
+
args: [{
|
|
424
|
+
isSignal: true,
|
|
425
|
+
alias: "popupClass",
|
|
426
|
+
required: false
|
|
427
|
+
}]
|
|
428
|
+
}],
|
|
429
|
+
size: [{
|
|
430
|
+
type: i0.Input,
|
|
431
|
+
args: [{
|
|
432
|
+
isSignal: true,
|
|
433
|
+
alias: "size",
|
|
434
|
+
required: false
|
|
435
|
+
}]
|
|
436
|
+
}],
|
|
437
|
+
treeId: [{
|
|
438
|
+
type: i0.Input,
|
|
439
|
+
args: [{
|
|
440
|
+
isSignal: true,
|
|
441
|
+
alias: "treeId",
|
|
442
|
+
required: true
|
|
443
|
+
}]
|
|
444
|
+
}]
|
|
445
|
+
}
|
|
446
|
+
});
|
|
16
447
|
var DropdownFilterableDirective = class DropdownFilterableDirective {
|
|
17
448
|
#defaultOptions;
|
|
18
449
|
#destroyRef;
|
|
19
450
|
#listService;
|
|
451
|
+
#treeService;
|
|
20
452
|
constructor() {
|
|
21
453
|
this.#defaultOptions = {
|
|
22
454
|
enabled: true,
|
|
@@ -25,7 +457,8 @@ var DropdownFilterableDirective = class DropdownFilterableDirective {
|
|
|
25
457
|
caseSensitive: false
|
|
26
458
|
};
|
|
27
459
|
this.#destroyRef = inject(DestroyRef);
|
|
28
|
-
this.#listService = inject(ListService);
|
|
460
|
+
this.#listService = inject(ListService, { optional: true });
|
|
461
|
+
this.#treeService = inject(TreeService, { optional: true });
|
|
29
462
|
this.filter = input("", ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
|
|
30
463
|
this.filterChange = output();
|
|
31
464
|
this.filterPlaceholder = input("", ...ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []);
|
|
@@ -35,25 +468,32 @@ var DropdownFilterableDirective = class DropdownFilterableDirective {
|
|
|
35
468
|
});
|
|
36
469
|
effect(() => {
|
|
37
470
|
const filter = this.filter();
|
|
38
|
-
untracked(() =>
|
|
471
|
+
untracked(() => {
|
|
472
|
+
this.#listService?.setFilter(filter);
|
|
473
|
+
this.#treeService?.filter$.next(filter);
|
|
474
|
+
});
|
|
39
475
|
});
|
|
40
476
|
effect(() => {
|
|
41
477
|
const filterPlaceholder = this.filterPlaceholder();
|
|
42
|
-
untracked(() =>
|
|
478
|
+
untracked(() => {
|
|
479
|
+
this.#listService?.setFilterPlaceholder(filterPlaceholder);
|
|
480
|
+
this.#treeService?.filterPlaceholder.set(filterPlaceholder);
|
|
481
|
+
});
|
|
43
482
|
});
|
|
44
483
|
effect(() => {
|
|
45
484
|
const options = this.options();
|
|
46
485
|
untracked(() => {
|
|
47
|
-
|
|
48
|
-
else this.#listService.setFilterableOptions({
|
|
486
|
+
const filterableOptions = options === "" ? this.#defaultOptions : {
|
|
49
487
|
...this.#defaultOptions,
|
|
50
488
|
...options,
|
|
51
489
|
enabled: options.enabled ?? this.#defaultOptions.enabled
|
|
52
|
-
}
|
|
490
|
+
};
|
|
491
|
+
this.#listService?.setFilterableOptions(filterableOptions);
|
|
492
|
+
this.#treeService?.setFilterableOptions(filterableOptions);
|
|
53
493
|
});
|
|
54
494
|
});
|
|
55
495
|
afterNextRender({ read: () => {
|
|
56
|
-
this.#listService
|
|
496
|
+
(this.#listService?.filterChange$ ?? this.#treeService?.filterChange$)?.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((filter) => {
|
|
57
497
|
this.filterChange.emit(filter);
|
|
58
498
|
});
|
|
59
499
|
} });
|
|
@@ -74,7 +514,7 @@ var DropdownFilterableDirective = class DropdownFilterableDirective {
|
|
|
74
514
|
version: "22.2.6",
|
|
75
515
|
type: DropdownFilterableDirective,
|
|
76
516
|
isStandalone: true,
|
|
77
|
-
selector: "\n mona-auto-complete[monaDropDownFilterable],\n mona-dropdown-list[monaDropDownFilterable],\n mona-combo-box[monaDropDownFilterable],\n mona-multi-select[monaDropDownFilterable]\n ",
|
|
517
|
+
selector: "\n mona-auto-complete[monaDropDownFilterable],\n mona-dropdown-list[monaDropDownFilterable],\n mona-combo-box[monaDropDownFilterable],\n mona-dropdown-tree[monaDropDownFilterable],\n mona-multi-select[monaDropDownFilterable],\n mona-multi-select-tree[monaDropDownFilterable]\n ",
|
|
78
518
|
inputs: {
|
|
79
519
|
filter: {
|
|
80
520
|
classPropertyName: "filter",
|
|
@@ -114,7 +554,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
114
554
|
mona-auto-complete[monaDropDownFilterable],
|
|
115
555
|
mona-dropdown-list[monaDropDownFilterable],
|
|
116
556
|
mona-combo-box[monaDropDownFilterable],
|
|
117
|
-
mona-
|
|
557
|
+
mona-dropdown-tree[monaDropDownFilterable],
|
|
558
|
+
mona-multi-select[monaDropDownFilterable],
|
|
559
|
+
mona-multi-select-tree[monaDropDownFilterable]
|
|
118
560
|
` }]
|
|
119
561
|
}],
|
|
120
562
|
ctorParameters: () => [],
|
|
@@ -166,7 +608,7 @@ var DropdownFooterTemplateDirective = class DropdownFooterTemplateDirective {
|
|
|
166
608
|
version: "22.2.6",
|
|
167
609
|
type: DropdownFooterTemplateDirective,
|
|
168
610
|
isStandalone: true,
|
|
169
|
-
selector: "\n ng-template[monaDropDownFooterTemplate],\n ng-template[monaAutoCompleteFooterTemplate],\n ng-template[monaDropDownListFooterTemplate],\n ng-template[monaDropDownTreeFooterTemplate],\n ng-template[monaComboBoxFooterTemplate],\n ng-template[monaMultiSelectFooterTemplate]\n ",
|
|
611
|
+
selector: "\n ng-template[monaDropDownFooterTemplate],\n ng-template[monaAutoCompleteFooterTemplate],\n ng-template[monaDropDownListFooterTemplate],\n ng-template[monaDropDownTreeFooterTemplate],\n ng-template[monaComboBoxFooterTemplate],\n ng-template[monaMultiSelectFooterTemplate],\n ng-template[monaMultiSelectTreeFooterTemplate]\n ",
|
|
170
612
|
ngImport: i0
|
|
171
613
|
});
|
|
172
614
|
}
|
|
@@ -184,7 +626,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
184
626
|
ng-template[monaDropDownListFooterTemplate],
|
|
185
627
|
ng-template[monaDropDownTreeFooterTemplate],
|
|
186
628
|
ng-template[monaComboBoxFooterTemplate],
|
|
187
|
-
ng-template[monaMultiSelectFooterTemplate]
|
|
629
|
+
ng-template[monaMultiSelectFooterTemplate],
|
|
630
|
+
ng-template[monaMultiSelectTreeFooterTemplate]
|
|
188
631
|
` }]
|
|
189
632
|
}]
|
|
190
633
|
});
|
|
@@ -344,7 +787,7 @@ var DropdownHeaderTemplateDirective = class DropdownHeaderTemplateDirective {
|
|
|
344
787
|
version: "22.2.6",
|
|
345
788
|
type: DropdownHeaderTemplateDirective,
|
|
346
789
|
isStandalone: true,
|
|
347
|
-
selector: "\n ng-template[monaDropDownHeaderTemplate],\n ng-template[monaAutoCompleteHeaderTemplate],\n ng-template[monaDropDownListHeaderTemplate],\n ng-template[monaDropDownTreeHeaderTemplate],\n ng-template[monaComboBoxHeaderTemplate],\n ng-template[monaMultiSelectHeaderTemplate]\n
|
|
790
|
+
selector: "\n ng-template[monaDropDownHeaderTemplate],\n ng-template[monaAutoCompleteHeaderTemplate],\n ng-template[monaDropDownListHeaderTemplate],\n ng-template[monaDropDownTreeHeaderTemplate],\n ng-template[monaComboBoxHeaderTemplate],\n ng-template[monaMultiSelectHeaderTemplate],\n ng-template[monaMultiSelectTreeHeaderTemplate]\n ",
|
|
348
791
|
ngImport: i0
|
|
349
792
|
});
|
|
350
793
|
}
|
|
@@ -362,8 +805,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
362
805
|
ng-template[monaDropDownListHeaderTemplate],
|
|
363
806
|
ng-template[monaDropDownTreeHeaderTemplate],
|
|
364
807
|
ng-template[monaComboBoxHeaderTemplate],
|
|
365
|
-
ng-template[monaMultiSelectHeaderTemplate]
|
|
366
|
-
|
|
808
|
+
ng-template[monaMultiSelectHeaderTemplate],
|
|
809
|
+
ng-template[monaMultiSelectTreeHeaderTemplate]
|
|
810
|
+
` }]
|
|
367
811
|
}]
|
|
368
812
|
});
|
|
369
813
|
var DropdownItemTemplateDirective = class DropdownItemTemplateDirective {
|
|
@@ -383,7 +827,7 @@ var DropdownItemTemplateDirective = class DropdownItemTemplateDirective {
|
|
|
383
827
|
version: "22.2.6",
|
|
384
828
|
type: DropdownItemTemplateDirective,
|
|
385
829
|
isStandalone: true,
|
|
386
|
-
selector: "\n ng-template[monaDropDownItemTemplate],\n ng-template[monaAutoCompleteItemTemplate],\n ng-template[monaDropDownListItemTemplate],\n ng-template[monaComboBoxItemTemplate],\n ng-template[monaMultiSelectItemTemplate]\n ",
|
|
830
|
+
selector: "\n ng-template[monaDropDownItemTemplate],\n ng-template[monaAutoCompleteItemTemplate],\n ng-template[monaDropDownListItemTemplate],\n ng-template[monaDropDownTreeItemTemplate],\n ng-template[monaComboBoxItemTemplate],\n ng-template[monaMultiSelectItemTemplate],\n ng-template[monaMultiSelectTreeItemTemplate]\n ",
|
|
387
831
|
ngImport: i0
|
|
388
832
|
});
|
|
389
833
|
}
|
|
@@ -399,8 +843,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
399
843
|
ng-template[monaDropDownItemTemplate],
|
|
400
844
|
ng-template[monaAutoCompleteItemTemplate],
|
|
401
845
|
ng-template[monaDropDownListItemTemplate],
|
|
846
|
+
ng-template[monaDropDownTreeItemTemplate],
|
|
402
847
|
ng-template[monaComboBoxItemTemplate],
|
|
403
|
-
ng-template[monaMultiSelectItemTemplate]
|
|
848
|
+
ng-template[monaMultiSelectItemTemplate],
|
|
849
|
+
ng-template[monaMultiSelectTreeItemTemplate]
|
|
404
850
|
` }]
|
|
405
851
|
}]
|
|
406
852
|
});
|
|
@@ -421,7 +867,7 @@ var DropdownNoDataTemplateDirective = class DropdownNoDataTemplateDirective {
|
|
|
421
867
|
version: "22.2.6",
|
|
422
868
|
type: DropdownNoDataTemplateDirective,
|
|
423
869
|
isStandalone: true,
|
|
424
|
-
selector: "\n ng-template[monaDropDownNoDataTemplate],\n ng-template[monaAutoCompleteNoDataTemplate],\n ng-template[monaDropDownListNoDataTemplate],\n ng-template[monaDropDownTreeNoDataTemplate],\n ng-template[monaComboBoxNoDataTemplate],\n ng-template[monaMultiSelectNoDataTemplate]\n ",
|
|
870
|
+
selector: "\n ng-template[monaDropDownNoDataTemplate],\n ng-template[monaAutoCompleteNoDataTemplate],\n ng-template[monaDropDownListNoDataTemplate],\n ng-template[monaDropDownTreeNoDataTemplate],\n ng-template[monaComboBoxNoDataTemplate],\n ng-template[monaMultiSelectNoDataTemplate],\n ng-template[monaMultiSelectTreeNoDataTemplate]\n ",
|
|
425
871
|
ngImport: i0
|
|
426
872
|
});
|
|
427
873
|
}
|
|
@@ -439,7 +885,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
439
885
|
ng-template[monaDropDownListNoDataTemplate],
|
|
440
886
|
ng-template[monaDropDownTreeNoDataTemplate],
|
|
441
887
|
ng-template[monaComboBoxNoDataTemplate],
|
|
442
|
-
ng-template[monaMultiSelectNoDataTemplate]
|
|
888
|
+
ng-template[monaMultiSelectNoDataTemplate],
|
|
889
|
+
ng-template[monaMultiSelectTreeNoDataTemplate]
|
|
443
890
|
` }]
|
|
444
891
|
}]
|
|
445
892
|
});
|
|
@@ -615,6 +1062,7 @@ var DropdownService = class DropdownService {
|
|
|
615
1062
|
this.popupRef = signal(null, ...ngDevMode ? [{ debugName: "popupRef" }] : /* istanbul ignore next */ []);
|
|
616
1063
|
this.popupTemplate = signal(null, ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
|
|
617
1064
|
this.restoreFocus = signal("auto", ...ngDevMode ? [{ debugName: "restoreFocus" }] : /* istanbul ignore next */ []);
|
|
1065
|
+
this.sheet = signal(false, ...ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []);
|
|
618
1066
|
this.triggerPopupOpen$ = new Subject();
|
|
619
1067
|
this.triggerPopupToggle$ = new Subject();
|
|
620
1068
|
}
|
|
@@ -659,6 +1107,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
659
1107
|
type: DropdownService,
|
|
660
1108
|
decorators: [{ type: Injectable }]
|
|
661
1109
|
});
|
|
1110
|
+
const SMALL_SCREEN_QUERY = "(max-width: 639.98px)";
|
|
1111
|
+
const SHEET_MAX_HEIGHT_RATIO = .85;
|
|
662
1112
|
var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
663
1113
|
#destroyRef = inject(DestroyRef);
|
|
664
1114
|
#document = inject(DOCUMENT);
|
|
@@ -680,32 +1130,8 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
|
680
1130
|
closePopup() {
|
|
681
1131
|
this.#dropdownService.popupRef()?.close();
|
|
682
1132
|
}
|
|
683
|
-
|
|
684
|
-
if (typeof maxHeight === "number") return maxHeight;
|
|
685
|
-
if (maxHeight === "auto" && height === "auto") return "auto";
|
|
686
|
-
if (!maxHeight || maxHeight === "auto") {
|
|
687
|
-
if (!height || height === "auto") return 200;
|
|
688
|
-
return height;
|
|
689
|
-
}
|
|
690
|
-
return maxHeight ?? 200;
|
|
691
|
-
}
|
|
692
|
-
getMinWidth(minWidth, width) {
|
|
693
|
-
if (typeof minWidth === "number") return minWidth;
|
|
694
|
-
if (!minWidth || minWidth === "auto") {
|
|
695
|
-
if (!width || width === "auto") return this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
696
|
-
return width;
|
|
697
|
-
}
|
|
698
|
-
return minWidth ?? this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
699
|
-
}
|
|
700
|
-
openPopup(settings) {
|
|
701
|
-
let popupRef = this.#dropdownService.popupRef();
|
|
702
|
-
if (popupRef || this.#host.disabled() || this.#host.readonly()) return;
|
|
703
|
-
const event = new PreventableEvent("popupOpen");
|
|
704
|
-
this.#host.open.emit(event);
|
|
705
|
-
if (event.isDefaultPrevented()) return;
|
|
706
|
-
const anchor = this.#hostElementRef.nativeElement;
|
|
1133
|
+
createPopup(anchor, content, settings) {
|
|
707
1134
|
const anchorConnectionPoint = settings.anchorConnectionPoint ?? "bottomleft";
|
|
708
|
-
const content = this.#dropdownService.popupTemplate();
|
|
709
1135
|
const closeOnOutsideClick = settings.closeOnOutsideClick ?? true;
|
|
710
1136
|
const closeOnScroll = settings.closeOnScroll ?? true;
|
|
711
1137
|
const hasBackdrop = settings.hasBackdrop ?? false;
|
|
@@ -721,7 +1147,7 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
|
721
1147
|
const width = settings.width ?? (this.#host.popupWidth() || anchor.getBoundingClientRect().width);
|
|
722
1148
|
const withPush = settings.withPush ?? false;
|
|
723
1149
|
const withScrollTracking = settings.withScrollTracking ?? false;
|
|
724
|
-
|
|
1150
|
+
return this.#popupService.create({
|
|
725
1151
|
anchor,
|
|
726
1152
|
anchorConnectionPoint,
|
|
727
1153
|
animation: dropdownPopupAnimation,
|
|
@@ -739,6 +1165,92 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
|
739
1165
|
withPush,
|
|
740
1166
|
withScrollTracking
|
|
741
1167
|
});
|
|
1168
|
+
}
|
|
1169
|
+
createSheet(anchor, content, restoreFocus) {
|
|
1170
|
+
const data = {
|
|
1171
|
+
content,
|
|
1172
|
+
title: computed(() => this.sheetTitle())
|
|
1173
|
+
};
|
|
1174
|
+
const popupRef = this.#popupService.create({
|
|
1175
|
+
anchor,
|
|
1176
|
+
animation: slideFromBottomPopupAnimation,
|
|
1177
|
+
backdropClass: [
|
|
1178
|
+
"fixed",
|
|
1179
|
+
"inset-0",
|
|
1180
|
+
"bg-background/50",
|
|
1181
|
+
"backdrop-blur-xs",
|
|
1182
|
+
"[transition-duration:240ms]!"
|
|
1183
|
+
],
|
|
1184
|
+
blockScroll: true,
|
|
1185
|
+
closeOnBackdropClick: true,
|
|
1186
|
+
closeOnEscape: true,
|
|
1187
|
+
closeOnOutsideClick: false,
|
|
1188
|
+
closeOnScroll: false,
|
|
1189
|
+
content: DropdownSheetComponent,
|
|
1190
|
+
data,
|
|
1191
|
+
hasBackdrop: true,
|
|
1192
|
+
maxHeight: `${SHEET_MAX_HEIGHT_RATIO * 100}dvh`,
|
|
1193
|
+
popupClass: "overflow-clip",
|
|
1194
|
+
popupWrapperClass: "mona-popup-constrain-height",
|
|
1195
|
+
positionStrategy: "global",
|
|
1196
|
+
restoreFocus,
|
|
1197
|
+
width: "100dvw"
|
|
1198
|
+
});
|
|
1199
|
+
this.followVisualViewport(popupRef);
|
|
1200
|
+
return popupRef;
|
|
1201
|
+
}
|
|
1202
|
+
followVisualViewport(popupRef) {
|
|
1203
|
+
const strategy = popupRef.overlayRef.getConfig().positionStrategy;
|
|
1204
|
+
if (typeof strategy?.bottom !== "function" || typeof strategy.left !== "function") return;
|
|
1205
|
+
const view = this.#document.defaultView;
|
|
1206
|
+
const viewport = view?.visualViewport ?? null;
|
|
1207
|
+
const place = () => {
|
|
1208
|
+
const keyboardInset = view && viewport ? Math.max(0, view.innerHeight - viewport.height - viewport.offsetTop) : 0;
|
|
1209
|
+
strategy.bottom?.(`${Math.round(keyboardInset)}px`);
|
|
1210
|
+
strategy.left?.("0px");
|
|
1211
|
+
if (viewport) popupRef.overlayRef.updateSize({ maxHeight: `${Math.round(viewport.height * SHEET_MAX_HEIGHT_RATIO)}px` });
|
|
1212
|
+
popupRef.overlayRef.updatePosition();
|
|
1213
|
+
};
|
|
1214
|
+
place();
|
|
1215
|
+
if (viewport) merge(fromEvent(viewport, "resize"), fromEvent(viewport, "scroll")).pipe(takeUntil(popupRef.closed)).subscribe(place);
|
|
1216
|
+
}
|
|
1217
|
+
getMaxHeight(maxHeight, height) {
|
|
1218
|
+
if (typeof maxHeight === "number") return maxHeight;
|
|
1219
|
+
if (maxHeight === "auto" && height === "auto") return "auto";
|
|
1220
|
+
if (!maxHeight || maxHeight === "auto") {
|
|
1221
|
+
if (!height || height === "auto") return 200;
|
|
1222
|
+
return height;
|
|
1223
|
+
}
|
|
1224
|
+
return maxHeight ?? 200;
|
|
1225
|
+
}
|
|
1226
|
+
getMinWidth(minWidth, width) {
|
|
1227
|
+
if (typeof minWidth === "number") return minWidth;
|
|
1228
|
+
if (!minWidth || minWidth === "auto") {
|
|
1229
|
+
if (!width || width === "auto") return this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
1230
|
+
return width;
|
|
1231
|
+
}
|
|
1232
|
+
return minWidth ?? this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
1233
|
+
}
|
|
1234
|
+
nameOf(element) {
|
|
1235
|
+
if (!element) return "";
|
|
1236
|
+
const textOf = (node) => node?.textContent?.replace(/\s+/g, " ").trim() ?? "";
|
|
1237
|
+
const join = (texts) => Array.from(texts).filter((text) => text.length > 0).join(" ");
|
|
1238
|
+
const labelledBy = join((element.getAttribute("aria-labelledby") ?? "").split(/\s+/).map((id) => id ? textOf(this.#document.getElementById(id)) : ""));
|
|
1239
|
+
const labels = element instanceof HTMLInputElement ? join(Array.from(element.labels ?? [], textOf)) : "";
|
|
1240
|
+
return labelledBy || element.getAttribute("aria-label")?.trim() || labels;
|
|
1241
|
+
}
|
|
1242
|
+
openPopup(settings) {
|
|
1243
|
+
let popupRef = this.#dropdownService.popupRef();
|
|
1244
|
+
if (popupRef || this.#host.disabled() || this.#host.readonly()) return;
|
|
1245
|
+
const event = new PreventableEvent("popupOpen");
|
|
1246
|
+
this.#host.open.emit(event);
|
|
1247
|
+
if (event.isDefaultPrevented()) return;
|
|
1248
|
+
const anchor = this.#hostElementRef.nativeElement;
|
|
1249
|
+
const content = this.#dropdownService.popupTemplate();
|
|
1250
|
+
const restoreFocus = this.#dropdownService.restoreFocus();
|
|
1251
|
+
const sheet = this.opensAsSheet();
|
|
1252
|
+
this.#dropdownService.sheet.set(sheet);
|
|
1253
|
+
popupRef = sheet ? this.createSheet(anchor, content, restoreFocus) : this.createPopup(anchor, content, settings);
|
|
742
1254
|
this.#dropdownService.popupRef.set(popupRef);
|
|
743
1255
|
this.setPopupCloseSubscriptions(popupRef);
|
|
744
1256
|
window.setTimeout(() => {
|
|
@@ -747,6 +1259,10 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
|
747
1259
|
this.#host.opened.emit();
|
|
748
1260
|
});
|
|
749
1261
|
}
|
|
1262
|
+
opensAsSheet() {
|
|
1263
|
+
if (this.#host.adaptiveMode?.() !== "auto") return false;
|
|
1264
|
+
return this.#document.defaultView?.matchMedia?.(SMALL_SCREEN_QUERY).matches ?? false;
|
|
1265
|
+
}
|
|
750
1266
|
setPopupCloseSubscriptions(popupRef) {
|
|
751
1267
|
popupRef.beforeClose.pipe(takeUntil(popupRef.closed)).subscribe((event) => {
|
|
752
1268
|
if (!this.#hostDestroyed) this.#host.close.emit(event);
|
|
@@ -757,10 +1273,17 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
|
|
|
757
1273
|
popupRef.closed.pipe(take(1)).subscribe((event) => {
|
|
758
1274
|
this.#dropdownService.focusCanReturn.set(focusCanReturn(this.#document, this.#hostElementRef.nativeElement, popupRef.overlayRef.overlayElement));
|
|
759
1275
|
this.#dropdownService.popupRef.set(null);
|
|
1276
|
+
this.#dropdownService.sheet.set(false);
|
|
760
1277
|
this.#dropdownService.popupCloseComplete$.next(event);
|
|
761
1278
|
if (!this.#hostDestroyed) this.#host.closed.emit();
|
|
762
1279
|
});
|
|
763
1280
|
}
|
|
1281
|
+
sheetTitle() {
|
|
1282
|
+
const title = this.#host.adaptiveTitle?.().trim();
|
|
1283
|
+
if (title) return title;
|
|
1284
|
+
const host = this.#hostElementRef.nativeElement;
|
|
1285
|
+
return this.nameOf(host) || this.nameOf(host.querySelector("input"));
|
|
1286
|
+
}
|
|
764
1287
|
togglePopup(settings) {
|
|
765
1288
|
if (this.#dropdownService.popupRef()) {
|
|
766
1289
|
this.closePopup();
|
|
@@ -917,14 +1440,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
917
1440
|
}],
|
|
918
1441
|
ctorParameters: () => []
|
|
919
1442
|
});
|
|
920
|
-
function localizeNumber(value, options) {
|
|
921
|
-
return formatNumber(value, "en-US", options);
|
|
922
|
-
}
|
|
923
|
-
const DROPDOWNS_DEFAULT_MESSAGES = {
|
|
924
|
-
itemPosition: (text, position, total) => `${text}, ${localizeNumber(position)} of ${localizeNumber(total)}`,
|
|
925
|
-
noResultsFound: "No results found",
|
|
926
|
-
resultsAvailable: (count) => count === 1 ? `${localizeNumber(count)} result available` : `${localizeNumber(count)} results available`
|
|
927
|
-
};
|
|
928
1443
|
var DropdownLiveRegionDirective = class DropdownLiveRegionDirective {
|
|
929
1444
|
#dropdownService = inject(DropdownService);
|
|
930
1445
|
#i18n = inject(MonaI18nService);
|
|
@@ -1048,6 +1563,156 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1048
1563
|
args: [{ selector: "ng-template[monaDropdownSuffixTemplate]" }]
|
|
1049
1564
|
}]
|
|
1050
1565
|
});
|
|
1566
|
+
var DropdownTreePopupHandlerDirective = class DropdownTreePopupHandlerDirective {
|
|
1567
|
+
#destroyRef = inject(DestroyRef);
|
|
1568
|
+
#direction = injectComponentDirection();
|
|
1569
|
+
#dropdownService = inject(DropdownService);
|
|
1570
|
+
#host = inject(DROPDOWN_POPUP_INPUT_TOKEN);
|
|
1571
|
+
#hostElementRef = inject(ElementRef);
|
|
1572
|
+
#treeService = inject(TreeService);
|
|
1573
|
+
#typeahead$ = new Subject();
|
|
1574
|
+
constructor() {
|
|
1575
|
+
afterNextRender({ read: () => {
|
|
1576
|
+
this.setHostEvents();
|
|
1577
|
+
setupTypeahead(this.#typeahead$).pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((buffer) => {
|
|
1578
|
+
const node = this.#treeService.findNodeByText(buffer);
|
|
1579
|
+
if (node) this.#treeService.navigatedNode.set(node);
|
|
1580
|
+
});
|
|
1581
|
+
} });
|
|
1582
|
+
effect((onCleanup) => {
|
|
1583
|
+
const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
|
|
1584
|
+
if (popupElement == null) return;
|
|
1585
|
+
untracked(() => this.activateCurrentNode());
|
|
1586
|
+
const onKeydown = (event) => this.handleFilterKeydown(event);
|
|
1587
|
+
popupElement.addEventListener("keydown", onKeydown);
|
|
1588
|
+
onCleanup(() => popupElement.removeEventListener("keydown", onKeydown));
|
|
1589
|
+
});
|
|
1590
|
+
effect(() => {
|
|
1591
|
+
const filterText = this.#treeService.filterText();
|
|
1592
|
+
untracked(() => {
|
|
1593
|
+
if (!filterText || this.#dropdownService.popupRef() === null) return;
|
|
1594
|
+
const match = this.#treeService.findFirstMatch();
|
|
1595
|
+
if (match) this.#treeService.navigatedNode.set(match);
|
|
1596
|
+
});
|
|
1597
|
+
});
|
|
1598
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
1599
|
+
this.#treeService.navigatedNode.set(null);
|
|
1600
|
+
this.#treeService.clearFilter();
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
activateCurrentNode() {
|
|
1604
|
+
const treeService = this.#treeService;
|
|
1605
|
+
const node = treeService.selectedNodes().firstOrDefault() ?? TreeService.flatten(treeService.nodeSet()).firstOrDefault((n) => n.checked()) ?? null;
|
|
1606
|
+
if (node === null) {
|
|
1607
|
+
treeService.navigatedNode.set(null);
|
|
1608
|
+
treeService.navigate("first");
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
const ancestors = [];
|
|
1612
|
+
for (let parent = node.parent; parent !== null; parent = parent.parent) ancestors.unshift(parent);
|
|
1613
|
+
for (const ancestor of ancestors) if (!treeService.isExpanded(ancestor)) treeService.setNodeExpand(ancestor, true);
|
|
1614
|
+
treeService.navigatedNode.set(node);
|
|
1615
|
+
}
|
|
1616
|
+
closePopup() {
|
|
1617
|
+
this.#dropdownService.popupRef()?.close();
|
|
1618
|
+
}
|
|
1619
|
+
handleFilterKeydown(event) {
|
|
1620
|
+
const target = event.target;
|
|
1621
|
+
if (event.isComposing || event.keyCode === 229 || !(target instanceof HTMLInputElement) || target.closest("mona-filter-input") === null) return;
|
|
1622
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") this.navigate(event);
|
|
1623
|
+
else if (event.key === "Enter") {
|
|
1624
|
+
event.preventDefault();
|
|
1625
|
+
this.#dropdownService.keydown$.next(event);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
handleHostKeydown(event) {
|
|
1629
|
+
if (event.isComposing || event.keyCode === 229) return;
|
|
1630
|
+
const beforeKeydown = new PreventableEvent("beforeKeydown", event);
|
|
1631
|
+
this.#dropdownService.beforeKeydown$.next(beforeKeydown);
|
|
1632
|
+
if (beforeKeydown.isDefaultPrevented()) return;
|
|
1633
|
+
const popupRef = this.#dropdownService.popupRef();
|
|
1634
|
+
if (event.key === "Escape") {
|
|
1635
|
+
popupRef?.close(new PopupCloseEvent({
|
|
1636
|
+
event,
|
|
1637
|
+
originalEvent: event,
|
|
1638
|
+
via: PopupCloseSource.Escape
|
|
1639
|
+
}));
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
if (event.key === "Tab") {
|
|
1643
|
+
this.closePopup();
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
if (event.altKey && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
1647
|
+
event.preventDefault();
|
|
1648
|
+
if (event.key === "ArrowDown") this.#dropdownService.triggerPopupOpen$.next({});
|
|
1649
|
+
else this.closePopup();
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
const opening = event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ";
|
|
1653
|
+
if (popupRef === null) {
|
|
1654
|
+
if (opening) {
|
|
1655
|
+
event.preventDefault();
|
|
1656
|
+
this.#dropdownService.triggerPopupOpen$.next({});
|
|
1657
|
+
} else this.#dropdownService.keydown$.next(event);
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1661
|
+
event.preventDefault();
|
|
1662
|
+
this.#dropdownService.keydown$.next(event);
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
if (!this.navigate(event)) this.#dropdownService.keydown$.next(event);
|
|
1666
|
+
}
|
|
1667
|
+
navigate(event) {
|
|
1668
|
+
return handleTreeNavigationKey(event, {
|
|
1669
|
+
rtl: this.#direction() === "rtl",
|
|
1670
|
+
treeService: this.#treeService,
|
|
1671
|
+
typeahead: (key) => this.#typeahead$.next(key)
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
setHostEvents() {
|
|
1675
|
+
const host = this.#hostElementRef.nativeElement;
|
|
1676
|
+
const usable = () => !this.#host.disabled() && !this.#host.readonly();
|
|
1677
|
+
fromEvent(host, "click").pipe(takeUntilDestroyed(this.#destroyRef), filter((event) => usable() && event.target?.tagName !== "INPUT")).subscribe(() => this.#dropdownService.triggerPopupToggle$.next({}));
|
|
1678
|
+
fromEvent(host, "keydown").pipe(takeUntilDestroyed(this.#destroyRef), filter(usable)).subscribe((event) => this.handleHostKeydown(event));
|
|
1679
|
+
}
|
|
1680
|
+
static {
|
|
1681
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1682
|
+
minVersion: "12.0.0",
|
|
1683
|
+
version: "22.2.6",
|
|
1684
|
+
ngImport: i0,
|
|
1685
|
+
type: DropdownTreePopupHandlerDirective,
|
|
1686
|
+
deps: [],
|
|
1687
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
static {
|
|
1691
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
1692
|
+
minVersion: "14.0.0",
|
|
1693
|
+
version: "22.2.6",
|
|
1694
|
+
type: DropdownTreePopupHandlerDirective,
|
|
1695
|
+
isStandalone: true,
|
|
1696
|
+
selector: "[monaDropdownTreePopupHandler]",
|
|
1697
|
+
hostDirectives: [{ directive: DropdownPopupHandlerDirective }],
|
|
1698
|
+
ngImport: i0
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1703
|
+
minVersion: "12.0.0",
|
|
1704
|
+
version: "22.2.6",
|
|
1705
|
+
ngImport: i0,
|
|
1706
|
+
type: DropdownTreePopupHandlerDirective,
|
|
1707
|
+
decorators: [{
|
|
1708
|
+
type: Directive,
|
|
1709
|
+
args: [{
|
|
1710
|
+
selector: "[monaDropdownTreePopupHandler]",
|
|
1711
|
+
hostDirectives: [DropdownPopupHandlerDirective]
|
|
1712
|
+
}]
|
|
1713
|
+
}],
|
|
1714
|
+
ctorParameters: () => []
|
|
1715
|
+
});
|
|
1051
1716
|
const dropdownPopupThemeVariants = cva(`
|
|
1052
1717
|
h-full max-h-64 overflow-auto
|
|
1053
1718
|
[scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
|
|
@@ -1075,6 +1740,11 @@ const dropdownPopupThemeVariants = cva(`
|
|
|
1075
1740
|
size: "medium"
|
|
1076
1741
|
}
|
|
1077
1742
|
});
|
|
1078
|
-
|
|
1743
|
+
function readDropdownField(item, field) {
|
|
1744
|
+
if (!field) return item;
|
|
1745
|
+
if (typeof field === "string") return item?.[field];
|
|
1746
|
+
return field(item);
|
|
1747
|
+
}
|
|
1748
|
+
export { DROPDOWNS_DEFAULT_MESSAGES, DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownDataInputToken, DropdownFilterableDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownGroupableDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPopupHandlerDirective, DropdownPrefixTemplateDirective, DropdownService, DropdownSheetComponent, DropdownSuffixTemplateDirective, DropdownTreePopupComponent, DropdownTreePopupHandlerDirective, DropdownVirtualScrollDirective, dropdownPopupThemeVariants, dropdownSheetPickerClasses, dropdownSheetSurfaceClasses, dropdownSheetThemeVariants, readDropdownField };
|
|
1079
1749
|
|
|
1080
1750
|
//# sourceMappingURL=nanahoshi-mona-ui-dropdowns.mjs.map
|