private async Task _toggleInlineEditClickHandler(bool enableEdit, bool applyChange) { //Show Edit if (enableEdit && !_editEnabled) { _editEnabled = true; await Task.Delay(5); new JsService(JSRuntime).FocusElementBySelector("#" + _inputElementId); } //Hide edit if (!enableEdit && _editEnabled) { var originalValue = FieldValueService.InitAsNullBool(Value); //Apply Change if (applyChange) { if (_value != originalValue) { //Update Function should be called await ValueChanged.InvokeAsync(new ChangeEventArgs { Value = _value }); } } //Abandon change else { _value = originalValue; } _editEnabled = false; } await InvokeAsync(StateHasChanged); }
protected override async Task OnParametersSetAsync() { _cssList = new List <string>(); if (!String.IsNullOrWhiteSpace(Class)) { _cssList.Add(Class); if (!Class.Contains("form-control")) { //Handle input-group case _cssList.Add("form-control-plaintext"); if (Value == null) { _cssList.Add("form-control-plaintext--empty"); } } } else { _cssList.Add("form-control-plaintext"); if (Value == null) { _cssList.Add("form-control-plaintext--empty"); } } var sizeSuffix = Size.ToDescriptionString(); if (!String.IsNullOrWhiteSpace(sizeSuffix)) { _cssList.Add($"form-control-{sizeSuffix}"); } _value = FieldValueService.InitAsNullBool(Value); await base.OnParametersSetAsync(); }
protected override async Task OnParametersSetAsync() { if (JsonConvert.SerializeObject(_originalValue) != JsonConvert.SerializeObject(Value)) { _originalValue = Value; _value = FieldValueService.InitAsNullBool(Value); } await base.OnParametersSetAsync(); }
protected override async Task OnParametersSetAsync() { _cssList = new List <string>(); if (!String.IsNullOrWhiteSpace(Class)) { _cssList.Add(Class); } var sizeSuffix = Size.ToDescriptionString(); if (!String.IsNullOrWhiteSpace(sizeSuffix)) { _cssList.Add($"form-control-{sizeSuffix}"); } if (JsonConvert.SerializeObject(_originalValue) != JsonConvert.SerializeObject(Value)) { _originalValue = Value; _value = FieldValueService.InitAsNullBool(Value); } await base.OnParametersSetAsync(); }