@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,701 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, DestroyRef, input, output, effect, untracked, afterNextRender, Directive, Injectable, signal, ElementRef, computed } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { ListService } from '@nanahoshi/mona-ui/internal/list';
|
|
5
|
+
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
6
|
+
import { Subject, takeUntil, take, filter, switchMap, fromEvent } from 'rxjs';
|
|
7
|
+
import { ConnectionPositionPair } from '@angular/cdk/overlay';
|
|
8
|
+
import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
10
|
+
|
|
11
|
+
const DropdownDataInputToken = new InjectionToken("DROPDOWN_DATA_INPUT");
|
|
12
|
+
|
|
13
|
+
const DropdownPopupInputToken = new InjectionToken("DROPDOWN_POPUP_INPUT");
|
|
14
|
+
|
|
15
|
+
class DropdownFilterableDirective {
|
|
16
|
+
#defaultOptions;
|
|
17
|
+
#destroyRef;
|
|
18
|
+
#listService;
|
|
19
|
+
constructor() {
|
|
20
|
+
this.#defaultOptions = {
|
|
21
|
+
enabled: true,
|
|
22
|
+
operator: "contains",
|
|
23
|
+
debounce: 0,
|
|
24
|
+
caseSensitive: false
|
|
25
|
+
};
|
|
26
|
+
this.#destroyRef = inject(DestroyRef);
|
|
27
|
+
this.#listService = inject(ListService);
|
|
28
|
+
this.filter = input("", /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
30
|
+
this.filterChange = output();
|
|
31
|
+
this.filterPlaceholder = input("", /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
|
|
33
|
+
this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaDropDownFilterable" });
|
|
34
|
+
effect(() => {
|
|
35
|
+
const filter = this.filter();
|
|
36
|
+
untracked(() => this.#listService.setFilter(filter));
|
|
37
|
+
});
|
|
38
|
+
effect(() => {
|
|
39
|
+
const filterPlaceholder = this.filterPlaceholder();
|
|
40
|
+
untracked(() => this.#listService.setFilterPlaceholder(filterPlaceholder));
|
|
41
|
+
});
|
|
42
|
+
effect(() => {
|
|
43
|
+
const options = this.options();
|
|
44
|
+
untracked(() => {
|
|
45
|
+
if (options === "") {
|
|
46
|
+
this.#listService.setFilterableOptions(this.#defaultOptions);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.#listService.setFilterableOptions({
|
|
50
|
+
...this.#defaultOptions,
|
|
51
|
+
...options,
|
|
52
|
+
enabled: options.enabled ?? this.#defaultOptions.enabled
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
afterNextRender({
|
|
58
|
+
read: () => {
|
|
59
|
+
this.#listService.filterChange$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(filter => {
|
|
60
|
+
this.filterChange.emit(filter);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownFilterableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
66
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DropdownFilterableDirective, isStandalone: true, selector: "\n mona-auto-complete[monaDropDownFilterable],\n mona-dropdown-list[monaDropDownFilterable],\n mona-combo-box[monaDropDownFilterable],\n mona-multi-select[monaDropDownFilterable]\n ", inputs: { filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaDropDownFilterable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filterChange: "filterChange" }, ngImport: i0 }); }
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownFilterableDirective, decorators: [{
|
|
69
|
+
type: Directive,
|
|
70
|
+
args: [{
|
|
71
|
+
selector: `
|
|
72
|
+
mona-auto-complete[monaDropDownFilterable],
|
|
73
|
+
mona-dropdown-list[monaDropDownFilterable],
|
|
74
|
+
mona-combo-box[monaDropDownFilterable],
|
|
75
|
+
mona-multi-select[monaDropDownFilterable]
|
|
76
|
+
`
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: () => [], propDecorators: { filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaDropDownFilterable", required: false }] }] } });
|
|
79
|
+
|
|
80
|
+
class DropdownFooterTemplateDirective {
|
|
81
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
82
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownFooterTemplateDirective, isStandalone: true, 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 ", ngImport: i0 }); }
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownFooterTemplateDirective, decorators: [{
|
|
85
|
+
type: Directive,
|
|
86
|
+
args: [{
|
|
87
|
+
selector: `
|
|
88
|
+
ng-template[monaDropDownFooterTemplate],
|
|
89
|
+
ng-template[monaAutoCompleteFooterTemplate],
|
|
90
|
+
ng-template[monaDropDownListFooterTemplate],
|
|
91
|
+
ng-template[monaDropDownTreeFooterTemplate],
|
|
92
|
+
ng-template[monaComboBoxFooterTemplate],
|
|
93
|
+
ng-template[monaMultiSelectFooterTemplate]
|
|
94
|
+
`,
|
|
95
|
+
standalone: true
|
|
96
|
+
}]
|
|
97
|
+
}] });
|
|
98
|
+
|
|
99
|
+
class DropdownGroupHeaderTemplateDirective {
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownGroupHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
101
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownGroupHeaderTemplateDirective, isStandalone: true, selector: "\n ng-template[monaDropDownGroupHeaderTemplate],\n ng-template[monaAutoCompleteGroupHeaderTemplate],\n ng-template[monaDropDownListGroupHeaderTemplate],\n ng-template[monaComboBoxGroupHeaderTemplate],\n ng-template[monaMultiSelectGroupHeaderTemplate]\n ", ngImport: i0 }); }
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownGroupHeaderTemplateDirective, decorators: [{
|
|
104
|
+
type: Directive,
|
|
105
|
+
args: [{
|
|
106
|
+
selector: `
|
|
107
|
+
ng-template[monaDropDownGroupHeaderTemplate],
|
|
108
|
+
ng-template[monaAutoCompleteGroupHeaderTemplate],
|
|
109
|
+
ng-template[monaDropDownListGroupHeaderTemplate],
|
|
110
|
+
ng-template[monaComboBoxGroupHeaderTemplate],
|
|
111
|
+
ng-template[monaMultiSelectGroupHeaderTemplate]
|
|
112
|
+
`,
|
|
113
|
+
standalone: true
|
|
114
|
+
}]
|
|
115
|
+
}] });
|
|
116
|
+
|
|
117
|
+
class DropdownGroupableDirective {
|
|
118
|
+
#defaultOptions;
|
|
119
|
+
#listService;
|
|
120
|
+
constructor() {
|
|
121
|
+
this.#defaultOptions = {
|
|
122
|
+
enabled: true,
|
|
123
|
+
headerOrder: "asc"
|
|
124
|
+
};
|
|
125
|
+
this.#listService = inject(ListService);
|
|
126
|
+
this.groupBy = input("", /* @ts-ignore */
|
|
127
|
+
...(ngDevMode ? [{ debugName: "groupBy" }] : /* istanbul ignore next */ []));
|
|
128
|
+
this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaDropDownGroupable" });
|
|
129
|
+
effect(() => {
|
|
130
|
+
const groupBy = this.groupBy() ?? "";
|
|
131
|
+
untracked(() => this.#listService.setGroupBy(groupBy));
|
|
132
|
+
});
|
|
133
|
+
effect(() => {
|
|
134
|
+
const options = this.options();
|
|
135
|
+
untracked(() => {
|
|
136
|
+
if (options === "") {
|
|
137
|
+
this.#listService.setGroupableOptions(this.#defaultOptions);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.#listService.setGroupableOptions({
|
|
141
|
+
...this.#defaultOptions,
|
|
142
|
+
...options,
|
|
143
|
+
enabled: options.enabled ?? this.#defaultOptions.enabled
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownGroupableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
150
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DropdownGroupableDirective, isStandalone: true, selector: "\n mona-auto-complete[monaDropDownGroupable],\n mona-combo-box[monaDropDownGroupable],\n mona-dropdown-list[monaDropDownGroupable],\n mona-multi-select[monaDropDownGroupable],\n ", inputs: { groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "monaDropDownGroupable", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
151
|
+
}
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownGroupableDirective, decorators: [{
|
|
153
|
+
type: Directive,
|
|
154
|
+
args: [{
|
|
155
|
+
selector: `
|
|
156
|
+
mona-auto-complete[monaDropDownGroupable],
|
|
157
|
+
mona-combo-box[monaDropDownGroupable],
|
|
158
|
+
mona-dropdown-list[monaDropDownGroupable],
|
|
159
|
+
mona-multi-select[monaDropDownGroupable],
|
|
160
|
+
`
|
|
161
|
+
}]
|
|
162
|
+
}], ctorParameters: () => [], propDecorators: { groupBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupBy", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaDropDownGroupable", required: false }] }] } });
|
|
163
|
+
|
|
164
|
+
class DropdownHeaderTemplateDirective {
|
|
165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
166
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownHeaderTemplateDirective, isStandalone: true, 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 ", ngImport: i0 }); }
|
|
167
|
+
}
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownHeaderTemplateDirective, decorators: [{
|
|
169
|
+
type: Directive,
|
|
170
|
+
args: [{
|
|
171
|
+
selector: `
|
|
172
|
+
ng-template[monaDropDownHeaderTemplate],
|
|
173
|
+
ng-template[monaAutoCompleteHeaderTemplate],
|
|
174
|
+
ng-template[monaDropDownListHeaderTemplate],
|
|
175
|
+
ng-template[monaDropDownTreeHeaderTemplate],
|
|
176
|
+
ng-template[monaComboBoxHeaderTemplate],
|
|
177
|
+
ng-template[monaMultiSelectHeaderTemplate]
|
|
178
|
+
`,
|
|
179
|
+
standalone: true
|
|
180
|
+
}]
|
|
181
|
+
}] });
|
|
182
|
+
|
|
183
|
+
class DropdownItemTemplateDirective {
|
|
184
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
185
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownItemTemplateDirective, isStandalone: true, selector: "\n ng-template[monaDropDownItemTemplate],\n ng-template[monaAutoCompleteItemTemplate],\n ng-template[monaDropDownListItemTemplate],\n ng-template[monaComboBoxItemTemplate],\n ng-template[monaMultiSelectItemTemplate]\n ", ngImport: i0 }); }
|
|
186
|
+
}
|
|
187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownItemTemplateDirective, decorators: [{
|
|
188
|
+
type: Directive,
|
|
189
|
+
args: [{
|
|
190
|
+
selector: `
|
|
191
|
+
ng-template[monaDropDownItemTemplate],
|
|
192
|
+
ng-template[monaAutoCompleteItemTemplate],
|
|
193
|
+
ng-template[monaDropDownListItemTemplate],
|
|
194
|
+
ng-template[monaComboBoxItemTemplate],
|
|
195
|
+
ng-template[monaMultiSelectItemTemplate]
|
|
196
|
+
`,
|
|
197
|
+
standalone: true
|
|
198
|
+
}]
|
|
199
|
+
}] });
|
|
200
|
+
|
|
201
|
+
class DropdownNoDataTemplateDirective {
|
|
202
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownNoDataTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
203
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownNoDataTemplateDirective, isStandalone: true, 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 ", ngImport: i0 }); }
|
|
204
|
+
}
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownNoDataTemplateDirective, decorators: [{
|
|
206
|
+
type: Directive,
|
|
207
|
+
args: [{
|
|
208
|
+
selector: `
|
|
209
|
+
ng-template[monaDropDownNoDataTemplate],
|
|
210
|
+
ng-template[monaAutoCompleteNoDataTemplate],
|
|
211
|
+
ng-template[monaDropDownListNoDataTemplate],
|
|
212
|
+
ng-template[monaDropDownTreeNoDataTemplate],
|
|
213
|
+
ng-template[monaComboBoxNoDataTemplate],
|
|
214
|
+
ng-template[monaMultiSelectNoDataTemplate]
|
|
215
|
+
`,
|
|
216
|
+
standalone: true
|
|
217
|
+
}]
|
|
218
|
+
}] });
|
|
219
|
+
|
|
220
|
+
class DropdownVirtualScrollDirective {
|
|
221
|
+
#defaultOptions;
|
|
222
|
+
#listService;
|
|
223
|
+
constructor() {
|
|
224
|
+
this.#defaultOptions = {
|
|
225
|
+
enabled: true,
|
|
226
|
+
height: 28
|
|
227
|
+
};
|
|
228
|
+
this.#listService = inject(ListService);
|
|
229
|
+
this.options = input("", { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaDropDownVirtualScroll" });
|
|
230
|
+
effect(() => {
|
|
231
|
+
const options = this.options();
|
|
232
|
+
untracked(() => {
|
|
233
|
+
if (options === "") {
|
|
234
|
+
this.#listService.setVirtualScrollOptions(this.#defaultOptions);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.#listService.setVirtualScrollOptions({
|
|
238
|
+
...this.#defaultOptions,
|
|
239
|
+
...options,
|
|
240
|
+
enabled: options.enabled ?? this.#defaultOptions.enabled
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownVirtualScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
247
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DropdownVirtualScrollDirective, isStandalone: true, selector: "\n mona-auto-complete[monaDropDownVirtualScroll],\n mona-dropdown-list[monaDropDownVirtualScroll],\n mona-combo-box[monaDropDownVirtualScroll],\n mona-multi-select[monaDropDownVirtualScroll]\n ", inputs: { options: { classPropertyName: "options", publicName: "monaDropDownVirtualScroll", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
248
|
+
}
|
|
249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownVirtualScrollDirective, decorators: [{
|
|
250
|
+
type: Directive,
|
|
251
|
+
args: [{
|
|
252
|
+
selector: `
|
|
253
|
+
mona-auto-complete[monaDropDownVirtualScroll],
|
|
254
|
+
mona-dropdown-list[monaDropDownVirtualScroll],
|
|
255
|
+
mona-combo-box[monaDropDownVirtualScroll],
|
|
256
|
+
mona-multi-select[monaDropDownVirtualScroll]
|
|
257
|
+
`,
|
|
258
|
+
standalone: true
|
|
259
|
+
}]
|
|
260
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaDropDownVirtualScroll", required: false }] }] } });
|
|
261
|
+
|
|
262
|
+
class DropdownDataHandlerDirective {
|
|
263
|
+
#host = inject(DropdownDataInputToken);
|
|
264
|
+
#listService = inject(ListService);
|
|
265
|
+
constructor() {
|
|
266
|
+
effect(() => {
|
|
267
|
+
const data = this.#host.data();
|
|
268
|
+
untracked(() => this.#listService.setData(data));
|
|
269
|
+
});
|
|
270
|
+
effect(() => {
|
|
271
|
+
const itemDisabled = this.#host.itemDisabled() ?? "";
|
|
272
|
+
untracked(() => this.#listService.setDisabledBy(itemDisabled));
|
|
273
|
+
});
|
|
274
|
+
effect(() => {
|
|
275
|
+
const textField = this.#host.textField() ?? "";
|
|
276
|
+
untracked(() => this.#listService.setTextField(textField));
|
|
277
|
+
});
|
|
278
|
+
effect(() => {
|
|
279
|
+
const valueField = this.#host.valueField() ?? "";
|
|
280
|
+
untracked(() => this.#listService.setValueField(valueField));
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownDataHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
284
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownDataHandlerDirective, isStandalone: true, selector: "[monaDropdownDataHandler]", ngImport: i0 }); }
|
|
285
|
+
}
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownDataHandlerDirective, decorators: [{
|
|
287
|
+
type: Directive,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: "[monaDropdownDataHandler]"
|
|
290
|
+
}]
|
|
291
|
+
}], ctorParameters: () => [] });
|
|
292
|
+
|
|
293
|
+
class DropdownListService {
|
|
294
|
+
constructor() {
|
|
295
|
+
this.navigate$ = new Subject();
|
|
296
|
+
}
|
|
297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
298
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListService }); }
|
|
299
|
+
}
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListService, decorators: [{
|
|
301
|
+
type: Injectable
|
|
302
|
+
}] });
|
|
303
|
+
|
|
304
|
+
class DropdownService {
|
|
305
|
+
constructor() {
|
|
306
|
+
this.beforeKeydown$ = new Subject();
|
|
307
|
+
this.beforeNavigate$ = new Subject();
|
|
308
|
+
this.keydown$ = new Subject();
|
|
309
|
+
this.popupCloseComplete$ = new Subject();
|
|
310
|
+
this.popupCloseStart$ = new Subject();
|
|
311
|
+
this.popupOpenComplete$ = new Subject();
|
|
312
|
+
this.popupRef = signal(null, /* @ts-ignore */
|
|
313
|
+
...(ngDevMode ? [{ debugName: "popupRef" }] : /* istanbul ignore next */ []));
|
|
314
|
+
this.popupTemplate = signal(null, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
316
|
+
this.restoreFocus = signal("auto", /* @ts-ignore */
|
|
317
|
+
...(ngDevMode ? [{ debugName: "restoreFocus" }] : /* istanbul ignore next */ []));
|
|
318
|
+
this.triggerPopupOpen$ = new Subject();
|
|
319
|
+
this.triggerPopupToggle$ = new Subject();
|
|
320
|
+
}
|
|
321
|
+
static getDefaultPositions() {
|
|
322
|
+
return [
|
|
323
|
+
new ConnectionPositionPair({ originX: "start", originY: "bottom" }, { overlayX: "start", overlayY: "top" }, -1, 0, "mona-dropdown-popup-content-bottom"),
|
|
324
|
+
new ConnectionPositionPair({ originX: "start", originY: "top" }, { overlayX: "start", overlayY: "bottom" }, -1, -1, "mona-dropdown-popup-content-top")
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
328
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownService }); }
|
|
329
|
+
}
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownService, decorators: [{
|
|
331
|
+
type: Injectable
|
|
332
|
+
}] });
|
|
333
|
+
|
|
334
|
+
class DropdownPopupHandlerDirective {
|
|
335
|
+
#destroyRef = inject(DestroyRef);
|
|
336
|
+
#dropdownService = inject(DropdownService);
|
|
337
|
+
#hostElementRef = inject((ElementRef));
|
|
338
|
+
#host = inject(DropdownPopupInputToken);
|
|
339
|
+
#popupService = inject(PopupService);
|
|
340
|
+
constructor() {
|
|
341
|
+
afterNextRender({
|
|
342
|
+
read: () => {
|
|
343
|
+
this.#dropdownService.triggerPopupOpen$
|
|
344
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
345
|
+
.subscribe(s => this.openPopup(s));
|
|
346
|
+
this.#dropdownService.triggerPopupToggle$
|
|
347
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
348
|
+
.subscribe(s => this.togglePopup(s));
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
this.#destroyRef.onDestroy(() => this.closePopup());
|
|
352
|
+
}
|
|
353
|
+
closePopup() {
|
|
354
|
+
this.#dropdownService.popupRef()?.close();
|
|
355
|
+
}
|
|
356
|
+
getMaxHeight(maxHeight, height) {
|
|
357
|
+
if (typeof maxHeight === "number") {
|
|
358
|
+
return maxHeight;
|
|
359
|
+
}
|
|
360
|
+
if (maxHeight === "auto" && height === "auto") {
|
|
361
|
+
return "auto";
|
|
362
|
+
}
|
|
363
|
+
if (!maxHeight || maxHeight === "auto") {
|
|
364
|
+
if (!height || height === "auto") {
|
|
365
|
+
return 200;
|
|
366
|
+
}
|
|
367
|
+
return height;
|
|
368
|
+
}
|
|
369
|
+
return maxHeight ?? 200;
|
|
370
|
+
}
|
|
371
|
+
getMinWidth(minWidth, width) {
|
|
372
|
+
if (typeof minWidth === "number") {
|
|
373
|
+
return minWidth;
|
|
374
|
+
}
|
|
375
|
+
if (!minWidth || minWidth === "auto") {
|
|
376
|
+
if (!width || width === "auto") {
|
|
377
|
+
return this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
378
|
+
}
|
|
379
|
+
return width;
|
|
380
|
+
}
|
|
381
|
+
return minWidth ?? this.#hostElementRef.nativeElement.getBoundingClientRect().width;
|
|
382
|
+
}
|
|
383
|
+
openPopup(settings) {
|
|
384
|
+
let popupRef = this.#dropdownService.popupRef();
|
|
385
|
+
if (popupRef || this.#host.disabled() || this.#host.readonly()) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const event = new PreventableEvent("popupOpen");
|
|
389
|
+
this.#host.open.emit(event);
|
|
390
|
+
if (event.isDefaultPrevented()) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const anchor = this.#hostElementRef.nativeElement;
|
|
394
|
+
const anchorConnectionPoint = settings.anchorConnectionPoint ?? "bottomleft";
|
|
395
|
+
const content = this.#dropdownService.popupTemplate();
|
|
396
|
+
const closeOnOutsideClick = settings.closeOnOutsideClick ?? true;
|
|
397
|
+
const closeOnScroll = settings.closeOnScroll ?? true;
|
|
398
|
+
const hasBackdrop = settings.hasBackdrop ?? false;
|
|
399
|
+
const height = settings.height;
|
|
400
|
+
const maxHeight = this.getMaxHeight(settings.maxHeight, settings.height);
|
|
401
|
+
const minWidth = this.getMinWidth(settings.minWidth, settings.width);
|
|
402
|
+
const offset = settings.offset ?? { horizontal: 0, vertical: 4 };
|
|
403
|
+
const popupConnectionPoint = settings.popupConnectionPoint ?? "topleft";
|
|
404
|
+
const restoreFocus = this.#dropdownService.restoreFocus();
|
|
405
|
+
const width = settings.width ?? (this.#host.popupWidth() || anchor.getBoundingClientRect().width);
|
|
406
|
+
const withPush = settings.withPush ?? false;
|
|
407
|
+
const withScrollTracking = settings.withScrollTracking ?? false;
|
|
408
|
+
popupRef = this.#popupService.create({
|
|
409
|
+
anchor,
|
|
410
|
+
anchorConnectionPoint,
|
|
411
|
+
animation: dropdownPopupAnimation,
|
|
412
|
+
content,
|
|
413
|
+
closeOnOutsideClick,
|
|
414
|
+
closeOnScroll,
|
|
415
|
+
hasBackdrop,
|
|
416
|
+
height,
|
|
417
|
+
maxHeight,
|
|
418
|
+
minWidth,
|
|
419
|
+
offset,
|
|
420
|
+
popupConnectionPoint,
|
|
421
|
+
restoreFocus,
|
|
422
|
+
width,
|
|
423
|
+
withPush,
|
|
424
|
+
withScrollTracking
|
|
425
|
+
});
|
|
426
|
+
this.#dropdownService.popupRef.set(popupRef);
|
|
427
|
+
this.setPopupCloseSubscriptions(popupRef);
|
|
428
|
+
window.setTimeout(() => {
|
|
429
|
+
this.#dropdownService.popupOpenComplete$.next();
|
|
430
|
+
this.#host.opened.emit();
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
setPopupCloseSubscriptions(popupRef) {
|
|
434
|
+
popupRef.beforeClose.pipe(takeUntil(popupRef.closed)).subscribe(event => {
|
|
435
|
+
this.#host.close.emit(event);
|
|
436
|
+
});
|
|
437
|
+
popupRef.closeStart.pipe(takeUntil(popupRef.closed)).subscribe(event => {
|
|
438
|
+
this.#dropdownService.popupCloseStart$.next(event);
|
|
439
|
+
});
|
|
440
|
+
popupRef.closed.pipe(take(1)).subscribe(event => {
|
|
441
|
+
this.#dropdownService.popupRef.set(null);
|
|
442
|
+
this.#dropdownService.popupCloseComplete$.next(event);
|
|
443
|
+
this.#host.closed.emit();
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
togglePopup(settings) {
|
|
447
|
+
if (this.#dropdownService.popupRef()) {
|
|
448
|
+
this.closePopup();
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
this.openPopup(settings);
|
|
452
|
+
}
|
|
453
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownPopupHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
454
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownPopupHandlerDirective, isStandalone: true, selector: "[monaDropdownPopupHandler]", ngImport: i0 }); }
|
|
455
|
+
}
|
|
456
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownPopupHandlerDirective, decorators: [{
|
|
457
|
+
type: Directive,
|
|
458
|
+
args: [{
|
|
459
|
+
selector: "[monaDropdownPopupHandler]"
|
|
460
|
+
}]
|
|
461
|
+
}], ctorParameters: () => [] });
|
|
462
|
+
|
|
463
|
+
class DropdownListPopupHandlerDirective {
|
|
464
|
+
#destroyRef = inject(DestroyRef);
|
|
465
|
+
#dropdownListService = inject(DropdownListService, { optional: true });
|
|
466
|
+
#dropdownService = inject(DropdownService);
|
|
467
|
+
#host = inject(DropdownPopupInputToken);
|
|
468
|
+
#hostElementRef = inject(ElementRef);
|
|
469
|
+
#listService = inject(ListService);
|
|
470
|
+
#popupClosed$ = toObservable(this.#dropdownService.popupRef).pipe(filter(popupRef => !!popupRef), switchMap(popupRef => popupRef.closed.pipe(take(1))));
|
|
471
|
+
#popupOpened$ = toObservable(this.#dropdownService.popupRef).pipe(filter(popupRef => !!popupRef), switchMap(popupRef => popupRef.opened.pipe(take(1))));
|
|
472
|
+
constructor() {
|
|
473
|
+
afterNextRender({
|
|
474
|
+
read: () => {
|
|
475
|
+
this.setKeyboardEvents();
|
|
476
|
+
this.#popupClosed$
|
|
477
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
478
|
+
.subscribe(() => this.setPopupCloseSubscriptions());
|
|
479
|
+
this.#popupOpened$
|
|
480
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
481
|
+
.subscribe(() => this.handleScrollOnPopupOpen());
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
closePopup() {
|
|
486
|
+
this.#dropdownService.popupRef()?.close();
|
|
487
|
+
}
|
|
488
|
+
handleArrowKeys(event) {
|
|
489
|
+
const navigateEvent = new PreventableEvent("beforeNavigate", event);
|
|
490
|
+
this.#dropdownService.beforeNavigate$.next(navigateEvent);
|
|
491
|
+
if (navigateEvent.isDefaultPrevented()) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
if (event.altKey) {
|
|
496
|
+
if (event.key === "ArrowDown") {
|
|
497
|
+
this.#dropdownService.triggerPopupOpen$.next({});
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
this.closePopup();
|
|
501
|
+
}
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
const previousItem = this.#listService.selectedListItems().lastOrDefault();
|
|
505
|
+
const direction = event.key === "ArrowDown" ? "next" : "previous";
|
|
506
|
+
const mode = this.#listService.navigableOptions().mode;
|
|
507
|
+
const item = this.#listService.navigate(direction, mode, false);
|
|
508
|
+
if (!item || previousItem === item) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
this.#dropdownListService?.navigate$.next({ item });
|
|
512
|
+
}
|
|
513
|
+
handleKeyDown(e) {
|
|
514
|
+
const event = new PreventableEvent("beforeKeydown", e);
|
|
515
|
+
this.#dropdownService.beforeKeydown$.next(event);
|
|
516
|
+
if (event.isDefaultPrevented()) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
520
|
+
this.handleArrowKeys(e);
|
|
521
|
+
}
|
|
522
|
+
else if (e.key === "Escape") {
|
|
523
|
+
this.closePopup();
|
|
524
|
+
}
|
|
525
|
+
else if (e.key === "Tab") {
|
|
526
|
+
this.closePopup();
|
|
527
|
+
}
|
|
528
|
+
else if (e.key === " ") {
|
|
529
|
+
e.preventDefault();
|
|
530
|
+
this.#dropdownService.triggerPopupToggle$.next({});
|
|
531
|
+
}
|
|
532
|
+
else if (e.key === "Enter") {
|
|
533
|
+
this.#dropdownService.keydown$.next(e);
|
|
534
|
+
if (e.defaultPrevented) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
this.#dropdownService.triggerPopupToggle$.next({});
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
this.#dropdownService.keydown$.next(e);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
handleScrollOnPopupOpen() {
|
|
544
|
+
const selectedDataItem = this.#listService.selectedListItems().lastOrDefault();
|
|
545
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
546
|
+
if (selectedDataItem) {
|
|
547
|
+
this.scrollToSelectedItem();
|
|
548
|
+
}
|
|
549
|
+
else if (highlightedItem) {
|
|
550
|
+
this.scrollToHighlightedItem();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
scrollToHighlightedItem() {
|
|
554
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
555
|
+
if (!highlightedItem) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
window.setTimeout(() => this.#listService.scrollToItem(highlightedItem, false));
|
|
559
|
+
}
|
|
560
|
+
scrollToSelectedItem() {
|
|
561
|
+
const item = this.#listService.selectedListItems().lastOrDefault();
|
|
562
|
+
if (!item) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
window.setTimeout(() => this.#listService.scrollToItem(item, false));
|
|
566
|
+
}
|
|
567
|
+
setKeyboardEvents() {
|
|
568
|
+
fromEvent(this.#hostElementRef.nativeElement, "click")
|
|
569
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(e => !this.#host.disabled() &&
|
|
570
|
+
!this.#host.readonly() &&
|
|
571
|
+
!!e.target &&
|
|
572
|
+
e.target.tagName !== "INPUT"))
|
|
573
|
+
.subscribe(() => this.#dropdownService.triggerPopupToggle$.next({}));
|
|
574
|
+
fromEvent(this.#hostElementRef.nativeElement, "keydown")
|
|
575
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(() => !this.#host.disabled() && !this.#host.readonly()))
|
|
576
|
+
.subscribe(e => this.handleKeyDown(e));
|
|
577
|
+
}
|
|
578
|
+
setPopupCloseSubscriptions() {
|
|
579
|
+
this.#listService.clearHighlightedItem();
|
|
580
|
+
this.#listService.clearFilter();
|
|
581
|
+
}
|
|
582
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListPopupHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
583
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownListPopupHandlerDirective, isStandalone: true, selector: "[monaDropdownListPopupHandler]", hostDirectives: [{ directive: DropdownPopupHandlerDirective }], ngImport: i0 }); }
|
|
584
|
+
}
|
|
585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListPopupHandlerDirective, decorators: [{
|
|
586
|
+
type: Directive,
|
|
587
|
+
args: [{
|
|
588
|
+
selector: "[monaDropdownListPopupHandler]",
|
|
589
|
+
hostDirectives: [DropdownPopupHandlerDirective]
|
|
590
|
+
}]
|
|
591
|
+
}], ctorParameters: () => [] });
|
|
592
|
+
|
|
593
|
+
class DropdownLiveRegionDirective {
|
|
594
|
+
#dropdownService;
|
|
595
|
+
#host;
|
|
596
|
+
#listService;
|
|
597
|
+
#expanded;
|
|
598
|
+
constructor() {
|
|
599
|
+
this.#dropdownService = inject(DropdownService);
|
|
600
|
+
this.#host = inject(ElementRef);
|
|
601
|
+
this.#listService = inject(ListService);
|
|
602
|
+
this.#expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
|
|
603
|
+
...(ngDevMode ? [{ debugName: "#expanded" }] : /* istanbul ignore next */ []));
|
|
604
|
+
this.liveRegionText = computed(() => {
|
|
605
|
+
const highlightedItem = this.#listService.highlightedItem();
|
|
606
|
+
const selectedItem = this.#listService.selectedListItems().lastOrDefault();
|
|
607
|
+
const count = this.#listService.viewItems().size();
|
|
608
|
+
const activeItem = highlightedItem ?? selectedItem;
|
|
609
|
+
if (activeItem && this.#expanded()) {
|
|
610
|
+
const text = this.#listService.getItemText(activeItem);
|
|
611
|
+
const positionInfo = this.#listService.getItemPosition(activeItem);
|
|
612
|
+
if (positionInfo) {
|
|
613
|
+
return `${text}, ${positionInfo.position} of ${positionInfo.total}`;
|
|
614
|
+
}
|
|
615
|
+
return text;
|
|
616
|
+
}
|
|
617
|
+
return count === 0 ? "No results found" : `${count} result${count === 1 ? "" : "s"} available`;
|
|
618
|
+
}, /* @ts-ignore */
|
|
619
|
+
...(ngDevMode ? [{ debugName: "liveRegionText" }] : /* istanbul ignore next */ []));
|
|
620
|
+
effect(() => {
|
|
621
|
+
this.#host.nativeElement.textContent = this.liveRegionText();
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownLiveRegionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
625
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownLiveRegionDirective, isStandalone: true, selector: "span[monaDropdownLiveRegion]", host: { properties: { "class.sr-only": "true", "attr.aria-live": "\"polite\"", "attr.aria-atomic": "\"true\"", "attr.aria-label": "liveRegionText()" } }, ngImport: i0 }); }
|
|
626
|
+
}
|
|
627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownLiveRegionDirective, decorators: [{
|
|
628
|
+
type: Directive,
|
|
629
|
+
args: [{
|
|
630
|
+
selector: "span[monaDropdownLiveRegion]",
|
|
631
|
+
host: {
|
|
632
|
+
"[class.sr-only]": "true",
|
|
633
|
+
"[attr.aria-live]": '"polite"',
|
|
634
|
+
"[attr.aria-atomic]": '"true"',
|
|
635
|
+
"[attr.aria-label]": "liveRegionText()"
|
|
636
|
+
}
|
|
637
|
+
}]
|
|
638
|
+
}], ctorParameters: () => [] });
|
|
639
|
+
|
|
640
|
+
class DropdownPrefixTemplateDirective {
|
|
641
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownPrefixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
642
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownPrefixTemplateDirective, isStandalone: true, selector: "ng-template[monaDropdownPrefixTemplate]", ngImport: i0 }); }
|
|
643
|
+
}
|
|
644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownPrefixTemplateDirective, decorators: [{
|
|
645
|
+
type: Directive,
|
|
646
|
+
args: [{
|
|
647
|
+
selector: "ng-template[monaDropdownPrefixTemplate]"
|
|
648
|
+
}]
|
|
649
|
+
}] });
|
|
650
|
+
|
|
651
|
+
class DropdownSuffixTemplateDirective {
|
|
652
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownSuffixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
653
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DropdownSuffixTemplateDirective, isStandalone: true, selector: "ng-template[monaDropdownSuffixTemplate]", ngImport: i0 }); }
|
|
654
|
+
}
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownSuffixTemplateDirective, decorators: [{
|
|
656
|
+
type: Directive,
|
|
657
|
+
args: [{
|
|
658
|
+
selector: "ng-template[monaDropdownSuffixTemplate]"
|
|
659
|
+
}]
|
|
660
|
+
}] });
|
|
661
|
+
|
|
662
|
+
const dropdownPopupVariants = cva(`
|
|
663
|
+
bg-background shadow-md
|
|
664
|
+
border border-input-border
|
|
665
|
+
h-full max-h-64 overflow-auto
|
|
666
|
+
`, {
|
|
667
|
+
variants: {
|
|
668
|
+
rounded: {
|
|
669
|
+
none: "rounded-none",
|
|
670
|
+
small: "rounded-sm",
|
|
671
|
+
medium: "rounded-md",
|
|
672
|
+
large: "rounded-lg",
|
|
673
|
+
full: "rounded-lg"
|
|
674
|
+
},
|
|
675
|
+
size: {
|
|
676
|
+
large: "text-md",
|
|
677
|
+
medium: "text-sm",
|
|
678
|
+
small: "text-xs"
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
defaultVariants: {
|
|
682
|
+
rounded: "medium",
|
|
683
|
+
size: "medium"
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
const dropdownPopupThemeVariants = (theme) => {
|
|
688
|
+
switch (theme) {
|
|
689
|
+
case "mona":
|
|
690
|
+
return dropdownPopupVariants;
|
|
691
|
+
default:
|
|
692
|
+
return dropdownPopupVariants;
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Generated bundle index. Do not edit.
|
|
698
|
+
*/
|
|
699
|
+
|
|
700
|
+
export { DropdownDataHandlerDirective, DropdownDataInputToken, DropdownFilterableDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownGroupableDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPopupHandlerDirective, DropdownPopupInputToken, DropdownPrefixTemplateDirective, DropdownService, DropdownSuffixTemplateDirective, DropdownVirtualScrollDirective, dropdownPopupThemeVariants };
|
|
701
|
+
//# sourceMappingURL=nanahoshi-mona-ui-dropdowns.mjs.map
|