ant-design-blazor/components/date-picker/internal/DatePickerDecadePanel.razor
James Yeung 4d2c77fec7 refactor: dropdown and menu (#126)
* feat: add mock browser

* docs: add mock browser

* docs: rename menu

* fix: style for submenu

* docs: add two menu demo

* fix: some errors

* fix(module:menu): openkeys

* docs: add switch-mode demo for menu

* docs(module:menu): finish demos

* docs(module: menu): add router demo

* docs: add new demos (#111)

* feat(module: datepicker): remove ant prefix

* feat(module: dropdown): remove ant prefix

* feat(module: empty): remove ant prefix

* feat(module: timepicker): remove ant prefix

* docs(module: datepicker): add new demos

* docs(module: dropdown): add new demos

* docs(module: empty): add new demos

* docs(module: timepicker): add new demos

* docs: remove old demo

Co-authored-by: 钟迪龙 <mutouzdl@hotmail.com>

* refactor(module: dropdown): add overlay (#122)

* feat(module: dropdown): support left/right popup

* feat(module: submenu): use dropdown to popup

* feat: add overlay and trigger class(not complete yet)

* feat: add OverlayTrigger.cs

* feat: submenu support dropdown

* feat(module: overlay): prevent hide when child is showing

* fix(module: menu): prefixCls error

* feat(module: overlay-trigger): change function to virtual

* feat(module: dropdown): remove unuse class

* feat(module: sub-menu): set IsOpen to Visible

* refactor: change namespace

* refactor: use smartEnum

* fix: menu json

* fix: submenu open state

Co-authored-by: 笨木头 <musicvs@163.com>
Co-authored-by: 钟迪龙 <mutouzdl@hotmail.com>
2020-05-18 14:46:42 +08:00

39 lines
1.6 KiB
Plaintext

@namespace AntBlazor.Internal
@inherits DatePickerPanelBase
@using System.Globalization;
@{
var calendar = CultureInfo.InvariantCulture.Calendar;
int startYear = PickerValue.Year / 100 * 100 - 10;
DateTime startDate = new DateTime(startYear, 1, 1);
int yearIndex = 0;
const int MAX_ROW = 4;
const int MAX_COL = 3;
const int FIRST_YEAR_INDEX = 0;
const int LAST_YEAR_INDEX = MAX_ROW * MAX_COL;
}
<DatePickerTemplate PickerIndex="@PickerIndex"
MaxRow="MAX_ROW"
MaxCol="MAX_COL"
ViewStartDate="startDate"
IsInView="date => yearIndex != FIRST_YEAR_INDEX && yearIndex != LAST_YEAR_INDEX"
IsToday="date => DateHelper.IsSameYear(date, DatePicker.CurrentDate)"
IsSelected="date => DateHelper.IsSameYear(date, Value)"
OnValueSelect="date => OnSelectYear(date)"
GetNextColValue="date => date.AddYears(10)">
<RenderPickerHeader>
<DatePickerHeader SuperChangeDateInterval="100"
PickerIndex="@PickerIndex"
ShowPreChange="@false"
ShowNextChange="@false"
ShowSuperPreChange="@(!(DatePicker.IsRange && PickerIndex == 1))"
ShowSuperNextChange="@(!(DatePicker.IsRange && PickerIndex == 0))" />
</RenderPickerHeader>
<RenderColValue Context="currentColDate">
@{yearIndex++;}
@(currentColDate.Year)-@(currentColDate.Year + 9)
</RenderColValue>
</DatePickerTemplate>