@memberjunction/ng-ui-components 6.2.1 → 6.3.0-edge.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 +28 -4
- package/dist/lib/accordion/accordion-sections.component.d.ts +51 -0
- package/dist/lib/accordion/accordion-sections.component.d.ts.map +1 -0
- package/dist/lib/accordion/accordion-sections.component.js +138 -0
- package/dist/lib/accordion/accordion-sections.component.js.map +1 -0
- package/dist/lib/accordion/accordion.component.d.ts +53 -4
- package/dist/lib/accordion/accordion.component.d.ts.map +1 -1
- package/dist/lib/accordion/accordion.component.js +233 -68
- package/dist/lib/accordion/accordion.component.js.map +1 -1
- package/dist/lib/accordion/accordion.scss +76 -0
- package/dist/lib/combobox/combobox.component.d.ts +1 -1
- package/dist/lib/combobox/combobox.component.js +1 -1
- package/dist/lib/combobox/combobox.component.js.map +1 -1
- package/dist/lib/confirm-dialog/confirm-dialog.component.d.ts.map +1 -1
- package/dist/lib/confirm-dialog/confirm-dialog.component.js +6 -2
- package/dist/lib/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/dist/lib/datepicker/datepicker.component.d.ts +1 -1
- package/dist/lib/datepicker/datepicker.component.js +1 -1
- package/dist/lib/datepicker/datepicker.component.js.map +1 -1
- package/dist/lib/dialog/dialog.component.d.ts +15 -6
- package/dist/lib/dialog/dialog.component.d.ts.map +1 -1
- package/dist/lib/dialog/dialog.component.js +34 -13
- package/dist/lib/dialog/dialog.component.js.map +1 -1
- package/dist/lib/dialog/dialog.scss +82 -6
- package/dist/lib/dialog/dialog.service.d.ts +3 -3
- package/dist/lib/dialog/dialog.service.js +3 -3
- package/dist/lib/dialog/dialog.service.js.map +1 -1
- package/dist/lib/dropdown/dropdown.component.d.ts +0 -1
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -1
- package/dist/lib/dropdown/dropdown.component.js +1 -2
- package/dist/lib/dropdown/dropdown.component.js.map +1 -1
- package/dist/lib/filter-panel/filter-panel.component.d.ts.map +1 -1
- package/dist/lib/filter-panel/filter-panel.component.js +5 -4
- package/dist/lib/filter-panel/filter-panel.component.js.map +1 -1
- package/dist/lib/input/chip.scss +1 -1
- package/dist/lib/input/input.scss +4 -4
- package/dist/lib/numeric-input/numeric-input.component.d.ts +1 -1
- package/dist/lib/numeric-input/numeric-input.component.js +1 -1
- package/dist/lib/numeric-input/numeric-input.component.js.map +1 -1
- package/dist/lib/progress-bar/progress-bar.component.d.ts +1 -1
- package/dist/lib/progress-bar/progress-bar.component.js +1 -1
- package/dist/lib/progress-bar/progress-bar.component.js.map +1 -1
- package/dist/lib/section-picker/section-picker.component.d.ts +108 -0
- package/dist/lib/section-picker/section-picker.component.d.ts.map +1 -0
- package/dist/lib/section-picker/section-picker.component.js +429 -0
- package/dist/lib/section-picker/section-picker.component.js.map +1 -0
- package/dist/lib/splitter/splitter.component.d.ts +2 -5
- package/dist/lib/splitter/splitter.component.d.ts.map +1 -1
- package/dist/lib/splitter/splitter.component.js +2 -5
- package/dist/lib/splitter/splitter.component.js.map +1 -1
- package/dist/lib/switch/switch.component.d.ts +1 -1
- package/dist/lib/switch/switch.component.js +1 -1
- package/dist/lib/switch/switch.component.js.map +1 -1
- package/dist/lib/viewport/phone-viewport.d.ts +15 -0
- package/dist/lib/viewport/phone-viewport.d.ts.map +1 -0
- package/dist/lib/viewport/phone-viewport.js +29 -0
- package/dist/lib/viewport/phone-viewport.js.map +1 -0
- package/dist/lib/window/window.component.d.ts +3 -3
- package/dist/lib/window/window.component.js +3 -3
- package/dist/lib/window/window.component.js.map +1 -1
- package/dist/lib/window/window.scss +43 -4
- package/dist/public-api.d.ts +3 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +3 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +3 -3
|
@@ -46,8 +46,10 @@ function MJDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
46
46
|
i0.ɵɵdomElementEnd()();
|
|
47
47
|
} if (rf & 2) {
|
|
48
48
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
49
|
+
i0.ɵɵclassProp("mj-dialog-backdrop--sheet", ctx_r1.PhoneMode === "sheet");
|
|
49
50
|
i0.ɵɵadvance();
|
|
50
51
|
i0.ɵɵstyleProp("width", ctx_r1.resolvedWidth)("height", ctx_r1.resolvedHeight)("max-width", "90vw")("max-height", "90vh");
|
|
52
|
+
i0.ɵɵclassProp("mj-dialog-container--sheet", ctx_r1.PhoneMode === "sheet")("mj-dialog-container--full", ctx_r1.PhoneMode === "full");
|
|
51
53
|
i0.ɵɵattribute("role", ctx_r1.Role)("aria-labelledby", ctx_r1.Title ? "mj-dialog-title-" + ctx_r1.dialogId : null)("aria-label", ctx_r1.Title ? null : ctx_r1.AriaLabel || null);
|
|
52
54
|
i0.ɵɵadvance();
|
|
53
55
|
i0.ɵɵconditional(ctx_r1.Title || ctx_r1.Closeable ? 2 : -1);
|
|
@@ -63,7 +65,6 @@ const SIZE_MAP = {
|
|
|
63
65
|
/**
|
|
64
66
|
* mj-dialog — Modal dialog component using native `<dialog>` element.
|
|
65
67
|
*
|
|
66
|
-
* Replaces `<kendo-dialog>`.
|
|
67
68
|
*
|
|
68
69
|
* Supports both explicit width/height and size presets.
|
|
69
70
|
* Content is projected, with an optional `<mj-dialog-actions>` for the footer.
|
|
@@ -186,6 +187,19 @@ export class MJDialogComponent {
|
|
|
186
187
|
get dialogId() {
|
|
187
188
|
return this.DialogId;
|
|
188
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* How the dialog presents on a phone (dialog.scss applies it under 768px; desktop is unchanged).
|
|
192
|
+
* `sheet`: a bottom sheet sized to its content, for every alert dialog and for `sm` / `auto`
|
|
193
|
+
* dialogs without an explicit `Width`. `full`: full-screen with the title and actions pinned,
|
|
194
|
+
* for `md` / `lg` / `xl` and any dialog given a `Width` (it was laid out for a desktop width).
|
|
195
|
+
*/
|
|
196
|
+
get PhoneMode() {
|
|
197
|
+
if (this.Role === 'alertdialog')
|
|
198
|
+
return 'sheet';
|
|
199
|
+
if (this.Width)
|
|
200
|
+
return 'full';
|
|
201
|
+
return this.Size === 'sm' || this.Size === 'auto' ? 'sheet' : 'full';
|
|
202
|
+
}
|
|
189
203
|
get ResolvedWidth() {
|
|
190
204
|
if (this.Width) {
|
|
191
205
|
return typeof this.Width === 'number' ? `${this.Width}px` : this.Width;
|
|
@@ -343,7 +357,11 @@ export class MJDialogComponent {
|
|
|
343
357
|
return button;
|
|
344
358
|
return container;
|
|
345
359
|
}
|
|
346
|
-
/**
|
|
360
|
+
/**
|
|
361
|
+
* First element that can take focus. The ✕ is skipped only for the button fallback. A hidden or
|
|
362
|
+
* inert element is skipped too: `.focus()` on one is a silent no-op, which would leave focus
|
|
363
|
+
* outside the dialog.
|
|
364
|
+
*/
|
|
347
365
|
firstEnabled(nodes, skipClose = false) {
|
|
348
366
|
for (const el of Array.from(nodes)) {
|
|
349
367
|
if (skipClose && el.classList.contains('mj-dialog-close'))
|
|
@@ -352,6 +370,8 @@ export class MJDialogComponent {
|
|
|
352
370
|
continue;
|
|
353
371
|
if (el instanceof HTMLInputElement && el.type === 'hidden')
|
|
354
372
|
continue;
|
|
373
|
+
if (!this.isVisibleStop(el))
|
|
374
|
+
continue;
|
|
355
375
|
return el;
|
|
356
376
|
}
|
|
357
377
|
return null;
|
|
@@ -398,15 +418,16 @@ export class MJDialogComponent {
|
|
|
398
418
|
return true;
|
|
399
419
|
}
|
|
400
420
|
/**
|
|
401
|
-
* display:none and [
|
|
402
|
-
* can set visible again, so that check is only on the
|
|
421
|
+
* display:none, [hidden] and [inert] (a collapsed accordion body) take the whole subtree out of
|
|
422
|
+
* focus. visibility is inherited, and a child can set visible again, so that check is only on the
|
|
423
|
+
* element itself.
|
|
403
424
|
*/
|
|
404
425
|
isVisibleStop(el) {
|
|
405
426
|
if (getComputedStyle(el).visibility === 'hidden')
|
|
406
427
|
return false;
|
|
407
428
|
let current = el;
|
|
408
429
|
while (current) {
|
|
409
|
-
if (current.hasAttribute('hidden'))
|
|
430
|
+
if (current.hasAttribute('hidden') || current.hasAttribute('inert'))
|
|
410
431
|
return false;
|
|
411
432
|
if (getComputedStyle(current).display === 'none')
|
|
412
433
|
return false;
|
|
@@ -429,9 +450,9 @@ export class MJDialogComponent {
|
|
|
429
450
|
static ɵfac = function MJDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJDialogComponent)(); };
|
|
430
451
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJDialogComponent, selectors: [["mj-dialog"]], hostBindings: function MJDialogComponent_HostBindings(rf, ctx) { if (rf & 1) {
|
|
431
452
|
i0.ɵɵlistener("keydown.escape", function MJDialogComponent_keydown_escape_HostBindingHandler() { return ctx.OnEscapeKey(); }, i0.ɵɵresolveDocument);
|
|
432
|
-
} }, inputs: { Visible: "Visible", Title: "Title", Width: "Width", Height: "Height", Size: "Size", Closeable: "Closeable", MinWidth: "MinWidth", Role: "Role", AutoFocus: "AutoFocus", TrapFocus: "TrapFocus", RestoreFocus: "RestoreFocus", AriaLabel: "AriaLabel" }, outputs: { Close: "Close" }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[1, "mj-dialog-backdrop"], [1, "mj-dialog-backdrop", 3, "click"], ["aria-modal", "true", "tabindex", "-1", 1, "mj-dialog-container", 3, "keydown", "click"], [1, "mj-dialog-titlebar"], [1, "mj-dialog-body"], [1, "mj-dialog-title", 3, "id"], ["aria-label", "Close dialog", 1, "mj-dialog-close"], ["aria-label", "Close dialog", 1, "mj-dialog-close", 3, "click"], [1, "fa-solid", "fa-times"]], template: function MJDialogComponent_Template(rf, ctx) { if (rf & 1) {
|
|
453
|
+
} }, inputs: { Visible: "Visible", Title: "Title", Width: "Width", Height: "Height", Size: "Size", Closeable: "Closeable", MinWidth: "MinWidth", Role: "Role", AutoFocus: "AutoFocus", TrapFocus: "TrapFocus", RestoreFocus: "RestoreFocus", AriaLabel: "AriaLabel" }, outputs: { Close: "Close" }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[1, "mj-dialog-backdrop", 3, "mj-dialog-backdrop--sheet"], [1, "mj-dialog-backdrop", 3, "click"], ["aria-modal", "true", "tabindex", "-1", 1, "mj-dialog-container", 3, "keydown", "click"], [1, "mj-dialog-titlebar"], [1, "mj-dialog-body"], [1, "mj-dialog-title", 3, "id"], ["aria-label", "Close dialog", 1, "mj-dialog-close"], ["aria-label", "Close dialog", 1, "mj-dialog-close", 3, "click"], [1, "fa-solid", "fa-times"]], template: function MJDialogComponent_Template(rf, ctx) { if (rf & 1) {
|
|
433
454
|
i0.ɵɵprojectionDef(_c0);
|
|
434
|
-
i0.ɵɵconditionalCreate(0, MJDialogComponent_Conditional_0_Template, 6,
|
|
455
|
+
i0.ɵɵconditionalCreate(0, MJDialogComponent_Conditional_0_Template, 6, 18, "div", 0);
|
|
435
456
|
} if (rf & 2) {
|
|
436
457
|
i0.ɵɵconditional(ctx.Visible ? 0 : -1);
|
|
437
458
|
} }, encapsulation: 2 });
|
|
@@ -443,8 +464,10 @@ export class MJDialogComponent {
|
|
|
443
464
|
standalone: true,
|
|
444
465
|
template: `
|
|
445
466
|
@if (Visible) {
|
|
446
|
-
<div class="mj-dialog-backdrop" (click)="OnBackdropClick($event)">
|
|
467
|
+
<div class="mj-dialog-backdrop" [class.mj-dialog-backdrop--sheet]="PhoneMode === 'sheet'" (click)="OnBackdropClick($event)">
|
|
447
468
|
<div class="mj-dialog-container"
|
|
469
|
+
[class.mj-dialog-container--sheet]="PhoneMode === 'sheet'"
|
|
470
|
+
[class.mj-dialog-container--full]="PhoneMode === 'full'"
|
|
448
471
|
[attr.role]="Role"
|
|
449
472
|
aria-modal="true"
|
|
450
473
|
tabindex="-1"
|
|
@@ -514,11 +537,10 @@ export class MJDialogComponent {
|
|
|
514
537
|
type: HostListener,
|
|
515
538
|
args: ['document:keydown.escape']
|
|
516
539
|
}] }); })();
|
|
517
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogComponent, { className: "MJDialogComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber:
|
|
540
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogComponent, { className: "MJDialogComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 101 }); })();
|
|
518
541
|
/**
|
|
519
542
|
* mj-dialog-titlebar — Custom titlebar content for mj-dialog.
|
|
520
543
|
*
|
|
521
|
-
* Replaces `<kendo-dialog-titlebar>`.
|
|
522
544
|
*
|
|
523
545
|
* @example
|
|
524
546
|
* ```html
|
|
@@ -545,11 +567,10 @@ export class MJDialogTitlebarComponent {
|
|
|
545
567
|
template: `<ng-content></ng-content>`
|
|
546
568
|
}]
|
|
547
569
|
}], null, null); })();
|
|
548
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogTitlebarComponent, { className: "MJDialogTitlebarComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber:
|
|
570
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogTitlebarComponent, { className: "MJDialogTitlebarComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 501 }); })();
|
|
549
571
|
/**
|
|
550
572
|
* mj-dialog-actions — Footer action bar for mj-dialog.
|
|
551
573
|
*
|
|
552
|
-
* Replaces `<kendo-dialog-actions>`.
|
|
553
574
|
*
|
|
554
575
|
* @example
|
|
555
576
|
* ```html
|
|
@@ -580,5 +601,5 @@ export class MJDialogActionsComponent {
|
|
|
580
601
|
`
|
|
581
602
|
}]
|
|
582
603
|
}], null, null); })();
|
|
583
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogActionsComponent, { className: "MJDialogActionsComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber:
|
|
604
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogActionsComponent, { className: "MJDialogActionsComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 524 }); })();
|
|
584
605
|
//# sourceMappingURL=dialog.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,UAAU,EAEV,MAAM,EACP,MAAM,eAAe,CAAC;;;;;IAmEP,gCAAiE;IAAA,YAAW;IAAA,oBAAK;;;IAArD,4DAAoC;IAAC,cAAW;IAAX,kCAAW;;;;IAI5E,oCAAmF;IAAnD,qNAAS,qBAAc,KAAC;IACtD,0BAAiC;IACnC,oBAAS;;;IARb,iCAAgC;IAC9B,8GAAa;IAGb,qBAAqD;IACrD,kHAAiB;IAKnB,oBAAM;;;IATJ,cAEC;IAFD,uCAEC;IAED,eAIC;IAJD,2CAIC;;;;IAzBT,iCAAkE;IAAlC,2LAAS,8BAAuB,KAAC;IAC/D,iCAWqC;IAAnC,AADA,+LAAW,uBAAgB,KAAC,kGACnB,wBAAwB,IAAC;IAGlC,iGAA0B;IAe1B,iCAA4B;IAC1B,kBAAyB;IAC3B,oBAAM;IAGN,qBAAoD;IAExD,AADE,oBAAM,EACF;;;IA9BF,cAA6B;IAG7B,AADA,AADA,AADA,6CAA6B,iCACE,qBACL,sBACC;;IAK3B,cAYC;IAZD,2DAYC;;;AAxEX,MAAM,QAAQ,GAAiC;IAC7C,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,MAAM;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA+CH,MAAM,OAAO,iBAAiB;IACX,IAAI,GAAG,MAAM,CAAC,UAAU,CAA4B,CA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AY,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;2GAxWU,iBAAiB;6DAAjB,iBAAiB;YAAjB,wGAAA,iBAAa,0BAAI;;;YA1C1B,oFAAe;;YAAf,sCAuCC;;;iFAGQ,iBAAiB;cA9C7B,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCT;aACF;;kBA4CE,KAAK;;kBAeL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAQL,KAAK;;kBAGL,KAAK;;kBASL,KAAK;;kBAGL,KAAK;;kBAML,KAAK;;kBAEL,MAAM;;kBAgCN,YAAY;mBAAC,yBAAyB;;kFA9H5B,iBAAiB;AA2W9B;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,yBAAyB;mHAAzB,yBAAyB;6DAAzB,yBAAyB;;YAFzB,kBAAyB;;;iFAEzB,yBAAyB;cALrC,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,2BAA2B;aACtC;;kFACY,yBAAyB;AAEtC;;;;;;;;;;;;GAYG;AAUH,MAAM,OAAO,wBAAwB;kHAAxB,wBAAwB;6DAAxB,wBAAwB;;YALjC,iCAA+B;YAC7B,kBAAyB;YAC3B,oBAAM;;;iFAGG,wBAAwB;cATpC,SAAS;eAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;GAIT;aACF;;kFACY,wBAAwB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n HostListener,\n ElementRef,\n OnDestroy,\n inject\n} from '@angular/core';\n\nexport type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';\n\nconst SIZE_MAP: Record<MjDialogSize, string> = {\n sm: '400px',\n md: '600px',\n lg: '800px',\n xl: '1000px',\n auto: 'auto'\n};\n\n/**\n * mj-dialog — Modal dialog component using native `<dialog>` element.\n *\n * Replaces `<kendo-dialog>`.\n *\n * Supports both explicit width/height and size presets.\n * Content is projected, with an optional `<mj-dialog-actions>` for the footer.\n *\n * On open, focus moves to `[data-autofocus]`, else the first field in the body,\n * else the first button in the body or actions (never the ✕), else the container.\n * Tab between stops is left to the browser. Tab on the last stop wraps to the\n * first, and Shift+Tab on the first stop or the container wraps to the last.\n * A Tab that arrives from outside is taken only by the topmost visible dialog,\n * and only when that dialog traps focus and focus is on the page behind it:\n * not in another modal, and not in an overlay panel rendered on the body.\n * A dropdown or calendar that hands focus back to its field is wrapped when\n * that field is the first or last stop, because the key started in the overlay.\n * Focus returns to the trigger on close.\n * `AutoFocus`, `TrapFocus`, and `RestoreFocus` each default on so a dialog that\n * manages focus itself can turn that one behavior off.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"showDialog\" Title=\"Confirm\" (Close)=\"onClose()\">\n * <p>Are you sure?</p>\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\" (click)=\"onConfirm()\">Yes</button>\n * <button mjButton (click)=\"onClose()\">No</button>\n * </mj-dialog-actions>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog',\n standalone: true,\n template: `\n @if (Visible) {\n <div class=\"mj-dialog-backdrop\" (click)=\"OnBackdropClick($event)\">\n <div class=\"mj-dialog-container\"\n [attr.role]=\"Role\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"Title ? 'mj-dialog-title-' + dialogId : null\"\n [attr.aria-label]=\"Title ? null : (AriaLabel || null)\"\n [style.width]=\"resolvedWidth\"\n [style.height]=\"resolvedHeight\"\n [style.max-width]=\"'90vw'\"\n [style.max-height]=\"'90vh'\"\n (keydown)=\"OnTabKey($event)\"\n (click)=\"$event.stopPropagation()\">\n\n <!-- Title bar -->\n @if (Title || Closeable) {\n <div class=\"mj-dialog-titlebar\">\n @if (Title) {\n <h2 class=\"mj-dialog-title\" [id]=\"'mj-dialog-title-' + dialogId\">{{ Title }}</h2>\n }\n <ng-content select=\"mj-dialog-titlebar\"></ng-content>\n @if (Closeable) {\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close dialog\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n }\n </div>\n }\n\n <!-- Body -->\n <div class=\"mj-dialog-body\">\n <ng-content></ng-content>\n </div>\n\n <!-- Actions (projected) -->\n <ng-content select=\"mj-dialog-actions\"></ng-content>\n </div>\n </div>\n }\n `\n})\nexport class MJDialogComponent implements OnDestroy {\n private readonly host = inject(ElementRef) as ElementRef<HTMLElement>;\n private _visible = false;\n /** Element that held focus when the dialog opened; restored on close. */\n private previouslyFocused: HTMLElement | null = null;\n /** Set while the open focus is waiting for the `@if (Visible)` container. */\n private initialFocusPending = false;\n /** Open dialogs, oldest first. The last visible one decides whether an outside Tab is taken. */\n private static readonly openDialogs: MJDialogComponent[] = [];\n private static nextId = 0;\n\n private static readonly TAB_STOP_SELECTOR =\n 'a[href], button, input, select, textarea, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]';\n\n private readonly onDocumentKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this._visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (!this.isTopmostOpenDialog()) return;\n const container = this.containerElement();\n if (!container) return;\n const active = document.activeElement;\n // Another modal keeps its Tab. An overlay panel that still holds focus (a filter\n // popover, or any panel that does not move focus itself) keeps it too.\n if (active instanceof Element) {\n const modal = active.closest('[aria-modal=\"true\"]');\n if (modal && modal !== container) return;\n if (active.closest('.cdk-overlay-container')) return;\n }\n const focusInside = active instanceof Node && container.contains(active);\n const startedOutside = !(event.target instanceof Node && container.contains(event.target));\n // A dropdown or calendar focuses its field and leaves the key alone. The key\n // started in the overlay, so the container never saw it. Wrap at the ends.\n if (focusInside && startedOutside) {\n this.wrapTabAtEnds(event, container);\n return;\n }\n if (focusInside) return;\n const stops = this.tabStops(container);\n event.preventDefault();\n const target = stops.length === 0 ? container : (event.shiftKey ? stops[stops.length - 1] : stops[0]);\n target.focus();\n };\n\n @Input()\n set Visible(value: boolean) {\n const wasVisible = this._visible;\n this._visible = value;\n if (value && !wasVisible) {\n this.onOpen();\n }\n if (!value && wasVisible) {\n this.onCloseInternal();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n @Input() Title = '';\n @Input() Width: number | string | null = null;\n @Input() Height: number | string | null = null;\n @Input() Size: MjDialogSize = 'auto';\n @Input() Closeable = true;\n @Input() MinWidth: number | null = null;\n\n /**\n * ARIA role for the dialog container. Defaults to `'dialog'`; pass\n * `'alertdialog'` for confirmation / destructive prompts that interrupt the\n * user (per WAI-ARIA, an alertdialog conveys an urgent message requiring a\n * response). Backward compatible — existing callers keep `'dialog'`.\n */\n @Input() Role: 'dialog' | 'alertdialog' = 'dialog';\n\n /** Move focus into the dialog when it opens. Off when the dialog focuses itself. */\n @Input() AutoFocus = true;\n\n /**\n * Keep focus in the dialog. The browser moves Tab between stops. Tab on the last\n * stop wraps to the first, and Shift+Tab on the first stop or the container wraps\n * to the last. A Tab from outside is brought in only when this dialog is the topmost\n * visible one and it traps focus, and not while focus is already inside another\n * modal or an overlay panel.\n */\n @Input() TrapFocus = true;\n\n /** Return focus to the element that was focused when the dialog opened. */\n @Input() RestoreFocus = true;\n\n /**\n * Accessible name (`aria-label`) used only when {@link Title} is empty.\n * A set Title keeps `aria-labelledby` and does not also set `aria-label`.\n */\n @Input() AriaLabel: string | null = null;\n\n @Output() Close = new EventEmitter<void>();\n\n DialogId = MJDialogComponent.nextId++;\n\n get dialogId(): number { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.DialogId;\n }\n\n get ResolvedWidth(): string {\n if (this.Width) {\n return typeof this.Width === 'number' ? `${this.Width}px` : this.Width;\n }\n return SIZE_MAP[this.Size] ?? 'auto';\n }\n\n /** @deprecated Use {@link ResolvedWidth}. */\n get resolvedWidth(): string {\n return this.ResolvedWidth;\n }\n\n get ResolvedHeight(): string {\n if (this.Height) {\n return typeof this.Height === 'number' ? `${this.Height}px` : this.Height;\n }\n return 'auto';\n }\n\n /** @deprecated Use {@link ResolvedHeight}. */\n get resolvedHeight(): string {\n return this.ResolvedHeight;\n }\n\n @HostListener('document:keydown.escape')\n OnEscapeKey(): void {\n if (this.Visible && this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnBackdropClick(event: Event): void {\n if (this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnCloseClick(): void {\n this.Close.emit();\n }\n\n /**\n * Wraps Tab at the ends of the dialog. A Tab that is already handled, including\n * by a dialog nested inside this one, is left alone. With no enabled control,\n * focus stays on the container (it is `tabindex=\"-1\"`, so it is not itself a tab stop).\n */\n OnTabKey(event: KeyboardEvent): void {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this.Visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const container = event.currentTarget;\n if (!(container instanceof HTMLElement)) return;\n this.wrapTabAtEnds(event, container);\n }\n\n /**\n * Tab on the last stop wraps to the first. Shift+Tab on the first stop or the\n * container wraps to the last. A Tab in the middle is left for the browser.\n */\n private wrapTabAtEnds(event: KeyboardEvent, container: HTMLElement): void {\n const stops = this.tabStops(container);\n if (stops.length === 0) {\n event.preventDefault();\n container.focus();\n return;\n }\n\n const active = document.activeElement;\n const index = active instanceof HTMLElement ? stops.indexOf(active) : -1;\n const onContainer = active === container;\n if (event.shiftKey) {\n if (index === 0 || onContainer) {\n event.preventDefault();\n stops[stops.length - 1].focus();\n }\n return;\n }\n if (index === stops.length - 1) {\n event.preventDefault();\n stops[0].focus();\n }\n }\n\n ngOnDestroy(): void {\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n if (this._visible) {\n this.restoreFocus();\n }\n document.body.style.overflow = '';\n }\n\n private onOpen(): void {\n this.rememberOpen();\n document.body.style.overflow = 'hidden';\n document.addEventListener('keydown', this.onDocumentKeyDown);\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n if (this.AutoFocus) {\n this.scheduleInitialFocus();\n }\n }\n\n private onCloseInternal(): void {\n document.body.style.overflow = '';\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n this.restoreFocus();\n }\n\n private rememberOpen(): void {\n if (!MJDialogComponent.openDialogs.includes(this)) {\n MJDialogComponent.openDialogs.push(this);\n }\n }\n\n private forgetOpen(): void {\n const index = MJDialogComponent.openDialogs.indexOf(this);\n if (index >= 0) {\n MJDialogComponent.openDialogs.splice(index, 1);\n }\n }\n\n /**\n * The last visible dialog decides. When that dialog does not trap focus, nobody\n * takes the Tab, including a trapping dialog underneath it.\n */\n private isTopmostOpenDialog(): boolean {\n for (let i = MJDialogComponent.openDialogs.length - 1; i >= 0; i--) {\n const dialog = MJDialogComponent.openDialogs[i];\n if (!dialog._visible) continue;\n return dialog === this && dialog.TrapFocus;\n }\n return false;\n }\n\n private scheduleInitialFocus(): void {\n this.initialFocusPending = true;\n // The Visible setter runs before `@if` inserts `.mj-dialog-container`.\n Promise.resolve().then(() => {\n if (!this.initialFocusPending) return;\n this.initialFocusPending = false;\n this.focusInitial();\n });\n }\n\n private cancelPendingInitialFocus(): void {\n this.initialFocusPending = false;\n }\n\n private focusInitial(): void {\n if (!this._visible || !this.AutoFocus) return;\n const container = this.containerElement();\n if (!container) return;\n this.initialFocusTarget(container).focus();\n }\n\n private initialFocusTarget(container: HTMLElement): HTMLElement {\n const marked = this.firstEnabled(container.querySelectorAll<HTMLElement>('[data-autofocus]'));\n if (marked) return marked;\n\n const field = this.firstEnabled(container.querySelectorAll<HTMLElement>(\n '.mj-dialog-body input, .mj-dialog-body select, .mj-dialog-body textarea',\n ));\n if (field) return field;\n\n const button = this.firstEnabled(\n container.querySelectorAll<HTMLElement>('.mj-dialog-body button, .mj-dialog-actions button'),\n true,\n );\n if (button) return button;\n\n return container;\n }\n\n /** First element that can take focus. The ✕ is skipped only for the button fallback. */\n private firstEnabled(nodes: NodeListOf<HTMLElement>, skipClose = false): HTMLElement | null {\n for (const el of Array.from(nodes)) {\n if (skipClose && el.classList.contains('mj-dialog-close')) continue;\n if (this.isDisabled(el)) continue;\n if (el instanceof HTMLInputElement && el.type === 'hidden') continue;\n return el;\n }\n return null;\n }\n\n private restoreFocus(): void {\n const target = this.previouslyFocused;\n this.previouslyFocused = null;\n if (!this.RestoreFocus) return;\n // The trigger is outside the dialog. An element inside this host is about to be removed.\n if (target && target !== document.body && document.contains(target) && !this.host.nativeElement.contains(target)) {\n target.focus();\n return;\n }\n this.focusDocumentBody();\n }\n\n /** `document.body.focus()` is a no-op unless body is a focusable area; blur lands on body. */\n private focusDocumentBody(): void {\n const active = document.activeElement;\n if (active instanceof HTMLElement && active !== document.body) {\n active.blur();\n }\n if (document.activeElement !== document.body) {\n document.body.focus();\n }\n }\n\n private containerElement(): HTMLElement | null {\n const found = this.host.nativeElement.querySelector('.mj-dialog-container');\n return found instanceof HTMLElement ? found : null;\n }\n\n private tabStops(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(MJDialogComponent.TAB_STOP_SELECTOR)).filter((el) =>\n this.isTabStop(el),\n );\n }\n\n /** Real controls only. `tabindex=\"-1\"` (including the container) is the fallback, not a stop. */\n private isTabStop(el: HTMLElement): boolean {\n if (el.getAttribute('tabindex') === '-1') return false;\n if (this.isDisabled(el)) return false;\n if (el instanceof HTMLInputElement && el.type === 'hidden') return false;\n if (!this.isVisibleStop(el)) return false;\n return true;\n }\n\n /**\n * display:none and [hidden] hide the whole subtree. visibility is inherited, and a child\n * can set visible again, so that check is only on the element itself.\n */\n private isVisibleStop(el: HTMLElement): boolean {\n if (getComputedStyle(el).visibility === 'hidden') return false;\n let current: HTMLElement | null = el;\n while (current) {\n if (current.hasAttribute('hidden')) return false;\n if (getComputedStyle(current).display === 'none') return false;\n current = current.parentElement;\n }\n return true;\n }\n\n private isDisabled(el: HTMLElement): boolean {\n if (\n el instanceof HTMLButtonElement ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement ||\n el instanceof HTMLFieldSetElement ||\n el instanceof HTMLOptGroupElement ||\n el instanceof HTMLOptionElement\n ) {\n return el.disabled;\n }\n return el.hasAttribute('disabled');\n }\n}\n\n/**\n * mj-dialog-titlebar — Custom titlebar content for mj-dialog.\n *\n * Replaces `<kendo-dialog-titlebar>`.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"show\" (Close)=\"onClose()\">\n * <mj-dialog-titlebar>\n * <i class=\"fa-solid fa-save\"></i> Custom Title\n * </mj-dialog-titlebar>\n * <p>Dialog content</p>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog-titlebar',\n standalone: true,\n template: `<ng-content></ng-content>`\n})\nexport class MJDialogTitlebarComponent {}\n\n/**\n * mj-dialog-actions — Footer action bar for mj-dialog.\n *\n * Replaces `<kendo-dialog-actions>`.\n *\n * @example\n * ```html\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\">Save</button>\n * <button mjButton>Cancel</button>\n * </mj-dialog-actions>\n * ```\n */\n@Component({\n selector: 'mj-dialog-actions',\n standalone: true,\n template: `\n <div class=\"mj-dialog-actions\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class MJDialogActionsComponent {}\n"]}
|
|
1
|
+
{"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,UAAU,EAEV,MAAM,EACP,MAAM,eAAe,CAAC;;;;;IAoEP,gCAAiE;IAAA,YAAW;IAAA,oBAAK;;;IAArD,4D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;QACrB,CAAC;QACD,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;2GA1XU,iBAAiB;6DAAjB,iBAAiB;YAAjB,wGAAA,iBAAa,0BAAI;;;YA5C1B,oFAAe;;YAAf,sCAyCC;;;iFAGQ,iBAAiB;cAhD7B,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CT;aACF;;kBA4CE,KAAK;;kBAeL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAQL,KAAK;;kBAGL,KAAK;;kBASL,KAAK;;kBAGL,KAAK;;kBAML,KAAK;;kBAEL,MAAM;;kBA4CN,YAAY;mBAAC,yBAAyB;;kFA1I5B,iBAAiB;AA6X9B;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,yBAAyB;mHAAzB,yBAAyB;6DAAzB,yBAAyB;;YAFzB,kBAAyB;;;iFAEzB,yBAAyB;cALrC,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,2BAA2B;aACtC;;kFACY,yBAAyB;AAEtC;;;;;;;;;;;GAWG;AAUH,MAAM,OAAO,wBAAwB;kHAAxB,wBAAwB;6DAAxB,wBAAwB;;YALjC,iCAA+B;YAC7B,kBAAyB;YAC3B,oBAAM;;;iFAGG,wBAAwB;cATpC,SAAS;eAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;GAIT;aACF;;kFACY,wBAAwB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n HostListener,\n ElementRef,\n OnDestroy,\n inject\n} from '@angular/core';\n\nexport type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';\n\nconst SIZE_MAP: Record<MjDialogSize, string> = {\n sm: '400px',\n md: '600px',\n lg: '800px',\n xl: '1000px',\n auto: 'auto'\n};\n\n/**\n * mj-dialog — Modal dialog component using native `<dialog>` element.\n *\n *\n * Supports both explicit width/height and size presets.\n * Content is projected, with an optional `<mj-dialog-actions>` for the footer.\n *\n * On open, focus moves to `[data-autofocus]`, else the first field in the body,\n * else the first button in the body or actions (never the ✕), else the container.\n * Tab between stops is left to the browser. Tab on the last stop wraps to the\n * first, and Shift+Tab on the first stop or the container wraps to the last.\n * A Tab that arrives from outside is taken only by the topmost visible dialog,\n * and only when that dialog traps focus and focus is on the page behind it:\n * not in another modal, and not in an overlay panel rendered on the body.\n * A dropdown or calendar that hands focus back to its field is wrapped when\n * that field is the first or last stop, because the key started in the overlay.\n * Focus returns to the trigger on close.\n * `AutoFocus`, `TrapFocus`, and `RestoreFocus` each default on so a dialog that\n * manages focus itself can turn that one behavior off.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"showDialog\" Title=\"Confirm\" (Close)=\"onClose()\">\n * <p>Are you sure?</p>\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\" (click)=\"onConfirm()\">Yes</button>\n * <button mjButton (click)=\"onClose()\">No</button>\n * </mj-dialog-actions>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog',\n standalone: true,\n template: `\n @if (Visible) {\n <div class=\"mj-dialog-backdrop\" [class.mj-dialog-backdrop--sheet]=\"PhoneMode === 'sheet'\" (click)=\"OnBackdropClick($event)\">\n <div class=\"mj-dialog-container\"\n [class.mj-dialog-container--sheet]=\"PhoneMode === 'sheet'\"\n [class.mj-dialog-container--full]=\"PhoneMode === 'full'\"\n [attr.role]=\"Role\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"Title ? 'mj-dialog-title-' + dialogId : null\"\n [attr.aria-label]=\"Title ? null : (AriaLabel || null)\"\n [style.width]=\"resolvedWidth\"\n [style.height]=\"resolvedHeight\"\n [style.max-width]=\"'90vw'\"\n [style.max-height]=\"'90vh'\"\n (keydown)=\"OnTabKey($event)\"\n (click)=\"$event.stopPropagation()\">\n\n <!-- Title bar -->\n @if (Title || Closeable) {\n <div class=\"mj-dialog-titlebar\">\n @if (Title) {\n <h2 class=\"mj-dialog-title\" [id]=\"'mj-dialog-title-' + dialogId\">{{ Title }}</h2>\n }\n <ng-content select=\"mj-dialog-titlebar\"></ng-content>\n @if (Closeable) {\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close dialog\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n }\n </div>\n }\n\n <!-- Body -->\n <div class=\"mj-dialog-body\">\n <ng-content></ng-content>\n </div>\n\n <!-- Actions (projected) -->\n <ng-content select=\"mj-dialog-actions\"></ng-content>\n </div>\n </div>\n }\n `\n})\nexport class MJDialogComponent implements OnDestroy {\n private readonly host = inject(ElementRef) as ElementRef<HTMLElement>;\n private _visible = false;\n /** Element that held focus when the dialog opened; restored on close. */\n private previouslyFocused: HTMLElement | null = null;\n /** Set while the open focus is waiting for the `@if (Visible)` container. */\n private initialFocusPending = false;\n /** Open dialogs, oldest first. The last visible one decides whether an outside Tab is taken. */\n private static readonly openDialogs: MJDialogComponent[] = [];\n private static nextId = 0;\n\n private static readonly TAB_STOP_SELECTOR =\n 'a[href], button, input, select, textarea, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]';\n\n private readonly onDocumentKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this._visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (!this.isTopmostOpenDialog()) return;\n const container = this.containerElement();\n if (!container) return;\n const active = document.activeElement;\n // Another modal keeps its Tab. An overlay panel that still holds focus (a filter\n // popover, or any panel that does not move focus itself) keeps it too.\n if (active instanceof Element) {\n const modal = active.closest('[aria-modal=\"true\"]');\n if (modal && modal !== container) return;\n if (active.closest('.cdk-overlay-container')) return;\n }\n const focusInside = active instanceof Node && container.contains(active);\n const startedOutside = !(event.target instanceof Node && container.contains(event.target));\n // A dropdown or calendar focuses its field and leaves the key alone. The key\n // started in the overlay, so the container never saw it. Wrap at the ends.\n if (focusInside && startedOutside) {\n this.wrapTabAtEnds(event, container);\n return;\n }\n if (focusInside) return;\n const stops = this.tabStops(container);\n event.preventDefault();\n const target = stops.length === 0 ? container : (event.shiftKey ? stops[stops.length - 1] : stops[0]);\n target.focus();\n };\n\n @Input()\n set Visible(value: boolean) {\n const wasVisible = this._visible;\n this._visible = value;\n if (value && !wasVisible) {\n this.onOpen();\n }\n if (!value && wasVisible) {\n this.onCloseInternal();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n @Input() Title = '';\n @Input() Width: number | string | null = null;\n @Input() Height: number | string | null = null;\n @Input() Size: MjDialogSize = 'auto';\n @Input() Closeable = true;\n @Input() MinWidth: number | null = null;\n\n /**\n * ARIA role for the dialog container. Defaults to `'dialog'`; pass\n * `'alertdialog'` for confirmation / destructive prompts that interrupt the\n * user (per WAI-ARIA, an alertdialog conveys an urgent message requiring a\n * response). Backward compatible — existing callers keep `'dialog'`.\n */\n @Input() Role: 'dialog' | 'alertdialog' = 'dialog';\n\n /** Move focus into the dialog when it opens. Off when the dialog focuses itself. */\n @Input() AutoFocus = true;\n\n /**\n * Keep focus in the dialog. The browser moves Tab between stops. Tab on the last\n * stop wraps to the first, and Shift+Tab on the first stop or the container wraps\n * to the last. A Tab from outside is brought in only when this dialog is the topmost\n * visible one and it traps focus, and not while focus is already inside another\n * modal or an overlay panel.\n */\n @Input() TrapFocus = true;\n\n /** Return focus to the element that was focused when the dialog opened. */\n @Input() RestoreFocus = true;\n\n /**\n * Accessible name (`aria-label`) used only when {@link Title} is empty.\n * A set Title keeps `aria-labelledby` and does not also set `aria-label`.\n */\n @Input() AriaLabel: string | null = null;\n\n @Output() Close = new EventEmitter<void>();\n\n DialogId = MJDialogComponent.nextId++;\n\n get dialogId(): number { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.DialogId;\n }\n\n /**\n * How the dialog presents on a phone (dialog.scss applies it under 768px; desktop is unchanged).\n * `sheet`: a bottom sheet sized to its content, for every alert dialog and for `sm` / `auto`\n * dialogs without an explicit `Width`. `full`: full-screen with the title and actions pinned,\n * for `md` / `lg` / `xl` and any dialog given a `Width` (it was laid out for a desktop width).\n */\n get PhoneMode(): 'sheet' | 'full' {\n if (this.Role === 'alertdialog') return 'sheet';\n if (this.Width) return 'full';\n return this.Size === 'sm' || this.Size === 'auto' ? 'sheet' : 'full';\n }\n\n get ResolvedWidth(): string {\n if (this.Width) {\n return typeof this.Width === 'number' ? `${this.Width}px` : this.Width;\n }\n return SIZE_MAP[this.Size] ?? 'auto';\n }\n\n /** @deprecated Use {@link ResolvedWidth}. */\n get resolvedWidth(): string {\n return this.ResolvedWidth;\n }\n\n get ResolvedHeight(): string {\n if (this.Height) {\n return typeof this.Height === 'number' ? `${this.Height}px` : this.Height;\n }\n return 'auto';\n }\n\n /** @deprecated Use {@link ResolvedHeight}. */\n get resolvedHeight(): string {\n return this.ResolvedHeight;\n }\n\n @HostListener('document:keydown.escape')\n OnEscapeKey(): void {\n if (this.Visible && this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnBackdropClick(event: Event): void {\n if (this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnCloseClick(): void {\n this.Close.emit();\n }\n\n /**\n * Wraps Tab at the ends of the dialog. A Tab that is already handled, including\n * by a dialog nested inside this one, is left alone. With no enabled control,\n * focus stays on the container (it is `tabindex=\"-1\"`, so it is not itself a tab stop).\n */\n OnTabKey(event: KeyboardEvent): void {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this.Visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const container = event.currentTarget;\n if (!(container instanceof HTMLElement)) return;\n this.wrapTabAtEnds(event, container);\n }\n\n /**\n * Tab on the last stop wraps to the first. Shift+Tab on the first stop or the\n * container wraps to the last. A Tab in the middle is left for the browser.\n */\n private wrapTabAtEnds(event: KeyboardEvent, container: HTMLElement): void {\n const stops = this.tabStops(container);\n if (stops.length === 0) {\n event.preventDefault();\n container.focus();\n return;\n }\n\n const active = document.activeElement;\n const index = active instanceof HTMLElement ? stops.indexOf(active) : -1;\n const onContainer = active === container;\n if (event.shiftKey) {\n if (index === 0 || onContainer) {\n event.preventDefault();\n stops[stops.length - 1].focus();\n }\n return;\n }\n if (index === stops.length - 1) {\n event.preventDefault();\n stops[0].focus();\n }\n }\n\n ngOnDestroy(): void {\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n if (this._visible) {\n this.restoreFocus();\n }\n document.body.style.overflow = '';\n }\n\n private onOpen(): void {\n this.rememberOpen();\n document.body.style.overflow = 'hidden';\n document.addEventListener('keydown', this.onDocumentKeyDown);\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n if (this.AutoFocus) {\n this.scheduleInitialFocus();\n }\n }\n\n private onCloseInternal(): void {\n document.body.style.overflow = '';\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n this.restoreFocus();\n }\n\n private rememberOpen(): void {\n if (!MJDialogComponent.openDialogs.includes(this)) {\n MJDialogComponent.openDialogs.push(this);\n }\n }\n\n private forgetOpen(): void {\n const index = MJDialogComponent.openDialogs.indexOf(this);\n if (index >= 0) {\n MJDialogComponent.openDialogs.splice(index, 1);\n }\n }\n\n /**\n * The last visible dialog decides. When that dialog does not trap focus, nobody\n * takes the Tab, including a trapping dialog underneath it.\n */\n private isTopmostOpenDialog(): boolean {\n for (let i = MJDialogComponent.openDialogs.length - 1; i >= 0; i--) {\n const dialog = MJDialogComponent.openDialogs[i];\n if (!dialog._visible) continue;\n return dialog === this && dialog.TrapFocus;\n }\n return false;\n }\n\n private scheduleInitialFocus(): void {\n this.initialFocusPending = true;\n // The Visible setter runs before `@if` inserts `.mj-dialog-container`.\n Promise.resolve().then(() => {\n if (!this.initialFocusPending) return;\n this.initialFocusPending = false;\n this.focusInitial();\n });\n }\n\n private cancelPendingInitialFocus(): void {\n this.initialFocusPending = false;\n }\n\n private focusInitial(): void {\n if (!this._visible || !this.AutoFocus) return;\n const container = this.containerElement();\n if (!container) return;\n this.initialFocusTarget(container).focus();\n }\n\n private initialFocusTarget(container: HTMLElement): HTMLElement {\n const marked = this.firstEnabled(container.querySelectorAll<HTMLElement>('[data-autofocus]'));\n if (marked) return marked;\n\n const field = this.firstEnabled(container.querySelectorAll<HTMLElement>(\n '.mj-dialog-body input, .mj-dialog-body select, .mj-dialog-body textarea',\n ));\n if (field) return field;\n\n const button = this.firstEnabled(\n container.querySelectorAll<HTMLElement>('.mj-dialog-body button, .mj-dialog-actions button'),\n true,\n );\n if (button) return button;\n\n return container;\n }\n\n /**\n * First element that can take focus. The ✕ is skipped only for the button fallback. A hidden or\n * inert element is skipped too: `.focus()` on one is a silent no-op, which would leave focus\n * outside the dialog.\n */\n private firstEnabled(nodes: NodeListOf<HTMLElement>, skipClose = false): HTMLElement | null {\n for (const el of Array.from(nodes)) {\n if (skipClose && el.classList.contains('mj-dialog-close')) continue;\n if (this.isDisabled(el)) continue;\n if (el instanceof HTMLInputElement && el.type === 'hidden') continue;\n if (!this.isVisibleStop(el)) continue;\n return el;\n }\n return null;\n }\n\n private restoreFocus(): void {\n const target = this.previouslyFocused;\n this.previouslyFocused = null;\n if (!this.RestoreFocus) return;\n // The trigger is outside the dialog. An element inside this host is about to be removed.\n if (target && target !== document.body && document.contains(target) && !this.host.nativeElement.contains(target)) {\n target.focus();\n return;\n }\n this.focusDocumentBody();\n }\n\n /** `document.body.focus()` is a no-op unless body is a focusable area; blur lands on body. */\n private focusDocumentBody(): void {\n const active = document.activeElement;\n if (active instanceof HTMLElement && active !== document.body) {\n active.blur();\n }\n if (document.activeElement !== document.body) {\n document.body.focus();\n }\n }\n\n private containerElement(): HTMLElement | null {\n const found = this.host.nativeElement.querySelector('.mj-dialog-container');\n return found instanceof HTMLElement ? found : null;\n }\n\n private tabStops(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(MJDialogComponent.TAB_STOP_SELECTOR)).filter((el) =>\n this.isTabStop(el),\n );\n }\n\n /** Real controls only. `tabindex=\"-1\"` (including the container) is the fallback, not a stop. */\n private isTabStop(el: HTMLElement): boolean {\n if (el.getAttribute('tabindex') === '-1') return false;\n if (this.isDisabled(el)) return false;\n if (el instanceof HTMLInputElement && el.type === 'hidden') return false;\n if (!this.isVisibleStop(el)) return false;\n return true;\n }\n\n /**\n * display:none, [hidden] and [inert] (a collapsed accordion body) take the whole subtree out of\n * focus. visibility is inherited, and a child can set visible again, so that check is only on the\n * element itself.\n */\n private isVisibleStop(el: HTMLElement): boolean {\n if (getComputedStyle(el).visibility === 'hidden') return false;\n let current: HTMLElement | null = el;\n while (current) {\n if (current.hasAttribute('hidden') || current.hasAttribute('inert')) return false;\n if (getComputedStyle(current).display === 'none') return false;\n current = current.parentElement;\n }\n return true;\n }\n\n private isDisabled(el: HTMLElement): boolean {\n if (\n el instanceof HTMLButtonElement ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement ||\n el instanceof HTMLFieldSetElement ||\n el instanceof HTMLOptGroupElement ||\n el instanceof HTMLOptionElement\n ) {\n return el.disabled;\n }\n return el.hasAttribute('disabled');\n }\n}\n\n/**\n * mj-dialog-titlebar — Custom titlebar content for mj-dialog.\n *\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"show\" (Close)=\"onClose()\">\n * <mj-dialog-titlebar>\n * <i class=\"fa-solid fa-save\"></i> Custom Title\n * </mj-dialog-titlebar>\n * <p>Dialog content</p>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog-titlebar',\n standalone: true,\n template: `<ng-content></ng-content>`\n})\nexport class MJDialogTitlebarComponent {}\n\n/**\n * mj-dialog-actions — Footer action bar for mj-dialog.\n *\n *\n * @example\n * ```html\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\">Save</button>\n * <button mjButton>Cancel</button>\n * </mj-dialog-actions>\n * ```\n */\n@Component({\n selector: 'mj-dialog-actions',\n standalone: true,\n template: `\n <div class=\"mj-dialog-actions\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class MJDialogActionsComponent {}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MJ Dialog Styles
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Dialog styling. Uses --mj-* semantic design tokens.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/* ========== Backdrop ========== */
|
|
@@ -117,14 +117,90 @@
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/* ==========
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
/* ========== Phone (design call 8) ==========
|
|
121
|
+
The container's inline size (Size / Width, capped at 90vw x 90vh) is a desktop layout, hence
|
|
122
|
+
!important. PhoneMode picks one of two presentations:
|
|
123
|
+
- sheet: alert dialogs and sm / auto dialogs rise from the bottom, sized to their content.
|
|
124
|
+
- full: md / lg / xl and Width-set dialogs fill the visible screen (100dvh, so the actions never
|
|
125
|
+
sit under a mobile browser's toolbar), title and actions pinned, body scrolling.
|
|
126
|
+
env(safe-area-inset-*) keeps actions clear of the home indicator; it is 0 where there is none. */
|
|
127
|
+
@media (max-width: 768px) {
|
|
128
|
+
.mj-dialog-container--full {
|
|
123
129
|
width: 100vw !important;
|
|
124
|
-
height: 100vh !important;
|
|
125
130
|
max-width: 100vw !important;
|
|
126
|
-
|
|
131
|
+
height: 100vh !important;
|
|
132
|
+
height: 100dvh !important;
|
|
133
|
+
max-height: 100dvh !important;
|
|
127
134
|
border-radius: 0;
|
|
135
|
+
animation: mj-dialog-slide-up var(--mj-transition-base);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.mj-dialog-container--full > .mj-dialog-titlebar {
|
|
139
|
+
padding-top: calc(12px + env(safe-area-inset-top, 0px));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.mj-dialog-backdrop--sheet {
|
|
143
|
+
align-items: flex-end;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.mj-dialog-container--sheet {
|
|
147
|
+
width: 100vw !important;
|
|
148
|
+
max-width: 100vw !important;
|
|
149
|
+
height: auto !important;
|
|
150
|
+
max-height: 90vh !important;
|
|
151
|
+
max-height: 90dvh !important;
|
|
152
|
+
border-radius: var(--mj-radius-lg) var(--mj-radius-lg) 0 0;
|
|
153
|
+
padding-bottom: env(safe-area-inset-bottom, 0px);
|
|
154
|
+
animation: mj-dialog-slide-up var(--mj-transition-base);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.mj-dialog-titlebar {
|
|
158
|
+
padding: 4px 8px 4px 16px;
|
|
159
|
+
min-height: 52px;
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.mj-dialog-close {
|
|
164
|
+
width: 44px;
|
|
165
|
+
height: 44px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.mj-dialog-body {
|
|
169
|
+
padding: 16px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.mj-dialog-actions {
|
|
173
|
+
flex-wrap: wrap;
|
|
174
|
+
padding: 12px 16px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.mj-dialog-container--full .mj-dialog-actions {
|
|
178
|
+
padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Each action is a full-width 44px row, in the order the dialog declares them (MJ puts the
|
|
182
|
+
confirm action first). */
|
|
183
|
+
.mj-dialog-container--sheet .mj-dialog-actions {
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
align-items: stretch;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.mj-dialog-container--sheet .mj-dialog-actions > button,
|
|
189
|
+
.mj-dialog-container--full .mj-dialog-actions > button {
|
|
190
|
+
flex: 1 1 0;
|
|
191
|
+
min-height: 44px;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@keyframes mj-dialog-slide-up {
|
|
197
|
+
from {
|
|
198
|
+
opacity: 0;
|
|
199
|
+
transform: translateY(24px);
|
|
200
|
+
}
|
|
201
|
+
to {
|
|
202
|
+
opacity: 1;
|
|
203
|
+
transform: translateY(0);
|
|
128
204
|
}
|
|
129
205
|
}
|
|
130
206
|
|
|
@@ -66,7 +66,7 @@ export declare class MJDialogContainerComponent {
|
|
|
66
66
|
static ɵcmp: i0.ɵɵComponentDeclaration<MJDialogContainerComponent, "mj-dialog-container-internal", never, { "Title": { "alias": "Title"; "required": false; }; "StringContent": { "alias": "StringContent"; "required": false; }; "Width": { "alias": "Width"; "required": false; }; "MinWidth": { "alias": "MinWidth"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "Actions": { "alias": "Actions"; "required": false; }; }, { "ActionClicked": "ActionClicked"; "CloseClicked": "CloseClicked"; }, never, never, true, never>;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* MJDialogService — Programmatic dialog opening.
|
|
69
|
+
* MJDialogService — Programmatic dialog opening.
|
|
70
70
|
*
|
|
71
71
|
* @example
|
|
72
72
|
* ```typescript
|
|
@@ -96,7 +96,7 @@ export declare class MJDialogService {
|
|
|
96
96
|
/**
|
|
97
97
|
* Open a dialog programmatically.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
99
|
+
* Accepts `content` as a string or a Component class,
|
|
100
100
|
* returns a ref with `.Content.instance` and `.Result` observable.
|
|
101
101
|
*/
|
|
102
102
|
Open(settings: MJDialogSettings): MJDialogRef;
|
|
@@ -105,7 +105,7 @@ export declare class MJDialogService {
|
|
|
105
105
|
private attachToDOM;
|
|
106
106
|
private attachContentComponent;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Lowercase `open` alias.
|
|
109
109
|
*/
|
|
110
110
|
open(settings: MJDialogSettings): MJDialogRef;
|
|
111
111
|
static ɵfac: i0.ɵɵFactoryDeclaration<MJDialogService, never>;
|
|
@@ -180,7 +180,7 @@ export class MJDialogContainerComponent {
|
|
|
180
180
|
}] }); })();
|
|
181
181
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogContainerComponent, { className: "MJDialogContainerComponent", filePath: "lib/dialog/dialog.service.ts", lineNumber: 252 }); })();
|
|
182
182
|
/**
|
|
183
|
-
* MJDialogService — Programmatic dialog opening.
|
|
183
|
+
* MJDialogService — Programmatic dialog opening.
|
|
184
184
|
*
|
|
185
185
|
* @example
|
|
186
186
|
* ```typescript
|
|
@@ -210,7 +210,7 @@ export class MJDialogService {
|
|
|
210
210
|
/**
|
|
211
211
|
* Open a dialog programmatically.
|
|
212
212
|
*
|
|
213
|
-
*
|
|
213
|
+
* Accepts `content` as a string or a Component class,
|
|
214
214
|
* returns a ref with `.Content.instance` and `.Result` observable.
|
|
215
215
|
*/
|
|
216
216
|
Open(settings) {
|
|
@@ -266,7 +266,7 @@ export class MJDialogService {
|
|
|
266
266
|
dialogRef.Content = { instance: contentRef.instance };
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
269
|
+
* Lowercase `open` alias.
|
|
270
270
|
*/
|
|
271
271
|
open(settings) {
|
|
272
272
|
return this.Open(settings);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.service.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC;AA4D3C;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C,eAAe,EAAE,QAAQ;YACzB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5C,SAAS,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAmC,EAAE,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,QAA0B;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;yGApFU,eAAe;gEAAf,eAAe,WAAf,eAAe,mBADF,MAAM;;iFACnB,eAAe;cAD3B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import {\n Injectable,\n ComponentRef,\n Type,\n ViewContainerRef,\n ApplicationRef,\n Injector,\n createComponent,\n inject\n} from '@angular/core';\nimport { Subject, Observable } from 'rxjs';\n\n/**\n * Result returned when a dialog action button is clicked.\n */\nexport interface MJDialogAction {\n text: string;\n primary?: boolean;\n themeColor?: string;\n}\n\n/**\n * Options for opening a dialog programmatically.\n */\nexport interface MJDialogSettings {\n /** Dialog title */\n title?: string;\n /** Content: either a string message or a Component class */\n content?: string | Type<unknown>;\n /** Action buttons shown in the footer */\n actions?: MJDialogAction[];\n /** Dialog width in pixels */\n width?: number;\n /** Dialog minimum width in pixels */\n minWidth?: number;\n /** Dialog height in pixels */\n height?: number;\n /** ViewContainerRef to attach the dialog to (for proper DI context) */\n appendTo?: ViewContainerRef;\n}\n\n/**\n * Reference to an open dialog. Used to access content instance and subscribe to results.\n */\nexport class MJDialogRef {\n private resultSubject = new Subject<unknown>();\n private containerRef: ComponentRef<MJDialogContainerComponent> | null = null;\n\n /** The content component instance (when content is a Component class) */\n Content: { instance: Record<string, unknown> } | null = null;\n\n /** Observable that emits when the dialog is closed */\n get Result(): Observable<unknown> {\n return this.resultSubject.asObservable();\n }\n\n /** @internal */\n SetContainerRef(ref: ComponentRef<MJDialogContainerComponent>): void {\n this.containerRef = ref;\n }\n\n /** Close the dialog with a result */\n Close(result?: unknown): void {\n this.resultSubject.next(result);\n this.resultSubject.complete();\n this.containerRef?.location.nativeElement.remove();\n this.containerRef?.destroy();\n }\n}\n\n/**\n * Internal container component that wraps dialog content.\n * This is dynamically created by MJDialogService.\n */\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'mj-dialog-container-internal',\n standalone: true,\n template: `\n <div class=\"mj-dialog-backdrop\" (click)=\"OnBackdropClick()\">\n <div class=\"mj-dialog-container\"\n [style.width]=\"Width ? Width + 'px' : '450px'\"\n [style.min-width]=\"MinWidth ? MinWidth + 'px' : null\"\n [style.height]=\"Height ? Height + 'px' : null\"\n (click)=\"$event.stopPropagation()\"\n role=\"dialog\"\n aria-modal=\"true\">\n\n @if (Title) {\n <div class=\"mj-dialog-titlebar\">\n <h3 class=\"mj-dialog-title\">{{ Title }}</h3>\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n }\n\n <div class=\"mj-dialog-body\">\n @if (StringContent) {\n <p>{{ StringContent }}</p>\n }\n <div #contentHost></div>\n </div>\n\n @if (Actions && Actions.length > 0) {\n <div class=\"mj-dialog-actions\">\n @for (action of Actions; track action.text) {\n <button\n class=\"mj-btn\"\n [class.mj-btn--primary]=\"action.primary\"\n [class.mj-btn--danger]=\"action.themeColor === 'error'\"\n (click)=\"OnActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n </div>\n </div>\n `,\n styles: [`\n .mj-dialog-backdrop {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: var(--mj-bg-overlay);\n z-index: 10001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .mj-dialog-container {\n background: var(--mj-bg-surface);\n border-radius: var(--mj-radius-lg);\n box-shadow: var(--mj-shadow-xl, 0 20px 60px color-mix(in srgb, var(--mj-text-primary) 30%, transparent));\n display: flex;\n flex-direction: column;\n max-height: 90vh;\n max-width: 90vw;\n overflow: hidden;\n }\n\n .mj-dialog-titlebar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n }\n\n .mj-dialog-title {\n margin: 0;\n font-size: 1.1rem;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-text-primary);\n }\n\n .mj-dialog-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n cursor: pointer;\n color: var(--mj-text-muted);\n border-radius: var(--mj-radius-sm);\n transition: var(--mj-transition-colors);\n }\n .mj-dialog-close:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n\n .mj-dialog-body {\n flex: 1;\n /* CONTRACT: the body pads only STRING content (the \"> p\" rule below). A COMPONENT body arrives with no\n inset and pads itself — see rating-dialog and input-dialog in ng-conversations, which both apply\n 4px 20px 8px. Padding here would double-pad them and break deliberately full-bleed bodies (About,\n Profile, the action gallery, the sharing centre). If a third component rediscovers this, add a\n padded setting to MJDialogSettings rather than a special case. */\n padding: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n\n .mj-dialog-body > p {\n padding: 20px;\n }\n\n .mj-dialog-body > div {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n min-height: 0;\n }\n\n .mj-dialog-body p {\n margin: 0;\n color: var(--mj-text-primary);\n line-height: 1.5;\n }\n\n .mj-dialog-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 20px;\n border-top: 1px solid var(--mj-border-default);\n }\n\n .mj-btn {\n padding: 8px 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-sm);\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n cursor: pointer;\n font-size: 0.875rem;\n transition: var(--mj-transition-colors);\n }\n .mj-btn:hover { background: var(--mj-bg-surface-hover); }\n .mj-btn--primary {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-color: var(--mj-brand-primary);\n }\n .mj-btn--primary:hover { background: var(--mj-brand-primary-hover); }\n .mj-btn--danger {\n background: var(--mj-status-error);\n color: var(--mj-text-inverse);\n border-color: var(--mj-status-error);\n }\n\n @media (max-width: 767px) {\n .mj-dialog-container {\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n }\n `]\n})\nexport class MJDialogContainerComponent {\n @Input() Title = '';\n @Input() StringContent = '';\n @Input() Width: number | null = null;\n @Input() MinWidth: number | null = null;\n @Input() Height: number | null = null;\n @Input() Actions: MJDialogAction[] = [];\n @Output() ActionClicked = new EventEmitter<MJDialogAction>();\n @Output() CloseClicked = new EventEmitter<void>();\n\n OnBackdropClick(): void {\n this.CloseClicked.emit();\n }\n\n OnCloseClick(): void {\n this.CloseClicked.emit();\n }\n\n OnActionClick(action: MJDialogAction): void {\n this.ActionClicked.emit(action);\n }\n}\n\n/**\n * MJDialogService — Programmatic dialog opening. Replaces Kendo `DialogService`.\n *\n * @example\n * ```typescript\n * // Simple confirm\n * const dialogRef = this.dialogService.Open({\n * title: 'Confirm',\n * content: 'Are you sure?',\n * actions: [\n * { text: 'OK', primary: true },\n * { text: 'Cancel' }\n * ]\n * });\n * dialogRef.Result.subscribe(result => { ... });\n *\n * // Component content\n * const dialogRef = this.dialogService.Open({\n * content: MyDialogComponent,\n * width: 500\n * });\n * dialogRef.Content.instance.someInput = 'value';\n * dialogRef.Result.subscribe(result => { ... });\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class MJDialogService {\n private appRef = inject(ApplicationRef);\n private injector = inject(Injector);\n\n /**\n * Open a dialog programmatically.\n *\n * Kendo-compatible API: accepts `content` as string or Component class,\n * returns a ref with `.Content.instance` and `.Result` observable.\n */\n Open(settings: MJDialogSettings): MJDialogRef {\n const dialogRef = new MJDialogRef();\n const injector = settings.appendTo?.injector ?? this.injector;\n\n const containerRef = this.createContainer(injector);\n this.configureContainer(containerRef, settings, dialogRef);\n this.attachToDOM(containerRef, settings);\n this.attachContentComponent(containerRef, settings, dialogRef, injector);\n\n containerRef.changeDetectorRef.detectChanges();\n return dialogRef;\n }\n\n private createContainer(injector: Injector): ComponentRef<MJDialogContainerComponent> {\n return createComponent(MJDialogContainerComponent, {\n environmentInjector: this.appRef.injector,\n elementInjector: injector\n });\n }\n\n private configureContainer(\n containerRef: ComponentRef<MJDialogContainerComponent>,\n settings: MJDialogSettings,\n dialogRef: MJDialogRef\n ): void {\n containerRef.instance.Title = settings.title ?? '';\n containerRef.instance.Width = settings.width ?? null;\n containerRef.instance.MinWidth = settings.minWidth ?? null;\n containerRef.instance.Height = settings.height ?? null;\n containerRef.instance.Actions = settings.actions ?? [];\n\n if (typeof settings.content === 'string') {\n containerRef.instance.StringContent = settings.content;\n }\n\n containerRef.instance.CloseClicked.subscribe(() => dialogRef.Close(undefined));\n containerRef.instance.ActionClicked.subscribe((action: MJDialogAction) => dialogRef.Close(action));\n dialogRef.SetContainerRef(containerRef);\n }\n\n private attachToDOM(containerRef: ComponentRef<MJDialogContainerComponent>, settings: MJDialogSettings): void {\n if (settings.appendTo) {\n settings.appendTo.insert(containerRef.hostView);\n } else {\n document.body.appendChild(containerRef.location.nativeElement);\n this.appRef.attachView(containerRef.hostView);\n }\n }\n\n private attachContentComponent(\n containerRef: ComponentRef<MJDialogContainerComponent>,\n settings: MJDialogSettings,\n dialogRef: MJDialogRef,\n injector: Injector\n ): void {\n if (!settings.content || typeof settings.content === 'string') return;\n\n const contentHost = containerRef.location.nativeElement.querySelector('.mj-dialog-body div');\n if (!contentHost) return;\n\n const contentRef = createComponent(settings.content as Type<unknown>, {\n environmentInjector: this.appRef.injector,\n elementInjector: injector,\n hostElement: contentHost\n });\n this.appRef.attachView(contentRef.hostView);\n dialogRef.Content = { instance: contentRef.instance as Record<string, unknown> };\n }\n\n /**\n * Kendo-compatible alias — lowercase `open` for easier migration.\n */\n open(settings: MJDialogSettings): MJDialogRef { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.Open(settings);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dialog.service.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC;AA4D3C;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;;;;IAiB3D,AADF,iCAAgC,YACF;IAAA,YAAW;IAAA,oBAAK;IAC5C,oCAA4E;IAA5C,iMAAS,qBAAc,KAAC;IACtD,0BAAiC;IAErC,AADE,oBAAS,EACL;;;IAJwB,eAAW;IAAX,kCAAW;;;IASvC,4BAAG;IAAA,YAAmB;IAAA,oBAAI;;;IAAvB,cAAmB;IAAnB,0CAAmB;;;;IAQpB,qCAIkC;IAAhC,oOAAS,+BAAqB,KAAC;IAC/B,YACF;IAAA,oBAAS;;;IAHP,AADA,oDAAwC,oDACc;IAEtD,cACF;IADE,+CACF;;;IARJ,iCAA+B;IAC7B,8GAQC;IACH,oBAAM;;;IATJ,cAQC;IARD,6BAQC;;AA1Eb;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,aAAa,GAAG,IAAI,OAAO,EAAW,CAAC;IACvC,YAAY,GAAoD,IAAI,CAAC;IAE7E,yEAAyE;IACzE,OAAO,GAAiD,IAAI,CAAC;IAE7D,sDAAsD;IACtD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,CAAC;IAED,gBAAgB;IAChB,eAAe,CAAC,GAA6C;QAC3D,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;IAC1B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,EACtB,QAAkB;QAElB,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO;QAEtE,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;QAC7F,IAAI,CAAC,WAAW;YAAE,OAAO;QAEzB,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC,OAAwB,EAAE;YACpE,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YACzC,eAAe,EAAE,QAAQ;YACzB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5C,SAAS,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAmC,EAAE,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,QAA0B;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;yGApFU,eAAe;gEAAf,eAAe,WAAf,eAAe,mBADF,MAAM;;iFACnB,eAAe;cAD3B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import {\n Injectable,\n ComponentRef,\n Type,\n ViewContainerRef,\n ApplicationRef,\n Injector,\n createComponent,\n inject\n} from '@angular/core';\nimport { Subject, Observable } from 'rxjs';\n\n/**\n * Result returned when a dialog action button is clicked.\n */\nexport interface MJDialogAction {\n text: string;\n primary?: boolean;\n themeColor?: string;\n}\n\n/**\n * Options for opening a dialog programmatically.\n */\nexport interface MJDialogSettings {\n /** Dialog title */\n title?: string;\n /** Content: either a string message or a Component class */\n content?: string | Type<unknown>;\n /** Action buttons shown in the footer */\n actions?: MJDialogAction[];\n /** Dialog width in pixels */\n width?: number;\n /** Dialog minimum width in pixels */\n minWidth?: number;\n /** Dialog height in pixels */\n height?: number;\n /** ViewContainerRef to attach the dialog to (for proper DI context) */\n appendTo?: ViewContainerRef;\n}\n\n/**\n * Reference to an open dialog. Used to access content instance and subscribe to results.\n */\nexport class MJDialogRef {\n private resultSubject = new Subject<unknown>();\n private containerRef: ComponentRef<MJDialogContainerComponent> | null = null;\n\n /** The content component instance (when content is a Component class) */\n Content: { instance: Record<string, unknown> } | null = null;\n\n /** Observable that emits when the dialog is closed */\n get Result(): Observable<unknown> {\n return this.resultSubject.asObservable();\n }\n\n /** @internal */\n SetContainerRef(ref: ComponentRef<MJDialogContainerComponent>): void {\n this.containerRef = ref;\n }\n\n /** Close the dialog with a result */\n Close(result?: unknown): void {\n this.resultSubject.next(result);\n this.resultSubject.complete();\n this.containerRef?.location.nativeElement.remove();\n this.containerRef?.destroy();\n }\n}\n\n/**\n * Internal container component that wraps dialog content.\n * This is dynamically created by MJDialogService.\n */\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'mj-dialog-container-internal',\n standalone: true,\n template: `\n <div class=\"mj-dialog-backdrop\" (click)=\"OnBackdropClick()\">\n <div class=\"mj-dialog-container\"\n [style.width]=\"Width ? Width + 'px' : '450px'\"\n [style.min-width]=\"MinWidth ? MinWidth + 'px' : null\"\n [style.height]=\"Height ? Height + 'px' : null\"\n (click)=\"$event.stopPropagation()\"\n role=\"dialog\"\n aria-modal=\"true\">\n\n @if (Title) {\n <div class=\"mj-dialog-titlebar\">\n <h3 class=\"mj-dialog-title\">{{ Title }}</h3>\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n }\n\n <div class=\"mj-dialog-body\">\n @if (StringContent) {\n <p>{{ StringContent }}</p>\n }\n <div #contentHost></div>\n </div>\n\n @if (Actions && Actions.length > 0) {\n <div class=\"mj-dialog-actions\">\n @for (action of Actions; track action.text) {\n <button\n class=\"mj-btn\"\n [class.mj-btn--primary]=\"action.primary\"\n [class.mj-btn--danger]=\"action.themeColor === 'error'\"\n (click)=\"OnActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n </div>\n </div>\n `,\n styles: [`\n .mj-dialog-backdrop {\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: var(--mj-bg-overlay);\n z-index: 10001;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .mj-dialog-container {\n background: var(--mj-bg-surface);\n border-radius: var(--mj-radius-lg);\n box-shadow: var(--mj-shadow-xl, 0 20px 60px color-mix(in srgb, var(--mj-text-primary) 30%, transparent));\n display: flex;\n flex-direction: column;\n max-height: 90vh;\n max-width: 90vw;\n overflow: hidden;\n }\n\n .mj-dialog-titlebar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n }\n\n .mj-dialog-title {\n margin: 0;\n font-size: 1.1rem;\n font-weight: var(--mj-font-semibold);\n color: var(--mj-text-primary);\n }\n\n .mj-dialog-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n cursor: pointer;\n color: var(--mj-text-muted);\n border-radius: var(--mj-radius-sm);\n transition: var(--mj-transition-colors);\n }\n .mj-dialog-close:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n\n .mj-dialog-body {\n flex: 1;\n /* CONTRACT: the body pads only STRING content (the \"> p\" rule below). A COMPONENT body arrives with no\n inset and pads itself — see rating-dialog and input-dialog in ng-conversations, which both apply\n 4px 20px 8px. Padding here would double-pad them and break deliberately full-bleed bodies (About,\n Profile, the action gallery, the sharing centre). If a third component rediscovers this, add a\n padded setting to MJDialogSettings rather than a special case. */\n padding: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n\n .mj-dialog-body > p {\n padding: 20px;\n }\n\n .mj-dialog-body > div {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n min-height: 0;\n }\n\n .mj-dialog-body p {\n margin: 0;\n color: var(--mj-text-primary);\n line-height: 1.5;\n }\n\n .mj-dialog-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 20px;\n border-top: 1px solid var(--mj-border-default);\n }\n\n .mj-btn {\n padding: 8px 16px;\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-sm);\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n cursor: pointer;\n font-size: 0.875rem;\n transition: var(--mj-transition-colors);\n }\n .mj-btn:hover { background: var(--mj-bg-surface-hover); }\n .mj-btn--primary {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-color: var(--mj-brand-primary);\n }\n .mj-btn--primary:hover { background: var(--mj-brand-primary-hover); }\n .mj-btn--danger {\n background: var(--mj-status-error);\n color: var(--mj-text-inverse);\n border-color: var(--mj-status-error);\n }\n\n @media (max-width: 767px) {\n .mj-dialog-container {\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n }\n `]\n})\nexport class MJDialogContainerComponent {\n @Input() Title = '';\n @Input() StringContent = '';\n @Input() Width: number | null = null;\n @Input() MinWidth: number | null = null;\n @Input() Height: number | null = null;\n @Input() Actions: MJDialogAction[] = [];\n @Output() ActionClicked = new EventEmitter<MJDialogAction>();\n @Output() CloseClicked = new EventEmitter<void>();\n\n OnBackdropClick(): void {\n this.CloseClicked.emit();\n }\n\n OnCloseClick(): void {\n this.CloseClicked.emit();\n }\n\n OnActionClick(action: MJDialogAction): void {\n this.ActionClicked.emit(action);\n }\n}\n\n/**\n * MJDialogService — Programmatic dialog opening.\n *\n * @example\n * ```typescript\n * // Simple confirm\n * const dialogRef = this.dialogService.Open({\n * title: 'Confirm',\n * content: 'Are you sure?',\n * actions: [\n * { text: 'OK', primary: true },\n * { text: 'Cancel' }\n * ]\n * });\n * dialogRef.Result.subscribe(result => { ... });\n *\n * // Component content\n * const dialogRef = this.dialogService.Open({\n * content: MyDialogComponent,\n * width: 500\n * });\n * dialogRef.Content.instance.someInput = 'value';\n * dialogRef.Result.subscribe(result => { ... });\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class MJDialogService {\n private appRef = inject(ApplicationRef);\n private injector = inject(Injector);\n\n /**\n * Open a dialog programmatically.\n *\n * Accepts `content` as a string or a Component class,\n * returns a ref with `.Content.instance` and `.Result` observable.\n */\n Open(settings: MJDialogSettings): MJDialogRef {\n const dialogRef = new MJDialogRef();\n const injector = settings.appendTo?.injector ?? this.injector;\n\n const containerRef = this.createContainer(injector);\n this.configureContainer(containerRef, settings, dialogRef);\n this.attachToDOM(containerRef, settings);\n this.attachContentComponent(containerRef, settings, dialogRef, injector);\n\n containerRef.changeDetectorRef.detectChanges();\n return dialogRef;\n }\n\n private createContainer(injector: Injector): ComponentRef<MJDialogContainerComponent> {\n return createComponent(MJDialogContainerComponent, {\n environmentInjector: this.appRef.injector,\n elementInjector: injector\n });\n }\n\n private configureContainer(\n containerRef: ComponentRef<MJDialogContainerComponent>,\n settings: MJDialogSettings,\n dialogRef: MJDialogRef\n ): void {\n containerRef.instance.Title = settings.title ?? '';\n containerRef.instance.Width = settings.width ?? null;\n containerRef.instance.MinWidth = settings.minWidth ?? null;\n containerRef.instance.Height = settings.height ?? null;\n containerRef.instance.Actions = settings.actions ?? [];\n\n if (typeof settings.content === 'string') {\n containerRef.instance.StringContent = settings.content;\n }\n\n containerRef.instance.CloseClicked.subscribe(() => dialogRef.Close(undefined));\n containerRef.instance.ActionClicked.subscribe((action: MJDialogAction) => dialogRef.Close(action));\n dialogRef.SetContainerRef(containerRef);\n }\n\n private attachToDOM(containerRef: ComponentRef<MJDialogContainerComponent>, settings: MJDialogSettings): void {\n if (settings.appendTo) {\n settings.appendTo.insert(containerRef.hostView);\n } else {\n document.body.appendChild(containerRef.location.nativeElement);\n this.appRef.attachView(containerRef.hostView);\n }\n }\n\n private attachContentComponent(\n containerRef: ComponentRef<MJDialogContainerComponent>,\n settings: MJDialogSettings,\n dialogRef: MJDialogRef,\n injector: Injector\n ): void {\n if (!settings.content || typeof settings.content === 'string') return;\n\n const contentHost = containerRef.location.nativeElement.querySelector('.mj-dialog-body div');\n if (!contentHost) return;\n\n const contentRef = createComponent(settings.content as Type<unknown>, {\n environmentInjector: this.appRef.injector,\n elementInjector: injector,\n hostElement: contentHost\n });\n this.appRef.attachView(contentRef.hostView);\n dialogRef.Content = { instance: contentRef.instance as Record<string, unknown> };\n }\n\n /**\n * Lowercase `open` alias.\n */\n open(settings: MJDialogSettings): MJDialogRef { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.Open(settings);\n }\n}\n"]}
|
|
@@ -6,7 +6,6 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
/**
|
|
7
7
|
* mj-dropdown — Dropdown select component using CDK Overlay.
|
|
8
8
|
*
|
|
9
|
-
* Replaces `<kendo-dropdownlist>`.
|
|
10
9
|
*
|
|
11
10
|
* Every dropdown needs an ACCESSIBLE NAME, or it announces as "combobox, collapsed" with no hint of
|
|
12
11
|
* what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAIb,YAAY,EAMZ,WAAW,EACX,SAAS,EAGV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAiB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;;AAGhE
|
|
1
|
+
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa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I;IAI5C;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAOzB,MAAM,IAAI,IAAI;IAEd,eAAe,IAAI,IAAI;IAEvB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAOlC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAMpC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEnC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAChC,gBAAgB,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IACpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IACvC,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;IAC3C,WAAW,IAAI,IAAI;IAEnB,OAAO,CAAC,gBAAgB;yCA5Rb,mBAAmB;2CAAnB,mBAAmB;CAgS/B"}
|
|
@@ -98,7 +98,6 @@ function MJDropdownComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
|
|
|
98
98
|
/**
|
|
99
99
|
* mj-dropdown — Dropdown select component using CDK Overlay.
|
|
100
100
|
*
|
|
101
|
-
* Replaces `<kendo-dropdownlist>`.
|
|
102
101
|
*
|
|
103
102
|
* Every dropdown needs an ACCESSIBLE NAME, or it announces as "combobox, collapsed" with no hint of
|
|
104
103
|
* what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —
|
|
@@ -603,5 +602,5 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
603
602
|
type: HostBinding,
|
|
604
603
|
args: ['class.mj-dropdown-host']
|
|
605
604
|
}] }); })();
|
|
606
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDropdownComponent, { className: "MJDropdownComponent", filePath: "lib/dropdown/dropdown.component.ts", lineNumber:
|
|
605
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDropdownComponent, { className: "MJDropdownComponent", filePath: "lib/dropdown/dropdown.component.ts", lineNumber: 199 }); })();
|
|
607
606
|
//# sourceMappingURL=dropdown.component.js.map
|