using System; using System.Collections.Generic; using Microsoft.AspNetCore.Components; namespace AntDesign.Internal { public partial class DatePickerDatetimePanel : DatePickerPanelBase { [Parameter] public bool ShowToday { get; set; } = false; [Parameter] public string ShowTimeFormat { get; set; } [Parameter] public string Format { get; set; } [Parameter] public Func DisabledHours { get; set; } = null; [Parameter] public Func DisabledMinutes { get; set; } = null; [Parameter] public Func DisabledSeconds { get; set; } = null; [Parameter] public Func DisabledTime { get; set; } = null; [Parameter] public EventCallback OnOkClick { get; set; } private DatePickerDisabledTime GetDisabledTime() { List disabledHours = new List(); List disabledMinutes = new List(); List disabledSeconds = new List(); DatePickerDisabledTime userDisabledTime = null; if (Value is not null) { if (DisabledHours is not null) { disabledHours.AddRange(DisabledHours(Value.Value)); } if (DisabledMinutes is not null) { disabledMinutes.AddRange(DisabledMinutes(Value.Value)); } if (DisabledSeconds is not null) { disabledSeconds.AddRange(DisabledSeconds(Value.Value)); } userDisabledTime = DisabledTime?.Invoke(Value ?? DateTime.Now); } if (userDisabledTime != null) { if (userDisabledTime._disabledHours != null) { disabledHours.AddRange(userDisabledTime._disabledHours); } if (userDisabledTime._disabledMinutes != null) { disabledMinutes.AddRange(userDisabledTime._disabledMinutes); } if (userDisabledTime._disabledSeconds != null) { disabledSeconds.AddRange(userDisabledTime._disabledSeconds); } } return new DatePickerDisabledTime(disabledHours.ToArray(), disabledMinutes.ToArray(), disabledSeconds.ToArray()); } } }