-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dev-v5] [Dialog Service] Add the FluentDialog and services #3112
Merged
Conversation
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
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 98.9%
|
vnbaaij
reviewed
Jan 7, 2025
.../FluentUI.Demo.Client/Documentation/Components/Dialog/Examples/DialogServiceCustomized.razor
Outdated
Show resolved
Hide resolved
vnbaaij
reviewed
Jan 7, 2025
examples/Demo/FluentUI.Demo.Client/Documentation/Components/Dialog/FluentDialog.md
Outdated
Show resolved
Hide resolved
vnbaaij
reviewed
Jan 7, 2025
vnbaaij
reviewed
Jan 7, 2025
vnbaaij
reviewed
Jan 7, 2025
vnbaaij
reviewed
Jan 7, 2025
vnbaaij
requested changes
Jan 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved once comments are resolved (if I approve now, it will get merged immediately)
vnbaaij
approved these changes
Jan 8, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[dev-v5] [Dialog Service] Add the FluentDialog and services
Dialog
FluentDialog is a window overlaid on either the primary window or another dialog window. Windows under a modal dialog are inert. That is, users cannot interact with content outside an active dialog window. Inert content outside an active dialog is typically visually obscured or dimmed so it is difficult to discern, and in some implementations, attempts to interact with the inert content cause the dialog to close
Usage
The simplest way is to use the DialogService to display a dialog box. By injecting this service, you have ShowDialogAsync methods at your disposal. You can pass the type of Dialog to be displayed and the options to be passed to that window.
Once the user closes the dialog window, the ShowDialogAsync method returns a DialogResult object containing the return data.
The SimpleDialog window can inherit from the FluentDialogInstance class to have access to the DialogInstance property, which contains all parameters defined when calling ShowDialogAsync, as well as the CloseAsync and CancelAsync methods. Using CloseAsync you can pass a return object to the parent component. It is then retrieved in the DialogResult like in the example below.
Data exchange between components
You can easily send data from your main component to the dialog box by using the options.Parameters.Add() method in the ShowDialogAsync method options.
Parameters is a dictionary that allows you to send any type of data to the dialog box. the key is the name of the property in the dialog box, and the value is the data to be sent.
MessageBox
A MessageBox is a dialog that is used to display information with a specific intent to the user. It uses the DialogService to display the dialog.
The DialogService is an injected service that can be used into any component. It exposes methods to show a dialog. For working with a MessageBox, the following methods are available:
ShowSuccessAsync: Shows a dialog with a success (green) icon, a message and an OK button.
ShowWarningAsync: Shows a dialog with a warning (orange) icon, a message and an OK button.
ShowInfoAsync: Shows a dialog with an information (gray) icon, a message and an OK button.
ShowErrorAsync: Shows a dialog with an error (red) icon, a message and an OK button.
ShowConfirmationAsync: Shows a dialog with a confirmation icon, a message and a Yes/No buttons. This method returns a DialogResult object where Cancelled = false if Yes is pressed and Cancelled = true if No is pressed.
ShowMessageBoxAsync: Shows a dialog with the specified options.
Live Demo
See the Dialog page,
and the MessageBox page.
Unit Tests