Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 22x 1x 21x | /** * Copyright (c) Siemens 2016 - 2025 * SPDX-License-Identifier: MIT */ import { ElementRef } from '@angular/core'; import { ReplaySubject, Subject } from 'rxjs'; import { ModalOptions } from './si-modal.service'; /** * Reference to a modal dialog * @typeParam T - the type of the content * @typeParam CT - the close type */ export class ModalRef<T = never, CT = any> { /** Emits the close value when the modal is hidden. */ hidden = new Subject<CT | undefined>(); /** Allows messaging state to consumer w/o closing the dialog. */ message = new Subject<CT | undefined>(); /** Emits the modal element reference when it is shown. */ shown = new ReplaySubject<ElementRef>(1); /** * The modal options passed during creation. * * @defaultValue `{}` * @see {@link SiModalService} */ data: ModalOptions = {}; /** @defaultValue true */ ignoreBackdropClick = true; /** * Custom class for modal-dialog * * @defaultValue '' */ dialogClass = ''; /** * The layer of the modal. The modal with the highest layer will be shown on top. * * @defaultValue 0 */ layer = 0; /** The default close value of the modal. */ closeValue?: CT; get content(): T { return undefined as unknown as T; } /** Set the input of a component shown in the modal. */ setInput(input: string, value: unknown): void {} /** * @defaultValue `() => false` */ isCurrent: () => boolean = () => false; /** * @defaultValue `() => {}` */ detach: () => void = () => {}; /** * Close the modal with a custom close value. * * @defaultValue `() => {}` */ hide: (reason?: CT) => void = () => {}; /** * When `data.disableAutoHide` is set, messages the `reason`, otherwise calls {@link hide}. */ messageOrHide(reason?: CT): void { if (this.data.messageInsteadOfAutoHide) { this.message.next(reason); } else { this.hide(reason); } } } |