-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular/modal): support modal content by component class (#256)
- Loading branch information
1 parent
f3b5372
commit d7479d9
Showing
6 changed files
with
189 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 Siemens AG | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import { closeModal, dismissModal } from '@siemens/ix'; | ||
|
||
export class IxActiveModal<TData = any, TReason = any> { | ||
modalElement: HTMLElement; | ||
|
||
constructor(private readonly modalData?: TData) {} | ||
|
||
public get data() { | ||
return this.modalData; | ||
} | ||
|
||
/** | ||
* Close the active modal | ||
* | ||
* @param reason | ||
*/ | ||
public close(reason: TReason) { | ||
closeModal(this.modalElement, reason); | ||
} | ||
|
||
/** | ||
* Dismiss the active modal | ||
* | ||
* @param reason | ||
*/ | ||
public dismiss(reason?: TReason) { | ||
dismissModal(this.modalElement, reason); | ||
} | ||
} | ||
|
||
export class InternalIxActiveModal< | ||
TData = any, | ||
TReason = any | ||
> extends IxActiveModal<TData, TReason> { | ||
setModalElement(element: HTMLElement) { | ||
this.modalElement = element; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters