Skip to content

Commit

Permalink
[2.0] Unify input components APIs (#5732)
Browse files Browse the repository at this point in the history
* Introduce Value API to input components

* Use CurrentValue for Bulma TextEdit

* Mark Obsolete parameters

* Check Value when initializing validation

* Invoke ValueChanged for Select and DatePicker

* Invoke ValueChanged for Radio and Check

* Refactor Select component

* Remove Text from TextEdit and MemoEdit

* Remove Date and Time from DateEdit and TimeEdit

* Remove Color from ColorEdit

* Remove CheckedValue from RadioGroup

* Fix Forms page demo

* Remove Checked from Check and Switch

* Remove Color from ColorPicker

* Remove Time from TimePicker

* Remove Date and Dates from DatePicker

* Check for array types on Select

* Move ISelect to separate file

* Migration notes

* Move GetFormatedValueExpression to base class

* Move OnInternalValueChanged implementation to base class

* Refactor input components initialization (#5742)

* Centralize initialization lifecycle

* Leave new Before/After methods on input base component

* Fix the method calls

* Adjust DatePicker, NumericEdit, and Select

* Use custom compare function

* Comments

* Fix examples
  • Loading branch information
stsrki authored Nov 27, 2024
1 parent 52a7f0d commit bc4b191
Show file tree
Hide file tree
Showing 324 changed files with 1,936 additions and 2,167 deletions.
2 changes: 1 addition & 1 deletion Demos/Apps/TodoApp/TodoItem.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ListGroupItem>
<Field Horizontal Padding="Padding.IsAuto.OnAll">
<FieldBody ColumnSize="ColumnSize.Is1">
<Check TValue="bool" Checked="@Todo.Completed" CheckedChanged="@OnCheckedChanged"></Check>
<Check TValue="bool" Value="@Todo.Completed" ValueChanged="@OnCheckedChanged"></Check>
</FieldBody>
<FieldBody ColumnSize="ColumnSize.Is11">
@Todo.Description
Expand Down
4 changes: 2 additions & 2 deletions Demos/Apps/TodoApp/TodoItems.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Fields>
<Column ColumnSize="ColumnSize.Is1">
<Field>
<Check TValue="bool" Checked="@Todos.All(x=>x.Completed)" CheckedChanged="@OnCheckAll">All</Check>
<Check TValue="bool" Value="@Todos.All(x=>x.Completed)" ValueChanged="@OnCheckAll">All</Check>
</Field>
</Column>
<Column ColumnSize="ColumnSize.Is11">
Expand All @@ -19,7 +19,7 @@
<Addon AddonType="AddonType.Body">
<Validations @ref="validations" Mode="ValidationMode.Manual">
<Validation Validator="@ValidationRule.IsNotEmpty">
<TextEdit @bind-Text="@description" Placeholder="What needs to be done?"></TextEdit>
<TextEdit @bind-Value="@description" Placeholder="What needs to be done?"></TextEdit>
</Validation>
</Validations>
</Addon>
Expand Down
4 changes: 2 additions & 2 deletions Demos/Blazorise.Demo/Components/FormularyModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<Field Horizontal>
<FieldLabel ColumnSize="ColumnSize.IsFull.OnTablet.Is3.OnDesktop">First Name</FieldLabel>
<FieldBody ColumnSize="ColumnSize.IsFull.OnTablet.Is9.OnDesktop">
<TextEdit @bind-Text="model.FirstName"></TextEdit>
<TextEdit @bind-Value="model.FirstName"></TextEdit>
</FieldBody>
</Field>

<Field Horizontal>
<FieldLabel ColumnSize="ColumnSize.IsFull.OnTablet.Is3.OnDesktop">Email</FieldLabel>
<FieldBody ColumnSize="ColumnSize.IsFull.OnTablet.Is9.OnDesktop">
<TextEdit @bind-Text="model.Email"></TextEdit>
<TextEdit @bind-Value="model.Email"></TextEdit>
</FieldBody>
</Field>

Expand Down
6 changes: 3 additions & 3 deletions Demos/Blazorise.Demo/Components/TopMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@
<Row>
<Column Margin="Margin.Is2.FromBottom">
<Field>
<Switch TValue="bool" Checked="@(Theme?.Enabled == true)" CheckedChanged="@ThemeEnabledChanged">Theme enabled</Switch>
<Switch TValue="bool" Value="@(Theme?.Enabled == true)" ValueChanged="@ThemeEnabledChanged">Theme enabled</Switch>
</Field>
</Column>
</Row>
<Row>
<Column Margin="Margin.Is2.FromBottom">
<Field>
<Check TValue="bool" Checked="@(Theme?.IsGradient == true)" CheckedChanged="@ThemeGradientChanged">Gradient colors</Check>
<Check TValue="bool" Value="@(Theme?.IsGradient == true)" ValueChanged="@ThemeGradientChanged">Gradient colors</Check>
</Field>
<Field>
<Check TValue="bool" Checked="@(Theme?.IsRounded == true)" CheckedChanged="@ThemeRoundedChanged">Rounded elements</Check>
<Check TValue="bool" Value="@(Theme?.IsRounded == true)" ValueChanged="@ThemeRoundedChanged">Rounded elements</Check>
</Field>
</Column>
</Row>
Expand Down
12 changes: 6 additions & 6 deletions Demos/Blazorise.Demo/Pages/Tests/AutocompletesPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@autocompleteFreeTyping">FreeTyping</Check>
<Check @bind-Value="@autocompleteFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>
<Field Horizontal JustifyContent="JustifyContent.End">
Expand Down Expand Up @@ -57,7 +57,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@multipleAutocompleteFreeTyping">FreeTyping</Check>
<Check @bind-Value="@multipleAutocompleteFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>
<Field Horizontal JustifyContent="JustifyContent.End">
Expand Down Expand Up @@ -100,7 +100,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@autocompleteReadDataFreeTyping">FreeTyping</Check>
<Check @bind-Value="@autocompleteReadDataFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>

Expand Down Expand Up @@ -147,7 +147,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@multipleAutocompleteReadDataFreeTyping">FreeTyping</Check>
<Check @bind-Value="@multipleAutocompleteReadDataFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>

Expand Down Expand Up @@ -199,7 +199,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@autocompleteVirtualizeFreeTyping">FreeTyping</Check>
<Check @bind-Value="@autocompleteVirtualizeFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>
<Field Horizontal JustifyContent="JustifyContent.End">
Expand Down Expand Up @@ -247,7 +247,7 @@
<CardBody>
<Field>
<FieldBody>
<Check @bind-Checked="@autocompleteVirtualizeReadDataFreeTyping">FreeTyping</Check>
<Check @bind-Value="@autocompleteVirtualizeReadDataFreeTyping">FreeTyping</Check>
</FieldBody>
</Field>

Expand Down
4 changes: 2 additions & 2 deletions Demos/Blazorise.Demo/Pages/Tests/CarouselPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<CardBody>
<Fields>
<Field ColumnSize="ColumnSize.Is3">
<Switch TValue="bool" @bind-Checked="@showIndicators">Indicators</Switch>
<Switch TValue="bool" @bind-Value="@showIndicators">Indicators</Switch>
</Field>
<Field ColumnSize="ColumnSize.Is3">
<Switch TValue="bool" @bind-Checked="@showControls">Controls</Switch>
<Switch TValue="bool" @bind-Value="@showControls">Controls</Switch>
</Field>
</Fields>
</CardBody>
Expand Down
4 changes: 2 additions & 2 deletions Demos/Blazorise.Demo/Pages/Tests/CropperPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Aspect Ratio
</FieldLabel>
<FieldBody>
<Select @bind-SelectedValue="@ratio">
<Select @bind-Value="@ratio">
<SelectItem Value="@CropperAspectRatio.Is16x9.Value">16:9</SelectItem>
<SelectItem Value="@CropperAspectRatio.Is4x3.Value">4:3</SelectItem>
<SelectItem Value="@CropperAspectRatio.Is1x1.Value">1:1</SelectItem>
Expand All @@ -48,7 +48,7 @@
</Field>
<Field>
<FieldBody>
<Check @bind-Checked="@enabled">Enabled</Check>
<Check @bind-Value="@enabled">Enabled</Check>
</FieldBody>
</Field>
<Field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</DataGridColumn>
<DataGridCheckColumn TItem="Employee" Field="@nameof(Employee.IsActive)" Caption="Active" Editable Filterable="false">
<DisplayTemplate>
<Check TValue="bool" Checked="context.IsActive" Disabled ReadOnly />
<Check TValue="bool" Value="context.IsActive" Disabled ReadOnly />
</DisplayTemplate>
</DataGridCheckColumn>
</DataGridColumns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</DataGridColumn>
<DataGridCheckColumn TItem="Employee" Field="@nameof(Employee.IsActive)" Caption="Active" Editable Filterable="false">
<DisplayTemplate>
<Check TValue="bool" Checked="context.IsActive" Disabled ReadOnly />
<Check TValue="bool" Value="context.IsActive" Disabled ReadOnly />
</DisplayTemplate>
</DataGridCheckColumn>
</DataGridColumns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</DataGridColumn>
<DataGridCheckColumn TItem="Employee" Field="@nameof(Employee.IsActive)" Caption="Active" Editable Filterable="false">
<DisplayTemplate>
<Check TValue="bool" Checked="context.IsActive" Disabled ReadOnly />
<Check TValue="bool" Value="context.IsActive" Disabled ReadOnly />
</DisplayTemplate>
</DataGridCheckColumn>
</DataGridColumns>
Expand Down
Loading

0 comments on commit bc4b191

Please sign in to comment.