Skip to content

Commit 1af80c1

Browse files
committed
refactor: 增加逻辑
1 parent 468c68a commit 1af80c1

File tree

3 files changed

+101
-16
lines changed

3 files changed

+101
-16
lines changed

src/BootstrapBlazor/Components/Button/DataTimePickerButton.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@namespace BootstrapBlazor.Components
2+
@typeparam TValue
3+
@inherits PopoverDropdownBase<TValue>
4+
@attribute [BootstrapModuleAutoLoader("DateTimePicker/DateTimePicker.razor.js", JSObjectReference = true)]
5+
6+
<div @attributes="@AdditionalAttributes" tabindex="@TabIndexString" id="@Id" class="@ClassString" data-bb-dropdown=".picker-panel">
7+
<button type="button" class="@ButtonClassString" disabled="@Disabled"
8+
data-bs-toggle="@Constants.DropdownToggleString" data-bs-placement="@PlacementString"
9+
data-bs-custom-class="@CustomClassString">@Text</button>
10+
<DatePickerBody @bind-Value="SelectedValue" @ref="_pickerBody" FirstDayOfWeek="FirstDayOfWeek"
11+
ShowClearButton="AllowNull" ShowSidebar="ShowSidebar" SidebarTemplate="SidebarTemplate"
12+
DateTimeFormat="@DateTimeFormat" DateFormat="@DateFormat" TimeFormat="@TimeFormat" ShowFooter="true"
13+
ShowLunar="ShowLunar" ShowSolarTerm="ShowSolarTerm" ShowFestivals="ShowFestivals" ShowHolidays="ShowHolidays"
14+
OnConfirm="OnConfirm" OnClear="OnClear" MinValue="MinValue" MaxValue="MaxValue"
15+
AutoClose="AutoClose" ViewMode="ViewMode" DayTemplate="DayTemplate!" DayDisabledTemplate="DayDisabledTemplate!"
16+
PickTimeMode="PickTimeMode" OnGetDisabledDaysCallback="OnGetDisabledDaysCallback!"
17+
EnableDisabledDaysCache="EnableDisabledDaysCache">
18+
@ChildContent
19+
</DatePickerBody>
20+
</div>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
5+
6+
using Microsoft.AspNetCore.Components.Web;
7+
8+
namespace BootstrapBlazor.Components;
9+
10+
/// <summary>
11+
/// DateTimePicker 按钮组件
12+
/// </summary>
13+
public partial class DateTimePickerButton
14+
{
15+
/// <summary>
16+
/// 获得/设置 OnClick 事件
17+
/// </summary>
18+
[Parameter]
19+
public EventCallback<MouseEventArgs> OnClick { get; set; }
20+
21+
/// <summary>
22+
/// 获得/设置 OnClick 事件不刷新父组件
23+
/// </summary>
24+
[Parameter]
25+
public Func<Task>? OnClickWithoutRender { get; set; }
26+
27+
/// <summary>
28+
/// 获得/设置 按钮颜色 默认 <see cref="Color.Primary"/>
29+
/// </summary>
30+
[Parameter]
31+
public virtual Color Color { get; set; } = Color.Primary;
32+
33+
/// <summary>
34+
/// 获得/设置 显示图标
35+
/// </summary>
36+
[Parameter]
37+
public string? Icon { get; set; }
38+
39+
/// <summary>
40+
/// 获得/设置 显示文字
41+
/// </summary>
42+
[Parameter]
43+
public string? Text { get; set; }
44+
45+
/// <summary>
46+
/// 获得/设置 Outline 样式 默认 false
47+
/// </summary>
48+
[Parameter]
49+
public bool IsOutline { get; set; }
50+
51+
/// <summary>
52+
/// 获得/设置 Size 大小
53+
/// </summary>
54+
[Parameter]
55+
public Size Size { get; set; }
56+
57+
/// <summary>
58+
/// 获得/设置 Block 模式
59+
/// </summary>
60+
[Parameter]
61+
public bool IsBlock { get; set; }
62+
63+
/// <summary>
64+
/// 获得/设置 是否禁用 默认为 false
65+
/// </summary>
66+
[Parameter]
67+
public bool IsDisabled { get; set; }
68+
69+
/// <summary>
70+
/// <inheritdoc />
71+
/// </summary>
72+
protected override void OnParametersSet()
73+
{
74+
base.OnParametersSet();
75+
76+
if (Tooltip != null && !string.IsNullOrEmpty(TooltipText))
77+
{
78+
Tooltip.SetParameters(TooltipText, TooltipPlacement, TooltipTrigger);
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)