| | 1 | | @namespace Syki.Front.Components.Custom |
| | 2 | |
|
| | 3 | | <MudTextField |
| | 4 | | T="string" |
| | 5 | | Class="@Class" |
| | 6 | | Label="@Label" |
| | 7 | | Value="@Value" |
| | 8 | | Required="true" |
| | 9 | | Immediate="true" |
| | 10 | | ReadOnly="@ReadOnly" |
| | 11 | | Margin="Margin.Dense" |
| | 12 | | MaxLength="@MaxLength" |
| | 13 | | AutoFocus="@AutoFocus" |
| | 14 | | RequiredError="Informe!" |
| | 15 | | OnlyValidateIfDirty="true" |
| | 16 | | Variant="Variant.Outlined" |
| | 17 | | ValueChanged="@ValueChanged" |
| | 18 | | OnAdornmentClick="@OnAdornmentClick" |
| | 19 | | AdornmentIcon="@Icons.Material.Filled.ContentCopy" |
| | 20 | | Adornment="@(CopyAdornment ? Adornment.End : Adornment.None)" |
| | 21 | | /> |
| | 22 | |
|
| | 23 | | @inject ClipboardService ClipboardService |
| | 24 | |
|
| | 25 | | @code |
| | 26 | | { |
| | 27 | | [Parameter] |
| 0 | 28 | | public string Value { get; set; } |
| | 29 | |
|
| | 30 | | [Parameter] |
| 0 | 31 | | public EventCallback<string> ValueChanged { get; set; } |
| | 32 | |
|
| | 33 | | [Parameter] |
| 0 | 34 | | public string Label { get; set; } |
| | 35 | |
|
| | 36 | | [Parameter] |
| 0 | 37 | | public string Class { get; set; } = "pb-2"; |
| | 38 | |
|
| | 39 | | [Parameter] |
| 0 | 40 | | public bool AutoFocus { get; set; } |
| | 41 | |
|
| | 42 | | [Parameter] |
| 0 | 43 | | public bool ReadOnly { get; set; } |
| | 44 | |
|
| | 45 | | [Parameter] |
| 0 | 46 | | public int MaxLength { get; set; } = 100; |
| | 47 | |
|
| | 48 | | [Parameter] |
| 0 | 49 | | public bool CopyAdornment { get; set; } |
| | 50 | |
|
| | 51 | | private async Task OnAdornmentClick() |
| | 52 | | { |
| 0 | 53 | | await ClipboardService.CopyToClipboard(Value); |
| 0 | 54 | | } |
| | 55 | | } |