|
1 | | -using System; |
| 1 | +using Microsoft.AspNetCore.Components; |
| 2 | +using System; |
2 | 3 | using System.Collections.Generic; |
3 | 4 | using System.Text; |
| 5 | +using System.Threading.Tasks; |
4 | 6 |
|
5 | 7 | namespace BlazorDialog |
6 | 8 | { |
| 9 | + public class ComponentAsDialogOptions |
| 10 | + { |
| 11 | + public ComponentAsDialogOptions(Type componentType) |
| 12 | + { |
| 13 | + ComponentType = componentType; |
| 14 | + } |
| 15 | + |
| 16 | + /// <summary> |
| 17 | + /// The type of the rendered component |
| 18 | + /// </summary> |
| 19 | + public Type ComponentType { get; protected set; } |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// The parameters of the rendered component. |
| 23 | + /// </summary> |
| 24 | + public Dictionary<string, object> Parameters { get; set; } = new(); |
| 25 | + |
| 26 | + /// <summary> |
| 27 | + /// If set to true then all default html/css is removed. Use when custom dialog implementations are needed. |
| 28 | + /// </summary> |
| 29 | + public bool IsCustom { get; set; } |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Allows you to change the appearing animation. Ignored when the dialog is <see cref="Dialog.IsCustom" />. |
| 33 | + /// </summary> |
| 34 | + public DialogAnimation Animation { get; set; } = DialogAnimation.None; |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// The base z-index of the dialog when shown. Default: 1050 |
| 38 | + /// </summary> |
| 39 | + public int BaseZIndex { get; set; } = 1050; |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Allows you to set the positioning of the dialog from the top. Ignored when the dialog is <see cref="Dialog.IsCustom" />. |
| 43 | + /// </summary> |
| 44 | + public bool Centered { get; set; } |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Adds a custom css class to the wrapper of the dialog. |
| 48 | + /// </summary> |
| 49 | + public string? CssClass { get; set; } |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// Allows you to set the dialog size. Ignored when the dialog is <see cref="Dialog.IsCustom" />. |
| 53 | + /// </summary> |
| 54 | + public DialogSize Size { get; set; } = DialogSize.Normal; |
| 55 | + } |
| 56 | + |
| 57 | + public class ComponentDialog |
| 58 | + { |
| 59 | + public ComponentAsDialogOptions Options { get; set; } |
| 60 | + public TaskCompletionSource RenderTaskCompletionSource { get; set; } |
| 61 | + } |
| 62 | + |
7 | 63 | public interface IBlazorDialogStore |
8 | 64 | { |
9 | 65 |
|
10 | 66 | void Register(Dialog blazorDialog); |
11 | 67 | void Unregister(Dialog blazorDialog); |
12 | 68 | Dialog GetById(string id); |
13 | 69 | int GetVisibleDialogsCount(); |
| 70 | + |
| 71 | + Task RegisterComponentDialog(string id, ComponentDialog compDialog); |
| 72 | + Task UnregisterComponentDialog(string id); |
| 73 | + |
| 74 | + Dictionary<string, ComponentDialog> GetComponentsAsDialogs(); |
| 75 | + |
| 76 | + event Func<Task> OnComponentAsDialogsChanged; |
| 77 | + |
14 | 78 | } |
15 | 79 | } |
0 commit comments