private void DateOnMouseLeave() { if (IsRange) { DatePicker.HoverDateTime = null; } string placeholder; if (IsRange) { var(startPlaceholder, endPlaceholder) = DatePickerPlaceholder.GetRangePlaceHolderByType(Picker, Locale); if (DatePicker.GetOnFocusPickerIndex() == 0) { placeholder = startPlaceholder; } else { placeholder = endPlaceholder; } } else { placeholder = DatePickerPlaceholder.GetPlaceholderByType(Picker, Locale); } int focusIndex = DatePicker.GetOnFocusPickerIndex(); DatePicker.ChangePlaceholder(placeholder, focusIndex); }
private bool IsShowDatePanel() { if (DatePicker.IsShowTime && PickerIndex != DatePicker.GetOnFocusPickerIndex()) { return(false); } return(DatePicker.Picker == AntDatePickerType.Date); }
private void DateOnMouseEnter(DateTime hoverDateTime) { if (IsRange) { DatePicker.HoverDateTime = hoverDateTime; DatePicker.InvokeStateHasChanged(); } int focusIndex = DatePicker.GetOnFocusPickerIndex(); string placeholder = DatePicker.GetFormatValue(hoverDateTime, focusIndex); DatePicker.ChangePlaceholder(placeholder, focusIndex); }
private string GetRangeHoverCls(DateTime currentColDate) { if (!IsRange || DatePicker.HoverDateTime == null || Picker.IsIn(DatePickerType.Date, DatePickerType.Year, DatePickerType.Month, DatePickerType.Quarter) == false) { return(""); } var startValue = FormatDateByPicker(GetIndexValue(0)); var endValue = FormatDateByPicker(GetIndexValue(1)); DateTime hoverDateTime = FormatDateByPicker((DateTime)DatePicker.HoverDateTime); if ((startValue != null && ((DateTime)startValue).Date == hoverDateTime.Date) || (endValue != null && ((DateTime)endValue).Date == hoverDateTime.Date)) { return(""); } DateTime currentDate = FormatDateByPicker(currentColDate); DateTime preDate = GetPreDate(currentDate); DateTime nextDate = GetNextDate(currentDate); int onfocusPickerIndex = DatePicker.GetOnFocusPickerIndex(); StringBuilder cls = new StringBuilder(); if (onfocusPickerIndex == 1 && startValue != null) { if (startValue != endValue && currentDate == startValue) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } else if (currentDate < hoverDateTime) { cls.Append($"{PrefixCls}-cell-range-hover"); // when pre day is not inview, then current day is the start. if (IsInView(preDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } // when next day is not inview, then current day is the end. else if (IsInView(nextDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (currentDate == hoverDateTime) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (onfocusPickerIndex == 0 && endValue != null) { if (startValue != endValue && currentDate == endValue) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } else if (currentDate > hoverDateTime) { cls.Append($"{PrefixCls}-cell-range-hover"); // when pre day is not inview, then current day is the start. if (IsInView(preDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } // when next day is not inview, then current day is the end. else if (IsInView(nextDate) == false) { cls.Append($" {PrefixCls}-cell-range-hover-end"); } } else if (currentDate == hoverDateTime) { cls.Append($" {PrefixCls}-cell-range-hover-start"); } } return(cls.ToString()); }