Ejemplo n.º 1
0
        private void OnItemClicked(int index)
        {
            if (Value == index)
            {
                return;
            }

            ValueChanged.InvokeAsync(index);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 选中日期时回调此方法
 /// </summary>
 /// <param name="value"></param>
 protected EventCallback <MouseEventArgs> OnCellClickCallback(DateTime value) => EventCallback.Factory.Create <MouseEventArgs>(this, async() =>
 {
     Value = value;
     if (ValueChanged.HasDelegate)
     {
         await ValueChanged.InvokeAsync(Value);
     }
     StateHasChanged();
 });
Ejemplo n.º 3
0
        void AcceptValue()
        {
            IsOpen = false;

            Value = RenderedValue;

            EditContext.NotifyValidationStateChanged();
            ValueChanged.InvokeAsync(Value);
        }
Ejemplo n.º 4
0
        private async Task NotifyValueChanged()
        {
            UpdateValidationMessages();
            await ValueChanged.InvokeAsync(Value);

            // note the ? because we can have a race condition
            // where Value is assigned before Initialize() is called
            _editContext?.NotifyFieldChanged(_fieldIdentifier);
        }
Ejemplo n.º 5
0
 private void DoChange(ChangeEventArgs e)
 {
     Value.IsChecked = (bool?)e.Value;
     ValueChanged.InvokeAsync(Value);
     if (OnChange.HasDelegate)
     {
         OnChange.InvokeAsync(Value);
     }
 }
Ejemplo n.º 6
0
 protected virtual void OnChangeEventArgs(ChangeEventArgs input)
 {
     Value = (TValue)TypeHelper.ChangeType(input.Value, typeof(TValue));
     if (ValueChanged.HasDelegate)
     {
         _ = ValueChanged.InvokeAsync(Value);
     }
     SetFieldValue(Value, true);
 }
Ejemplo n.º 7
0
        private async Task _removeFile()
        {
            _value = null;
            await ValueChanged.InvokeAsync(new ChangeEventArgs { Value = _value });

            await OnInput.InvokeAsync(new ChangeEventArgs { Value = _value });

            await InvokeAsync(StateHasChanged);
        }
Ejemplo n.º 8
0
 private void DoChange(ChangeEventArgs e)
 {
     Value.Value = (string)e.Value;
     ValueChanged.InvokeAsync(Value);
     if (OnChange.HasDelegate)
     {
         OnChange.InvokeAsync(Value);
     }
 }
Ejemplo n.º 9
0
        protected async Task OnSelectDateInternal(SelectedDateResult result)
        {
            SelectedDate = result.Date;
            await OnSelectDate.InvokeAsync(result);

            await ValueChanged.InvokeAsync(result.Date);

            await RangeChanged.InvokeAsync(result.SelectedDateRange);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 选中日期时回调此方法
 /// </summary>
 /// <param name="d"></param>
 protected async Task OnClickDay(DateTime d)
 {
     Value = d;
     if (ValueChanged.HasDelegate)
     {
         await ValueChanged.InvokeAsync(Value);
     }
     StateHasChanged();
 }
Ejemplo n.º 11
0
        private async Task _onValueChangeHandler(ChangeEventArgs e)
        {
            var value = (string)e.Value;
            //Generate new Rows
            var rows = WvpHelpers.GetCsvData <TItem>(value, _hasHeader, _delimiter, Culture);
            await ValueChanged.InvokeAsync(new ChangeEventArgs { Value = value });

            await RowsChanged.InvokeAsync(new ChangeEventArgs { Value = rows });
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 点击确认按钮时回调此方法
 /// </summary>
 private async Task OnClickConfirm()
 {
     Value = CurrentTime;
     if (ValueChanged.HasDelegate)
     {
         await ValueChanged.InvokeAsync(Value);
     }
     OnConfirm?.Invoke();
 }
Ejemplo n.º 13
0
 protected override void FormItem_OnReset(object value, bool requireRender)
 {
     Value = value?.ToString();
     if (ValueChanged.HasDelegate)
     {
         _ = ValueChanged.InvokeAsync(Value);
     }
     StateHasChanged();
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 选中日期时回调此方法
 /// </summary>
 /// <param name="d"></param>
 protected void OnClickDay(DateTime d)
 {
     Value = d;
     if (ValueChanged.HasDelegate)
     {
         ValueChanged.InvokeAsync(Value);
     }
     OnValueChanged?.Invoke(Value);
     StateHasChanged();
 }
        private async Task _onSelectHandler(TItem item)
        {
            _value = item;

            await OnInput.InvokeAsync(new ChangeEventArgs { Value = _value });

            await ValueChanged.InvokeAsync(new ChangeEventArgs { Value = _value });

            await InvokeAsync(StateHasChanged);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 点击确认按钮时回调此方法
 /// </summary>
 protected void OnClickConfirm()
 {
     Value = CurrentTime;
     if (ValueChanged.HasDelegate)
     {
         ValueChanged.InvokeAsync(Value);
     }
     OnValueChanged?.Invoke(Value);
     OnConfirm?.Invoke();
 }
Ejemplo n.º 17
0
 private void ClickHandle(int index)
 {
     if (Disabled)
     {
         return;
     }
     Value = index + 1;
     ValueChanged.InvokeAsync(index + 1);
     OnChanged.InvokeAsync(index + 1);
 }
        void TriggerChange()
        {
            if (!ShowButton)
            {
                ValueChanged.InvokeAsync(Color);
                Change.InvokeAsync(Color);
            }

            StateHasChanged();
        }
Ejemplo n.º 19
0
        protected override Task OnInternalValueChanged(MesContableEditDto value)
        {
            if (InternalValue != null && ParentValidation != null)
            {
                ParentValidation.Validate();
                StateHasChanged();
            }

            return(ValueChanged.InvokeAsync(InternalValue));
        }
Ejemplo n.º 20
0
        protected async Task OnSelectDateInternal(SelectedDateResult result)
        {
            SelectedDate = result.Date;
            CascadedEditContext?.NotifyFieldChanged(FieldIdentifier);
            await OnSelectDate.InvokeAsync(result);

            await ValueChanged.InvokeAsync(result.Date);

            await RangeChanged.InvokeAsync(result.SelectedDateRange);
        }
        private async Task OnClearClick()
        {
            Value    = "";
            Argument = "";
            await ValueChanged.InvokeAsync("");

            await ArgumentChanged.InvokeAsync("");

            IsSelected = false;
        }
Ejemplo n.º 22
0
    /// <summary>
    /// 选中日期时回调此方法
    /// </summary>
    /// <param name="value"></param>
    protected async Task OnCellClickCallback(DateTime value)
    {
        Value = value;
        if (ValueChanged.HasDelegate)
        {
            await ValueChanged.InvokeAsync(Value);
        }

        StateHasChanged();
    }
Ejemplo n.º 23
0
 protected override void OnParametersSet()
 {
     ListItem.Collapsed        = Value;
     ListItem.CollapsedChanged = () =>
     {
         Value = ListItem.Collapsed;
         ValueChanged.InvokeAsync(Value);
     };
     base.OnParametersSet();
 }
 private void ProcessModelChange()
 {
     if (_simpleMode && Value is not null)
     {
         Value.To[0].Amount = Value.From[0].Amount;
     }
     UpdateValidationMessages();
     _ = ValueChanged.InvokeAsync(Value);
     _editContext?.NotifyFieldChanged(_fieldIdentifier);
 }
Ejemplo n.º 25
0
        protected async Task HandleInput(ChangeEventArgs args)
        {
            var value = args.Value.ToString();

            value = ApplyMask(value);

            await ValueChanged.InvokeAsync(value);

            EditContext?.NotifyFieldChanged(_fieldIdentifier);
        }
        /// <summary>
        /// Parses the date.
        /// </summary>
        protected async Task ParseDate()
        {
            DateTime?newValue;
            DateTime value;
            var      inputValue = await JSRuntime.InvokeAsync <string>("Radzen.getInputValue", input);

            var valid    = DateTime.TryParseExact(inputValue, DateFormat, null, DateTimeStyles.None, out value);
            var nullable = Nullable.GetUnderlyingType(typeof(TValue)) != null;

            if (!valid)
            {
                valid = DateTime.TryParse(inputValue, out value);
            }

            if (valid && !DateAttributes(value).Disabled)
            {
                newValue = value;
            }
            else
            {
                newValue = null;

                if (nullable)
                {
                    await JSRuntime.InvokeAsync <string>("Radzen.setInputValue", input, "");
                }
                else
                {
                    await JSRuntime.InvokeAsync <string>("Radzen.setInputValue", input, FormattedValue);
                }
            }

            if (DateTimeValue != newValue && (newValue != null || nullable))
            {
                DateTimeValue = newValue;
                if ((typeof(TValue) == typeof(DateTimeOffset) || typeof(TValue) == typeof(DateTimeOffset?)) && Value != null)
                {
                    DateTimeOffset?offset = DateTime.SpecifyKind((DateTime)Value, DateTimeKind.Utc);
                    await ValueChanged.InvokeAsync((TValue)(object)offset);
                }
                else
                {
                    await ValueChanged.InvokeAsync((TValue)Value);
                }

                if (FieldIdentifier.FieldName != null)
                {
                    EditContext?.NotifyFieldChanged(FieldIdentifier);
                }

                await Change.InvokeAsync(DateTimeValue);

                StateHasChanged();
            }
        }
Ejemplo n.º 27
0
        protected void ChangeStatus(ChangeEventArgs uIMouseEvent)
        {
            if (IsDisabled)
            {
                return;
            }
            var oldValue = new CheckBoxValue()
            {
                Status = Status
            };
            var newValue = new CheckBoxValue();

            switch (Status)
            {
            case Status.UnChecked:
                newValue.Status = Status.Checked;
                break;

            case Status.Checked:
                newValue.Status = Status.UnChecked;
                break;

            case Status.Indeterminate:
                newValue.Status = Status.Checked;
                break;
            }
            if (newValue.Status == Status.Checked)
            {
                CheckBoxGroup?.SelectedItems?.Add(Value);
                Value = originValue;
            }
            else
            {
                CheckBoxGroup?.SelectedItems?.Remove(Value);
                Value = default;
            }
            Status = newValue.Status;

            //有 CheckBoxGroup 时,视整个CheckBoxGroup为一个字段
            if (CheckBoxGroup == null)
            {
                SetFieldValue(Value);
            }
            if (ValueChanged.HasDelegate)
            {
                _ = ValueChanged.InvokeAsync(Value);
            }
            if (StatusChanged.HasDelegate)
            {
                var args = new BChangeEventArgs <CheckBoxValue>();
                args.OldValue = oldValue;
                args.NewValue = newValue;
                _             = StatusChanged.InvokeAsync(newValue.Status);
            }
        }
Ejemplo n.º 28
0
 /// <summary>
 /// 点击控件时触发此方法
 /// </summary>
 protected virtual async Task OnClick()
 {
     if (!IsDisabled)
     {
         Value = !Value;
         if (ValueChanged.HasDelegate)
         {
             await ValueChanged.InvokeAsync(Value);
         }
     }
 }
        private async Task _onValueChangedHandler(ChangeEventArgs args)
        {
            //Value change in this case should be triggered only if the dropdown is not visible to prevent double posting (this method will be executed before _itemSelected)
            if (!_isDropdownHovered && _easySubmit && _activeItemIndex == -1)
            {
                await ValueChanged.InvokeAsync(args);

                _isDropdownVisible = false;
                await InvokeAsync(StateHasChanged);
            }
        }
Ejemplo n.º 30
0
        private async Task OnDayClick(MouseEventArgs e, CalendarDay day)
        {
            Value        = day.Date;
            _stringValue = Value.ToString(Format, CultureInfo.InvariantCulture);

            await ValueChanged.InvokeAsync(Value);

            await Changed.InvokeAsync(Value);

            _isOpen = false;
        }