/// <summary> /// Handles the component click event. /// </summary> /// <returns></returns> protected async Task OnClickHandler() { if (CopyToClipboard) { await JSUtilitiesModule.CopyToClipboard(ElementRef, ElementId); } }
private async Task Expand() { // An element location must be known every time we need to show the dropdown. The reason is mainly // because sometimes input can have different offset based on the changes on the page. For example // when validation is triggered the input can be pushed down by the error messages. elementInfo = await JSUtilitiesModule.GetElementInfo(ElementRef, ElementId); await JSClosableModule.Register(dotNetObjectRef, ElementRef); Expanded = true; // automatically set focus to the dropdown so that we can make it auto-close on blur event ExecuteAfterRender(async() => await DropdownElementRef.FocusAsync()); }
protected override async Task OnAfterRenderAsync(bool firstRender) { var listRect = await JSUtilitiesModule.GetElementInfo(slickListElementRef, null); if (slickWidth != (int)listRect.BoundingClientRect.Width) { slickWidth = (int)listRect.BoundingClientRect.Width; totalWidth = slickWidth * (carouselSlides.Count * 2 + 1); await InvokeAsync(StateHasChanged); } await base.OnAfterRenderAsync(firstRender); }
internal protected override void OnVisibleChanged(bool e) { ExecuteAfterRender(async() => { if (ParentDropdown != null && ParentDropdown is AntDesign.Dropdown dropdown) { var dropdownMenuElementInfo = await JSUtilitiesModule.GetElementInfo(ElementRef, ElementId); MenuStyleNames = GetMenuStyleNames(dropdown.ElementInfo, dropdownMenuElementInfo, dropdown.Direction); await InvokeAsync(StateHasChanged); } }); base.OnVisibleChanged(e); }
/// <inheritdoc/> protected async Task OnInputHandler(ChangeEventArgs e) { if (IsChangeTextOnKeyPress) { if (IsDelayTextOnKeyPress) { inputValueDebouncer?.Update(e?.Value?.ToString()); } else { var caret = await JSUtilitiesModule.GetCaret(ElementRef); await CurrentValueHandler(e?.Value?.ToString()); await JSUtilitiesModule.SetCaret(ElementRef, caret); } } }
protected async Task OnSliderMouseDown(MouseEventArgs e) { // only the left button can trigger the change if (e.Button != 0) { return; } mouseDown = true; sliderElementInfo = await JSUtilitiesModule.GetElementInfo(ElementRef, ElementId); sliderStart = sliderElementInfo.BoundingClientRect.Left; sliderWidth = sliderElementInfo.BoundingClientRect.Width; startedAt = e.ClientX; Percentage = CalculatePercentage(e.ClientX); await CurrentValueHandler(CalculateValue( Percentage )); }
/// <inheritdoc/> public override async Task SetParametersAsync(ParameterView parameters) { await base.SetParametersAsync(parameters); if (ParentValidation != null) { if (parameters.TryGetValue <Expression <Func <TValue> > >(nameof(CheckedExpression), out var expression)) { await ParentValidation.InitializeInputExpression(expression); } await InitializeValidation(); } if (parameters.TryGetValue <bool?>(nameof(Indeterminate), out var indeterminate) && this.indeterminate != indeterminate) { this.indeterminate = indeterminate; ExecuteAfterRender(async() => { await JSUtilitiesModule.SetProperty(ElementRef, "indeterminate", indeterminate); }); } }
/// <inheritdoc/> public virtual async Task Select(bool focus = true) { await JSUtilitiesModule.Select(ElementRef, ElementId, focus); }
/// <inheritdoc/> public virtual Task Select(bool focus = true) { return(JSUtilitiesModule.Select(ElementRef, ElementId, focus).AsTask()); }
/// <summary> /// Sets focus on the button element, if it can be focused. /// </summary> /// <param name="scrollToElement">If true the browser should scroll the document to bring the newly-focused element into view.</param> /// <returns>A task that represents the asynchronous operation.</returns> public Task Focus(bool scrollToElement = true) { return(JSUtilitiesModule.Focus(ElementRef, ElementId, scrollToElement).AsTask()); }
protected override async Task OnAfterRenderAsync(bool firstRender) { elementInfo = await JSUtilitiesModule.GetElementInfo(ElementRef, ElementId); await base.OnAfterRenderAsync(firstRender); }