@nanahoshi/mona-ui 0.18.5 → 0.19.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 +71 -13
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +17 -9
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +16 -7
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +122 -48
- package/fesm2022/nanahoshi-mona-ui-card.mjs +22 -14
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +78 -18
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +199 -77
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +1 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +23 -5
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +49 -28
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +42 -26
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +28 -16
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +74 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +57 -25
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +13 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +17 -6
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +178 -59
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +137 -54
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-WEDbZ5vy.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-Bg7rckst.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-ibH5osCg.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-BSSpaCLL.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-D9AwQFDV.mjs +145 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-hc-LeIb0.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Byb9iTes.mjs} +21 -17
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DYajpOb9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CBmdtrXm.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Pm8Fbp6M.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DPmJmCap.mjs} +90 -42
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +1168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +12 -4
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -21
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +33 -18
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +10 -10
- package/fesm2022/nanahoshi-mona-ui-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +29 -16
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +12 -3
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +23 -18
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +211 -106
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +46 -19
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +57 -46
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +35 -15
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +38 -17
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +25 -7
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +431 -101
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +26 -8
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +222 -28
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +91 -36
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +34 -15
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +39 -23
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +50 -25
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +32 -14
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +9 -9
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +74 -56
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +16 -8
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +33 -19
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +66 -27
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +23 -15
- package/fesm2022/nanahoshi-mona-ui-window.mjs +71 -40
- package/i18n/package.json +4 -0
- package/package.json +5 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +9 -3
- package/types/nanahoshi-mona-ui-button-group.d.ts +9 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +13 -3
- package/types/nanahoshi-mona-ui-card.d.ts +8 -2
- package/types/nanahoshi-mona-ui-chart.d.ts +10 -1
- package/types/nanahoshi-mona-ui-chip.d.ts +14 -5
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +6 -1
- package/types/nanahoshi-mona-ui-color-palette.d.ts +21 -10
- package/types/nanahoshi-mona-ui-color-picker.d.ts +30 -20
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -1
- package/types/nanahoshi-mona-ui-date-picker.d.ts +7 -2
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +33 -8
- package/types/nanahoshi-mona-ui-dialog.d.ts +16 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -1
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +4 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +6 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +16 -10
- package/types/nanahoshi-mona-ui-grid.d.ts +38 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +633 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +7 -2
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +7 -3
- package/types/nanahoshi-mona-ui-list-box.d.ts +9 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +6 -6
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-menubar.d.ts +59 -58
- package/types/nanahoshi-mona-ui-multi-select.d.ts +6 -1
- package/types/nanahoshi-mona-ui-notification.d.ts +11 -5
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +24 -15
- package/types/nanahoshi-mona-ui-otp-input.d.ts +9 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +19 -6
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +9 -7
- package/types/nanahoshi-mona-ui-rating.d.ts +19 -12
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +34 -28
- package/types/nanahoshi-mona-ui-sheet.d.ts +8 -2
- package/types/nanahoshi-mona-ui-sidebar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +44 -26
- package/types/nanahoshi-mona-ui-spinner.d.ts +13 -4
- package/types/nanahoshi-mona-ui-split-button.d.ts +62 -56
- package/types/nanahoshi-mona-ui-splitter.d.ts +9 -6
- package/types/nanahoshi-mona-ui-stepper.d.ts +9 -3
- package/types/nanahoshi-mona-ui-switch.d.ts +1 -1
- package/types/nanahoshi-mona-ui-tabs.d.ts +96 -35
- package/types/nanahoshi-mona-ui-text-box.d.ts +11 -5
- package/types/nanahoshi-mona-ui-time-picker.d.ts +7 -2
- package/types/nanahoshi-mona-ui-time-selector.d.ts +16 -5
- package/types/nanahoshi-mona-ui-tree-view.d.ts +15 -10
- package/types/nanahoshi-mona-ui-window.d.ts +26 -20
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ZM3CneJ0.mjs +0 -145
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, inject, ElementRef, computed, afterNextRender,
|
|
2
|
+
import { Directive, inject, ElementRef, computed, afterNextRender, Component, signal, DOCUMENT, Injector, forwardRef, Injectable, DestroyRef, contentChild, TemplateRef, output, input, effect } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { PopupDataInjectionToken, PopupCloseEvent, PopupCloseSource, PopupService } from '@nanahoshi/mona-ui/popup';
|
|
5
5
|
import { Subject, map, takeUntil, take } from 'rxjs';
|
|
@@ -10,6 +10,7 @@ import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
|
10
10
|
import { NgTemplateOutlet } from '@angular/common';
|
|
11
11
|
import { LucideOctagonAlert, LucideCircleCheckBig, LucideBadgeInfo, LucideOctagonX, LucideBadgeQuestionMark, LucideX, LucideDynamicIcon } from '@lucide/angular';
|
|
12
12
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
13
|
+
import { MonaI18nService, mergeMessages } from '@nanahoshi/mona-ui/i18n';
|
|
13
14
|
import { cva } from 'class-variance-authority';
|
|
14
15
|
|
|
15
16
|
class DialogContentTemplateDirective {
|
|
@@ -84,6 +85,12 @@ class DialogActionEvent extends PreventableEvent {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
const DIALOG_DEFAULT_MESSAGES = {
|
|
89
|
+
cancel: "Cancel",
|
|
90
|
+
closeDialog: "Close dialog",
|
|
91
|
+
ok: "OK"
|
|
92
|
+
};
|
|
93
|
+
|
|
87
94
|
const dialogBaseThemeVariants = cva(`
|
|
88
95
|
flex h-full w-full flex-col gap-0.5 overflow-hidden
|
|
89
96
|
${themeOverlaySurfaceClasses} text-foreground
|
|
@@ -105,12 +112,12 @@ const dialogContentContainerThemeVariants = cva(`
|
|
|
105
112
|
flex flex-1 flex-row gap-1
|
|
106
113
|
`);
|
|
107
114
|
const dialogBodyThemeVariants = cva(`
|
|
108
|
-
flex h-full w-full flex-col gap-0
|
|
115
|
+
flex h-full w-full flex-col gap-0 pe-2 pb-2
|
|
109
116
|
`, {
|
|
110
117
|
variants: {
|
|
111
118
|
hasIcon: {
|
|
112
119
|
true: "",
|
|
113
|
-
false: "
|
|
120
|
+
false: "ps-5"
|
|
114
121
|
}
|
|
115
122
|
}
|
|
116
123
|
});
|
|
@@ -119,12 +126,12 @@ const dialogHeaderThemeVariants = cva(`
|
|
|
119
126
|
select-none
|
|
120
127
|
`);
|
|
121
128
|
const dialogIconContainerThemeVariants = cva(`
|
|
122
|
-
flex items-start justify-center pt-8
|
|
129
|
+
flex items-start justify-center pt-8 pe-4 ps-6
|
|
123
130
|
`);
|
|
124
131
|
const dialogIconThemeVariants = cva(`
|
|
125
132
|
relative h-fit w-fit rounded-full border p-1.5
|
|
126
133
|
[&>span]:absolute [&>span]:flex [&>span]:rounded-full
|
|
127
|
-
[&>span]:-
|
|
134
|
+
[&>span]:-inset-3
|
|
128
135
|
[&>span]:min-h-full [&>span]:min-w-full [&>span]:border
|
|
129
136
|
`, {
|
|
130
137
|
variants: {
|
|
@@ -185,11 +192,14 @@ const dialogFooterThemeVariants = cva(`
|
|
|
185
192
|
|
|
186
193
|
class DialogContentComponent {
|
|
187
194
|
#hostElementRef;
|
|
195
|
+
#i18n;
|
|
188
196
|
#iconMap;
|
|
189
197
|
#injectedData;
|
|
198
|
+
#localeMessages;
|
|
190
199
|
#trapFocus;
|
|
191
200
|
constructor() {
|
|
192
201
|
this.#hostElementRef = inject(ElementRef);
|
|
202
|
+
this.#i18n = inject(MonaI18nService);
|
|
193
203
|
this.#iconMap = {
|
|
194
204
|
confirm: { color: "var(--color-success)", icon: LucideBadgeQuestionMark },
|
|
195
205
|
error: { color: "var(--color-error)", icon: LucideOctagonX },
|
|
@@ -198,7 +208,16 @@ class DialogContentComponent {
|
|
|
198
208
|
warning: { color: "var(--color-warning)", icon: LucideOctagonAlert }
|
|
199
209
|
};
|
|
200
210
|
this.#injectedData = inject(PopupDataInjectionToken);
|
|
211
|
+
this.#localeMessages = this.#i18n.componentMessages("dialog", DIALOG_DEFAULT_MESSAGES);
|
|
201
212
|
this.#trapFocus = inject(CdkTrapFocus);
|
|
213
|
+
this.actions = computed(() => {
|
|
214
|
+
const data = this.dialogData();
|
|
215
|
+
if (data.actions != null) {
|
|
216
|
+
return data.actions;
|
|
217
|
+
}
|
|
218
|
+
return this.getDefaultActions(data.type);
|
|
219
|
+
}, /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
202
221
|
this.baseClass = computed(() => {
|
|
203
222
|
const rounded = this.dialogData().rounded;
|
|
204
223
|
return dialogBaseThemeVariants({ rounded });
|
|
@@ -259,6 +278,10 @@ class DialogContentComponent {
|
|
|
259
278
|
return dialogIconContainerThemeVariants();
|
|
260
279
|
}, /* @ts-ignore */
|
|
261
280
|
...(ngDevMode ? [{ debugName: "iconContainerClass" }] : /* istanbul ignore next */ []));
|
|
281
|
+
this.messages = computed(() => {
|
|
282
|
+
return mergeMessages(this.#localeMessages(), this.dialogData().messages);
|
|
283
|
+
}, /* @ts-ignore */
|
|
284
|
+
...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
262
285
|
this.role = computed(() => {
|
|
263
286
|
const type = this.dialogData().type;
|
|
264
287
|
return type === "confirm" || type === "error" || type === "warning" ? "alertdialog" : "dialog";
|
|
@@ -298,17 +321,26 @@ class DialogContentComponent {
|
|
|
298
321
|
const dialogElement = this.#hostElementRef.nativeElement;
|
|
299
322
|
focusElement(dialogElement, element);
|
|
300
323
|
}
|
|
324
|
+
getDefaultActions(type) {
|
|
325
|
+
if (type === "confirm") {
|
|
326
|
+
return [
|
|
327
|
+
{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: this.messages().ok },
|
|
328
|
+
{ cssClass: "", iconOnly: false, look: "default", rounded: "medium", text: this.messages().cancel }
|
|
329
|
+
];
|
|
330
|
+
}
|
|
331
|
+
return [{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: this.messages().ok }];
|
|
332
|
+
}
|
|
301
333
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
302
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DialogContentComponent, isStandalone: true, selector: "ng-component", host: { properties: { "class": "baseClass()", "attr.aria-describedby": "describedById()", "attr.aria-labelledby": "headerId", "attr.role": "role()" } }, hostDirectives: [{ directive: i1.CdkTrapFocus }], ngImport: i0, template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n aria-label=\"
|
|
334
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DialogContentComponent, isStandalone: true, selector: "ng-component", host: { properties: { "class": "baseClass()", "attr.aria-describedby": "describedById()", "attr.aria-labelledby": "headerId", "attr.role": "role()" } }, hostDirectives: [{ directive: i1.CdkTrapFocus }], ngImport: i0, template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (data.content) {\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n } @else if (data.text) {\n <p class=\"select-none\">{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: AnyPipe, name: "monaAny" }] }); }
|
|
303
335
|
}
|
|
304
336
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, decorators: [{
|
|
305
337
|
type: Component,
|
|
306
|
-
args: [{ imports: [ButtonDirective, NgTemplateOutlet, AnyPipe, LucideX, LucideDynamicIcon],
|
|
338
|
+
args: [{ imports: [ButtonDirective, NgTemplateOutlet, AnyPipe, LucideX, LucideDynamicIcon], host: {
|
|
307
339
|
"[class]": "baseClass()",
|
|
308
340
|
"[attr.aria-describedby]": "describedById()",
|
|
309
341
|
"[attr.aria-labelledby]": "headerId",
|
|
310
342
|
"[attr.role]": "role()"
|
|
311
|
-
}, hostDirectives: [CdkTrapFocus], template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n aria-label=\"
|
|
343
|
+
}, hostDirectives: [CdkTrapFocus], template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (data.content) {\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n } @else if (data.text) {\n <p class=\"select-none\">{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n" }]
|
|
312
344
|
}], ctorParameters: () => [] });
|
|
313
345
|
|
|
314
346
|
class DialogRef {
|
|
@@ -414,7 +446,7 @@ class DialogReference {
|
|
|
414
446
|
|
|
415
447
|
const createDialogInjectorData = (settings) => {
|
|
416
448
|
return {
|
|
417
|
-
actions: settings.actions
|
|
449
|
+
actions: settings.actions,
|
|
418
450
|
actionsLayout: settings.actionsLayout ?? "end",
|
|
419
451
|
closable: settings.closable ?? true,
|
|
420
452
|
closeOnEscape: settings.closeOnEscape ?? true,
|
|
@@ -427,6 +459,7 @@ const createDialogInjectorData = (settings) => {
|
|
|
427
459
|
height: settings.height,
|
|
428
460
|
iconTemplate: settings.iconTemplate,
|
|
429
461
|
left: settings.left,
|
|
462
|
+
messages: settings.messages,
|
|
430
463
|
modal: settings.modal ?? true,
|
|
431
464
|
rounded: settings.rounded ?? "medium",
|
|
432
465
|
text: settings.text ?? "",
|
|
@@ -437,15 +470,6 @@ const createDialogInjectorData = (settings) => {
|
|
|
437
470
|
width: settings.width ?? 450
|
|
438
471
|
};
|
|
439
472
|
};
|
|
440
|
-
function getDefaultActions(type) {
|
|
441
|
-
if (type === "confirm") {
|
|
442
|
-
return [
|
|
443
|
-
{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: "OK" },
|
|
444
|
-
{ cssClass: "", iconOnly: false, look: "default", rounded: "medium", text: "Cancel" }
|
|
445
|
-
];
|
|
446
|
-
}
|
|
447
|
-
return [{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: "OK" }];
|
|
448
|
-
}
|
|
449
473
|
|
|
450
474
|
class DialogService {
|
|
451
475
|
#document = inject(DOCUMENT);
|
|
@@ -533,17 +557,18 @@ class DialogComponent {
|
|
|
533
557
|
* @description Emits when the user clicks on the close button or presses the escape key.
|
|
534
558
|
* This event is preventable.
|
|
535
559
|
*/
|
|
560
|
+
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
536
561
|
this.close = output();
|
|
537
|
-
/**
|
|
538
|
-
* @description Emits when the dialog is closed.
|
|
539
|
-
*/
|
|
540
|
-
this.closed = output();
|
|
541
562
|
/**
|
|
542
563
|
* @description Sets whether the dialog should close when the escape key is pressed.
|
|
543
564
|
* @default true
|
|
544
565
|
*/
|
|
545
566
|
this.closeOnEscape = input(true, /* @ts-ignore */
|
|
546
567
|
...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
|
|
568
|
+
/**
|
|
569
|
+
* @description Emits when the dialog is closed.
|
|
570
|
+
*/
|
|
571
|
+
this.closed = output();
|
|
547
572
|
/**
|
|
548
573
|
* @description Sets the description of the dialog.
|
|
549
574
|
*/
|
|
@@ -575,6 +600,11 @@ class DialogComponent {
|
|
|
575
600
|
*/
|
|
576
601
|
this.maxWidth = input(/* @ts-ignore */
|
|
577
602
|
...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
603
|
+
/**
|
|
604
|
+
* @description Sets the custom messages for the dialog.
|
|
605
|
+
*/
|
|
606
|
+
this.messages = input(/* @ts-ignore */
|
|
607
|
+
...(ngDevMode ? [undefined, { debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
578
608
|
/**
|
|
579
609
|
* @description Sets the minimum height of the dialog.
|
|
580
610
|
*/
|
|
@@ -634,6 +664,7 @@ class DialogComponent {
|
|
|
634
664
|
actionsLayout: this.actionsLayout(),
|
|
635
665
|
closable: this.closable(),
|
|
636
666
|
description: this.description(),
|
|
667
|
+
messages: this.messages(),
|
|
637
668
|
rounded: this.rounded(),
|
|
638
669
|
text: this.text(),
|
|
639
670
|
title: this.title(),
|
|
@@ -660,6 +691,7 @@ class DialogComponent {
|
|
|
660
691
|
left: this.left(),
|
|
661
692
|
maxHeight: this.maxHeight(),
|
|
662
693
|
maxWidth: this.maxWidth(),
|
|
694
|
+
messages: this.messages(),
|
|
663
695
|
minHeight: this.minHeight(),
|
|
664
696
|
minWidth: this.minWidth(),
|
|
665
697
|
modal: this.modal(),
|
|
@@ -690,7 +722,7 @@ class DialogComponent {
|
|
|
690
722
|
});
|
|
691
723
|
}
|
|
692
724
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
693
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: DialogComponent, isStandalone: true, selector: "mona-dialog", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionsLayout: { classPropertyName: "actionsLayout", publicName: "actionsLayout", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, top: { classPropertyName: "top", publicName: "top", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: DialogContentTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "descriptionTemplate", first: true, predicate: DialogDescriptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: DialogFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: DialogIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: DialogTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: ``, isInline: true }); }
|
|
725
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: DialogComponent, isStandalone: true, selector: "mona-dialog", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionsLayout: { classPropertyName: "actionsLayout", publicName: "actionsLayout", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, top: { classPropertyName: "top", publicName: "top", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: DialogContentTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "descriptionTemplate", first: true, predicate: DialogDescriptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: DialogFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: DialogIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: DialogTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: ``, isInline: true }); }
|
|
694
726
|
}
|
|
695
727
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, decorators: [{
|
|
696
728
|
type: Component,
|
|
@@ -701,7 +733,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
701
733
|
class: "hidden"
|
|
702
734
|
}
|
|
703
735
|
}]
|
|
704
|
-
}], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogContentTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], descriptionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogDescriptionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], action: [{ type: i0.Output, args: ["action"] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], actionsLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLayout", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }],
|
|
736
|
+
}], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogContentTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], descriptionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogDescriptionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], action: [{ type: i0.Output, args: ["action"] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], actionsLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLayout", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], left: [{ type: i0.Input, args: [{ isSignal: true, alias: "left", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], top: [{ type: i0.Input, args: [{ isSignal: true, alias: "top", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
705
737
|
|
|
706
738
|
/*
|
|
707
739
|
* Public API Surface of @nanahoshi/mona-ui/dialog
|
|
@@ -711,5 +743,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
711
743
|
* Generated bundle index. Do not edit.
|
|
712
744
|
*/
|
|
713
745
|
|
|
714
|
-
export { DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
|
|
746
|
+
export { DIALOG_DEFAULT_MESSAGES, DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
|
|
715
747
|
//# sourceMappingURL=nanahoshi-mona-ui-dialog.mjs.map
|
|
@@ -7,6 +7,7 @@ import { DropdownListService, DropdownService, DropdownFooterTemplateDirective,
|
|
|
7
7
|
import { themeControlSurfaceClasses, createElementControlId, isTypeaheadKey, setupTypeahead } from '@nanahoshi/mona-ui/internal';
|
|
8
8
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
9
9
|
import { ListService, ListComponent, ListItemTemplateDirective, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
10
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
10
11
|
import { Subject } from 'rxjs';
|
|
11
12
|
import { twMerge } from 'tailwind-merge';
|
|
12
13
|
import { cva } from 'class-variance-authority';
|
|
@@ -22,6 +23,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
22
23
|
}]
|
|
23
24
|
}] });
|
|
24
25
|
|
|
26
|
+
const DROPDOWN_LIST_DEFAULT_MESSAGES = {
|
|
27
|
+
clear: "Clear"
|
|
28
|
+
};
|
|
29
|
+
|
|
25
30
|
const dropdownListInputThemeVariants = cva(`
|
|
26
31
|
inline-flex items-center
|
|
27
32
|
cursor-pointer select-none
|
|
@@ -87,17 +92,19 @@ class DropdownListComponent {
|
|
|
87
92
|
#dropdownListService;
|
|
88
93
|
#dropdownService;
|
|
89
94
|
#hostElementRef;
|
|
90
|
-
#
|
|
95
|
+
#i18n;
|
|
91
96
|
#listService;
|
|
97
|
+
#navigatedItem;
|
|
92
98
|
#typeaheadKey;
|
|
93
99
|
constructor() {
|
|
94
100
|
this.#destroyRef = inject(DestroyRef);
|
|
95
101
|
this.#dropdownListService = inject(DropdownListService);
|
|
96
102
|
this.#dropdownService = inject(DropdownService);
|
|
97
103
|
this.#hostElementRef = inject((ElementRef));
|
|
104
|
+
this.#i18n = inject(MonaI18nService);
|
|
105
|
+
this.#listService = inject(ListService);
|
|
98
106
|
this.#navigatedItem = linkedSignal(() => this.selectedDataItem(), /* @ts-ignore */
|
|
99
107
|
...(ngDevMode ? [{ debugName: "#navigatedItem" }] : /* istanbul ignore next */ []));
|
|
100
|
-
this.#listService = inject(ListService);
|
|
101
108
|
this.#typeaheadKey = new Subject();
|
|
102
109
|
this.activeDescendant = computed(() => {
|
|
103
110
|
const highlightedItem = this.#listService.highlightedItem();
|
|
@@ -148,6 +155,7 @@ class DropdownListComponent {
|
|
|
148
155
|
return twMerge(variantClass, userClass);
|
|
149
156
|
}, /* @ts-ignore */
|
|
150
157
|
...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
|
|
158
|
+
this.messages = this.#i18n.componentMessages("dropdownList", DROPDOWN_LIST_DEFAULT_MESSAGES);
|
|
151
159
|
this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
152
160
|
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
153
161
|
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
@@ -557,7 +565,7 @@ class DropdownListComponent {
|
|
|
557
565
|
useExisting: forwardRef(() => DropdownListComponent),
|
|
558
566
|
multi: false
|
|
559
567
|
}
|
|
560
|
-
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "valueTemplate", first: true, predicate: DropdownListValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<span [class]=\"valueContainerClass()\">\n @if (!valueTemplate()) {\n <span>\n @if (selectedListItem()) {\n <span>{{ valueText() }}</span>\n } @else {\n <span>{{ placeholder() }}</span>\n }\n </span>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\n }\n</span>\n\n@if (selectedListItem() && showClearButton() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n label=\"
|
|
568
|
+
], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "valueTemplate", first: true, predicate: DropdownListValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<span [class]=\"valueContainerClass()\">\n @if (!valueTemplate()) {\n <span>\n @if (selectedListItem()) {\n <span>{{ valueText() }}</span>\n } @else {\n <span>{{ placeholder() }}</span>\n }\n </span>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\n }\n</span>\n\n@if (selectedListItem() && showClearButton() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<span monaDropdownLiveRegion></span>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\">\n <mona-list [listId]=\"listId\" [focusOnMount]=\"false\" [size]=\"size()\" (itemSelect)=\"onItemSelect($event)\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemSelect"] }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }, { kind: "directive", type: DropdownLiveRegionDirective, selector: "span[monaDropdownLiveRegion]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
561
569
|
}
|
|
562
570
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DropdownListComponent, decorators: [{
|
|
563
571
|
type: Component,
|
|
@@ -604,7 +612,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
604
612
|
"[attr.tabindex]": "disabled() ? null : 0",
|
|
605
613
|
"[class]": "baseClass()",
|
|
606
614
|
"(blur)": "onBlur()"
|
|
607
|
-
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<span [class]=\"valueContainerClass()\">\n @if (!valueTemplate()) {\n <span>\n @if (selectedListItem()) {\n <span>{{ valueText() }}</span>\n } @else {\n <span>{{ placeholder() }}</span>\n }\n </span>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\n }\n</span>\n\n@if (selectedListItem() && showClearButton() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n label=\"
|
|
615
|
+
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<span [class]=\"valueContainerClass()\">\n @if (!valueTemplate()) {\n <span>\n @if (selectedListItem()) {\n <span>{{ valueText() }}</span>\n } @else {\n <span>{{ placeholder() }}</span>\n }\n </span>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: selectedDataItem() }\"></ng-container>\n }\n</span>\n\n@if (selectedListItem() && showClearButton() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<span monaDropdownLiveRegion></span>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\">\n <mona-list [listId]=\"listId\" [focusOnMount]=\"false\" [size]=\"size()\" (itemSelect)=\"onItemSelect($event)\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n" }]
|
|
608
616
|
}], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{
|
|
609
617
|
read: TemplateRef
|
|
610
618
|
}, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownListValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], itemDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemDisabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], valuePrimitive: [{ type: i0.Input, args: [{ isSignal: true, alias: "valuePrimitive", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
@@ -617,5 +625,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
617
625
|
* Generated bundle index. Do not edit.
|
|
618
626
|
*/
|
|
619
627
|
|
|
620
|
-
export { DropdownListComponent, DropdownListValueTemplateDirective };
|
|
628
|
+
export { DROPDOWN_LIST_DEFAULT_MESSAGES, DropdownListComponent, DropdownListValueTemplateDirective };
|
|
621
629
|
//# sourceMappingURL=nanahoshi-mona-ui-dropdown-list.mjs.map
|
|
@@ -6,6 +6,7 @@ import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
|
6
6
|
import { Subject, takeUntil, take, filter, switchMap, fromEvent } from 'rxjs';
|
|
7
7
|
import { ConnectionPositionPair } from '@angular/cdk/overlay';
|
|
8
8
|
import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
9
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
9
10
|
import { cva } from 'class-variance-authority';
|
|
10
11
|
import { themeOverlaySurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
11
12
|
|
|
@@ -591,17 +592,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
591
592
|
}]
|
|
592
593
|
}], ctorParameters: () => [] });
|
|
593
594
|
|
|
595
|
+
const DROPDOWNS_DEFAULT_MESSAGES = {
|
|
596
|
+
itemPosition: (text, position, total) => `${text}, ${position} of ${total}`,
|
|
597
|
+
noResultsFound: "No results found",
|
|
598
|
+
resultsAvailable: (count) => `${count} result${count === 1 ? "" : "s"} available`
|
|
599
|
+
};
|
|
600
|
+
|
|
594
601
|
class DropdownLiveRegionDirective {
|
|
595
602
|
#dropdownService;
|
|
603
|
+
#expanded;
|
|
596
604
|
#host;
|
|
605
|
+
#i18n;
|
|
597
606
|
#listService;
|
|
598
|
-
#
|
|
607
|
+
#messages;
|
|
599
608
|
constructor() {
|
|
600
609
|
this.#dropdownService = inject(DropdownService);
|
|
601
|
-
this.#host = inject(ElementRef);
|
|
602
|
-
this.#listService = inject(ListService);
|
|
603
610
|
this.#expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
|
|
604
611
|
...(ngDevMode ? [{ debugName: "#expanded" }] : /* istanbul ignore next */ []));
|
|
612
|
+
this.#host = inject(ElementRef);
|
|
613
|
+
this.#i18n = inject(MonaI18nService);
|
|
614
|
+
this.#listService = inject(ListService);
|
|
615
|
+
this.#messages = this.#i18n.componentMessages("dropdowns", DROPDOWNS_DEFAULT_MESSAGES);
|
|
605
616
|
this.liveRegionText = computed(() => {
|
|
606
617
|
const highlightedItem = this.#listService.highlightedItem();
|
|
607
618
|
const selectedItem = this.#listService.selectedListItems().lastOrDefault();
|
|
@@ -611,11 +622,11 @@ class DropdownLiveRegionDirective {
|
|
|
611
622
|
const text = this.#listService.getItemText(activeItem);
|
|
612
623
|
const positionInfo = this.#listService.getItemPosition(activeItem);
|
|
613
624
|
if (positionInfo) {
|
|
614
|
-
return
|
|
625
|
+
return this.#messages().itemPosition(text, positionInfo.position, positionInfo.total);
|
|
615
626
|
}
|
|
616
627
|
return text;
|
|
617
628
|
}
|
|
618
|
-
return count === 0 ?
|
|
629
|
+
return count === 0 ? this.#messages().noResultsFound : this.#messages().resultsAvailable(count);
|
|
619
630
|
}, /* @ts-ignore */
|
|
620
631
|
...(ngDevMode ? [{ debugName: "liveRegionText" }] : /* istanbul ignore next */ []));
|
|
621
632
|
effect(() => {
|
|
@@ -692,5 +703,5 @@ const dropdownPopupThemeVariants = cva(`
|
|
|
692
703
|
* Generated bundle index. Do not edit.
|
|
693
704
|
*/
|
|
694
705
|
|
|
695
|
-
export { DropdownDataHandlerDirective, DropdownDataInputToken, DropdownFilterableDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownGroupableDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPopupHandlerDirective, DropdownPopupInputToken, DropdownPrefixTemplateDirective, DropdownService, DropdownSuffixTemplateDirective, DropdownVirtualScrollDirective, dropdownPopupThemeVariants };
|
|
706
|
+
export { DROPDOWNS_DEFAULT_MESSAGES, DropdownDataHandlerDirective, DropdownDataInputToken, DropdownFilterableDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownGroupableDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPopupHandlerDirective, DropdownPopupInputToken, DropdownPrefixTemplateDirective, DropdownService, DropdownSuffixTemplateDirective, DropdownVirtualScrollDirective, dropdownPopupThemeVariants };
|
|
696
707
|
//# sourceMappingURL=nanahoshi-mona-ui-dropdowns.mjs.map
|