Exemplo n.º 1
0
 /// <summary>
 /// Sets the focus trap.
 /// </summary>
 /// <returns>A task that represents the asynchronous operation.</returns>
 public async Task SetFocus()
 {
     if (Rendered)
     {
         if (HasFocusableComponents)
         {
             await HandleFocusableComponent();
         }
         else
         {
             await startFirstRef.FocusAsync();
         }
     }
 }
 protected override async Task OnAfterRenderAsync(bool firstRender)
 {
     if (firstRender)
     {
          await SearchInput.FocusAsync();
     }
 }
Exemplo n.º 3
0
 public void Focus()
 {
     if (FocusElement.Context != null)
     {
         FocusElement.FocusAsync();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Handles the focus end event.
 /// </summary>
 /// <param name="args">Supplies information about a focus event that is being raised.</param>
 /// <returns>A task that represents the asynchronous operation.</returns>
 protected virtual async Task OnFocusEndHandler(FocusEventArgs args)
 {
     if (shiftTabPressed)
     {
         await endFirstRef.FocusAsync();
     }
 }
Exemplo n.º 5
0
 internal static ValueTask FocusAsyncWithWarning(this ElementReference element, string parentName)
 {
     if (element.Id == null)
     {
         Console.WriteLine("Warning! {0} passed default ElementReference to FocusAsync", parentName);
     }
     return(element.FocusAsync());
 }
Exemplo n.º 6
0
        protected virtual async Task ClearButtonClickHandlerAsync(MouseEventArgs e)
        {
            await SetTextAsync(string.Empty, updateValue : true);

            await ElementReference.FocusAsync();

            await OnClearButtonClick.InvokeAsync(e);
        }
Exemplo n.º 7
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await Task.Delay(50);

                await _titleInput.FocusAsync();
            }
        }
Exemplo n.º 8
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (setFocus)
            {
                await input.FocusAsync();

                setFocus = false;
            }
        }
Exemplo n.º 9
0
        public async void Search()
        {
            var products = await ProductService.SearchProducts(SearchModel.SearchText);

            Products = products.Select(p => {
                return(new SelectableProduct(p)
                {
                });
            }).ToList();
            StateHasChanged();
            SearchInputControl.FocusAsync();
        }
        //send initial text (if supplied) to javascript to place in the div
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await _JSRuntime.InvokeAsync<string>("BlazorContentEditable", _id, DotNetObjectReference.Create(this), Value);
            }

            if (Element.Focus)
            {
                Element.Focus = false;

                await _elementRef.FocusAsync();
            }
        }
        public static async Task FocusAsync(this IJSRuntime jSRuntime, ElementReference target, bool preventScroll = false)
        {
#if NET6_0_OR_GREATER
            await target.FocusAsync(preventScroll);
#else
            try
            {
                await jSRuntime.InvokeVoidAsync(JSInteropConstants.Focus, target, preventScroll);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
#endif
        }
Exemplo n.º 12
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (!isInitialized)
            {
                await BlurContainer.FocusAsync();

                if (ModalModel.Options.Draggable)
                {
                    await TablerService.SetElementProperty(dragContainer, "draggable", true);

                    await TablerService.DisableDraggable(dragContainer, contentContainer);
                }
                isInitialized = true;
            }
        }
Exemplo n.º 13
0
 public override async ValueTask FocusAsync()
 {
     try
     {
         if (InputType == InputType.Hidden && ChildContent != null)
         {
             await _elementReference1.FocusAsync();
         }
         else
         {
             await ElementReference.FocusAsync();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("MudInput.FocusAsync: " + e.Message);
     }
 }
Exemplo n.º 14
0
 public ValueTask FocusAsync() => _elementReference.FocusAsync();
Exemplo n.º 15
0
 /// <summary>
 /// Focuses the start input of MudRangeInput
 /// </summary>
 /// <returns></returns>
 public ValueTask FocusStartAsync() => _elementReferenceStart.FocusAsync();
Exemplo n.º 16
0
 protected override async Task OnAfterRenderAsync(bool firstRender)
 {
     await LastNameInput.FocusAsync();
 }
Exemplo n.º 17
0
 public void MostrarInfo(string dato)
 {
     InputTextRef.FocusAsync();
     Console.WriteLine(dato);
     StateHasChanged();
 }
Exemplo n.º 18
0
 public override ValueTask FocusAsync()
 {
     return(_elementReference.FocusAsync());
 }
Exemplo n.º 19
0
 private async Task InitializeFocus()
 {
     await beatButton.FocusAsync();
 }
 protected async override Task OnAfterRenderAsync(bool firstRender) => await LastNameInput.FocusAsync();
Exemplo n.º 21
0
 /// <summary>
 /// Sets the focus on the input element.
 /// </summary>
 public async Task FocusAsync()
 {
     await input.FocusAsync();
 }
Exemplo n.º 22
0
 /// <summary>
 /// Gives focus to an element given its <see cref="ElementReference"/>.
 /// </summary>
 /// <param name="elementReference">A reference to the element to focus.</param>
 /// <returns>The <see cref="ValueTask"/> representing the asynchronous focus operation.</returns>
 public static ValueTask FocusAsync(this ElementReference elementReference) => elementReference.FocusAsync(preventScroll: false);
Exemplo n.º 23
0
 private void OnClick()
 {
     _ = inputEl.FocusAsync();
 }