@nanahoshi/mona-ui 0.24.8 → 0.24.10
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/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
- package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +342 -102
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1054 -452
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +9 -9
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +23 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +567 -33
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +20 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
- package/fesm2022/nanahoshi-mona-ui-window.mjs +594 -311
- package/i18n/catalogs/en-US.messages.json +24 -4
- package/locales/ar-sa/ar-sa.messages.json +20 -0
- package/locales/de-de/de-de.messages.json +20 -0
- package/locales/es-es/es-es.messages.json +20 -0
- package/locales/fr-fr/fr-fr.messages.json +20 -0
- package/locales/id-id/id-id.messages.json +20 -0
- package/locales/it-it/it-it.messages.json +20 -0
- package/locales/ja-jp/ja-jp.messages.json +20 -0
- package/locales/ko-kr/ko-kr.messages.json +20 -0
- package/locales/pt-br/pt-br.messages.json +20 -0
- package/locales/ru-ru/ru-ru.messages.json +20 -0
- package/locales/tr-tr/tr-tr.messages.json +20 -0
- package/locales/zh-cn/zh-cn.messages.json +20 -0
- package/locales/zh-tw/zh-tw.messages.json +20 -0
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
- package/types/nanahoshi-mona-ui-button.d.ts +20 -3
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
- package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
- package/types/nanahoshi-mona-ui-editor.d.ts +118 -21
- package/types/nanahoshi-mona-ui-i18n.d.ts +37 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +142 -16
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +20 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +20 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
- package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
- package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
- package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
- package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
- package/types/nanahoshi-mona-ui-window.d.ts +103 -14
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, inject, ElementRef, computed, afterNextRender, Component, signal, DOCUMENT,
|
|
2
|
+
import { Directive, inject, ElementRef, Injector, viewChild, ViewContainerRef, computed, TemplateRef, effect, untracked, afterNextRender, isDevMode, Component, InjectionToken, signal, DOCUMENT, forwardRef, Injectable, DestroyRef, contentChild, output, input } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { MonaI18nService, mergeMessages } from '@nanahoshi/mona-ui/i18n';
|
|
5
|
+
import { themeOverlaySurfaceClasses, createElementControlId, focusElement, positionGlobalOverlay, inertOutside } from '@nanahoshi/mona-ui/internal';
|
|
4
6
|
import { PopupDataInjectionToken, PopupCloseEvent, PopupCloseSource, PopupService } from '@nanahoshi/mona-ui/popup';
|
|
5
|
-
import { Subject,
|
|
6
|
-
import { PreventableEvent, AnyPipe } from '@nanahoshi/mona-ui/common';
|
|
7
|
-
import { themeOverlaySurfaceClasses, createElementControlId, focusElement, setWindowStyles } from '@nanahoshi/mona-ui/internal';
|
|
7
|
+
import { Subject, ReplaySubject, take, takeUntil, merge, map } from 'rxjs';
|
|
8
8
|
import * as i1 from '@angular/cdk/a11y';
|
|
9
9
|
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 {
|
|
13
|
+
import { AnyPipe, PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
14
14
|
import { cva } from 'class-variance-authority';
|
|
15
15
|
|
|
16
16
|
class DialogContentTemplateDirective {
|
|
@@ -68,23 +68,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
68
68
|
}]
|
|
69
69
|
}] });
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* @description Emitted when the user clicks a dialog action button. Call `preventDefault()` to keep the dialog open.
|
|
73
|
-
*/
|
|
74
|
-
class DialogActionEvent extends PreventableEvent {
|
|
75
|
-
#action;
|
|
76
|
-
constructor(action) {
|
|
77
|
-
super("dialogAction");
|
|
78
|
-
this.#action = action;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @description The action that was clicked.
|
|
82
|
-
*/
|
|
83
|
-
get action() {
|
|
84
|
-
return this.#action;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
71
|
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
89
72
|
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
90
73
|
const DIALOG_DEFAULT_MESSAGES = {
|
|
@@ -94,7 +77,7 @@ const DIALOG_DEFAULT_MESSAGES = {
|
|
|
94
77
|
};
|
|
95
78
|
|
|
96
79
|
const dialogBaseThemeVariants = cva(`
|
|
97
|
-
flex h-full w-full flex-col gap-0.5 overflow-hidden
|
|
80
|
+
flex h-full max-h-[inherit] min-h-0 w-full flex-col gap-0.5 overflow-hidden
|
|
98
81
|
${themeOverlaySurfaceClasses} text-foreground
|
|
99
82
|
border border-border shadow-(--shadow-overlay) outline-none
|
|
100
83
|
`, {
|
|
@@ -111,10 +94,10 @@ const dialogBaseThemeVariants = cva(`
|
|
|
111
94
|
}
|
|
112
95
|
});
|
|
113
96
|
const dialogContentContainerThemeVariants = cva(`
|
|
114
|
-
flex flex-1 flex-row gap-1
|
|
97
|
+
flex min-h-0 flex-1 flex-row gap-1
|
|
115
98
|
`);
|
|
116
99
|
const dialogBodyThemeVariants = cva(`
|
|
117
|
-
flex h-full w-full flex-col gap-0 pe-2 pb-2
|
|
100
|
+
flex h-full min-h-0 w-full flex-col gap-0 pe-2 pb-2
|
|
118
101
|
`, {
|
|
119
102
|
variants: {
|
|
120
103
|
hasIcon: {
|
|
@@ -124,8 +107,7 @@ const dialogBodyThemeVariants = cva(`
|
|
|
124
107
|
}
|
|
125
108
|
});
|
|
126
109
|
const dialogHeaderThemeVariants = cva(`
|
|
127
|
-
flex flex-row gap-2 pt-4
|
|
128
|
-
select-none
|
|
110
|
+
flex shrink-0 flex-row gap-2 pt-4
|
|
129
111
|
`);
|
|
130
112
|
const dialogIconContainerThemeVariants = cva(`
|
|
131
113
|
flex items-start justify-center pt-8 pe-4 ps-6
|
|
@@ -151,7 +133,6 @@ const dialogIconThemeVariants = cva(`
|
|
|
151
133
|
});
|
|
152
134
|
const dialogTitleContainerThemeVariants = cva(`
|
|
153
135
|
flex flex-1 items-center justify-start p-1
|
|
154
|
-
select-none
|
|
155
136
|
`);
|
|
156
137
|
const dialogCloseButtonContainerThemeVariants = cva(`
|
|
157
138
|
flex items-start justify-end
|
|
@@ -161,15 +142,13 @@ const dialogTitleThemeVariants = cva(`
|
|
|
161
142
|
`);
|
|
162
143
|
const dialogDescriptionThemeVariants = cva(`
|
|
163
144
|
text-sm text-muted-foreground
|
|
164
|
-
select-none
|
|
165
145
|
`);
|
|
166
146
|
const dialogContentThemeVariants = cva(`
|
|
167
|
-
flex-1 overflow-auto p-1
|
|
147
|
+
min-h-0 flex-1 overflow-auto p-1
|
|
168
148
|
[scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
|
|
169
149
|
`);
|
|
170
150
|
const dialogFooterThemeVariants = cva(`
|
|
171
|
-
flex flex-row gap-2 px-4 py-2
|
|
172
|
-
select-none
|
|
151
|
+
flex shrink-0 flex-row gap-2 px-4 py-2
|
|
173
152
|
bg-surface-muted
|
|
174
153
|
border-t border-border-subtle
|
|
175
154
|
`, {
|
|
@@ -192,13 +171,36 @@ const dialogFooterThemeVariants = cva(`
|
|
|
192
171
|
}
|
|
193
172
|
});
|
|
194
173
|
|
|
174
|
+
/** Targets that handle Enter themselves, so it doesn't trigger the dialog's default action. */
|
|
175
|
+
const HANDLES_ENTER = [
|
|
176
|
+
"a[href]",
|
|
177
|
+
"button",
|
|
178
|
+
"form",
|
|
179
|
+
"select",
|
|
180
|
+
"textarea",
|
|
181
|
+
"[contenteditable]:not([contenteditable='false'])",
|
|
182
|
+
"[role='button']",
|
|
183
|
+
"[role='checkbox']",
|
|
184
|
+
"[role='combobox']",
|
|
185
|
+
"[role='link']",
|
|
186
|
+
"[role='listbox']",
|
|
187
|
+
"[role='menu']",
|
|
188
|
+
"[role='menuitem']",
|
|
189
|
+
"[role='option']",
|
|
190
|
+
"[role='radio']",
|
|
191
|
+
"[role='switch']",
|
|
192
|
+
"[role='tab']",
|
|
193
|
+
"input:is([type='button'], [type='checkbox'], [type='color'], [type='file'], [type='image'], [type='radio'], [type='reset'], [type='submit'])"
|
|
194
|
+
].join(", ");
|
|
195
195
|
class DialogContentComponent {
|
|
196
196
|
#hostElementRef;
|
|
197
197
|
#i18n;
|
|
198
198
|
#iconMap;
|
|
199
199
|
#injectedData;
|
|
200
|
+
#injector;
|
|
200
201
|
#localeMessages;
|
|
201
202
|
#trapFocus;
|
|
203
|
+
#componentRef;
|
|
202
204
|
constructor() {
|
|
203
205
|
this.#hostElementRef = inject(ElementRef);
|
|
204
206
|
this.#i18n = inject(MonaI18nService);
|
|
@@ -210,8 +212,11 @@ class DialogContentComponent {
|
|
|
210
212
|
warning: { color: "var(--color-warning)", icon: LucideOctagonAlert }
|
|
211
213
|
};
|
|
212
214
|
this.#injectedData = inject(PopupDataInjectionToken);
|
|
215
|
+
this.#injector = inject(Injector);
|
|
213
216
|
this.#localeMessages = this.#i18n.componentMessages("dialog", DIALOG_DEFAULT_MESSAGES);
|
|
214
217
|
this.#trapFocus = inject(CdkTrapFocus);
|
|
218
|
+
this.#componentRef = null;
|
|
219
|
+
this.componentHost = viewChild("componentHost", { ...(ngDevMode ? { debugName: "componentHost" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
|
|
215
220
|
this.actions = computed(() => {
|
|
216
221
|
const data = this.dialogData();
|
|
217
222
|
if (data.actions != null) {
|
|
@@ -238,10 +243,20 @@ class DialogContentComponent {
|
|
|
238
243
|
return dialogContentThemeVariants();
|
|
239
244
|
}, /* @ts-ignore */
|
|
240
245
|
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
246
|
+
this.contentComponent = computed(() => {
|
|
247
|
+
const content = this.dialogData().content;
|
|
248
|
+
return content && !(content instanceof TemplateRef) ? content : null;
|
|
249
|
+
}, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "contentComponent" }] : /* istanbul ignore next */ []));
|
|
241
251
|
this.contentContainerClass = computed(() => {
|
|
242
252
|
return dialogContentContainerThemeVariants();
|
|
243
253
|
}, /* @ts-ignore */
|
|
244
254
|
...(ngDevMode ? [{ debugName: "contentContainerClass" }] : /* istanbul ignore next */ []));
|
|
255
|
+
this.contentTemplate = computed(() => {
|
|
256
|
+
const content = this.dialogData().content;
|
|
257
|
+
return content instanceof TemplateRef ? content : null;
|
|
258
|
+
}, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
|
|
245
260
|
this.describedById = computed(() => {
|
|
246
261
|
const data = this.dialogData();
|
|
247
262
|
return data.descriptionTemplate || data.description ? this.descriptionId : null;
|
|
@@ -254,6 +269,7 @@ class DialogContentComponent {
|
|
|
254
269
|
this.descriptionId = createElementControlId();
|
|
255
270
|
this.dialogData = computed(() => this.dialogReference.data(), /* @ts-ignore */
|
|
256
271
|
...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
|
|
272
|
+
this.dialogRef = this.#injectedData.dialogReference.dialogRef;
|
|
257
273
|
this.dialogReference = this.#injectedData.dialogReference;
|
|
258
274
|
this.footerClass = computed(() => {
|
|
259
275
|
const layout = this.dialogData().actionsLayout;
|
|
@@ -261,6 +277,11 @@ class DialogContentComponent {
|
|
|
261
277
|
return dialogFooterThemeVariants({ layout, rounded });
|
|
262
278
|
}, /* @ts-ignore */
|
|
263
279
|
...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
|
|
280
|
+
this.hasTitle = computed(() => {
|
|
281
|
+
const data = this.dialogData();
|
|
282
|
+
return !!data.titleTemplate || !!data.title;
|
|
283
|
+
}, /* @ts-ignore */
|
|
284
|
+
...(ngDevMode ? [{ debugName: "hasTitle" }] : /* istanbul ignore next */ []));
|
|
264
285
|
this.headerClass = computed(() => {
|
|
265
286
|
return dialogHeaderThemeVariants();
|
|
266
287
|
}, /* @ts-ignore */
|
|
@@ -298,22 +319,63 @@ class DialogContentComponent {
|
|
|
298
319
|
}, /* @ts-ignore */
|
|
299
320
|
...(ngDevMode ? [{ debugName: "titleContainerClass" }] : /* istanbul ignore next */ []));
|
|
300
321
|
this.#trapFocus.autoCapture = true;
|
|
322
|
+
// A non-modal dialog leaves the page usable, so Tab can leave it too.
|
|
323
|
+
this.#trapFocus.enabled = this.dialogData().modal ?? true;
|
|
324
|
+
effect(() => {
|
|
325
|
+
const host = this.componentHost();
|
|
326
|
+
const type = this.contentComponent();
|
|
327
|
+
untracked(() => this.#renderComponent(host, type));
|
|
328
|
+
});
|
|
301
329
|
afterNextRender({
|
|
302
|
-
|
|
330
|
+
write: () => {
|
|
303
331
|
this.focusElement();
|
|
332
|
+
if (isDevMode()) {
|
|
333
|
+
this.#warnIfUnnamed();
|
|
334
|
+
}
|
|
304
335
|
}
|
|
305
336
|
});
|
|
306
337
|
}
|
|
307
338
|
onActionClick(action) {
|
|
308
|
-
this.dialogReference.
|
|
309
|
-
action,
|
|
310
|
-
viaClose: false
|
|
311
|
-
});
|
|
339
|
+
this.dialogReference.requestAction(action);
|
|
312
340
|
}
|
|
313
341
|
onCloseClick() {
|
|
314
|
-
this.dialogReference.
|
|
315
|
-
|
|
316
|
-
|
|
342
|
+
this.dialogReference.requestClose();
|
|
343
|
+
}
|
|
344
|
+
/** Enter outside a control that handles it triggers the default action, as in a form. */
|
|
345
|
+
onKeydown(event) {
|
|
346
|
+
if (event.key !== "Enter" || event.defaultPrevented || event.isComposing) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || this.dialogData().footerTemplate) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
353
|
+
if (target?.closest(HANDLES_ENTER)) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const action = Array.from(this.actions()).find(candidate => candidate.default);
|
|
357
|
+
if (action) {
|
|
358
|
+
event.preventDefault();
|
|
359
|
+
this.onActionClick(action);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
#renderComponent(host, type) {
|
|
363
|
+
if (this.#componentRef && (!host || this.#componentRef.componentType !== type)) {
|
|
364
|
+
this.#componentRef.destroy();
|
|
365
|
+
this.#componentRef = null;
|
|
366
|
+
this.dialogReference.setComponentRef(undefined);
|
|
367
|
+
}
|
|
368
|
+
if (host && type && !this.#componentRef) {
|
|
369
|
+
host.clear();
|
|
370
|
+
this.#componentRef = host.createComponent(type, { injector: this.#injector });
|
|
371
|
+
this.dialogReference.setComponentRef(this.#componentRef);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
#warnIfUnnamed() {
|
|
375
|
+
if (this.hasTitle() || this.dialogData().ariaLabel) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
console.warn("[Mona Dialog] A dialog needs an accessible name. Set title, titleTemplate or ariaLabel.", this.#hostElementRef.nativeElement);
|
|
317
379
|
}
|
|
318
380
|
focusElement() {
|
|
319
381
|
const element = this.dialogData().focusedElement;
|
|
@@ -321,35 +383,59 @@ class DialogContentComponent {
|
|
|
321
383
|
return;
|
|
322
384
|
}
|
|
323
385
|
const dialogElement = this.#hostElementRef.nativeElement;
|
|
324
|
-
|
|
386
|
+
// The focus trap moves focus to its first tabbable element after this runs; marking the target makes it
|
|
387
|
+
// land here instead.
|
|
388
|
+
focusElement(dialogElement, element)?.setAttribute("cdkFocusInitial", "");
|
|
325
389
|
}
|
|
326
390
|
getDefaultActions(type) {
|
|
391
|
+
const messages = this.messages();
|
|
392
|
+
const ok = { data: "ok", default: true, look: "primary", text: messages.ok };
|
|
327
393
|
if (type === "confirm") {
|
|
328
|
-
return [
|
|
329
|
-
{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: this.messages().ok },
|
|
330
|
-
{ cssClass: "", iconOnly: false, look: "default", rounded: "medium", text: this.messages().cancel }
|
|
331
|
-
];
|
|
394
|
+
return [ok, { data: "cancel", look: "default", text: messages.cancel }];
|
|
332
395
|
}
|
|
333
|
-
return [
|
|
396
|
+
return [ok];
|
|
334
397
|
}
|
|
335
398
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
336
|
-
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
|
|
399
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DialogContentComponent, isStandalone: true, selector: "ng-component", host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "baseClass()", "attr.aria-describedby": "describedById()", "attr.aria-label": "hasTitle() ? null : dialogData().ariaLabel || null", "attr.aria-labelledby": "hasTitle() ? headerId : null", "attr.aria-modal": "dialogData().modal ? 'true' : null", "attr.role": "role()" } }, viewQueries: [{ propertyName: "componentHost", first: true, predicate: ["componentHost"], descendants: true, read: ViewContainerRef, isSignal: true }], 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 @if (hasTitle()) {\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 } @else {\n <div class=\"flex-1\"></div>\n }\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 (contentTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: data.data, dialogRef: dialogRef }\"></ng-container>\n } @else if (contentComponent()) {\n <ng-container #componentHost></ng-container>\n } @else if (data.text) {\n <p>{{ 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", "toggleable", "type", "class"], outputs: ["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" }] }); }
|
|
337
400
|
}
|
|
338
401
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, decorators: [{
|
|
339
402
|
type: Component,
|
|
340
403
|
args: [{ imports: [ButtonDirective, NgTemplateOutlet, AnyPipe, LucideX, LucideDynamicIcon], host: {
|
|
341
404
|
"[class]": "baseClass()",
|
|
342
405
|
"[attr.aria-describedby]": "describedById()",
|
|
343
|
-
"[attr.aria-
|
|
344
|
-
"[attr.
|
|
345
|
-
|
|
346
|
-
|
|
406
|
+
"[attr.aria-label]": "hasTitle() ? null : dialogData().ariaLabel || null",
|
|
407
|
+
"[attr.aria-labelledby]": "hasTitle() ? headerId : null",
|
|
408
|
+
"[attr.aria-modal]": "dialogData().modal ? 'true' : null",
|
|
409
|
+
"[attr.role]": "role()",
|
|
410
|
+
"(keydown)": "onKeydown($event)"
|
|
411
|
+
}, 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 @if (hasTitle()) {\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 } @else {\n <div class=\"flex-1\"></div>\n }\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 (contentTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: data.data, dialogRef: dialogRef }\"></ng-container>\n } @else if (contentComponent()) {\n <ng-container #componentHost></ng-container>\n } @else if (data.text) {\n <p>{{ 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" }]
|
|
412
|
+
}], ctorParameters: () => [], propDecorators: { componentHost: [{ type: i0.ViewChild, args: ["componentHost", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* The `data` a dialog was opened with, for a component given as its `content`.
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* readonly #data = inject<{ name: string }>(DIALOG_DATA);
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
const DIALOG_DATA = new InjectionToken("DIALOG_DATA");
|
|
347
422
|
|
|
423
|
+
/**
|
|
424
|
+
* A handle on an open dialog. The close contract:
|
|
425
|
+
* - `action$` emits when an action button is clicked, before the dialog closes; `preventDefault()` keeps it open.
|
|
426
|
+
* - `close$` emits before any close, and `preventDefault()` keeps the dialog open.
|
|
427
|
+
* - `result` emits how the dialog closed as soon as the close goes ahead, and `closed$` emits the same result once
|
|
428
|
+
* the dialog is gone. All of them complete when it closes.
|
|
429
|
+
*/
|
|
348
430
|
class DialogRef {
|
|
349
431
|
#options;
|
|
350
432
|
constructor(options) {
|
|
351
433
|
this.#options = options;
|
|
352
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* @description Closes the dialog. The value is the `value` of the result, which reports the close as
|
|
437
|
+
* programmatic.
|
|
438
|
+
*/
|
|
353
439
|
close(result) {
|
|
354
440
|
this.#options.close(result);
|
|
355
441
|
}
|
|
@@ -360,12 +446,30 @@ class DialogRef {
|
|
|
360
446
|
update(data) {
|
|
361
447
|
this.#options.update(data);
|
|
362
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* @description Emits when an action button is clicked, before the dialog closes. Call `preventDefault()` on
|
|
451
|
+
* the event to keep the dialog open. Completes when the dialog closes.
|
|
452
|
+
*/
|
|
453
|
+
get action$() {
|
|
454
|
+
return this.#options.action$;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* @description Emits before the dialog closes, whatever closes it. Call `preventDefault()` to keep it open.
|
|
458
|
+
* Completes when the dialog closes.
|
|
459
|
+
*/
|
|
363
460
|
get close$() {
|
|
364
461
|
return this.#options.close$;
|
|
365
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* @description Emits the dialog's result once it has closed and its leave animation has finished, then
|
|
465
|
+
* completes.
|
|
466
|
+
*/
|
|
366
467
|
get closed$() {
|
|
367
468
|
return this.#options.closed$;
|
|
368
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* @description The component given as `content`, or `null` for template and text content.
|
|
472
|
+
*/
|
|
369
473
|
get component() {
|
|
370
474
|
return this.#options.component;
|
|
371
475
|
}
|
|
@@ -378,6 +482,11 @@ class DialogRef {
|
|
|
378
482
|
get popupRef() {
|
|
379
483
|
return this.#options.popupRef;
|
|
380
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* @description Emits how the dialog closed (an action, the close button, Escape, a backdrop click or
|
|
487
|
+
* `close()`) as soon as the close goes ahead, then completes when the dialog is gone. Late subscribers get the
|
|
488
|
+
* result too.
|
|
489
|
+
*/
|
|
381
490
|
get result() {
|
|
382
491
|
return this.#options.result;
|
|
383
492
|
}
|
|
@@ -386,11 +495,37 @@ class DialogRef {
|
|
|
386
495
|
}
|
|
387
496
|
}
|
|
388
497
|
|
|
498
|
+
/**
|
|
499
|
+
* @description Emitted when the user clicks a dialog action button. Call `preventDefault()` to keep the dialog open.
|
|
500
|
+
*/
|
|
501
|
+
class DialogActionEvent extends PreventableEvent {
|
|
502
|
+
#action;
|
|
503
|
+
constructor(action) {
|
|
504
|
+
super("dialogAction");
|
|
505
|
+
this.#action = action;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @description The action that was clicked.
|
|
509
|
+
*/
|
|
510
|
+
get action() {
|
|
511
|
+
return this.#action;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* @internal The dialog's own side of `DialogRef`: action buttons and the close button report here, so a dialog
|
|
517
|
+
* opened through `DialogService` and one declared with `<mona-dialog>` close the same way.
|
|
518
|
+
*/
|
|
389
519
|
class DialogReference {
|
|
520
|
+
#action$ = new Subject();
|
|
521
|
+
#closed$ = new ReplaySubject(1);
|
|
390
522
|
#dialogRef;
|
|
523
|
+
#options;
|
|
524
|
+
#result$ = new ReplaySubject(1);
|
|
525
|
+
#pendingAction = null;
|
|
526
|
+
#resultValue = null;
|
|
391
527
|
constructor(options, initialData) {
|
|
392
|
-
this
|
|
393
|
-
this.dialogResult$ = new Subject();
|
|
528
|
+
this.#options = options;
|
|
394
529
|
this.#dialogRef = new DialogRef(this);
|
|
395
530
|
this.data = signal(initialData, /* @ts-ignore */
|
|
396
531
|
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -402,23 +537,73 @@ class DialogReference {
|
|
|
402
537
|
this.#popupRefOrThrow.close(event);
|
|
403
538
|
}
|
|
404
539
|
initializePopupRef(popupRef) {
|
|
405
|
-
this
|
|
540
|
+
this.#options.popupRef = popupRef;
|
|
541
|
+
popupRef.closeStart.pipe(take(1)).subscribe(event => this.#settle(event));
|
|
542
|
+
popupRef.closed.pipe(take(1)).subscribe(event => {
|
|
543
|
+
const result = this.#settle(event);
|
|
544
|
+
this.#result$.complete();
|
|
545
|
+
this.#action$.complete();
|
|
546
|
+
this.#closed$.next(result);
|
|
547
|
+
this.#closed$.complete();
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Reports a click on an action button: `action$` first, where it can be prevented, then the close.
|
|
552
|
+
*/
|
|
553
|
+
requestAction(action) {
|
|
554
|
+
const event = new DialogActionEvent(action);
|
|
555
|
+
this.#action$.next(event);
|
|
556
|
+
if (event.isDefaultPrevented()) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
this.#pendingAction = action;
|
|
560
|
+
if (!this.#popupRefOrThrow.close(new PopupCloseEvent({ via: PopupCloseSource.Action }))) {
|
|
561
|
+
this.#pendingAction = null;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Reports a click on the close button.
|
|
566
|
+
*/
|
|
567
|
+
requestClose() {
|
|
568
|
+
this.#popupRefOrThrow.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
|
|
569
|
+
}
|
|
570
|
+
setComponentRef(componentRef) {
|
|
571
|
+
this.#options.componentRef = componentRef;
|
|
406
572
|
}
|
|
407
573
|
update(data) {
|
|
408
574
|
this.data.update(current => ({ ...current, ...data }));
|
|
409
575
|
}
|
|
576
|
+
/** Works out the result once, when the close goes ahead, and publishes it on `result`. */
|
|
577
|
+
#settle(event) {
|
|
578
|
+
if (this.#resultValue) {
|
|
579
|
+
return this.#resultValue;
|
|
580
|
+
}
|
|
581
|
+
const action = this.#pendingAction;
|
|
582
|
+
const result = action && event.via === PopupCloseSource.Action
|
|
583
|
+
? { action, via: PopupCloseSource.Action, viaClose: false }
|
|
584
|
+
: {
|
|
585
|
+
value: event.result,
|
|
586
|
+
via: event.via == null || event.via === PopupCloseSource.Action
|
|
587
|
+
? PopupCloseSource.Programmatic
|
|
588
|
+
: event.via,
|
|
589
|
+
viaClose: true
|
|
590
|
+
};
|
|
591
|
+
this.#resultValue = result;
|
|
592
|
+
this.#result$.next(result);
|
|
593
|
+
return result;
|
|
594
|
+
}
|
|
595
|
+
get action$() {
|
|
596
|
+
return this.#action$.asObservable();
|
|
597
|
+
}
|
|
410
598
|
get close$() {
|
|
411
|
-
|
|
599
|
+
const popupRef = this.#popupRefOrThrow;
|
|
600
|
+
return popupRef.beforeClose.pipe(takeUntil(merge(popupRef.closed, this.#closed$).pipe(take(1))), map(event => event));
|
|
412
601
|
}
|
|
413
602
|
get closed$() {
|
|
414
|
-
return this.#
|
|
603
|
+
return this.#closed$.asObservable();
|
|
415
604
|
}
|
|
416
605
|
get component() {
|
|
417
|
-
|
|
418
|
-
if (!popupComponent) {
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
return popupComponent.instance.componentRef ?? null;
|
|
606
|
+
return this.#options.componentRef ?? null;
|
|
422
607
|
}
|
|
423
608
|
get dialogRef() {
|
|
424
609
|
return this.#dialogRef;
|
|
@@ -433,13 +618,13 @@ class DialogReference {
|
|
|
433
618
|
return this.#popupRefOrThrow;
|
|
434
619
|
}
|
|
435
620
|
get #popupRefOrThrow() {
|
|
436
|
-
if (!this
|
|
621
|
+
if (!this.#options.popupRef) {
|
|
437
622
|
throw new Error("DialogReference: popupRef has not been initialized.");
|
|
438
623
|
}
|
|
439
|
-
return this
|
|
624
|
+
return this.#options.popupRef;
|
|
440
625
|
}
|
|
441
626
|
get result() {
|
|
442
|
-
return this
|
|
627
|
+
return this.#result$.asObservable();
|
|
443
628
|
}
|
|
444
629
|
get width() {
|
|
445
630
|
return this.element.offsetWidth;
|
|
@@ -450,66 +635,110 @@ const createDialogInjectorData = (settings) => {
|
|
|
450
635
|
return {
|
|
451
636
|
actions: settings.actions,
|
|
452
637
|
actionsLayout: settings.actionsLayout ?? "end",
|
|
638
|
+
ariaLabel: settings.ariaLabel,
|
|
453
639
|
closable: settings.closable ?? true,
|
|
454
640
|
closeOnEscape: settings.closeOnEscape ?? true,
|
|
455
641
|
content: settings.content,
|
|
642
|
+
data: settings.data,
|
|
456
643
|
description: settings.description,
|
|
457
644
|
descriptionTemplate: settings.descriptionTemplate,
|
|
458
645
|
dialogReference: null,
|
|
459
646
|
focusedElement: settings.focusedElement ?? null,
|
|
460
647
|
footerTemplate: settings.footerTemplate,
|
|
461
|
-
height: settings.height,
|
|
462
648
|
iconTemplate: settings.iconTemplate,
|
|
463
|
-
left: settings.left,
|
|
464
649
|
messages: settings.messages,
|
|
465
650
|
modal: settings.modal ?? true,
|
|
466
651
|
rounded: settings.rounded ?? "medium",
|
|
467
652
|
text: settings.text ?? "",
|
|
468
653
|
title: settings.title,
|
|
469
654
|
titleTemplate: settings.titleTemplate,
|
|
470
|
-
|
|
471
|
-
type: settings.type,
|
|
472
|
-
width: settings.width ?? 450
|
|
655
|
+
type: settings.type
|
|
473
656
|
};
|
|
474
657
|
};
|
|
475
658
|
|
|
659
|
+
/** Marks the buttons `confirm()` and `alert()` add, so their result can be read without comparing text. */
|
|
660
|
+
const DIALOG_OK = "ok";
|
|
661
|
+
const DIALOG_CANCEL = "cancel";
|
|
662
|
+
/** Keeps a dialog 1rem inside the viewport unless the settings give their own limits. */
|
|
663
|
+
const VIEWPORT_MARGIN = "2rem";
|
|
476
664
|
class DialogService {
|
|
477
665
|
#document = inject(DOCUMENT);
|
|
666
|
+
#i18n = inject(MonaI18nService);
|
|
478
667
|
#injector = inject(Injector);
|
|
668
|
+
#localeMessages = this.#i18n.componentMessages("dialog", DIALOG_DEFAULT_MESSAGES);
|
|
479
669
|
#popupService = inject(PopupService);
|
|
670
|
+
/**
|
|
671
|
+
* Opens a dialog with an OK button. Emits once it closes, however it closes, then completes.
|
|
672
|
+
* The dialog opens when `alert()` is called, whether or not the result is subscribed to.
|
|
673
|
+
*/
|
|
674
|
+
alert(settings) {
|
|
675
|
+
const actions = this.#promptActions(settings, false);
|
|
676
|
+
return this.show({ type: "info", ...settings, actions }).result.pipe(map(() => undefined));
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Opens a confirmation dialog with OK and Cancel buttons. Emits `true` for OK and `false` for anything else
|
|
680
|
+
* (Cancel, the close button, Escape), then completes. The dialog opens when `confirm()` is called, whether or
|
|
681
|
+
* not the result is subscribed to.
|
|
682
|
+
*/
|
|
683
|
+
confirm(settings) {
|
|
684
|
+
const actions = this.#promptActions(settings, true);
|
|
685
|
+
return this.show({ type: "confirm", ...settings, actions }).result.pipe(map(result => !result.viaClose && result.action.data === DIALOG_OK));
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Opens a dialog.
|
|
689
|
+
* @typeParam R the type of the value passed to `DialogRef.close(value)`
|
|
690
|
+
* @typeParam D the type of `data`
|
|
691
|
+
*/
|
|
480
692
|
show(settings) {
|
|
693
|
+
const modal = settings.modal ?? true;
|
|
481
694
|
const injectorData = createDialogInjectorData(settings);
|
|
482
695
|
const dialogReference = new DialogReference({}, injectorData);
|
|
483
696
|
injectorData.dialogReference = dialogReference;
|
|
484
697
|
const popupRef = this.#popupService.create({
|
|
485
698
|
anchor: this.#document.body,
|
|
486
|
-
backdropClass:
|
|
699
|
+
backdropClass: modal
|
|
487
700
|
? ["fixed", "inset-0", "bg-background/50", "transition-opacity", "z-40", "backdrop-blur-xs"]
|
|
488
701
|
: "transparent",
|
|
702
|
+
blockScroll: modal,
|
|
489
703
|
closeOnBackdropClick: false,
|
|
490
704
|
closeOnEscape: injectorData.closeOnEscape,
|
|
491
705
|
closeOnOutsideClick: false,
|
|
492
706
|
content: DialogContentComponent,
|
|
493
707
|
data: injectorData,
|
|
494
|
-
hasBackdrop:
|
|
708
|
+
hasBackdrop: modal,
|
|
495
709
|
height: settings.height ?? "fit-content",
|
|
496
|
-
|
|
497
|
-
|
|
710
|
+
injector: settings.injector,
|
|
711
|
+
maxHeight: settings.maxHeight ?? `calc(100dvh - ${VIEWPORT_MARGIN})`,
|
|
712
|
+
maxWidth: settings.maxWidth ?? `calc(100dvw - ${VIEWPORT_MARGIN})`,
|
|
498
713
|
minHeight: settings.minHeight,
|
|
499
714
|
minWidth: settings.minWidth,
|
|
715
|
+
popupWrapperClass: "mona-popup-constrain-height",
|
|
500
716
|
positionStrategy: "global",
|
|
501
|
-
providers: [
|
|
717
|
+
providers: [
|
|
718
|
+
{ provide: DialogRef, useFactory: forwardRef(() => dialogReference.dialogRef) },
|
|
719
|
+
{ provide: DIALOG_DATA, useValue: settings.data }
|
|
720
|
+
],
|
|
721
|
+
restoreFocus: (settings.restoreFocus ?? true) ? "auto" : false,
|
|
502
722
|
width: settings.width
|
|
503
723
|
});
|
|
504
724
|
dialogReference.initializePopupRef(popupRef);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
725
|
+
positionGlobalOverlay(popupRef.overlayRef, { left: settings.left, top: settings.top });
|
|
726
|
+
if (modal) {
|
|
727
|
+
const release = inertOutside(popupRef.overlayRef.hostElement);
|
|
728
|
+
merge(popupRef.closeStart, popupRef.closed)
|
|
729
|
+
.pipe(take(1))
|
|
730
|
+
.subscribe(() => release());
|
|
731
|
+
}
|
|
732
|
+
// Once rendered, center again from the real size, in case the content changed it.
|
|
733
|
+
afterNextRender({ write: () => popupRef.overlayRef.updatePosition() }, { injector: this.#injector });
|
|
511
734
|
return dialogReference.dialogRef;
|
|
512
735
|
}
|
|
736
|
+
#promptActions(settings, withCancel) {
|
|
737
|
+
const messages = mergeMessages(this.#localeMessages(), settings.messages);
|
|
738
|
+
const ok = { data: DIALOG_OK, default: true, look: "primary", text: messages.ok };
|
|
739
|
+
const cancel = { data: DIALOG_CANCEL, look: "default", text: messages.cancel };
|
|
740
|
+
return withCancel ? [ok, cancel] : [ok];
|
|
741
|
+
}
|
|
513
742
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
514
743
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, providedIn: "root" }); }
|
|
515
744
|
}
|
|
@@ -523,10 +752,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
523
752
|
class DialogComponent {
|
|
524
753
|
#destroyRef;
|
|
525
754
|
#dialogService;
|
|
755
|
+
#destroyed;
|
|
526
756
|
#dialogRef;
|
|
527
757
|
constructor() {
|
|
528
758
|
this.#destroyRef = inject(DestroyRef);
|
|
529
759
|
this.#dialogService = inject(DialogService);
|
|
760
|
+
this.#destroyed = false;
|
|
530
761
|
this.contentTemplate = contentChild(DialogContentTemplateDirective, { ...(ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
531
762
|
this.descriptionTemplate = contentChild(DialogDescriptionTemplateDirective, { ...(ngDevMode ? { debugName: "descriptionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
532
763
|
this.footerTemplate = contentChild(DialogFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
@@ -549,6 +780,11 @@ class DialogComponent {
|
|
|
549
780
|
*/
|
|
550
781
|
this.actionsLayout = input("end", /* @ts-ignore */
|
|
551
782
|
...(ngDevMode ? [{ debugName: "actionsLayout" }] : /* istanbul ignore next */ []));
|
|
783
|
+
/**
|
|
784
|
+
* @description Accessible name for the dialog when it has no `title` or title template.
|
|
785
|
+
*/
|
|
786
|
+
this.ariaLabel = input(/* @ts-ignore */
|
|
787
|
+
...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
552
788
|
/**
|
|
553
789
|
* @description Sets the visibility of the close button in the dialog header.
|
|
554
790
|
* @default true
|
|
@@ -556,8 +792,9 @@ class DialogComponent {
|
|
|
556
792
|
this.closable = input(true, /* @ts-ignore */
|
|
557
793
|
...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
|
|
558
794
|
/**
|
|
559
|
-
* @description Emits
|
|
560
|
-
*
|
|
795
|
+
* @description Emits before the dialog closes, whatever closes it: an action, the close button, Escape, or the
|
|
796
|
+
* component being destroyed. Call `preventDefault()` to keep it open (a close caused by destruction can't be
|
|
797
|
+
* kept).
|
|
561
798
|
*/
|
|
562
799
|
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
563
800
|
this.close = output();
|
|
@@ -568,7 +805,7 @@ class DialogComponent {
|
|
|
568
805
|
this.closeOnEscape = input(true, /* @ts-ignore */
|
|
569
806
|
...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
|
|
570
807
|
/**
|
|
571
|
-
* @description Emits when the dialog
|
|
808
|
+
* @description Emits when the dialog has closed and its leave animation has finished.
|
|
572
809
|
*/
|
|
573
810
|
this.closed = output();
|
|
574
811
|
/**
|
|
@@ -618,7 +855,8 @@ class DialogComponent {
|
|
|
618
855
|
this.minWidth = input(/* @ts-ignore */
|
|
619
856
|
...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
620
857
|
/**
|
|
621
|
-
* @description
|
|
858
|
+
* @description Whether the dialog is modal: a backdrop, `aria-modal="true"`, focus kept inside, page scroll
|
|
859
|
+
* locked, and the rest of the page inert.
|
|
622
860
|
* @default true
|
|
623
861
|
*/
|
|
624
862
|
this.modal = input(true, /* @ts-ignore */
|
|
@@ -657,13 +895,14 @@ class DialogComponent {
|
|
|
657
895
|
this.width = input(/* @ts-ignore */
|
|
658
896
|
...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
|
|
659
897
|
afterNextRender({
|
|
660
|
-
|
|
898
|
+
write: () => this.#openDialog()
|
|
661
899
|
});
|
|
662
900
|
effect(() => {
|
|
663
901
|
const actions = this.actions() ? [...this.actions()] : undefined;
|
|
664
902
|
const update = {
|
|
665
903
|
actions,
|
|
666
904
|
actionsLayout: this.actionsLayout(),
|
|
905
|
+
ariaLabel: this.ariaLabel(),
|
|
667
906
|
closable: this.closable(),
|
|
668
907
|
description: this.description(),
|
|
669
908
|
messages: this.messages(),
|
|
@@ -674,13 +913,18 @@ class DialogComponent {
|
|
|
674
913
|
};
|
|
675
914
|
this.#dialogRef?.update(update);
|
|
676
915
|
});
|
|
677
|
-
this.#destroyRef.onDestroy(() =>
|
|
916
|
+
this.#destroyRef.onDestroy(() => {
|
|
917
|
+
// Outputs can't emit once the component is destroyed, so this close is silent.
|
|
918
|
+
this.#destroyed = true;
|
|
919
|
+
this.#dialogRef?.close();
|
|
920
|
+
});
|
|
678
921
|
}
|
|
679
922
|
#openDialog() {
|
|
680
923
|
const actions = this.actions() ? [...this.actions()] : undefined;
|
|
681
924
|
this.#dialogRef = this.#dialogService.show({
|
|
682
925
|
actions,
|
|
683
926
|
actionsLayout: this.actionsLayout(),
|
|
927
|
+
ariaLabel: this.ariaLabel(),
|
|
684
928
|
closable: this.closable(),
|
|
685
929
|
closeOnEscape: this.closeOnEscape(),
|
|
686
930
|
content: this.contentTemplate(),
|
|
@@ -705,26 +949,22 @@ class DialogComponent {
|
|
|
705
949
|
type: this.type(),
|
|
706
950
|
width: this.width()
|
|
707
951
|
});
|
|
708
|
-
this.#dialogRef.
|
|
709
|
-
if (result.viaClose) {
|
|
710
|
-
this.#dialogRef?.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
const event = new DialogActionEvent(result.action);
|
|
952
|
+
this.#dialogRef.action$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
|
|
714
953
|
this.action.emit(event);
|
|
715
|
-
if (!event.isDefaultPrevented()) {
|
|
716
|
-
this.#dialogRef?.close();
|
|
717
|
-
}
|
|
718
954
|
});
|
|
719
|
-
this.#dialogRef.close$.
|
|
720
|
-
this
|
|
955
|
+
this.#dialogRef.close$.subscribe((event) => {
|
|
956
|
+
if (!this.#destroyed) {
|
|
957
|
+
this.close.emit(event);
|
|
958
|
+
}
|
|
721
959
|
});
|
|
722
|
-
this.#dialogRef.closed$.
|
|
723
|
-
this
|
|
960
|
+
this.#dialogRef.closed$.subscribe(() => {
|
|
961
|
+
if (!this.#destroyed) {
|
|
962
|
+
this.closed.emit();
|
|
963
|
+
}
|
|
724
964
|
});
|
|
725
965
|
}
|
|
726
966
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
727
|
-
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 }); }
|
|
967
|
+
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 }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", 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 }); }
|
|
728
968
|
}
|
|
729
969
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, decorators: [{
|
|
730
970
|
type: Component,
|
|
@@ -735,7 +975,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
735
975
|
class: "hidden"
|
|
736
976
|
}
|
|
737
977
|
}]
|
|
738
|
-
}], 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 }] }] } });
|
|
978
|
+
}], 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 }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", 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 }] }] } });
|
|
739
979
|
|
|
740
980
|
/*
|
|
741
981
|
* Public API Surface of @nanahoshi/mona-ui/dialog
|
|
@@ -745,5 +985,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
745
985
|
* Generated bundle index. Do not edit.
|
|
746
986
|
*/
|
|
747
987
|
|
|
748
|
-
export { DIALOG_DEFAULT_MESSAGES, DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
|
|
988
|
+
export { DIALOG_CANCEL, DIALOG_DATA, DIALOG_DEFAULT_MESSAGES, DIALOG_OK, DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
|
|
749
989
|
//# sourceMappingURL=nanahoshi-mona-ui-dialog.mjs.map
|