From b86925ae30a40de98152d8c32a4b5f5488a6c5e6 Mon Sep 17 00:00:00 2001
From: sramaswami11
Date: Wed, 7 Apr 2021 11:24:56 -0400
Subject: [PATCH 1/6] MatSlider and MatNumeric components changed to rename
some paramters to Max,Min
---
src/MatBlazor.Demo/Demo/DemoMatSlider.razor | 38 +++++++++----------
.../Demo/DemoNumericUpDownField.razor | 24 ++++++------
.../Doc/DocMatNumericUpDownField.razor | 4 +-
src/MatBlazor.Demo/Doc/DocMatSlider.razor | 4 +-
.../BaseMatNumericUpDownFieldInternal.cs | 16 ++++----
.../Components/MatSlider/BaseMatSlider.cs | 12 +++---
.../Components/MatSlider/MatSlider.razor | 2 +-
7 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/src/MatBlazor.Demo/Demo/DemoMatSlider.razor b/src/MatBlazor.Demo/Demo/DemoMatSlider.razor
index f10d6233..2ff2e0e0 100644
--- a/src/MatBlazor.Demo/Demo/DemoMatSlider.razor
+++ b/src/MatBlazor.Demo/Demo/DemoMatSlider.razor
@@ -3,7 +3,7 @@
Continuous Slider: @Val
-
+
@code
{
@@ -50,7 +50,7 @@
Initializing the slider with custom ranges/values: @Val2
-
+
@code
{
@@ -71,7 +71,7 @@
+
@code
{
@@ -98,7 +98,7 @@
Pin will round to nearest 3 digit. Pin only works with Discrete.
-
+
@code
{
@@ -119,7 +119,7 @@
+
@code
{
@@ -145,7 +145,7 @@
Markers only work with Discrete
-
+
@code
{
@@ -166,7 +166,7 @@
+
@code
{
@@ -193,7 +193,7 @@
Changes to the slider will immediately reflect in changes to the value.
-
+
@code
{
@@ -214,7 +214,7 @@
+
@code
{
@@ -288,16 +288,16 @@
-
-
-
+
+
+
@code
{
public decimal Value { get; set; } = 50;
- public decimal ValueMin { get; set; } = 0;
- public decimal ValueMax { get; set; } = 100;
+ public decimal Min { get; set; } = 0;
+ public decimal Max { get; set; } = 100;
public void OnValueChanged2(decimal val)
{
@@ -310,16 +310,16 @@
-
-
-
+
+
+
@code
{
public decimal Value { get; set; } = 50;
- public decimal ValueMin { get; set; } = 0;
- public decimal ValueMax { get; set; } = 100;
+ public decimal Min { get; set; } = 0;
+ public decimal Max { get; set; } = 100;
public void OnValueChanged2(decimal val)
{
diff --git a/src/MatBlazor.Demo/Demo/DemoNumericUpDownField.razor b/src/MatBlazor.Demo/Demo/DemoNumericUpDownField.razor
index 444fd55c..e6d70590 100644
--- a/src/MatBlazor.Demo/Demo/DemoNumericUpDownField.razor
+++ b/src/MatBlazor.Demo/Demo/DemoNumericUpDownField.razor
@@ -18,7 +18,7 @@
+ Min=null Max=null>
@@ -35,7 +35,7 @@
@bind-Value=@testingNullableDecimal1
FieldType="MatNumericUpDownFieldType.Percent"
DecimalPlaces=0
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -44,7 +44,7 @@
@bind-Value=@testingNullableDecimal2
DecimalPlaces=0
Disabled=true
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -53,7 +53,7 @@
@bind-Value=@testingNullableDecimal3
DecimalPlaces=0
Icon="favorite"
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -62,7 +62,7 @@
@bind-Value=@testingNullableDecimal4
DecimalPlaces=0
Outlined="true"
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -79,7 +79,7 @@
DecimalPlaces=0
Outlined="true"
FullWidth="true"
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -122,7 +122,7 @@
+ Min=null Max=null>
@@ -139,7 +139,7 @@
@bind-Value=@testingNullableDecimal1
FieldType=""MatNumericUpDownFieldType.Percent""
DecimalPlaces=0
- Minimum=null Maximum=null>
+ Minimum=null Max=null>
@@ -148,7 +148,7 @@
@bind-Value=@testingNullableDecimal2
DecimalPlaces=0
Disabled=true
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -157,7 +157,7 @@
@bind-Value=@testingNullableDecimal3
DecimalPlaces=0
Icon=""favorite""
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -166,7 +166,7 @@
@bind-Value=@testingNullableDecimal4
DecimalPlaces=0
Outlined=""true""
- Minimum=null Maximum=null>
+ Min=null Max=null>
@@ -183,7 +183,7 @@
DecimalPlaces=0
Outlined=""true""
FullWidth=""true""
- Minimum=null Maximum=null>
+ Min=null Max=null>
diff --git a/src/MatBlazor.Demo/Doc/DocMatNumericUpDownField.razor b/src/MatBlazor.Demo/Doc/DocMatNumericUpDownField.razor
index c57918fe..01ef41e1 100644
--- a/src/MatBlazor.Demo/Doc/DocMatNumericUpDownField.razor
+++ b/src/MatBlazor.Demo/Doc/DocMatNumericUpDownField.razor
@@ -135,12 +135,12 @@
|
- Maximum |
+ Max |
TValue |
|
- Minimum |
+ Min |
TValue |
|
diff --git a/src/MatBlazor.Demo/Doc/DocMatSlider.razor b/src/MatBlazor.Demo/Doc/DocMatSlider.razor
index 55901e4b..4b6378c5 100644
--- a/src/MatBlazor.Demo/Doc/DocMatSlider.razor
+++ b/src/MatBlazor.Demo/Doc/DocMatSlider.razor
@@ -105,12 +105,12 @@
Gets or sets an expression that identifies the bound value. |
- ValueMax |
+ Max |
TValue |
|
- ValueMin |
+ Min |
TValue |
|
diff --git a/src/MatBlazor/Components/MatNumericUpDownField/BaseMatNumericUpDownFieldInternal.cs b/src/MatBlazor/Components/MatNumericUpDownField/BaseMatNumericUpDownFieldInternal.cs
index 1ef3fa4b..b514762e 100644
--- a/src/MatBlazor/Components/MatNumericUpDownField/BaseMatNumericUpDownFieldInternal.cs
+++ b/src/MatBlazor/Components/MatNumericUpDownField/BaseMatNumericUpDownFieldInternal.cs
@@ -18,12 +18,12 @@ protected override EventCallback OnKeyDownEvent()
protected void Increase()
{
- CurrentValue = SwitchT.Increase(CurrentValue, Step, Maximum);
+ CurrentValue = SwitchT.Increase(CurrentValue, Step, Max);
}
protected void Decrease()
{
- CurrentValue = SwitchT.Decrease(CurrentValue, Step, Minimum);
+ CurrentValue = SwitchT.Decrease(CurrentValue, Step, Min);
}
protected override TValue CurrentValue
@@ -37,10 +37,10 @@ protected override TValue CurrentValue
[Parameter]
- public TValue Maximum { get; set; }
+ public TValue Max { get; set; }
[Parameter]
- public TValue Minimum { get; set; }
+ public TValue Min { get; set; }
[Parameter]
public int DecimalPlaces { get; set; } = 0;
@@ -77,8 +77,8 @@ public BaseMatNumericUpDownFieldInternal()
Decrease();
}
});
- Maximum = SwitchT.GetMaximum();
- Minimum = SwitchT.GetMinimum();
+ Max = SwitchT.GetMaximum();
+ Min = SwitchT.GetMinimum();
ClassMapper.Add("mat-numeric-up-down-field");
ClassMapper.Add("mat-text-field-with-actions-container");
@@ -148,8 +148,8 @@ protected override bool TryParseValueFromString(string value, out TValue result,
if (result != null) // Snap to Min/Max
{
var comparer = Comparer.Default;
- if (Maximum != null && comparer.Compare(result, Maximum) > 0) result = Maximum;
- if (Minimum != null && comparer.Compare(result, Minimum) < 0) result = Minimum;
+ if (Max != null && comparer.Compare(result, Max) > 0) result = Max;
+ if (Min != null && comparer.Compare(result, Min) < 0) result = Min;
}
return success;
diff --git a/src/MatBlazor/Components/MatSlider/BaseMatSlider.cs b/src/MatBlazor/Components/MatSlider/BaseMatSlider.cs
index 9ece8463..23ef94c5 100644
--- a/src/MatBlazor/Components/MatSlider/BaseMatSlider.cs
+++ b/src/MatBlazor/Components/MatSlider/BaseMatSlider.cs
@@ -21,8 +21,8 @@ public BaseMatSlider()
{
jsHelper = new MatDotNetObjectReference(new MatSliderJsHelper());
jsHelper.Value.OnChangeEvent += Value_OnChangeEvent;
- ValueMin = SwitchT.GetMinimum();
- ValueMax = SwitchT.GetMaximum();
+ Min = SwitchT.GetMinimum();
+ Max = SwitchT.GetMaximum();
Step = SwitchT.GetStep();
ClassMapper
@@ -67,7 +67,7 @@ public override void Dispose()
[Parameter]
- public TValue ValueMin
+ public TValue Min
{
get => valueMin;
set
@@ -91,7 +91,7 @@ public TValue ValueMin
}
[Parameter]
- public TValue ValueMax
+ public TValue Max
{
get => valueMax;
set
@@ -168,8 +168,8 @@ public string MarkerStyle
{
try
{
- decimal.TryParse(ValueMin.ToString(), out var min);
- decimal.TryParse(ValueMax.ToString(), out var max);
+ decimal.TryParse(Min.ToString(), out var min);
+ decimal.TryParse(Max.ToString(), out var max);
if (!decimal.TryParse(Step.ToString(), out var step))
{
step = 1;
diff --git a/src/MatBlazor/Components/MatSlider/MatSlider.razor b/src/MatBlazor/Components/MatSlider/MatSlider.razor
index e47fafb5..58c366ad 100644
--- a/src/MatBlazor/Components/MatSlider/MatSlider.razor
+++ b/src/MatBlazor/Components/MatSlider/MatSlider.razor
@@ -4,7 +4,7 @@
From 41c70940dc5907fd796abc8cda06d07c412c1e45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Ad=C3=A1mek?=
Date: Tue, 18 May 2021 17:22:02 +0200
Subject: [PATCH 2/6] Do not automatically generate table search placeholder,
when custom one is provided.
---
src/MatBlazor/Components/MatTable/MatTable.razor | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor
index f3e07d73..e3ad9a75 100644
--- a/src/MatBlazor/Components/MatTable/MatTable.razor
+++ b/src/MatBlazor/Components/MatTable/MatTable.razor
@@ -141,7 +141,7 @@
var lastComma = tempPlaceholder.LastIndexOf(",");
- if (lastComma != -1)
+ if (lastComma != -1 && SearchTermFieldPlaceHolder == null)
{
SearchTermFieldPlaceHolder = tempPlaceholder.Remove(lastComma, 1).Insert(lastComma, " and");
}
From d3446775253b8539e38cf325dc8d1b95885740de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Ad=C3=A1mek?=
Date: Tue, 18 May 2021 17:24:27 +0200
Subject: [PATCH 3/6] Prevent throwing exception in MatTable when Items
colleciton is still not loaded (=null).
---
src/MatBlazor/Components/MatTable/MatTable.razor | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor
index e3ad9a75..d8d60ee1 100644
--- a/src/MatBlazor/Components/MatTable/MatTable.razor
+++ b/src/MatBlazor/Components/MatTable/MatTable.razor
@@ -341,13 +341,15 @@
ItemList = PageSize <= 0 ? filteredCollection : filteredCollection.Skip(RecordsFrom).Take(PageSize);
}
- else
+ else if (Items != null)
{
ItemList = PageSize <= 0 ? Items : Items.Skip(RecordsFrom).Take(PageSize);
RecordsTo = (RecordsFrom + PageSize < Items.Count()) ? RecordsFrom + PageSize : Items.Count();
TotalPages = Math.Max(1, (int)Math.Ceiling(Items.Count() / (decimal)PageSize));
EndPage = TotalPages;
}
+ else { } // Do nothing
+
SetPageSize(PageDirection.Next);
StateHasChanged();
}
From c406111594f137e8366809e84695225f598f1b5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Ad=C3=A1mek?=
Date: Mon, 26 Jul 2021 15:40:11 +0200
Subject: [PATCH 4/6] Make disabled button unclickable
---
src/MatBlazor/Components/MatButton/MatButton.razor.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/MatBlazor/Components/MatButton/MatButton.razor.cs b/src/MatBlazor/Components/MatButton/MatButton.razor.cs
index 9c99bb61..d8ae180b 100644
--- a/src/MatBlazor/Components/MatButton/MatButton.razor.cs
+++ b/src/MatBlazor/Components/MatButton/MatButton.razor.cs
@@ -142,6 +142,7 @@ public MatButton()
protected async Task OnClickHandler(MouseEventArgs ev)
{
+ if (Disabled) return;
if (Link != null)
{
if (!string.IsNullOrEmpty(Target))
From 78a8901e30e5168f093beaff8f5250aaca7ec890 Mon Sep 17 00:00:00 2001
From: AikelKocherbaeva <80120596+AikelKocherbaeva@users.noreply.github.com>
Date: Thu, 16 Sep 2021 23:02:12 +0600
Subject: [PATCH 5/6] Set to zero ItemList
---
src/MatBlazor/Components/MatTable/MatTable.razor | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor
index d8d60ee1..a5bbc06b 100644
--- a/src/MatBlazor/Components/MatTable/MatTable.razor
+++ b/src/MatBlazor/Components/MatTable/MatTable.razor
@@ -164,7 +164,7 @@
if (PageSize <= 0)
PageSize = 5;
}
-
+
StartPage = 1;
CurrentPage = StartPage;
@@ -283,14 +283,14 @@
var doc = JsonDocument.Parse(pagedData);
var root = doc.RootElement;
string itemsString = root.GetProperty(PagingDataPropertyName).GetRawText();
-
+
var opt = new JsonSerializerOptions()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
-
+
var items = JsonSerializer.Deserialize>(itemsString, opt);
-
+
Items = items;
int count = root.GetProperty(PagingRecordsCountPropertyName).GetInt32();
RecordsFrom = (CurrentPage - 1) * PageSize;
@@ -348,7 +348,10 @@
TotalPages = Math.Max(1, (int)Math.Ceiling(Items.Count() / (decimal)PageSize));
EndPage = TotalPages;
}
- else { } // Do nothing
+ else
+ {
+ ItemList = null;
+ } // Do nothing
SetPageSize(PageDirection.Next);
StateHasChanged();
From 53a8df966ddba9e432353a855e9c3a0d363468b9 Mon Sep 17 00:00:00 2001
From: SamProf
Date: Wed, 22 Sep 2021 18:32:32 +0200
Subject: [PATCH 6/6] remove not usefull comment
---
src/MatBlazor/Components/MatTable/MatTable.razor | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor
index a5bbc06b..a4203be4 100644
--- a/src/MatBlazor/Components/MatTable/MatTable.razor
+++ b/src/MatBlazor/Components/MatTable/MatTable.razor
@@ -351,7 +351,7 @@
else
{
ItemList = null;
- } // Do nothing
+ }
SetPageSize(PageDirection.Next);
StateHasChanged();