Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/Base/Animation.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
namespace Syncfusion.Blazor.Toolkit.Internal
{
/// <summary>
/// Animation properties for performing animation transition.
/// Configures animation timing, duration, and easing for component transitions.
/// </summary>
internal class AnimationSettings
{
/// <summary>
/// Gets or sets the animation duration.
/// Gets or sets the duration of the animation in milliseconds.
/// </summary>
/// <value>
/// An integer representing milliseconds. The default is <c>400</c>.
/// </value>
public int Duration { get; set; } = 400;

/// <summary>
/// Gets or sets the animation name.
/// Gets or sets the name of the animation effect to apply.
/// </summary>
/// <value>
/// A string matching one of the supported effect names (for example, <c>"FadeIn"</c> or <c>"SlideLeft"</c>). The default is <c>"FadeIn"</c>.
/// </value>
public string Name { get; set; } = "FadeIn";

/// <summary>
/// Gets or sets the animation timing function.
/// Gets or sets the CSS timing function that controls the acceleration curve of the animation.
/// </summary>
/// <value>
/// A standard CSS easing keyword such as <c>"ease"</c>, <c>"linear"</c>, or <c>"ease-in-out"</c>. The default is <c>"ease"</c>.
/// </value>
public string TimingFunction { get; set; } = "ease";

/// <summary>
/// Gets or sets the animation delay.
/// Gets or sets the delay before the animation starts, in milliseconds.
/// </summary>
/// <value>
/// An integer representing milliseconds. The default is <c>0</c>.
/// </value>
public int Delay { get; set; }
}
}
52 changes: 37 additions & 15 deletions src/Base/Enumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ public enum GlobalAnimationMode


/// <summary>
/// Specifies text overflow options when the text overflowing the container.
/// Specifies text overflow options when text overflows its container.
/// </summary>
public enum LabelOverflow
{
/// <summary>
/// Specifies an ellipsis (...) to the clipped text.
/// Appends an ellipsis (...) to clipped text.
/// </summary>
Ellipse,

/// <summary>
/// Specifies the text is clipped and not accessible.
/// Clips the text without appending any indicator.
/// </summary>
Clip
}
Expand Down Expand Up @@ -2847,42 +2847,64 @@ public enum LegendShape


/// <summary>
/// Supported marker shapes used inside tooltips.
/// Specifies marker shapes supported inside tooltip visual elements.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum TooltipShape
{
// Circle marker.
/// <summary>
/// Renders a circular marker.
/// </summary>
[EnumMember(Value = "Circle")]
Circle,
// Rectangle marker.
/// <summary>
/// Renders a rectangular marker.
/// </summary>
[EnumMember(Value = "Rectangle")]
Rectangle,
// Triangle marker.
/// <summary>
/// Renders a triangular marker.
/// </summary>
[EnumMember(Value = "Triangle")]
Triangle,
// Diamond marker.
/// <summary>
/// Renders a diamond-shaped marker.
/// </summary>
[EnumMember(Value = "Diamond")]
Diamond,
// Cross marker.
/// <summary>
/// Renders a cross-shaped marker.
/// </summary>
[EnumMember(Value = "Cross")]
Cross,
// Horizontal line marker.
/// <summary>
/// Renders a horizontal line marker.
/// </summary>
[EnumMember(Value = "HorizontalLine")]
HorizontalLine,
// Vertical line marker.
/// <summary>
/// Renders a vertical line marker.
/// </summary>
[EnumMember(Value = "VerticalLine")]
VerticalLine,
// Pentagon marker.
/// <summary>
/// Renders a pentagonal marker.
/// </summary>
[EnumMember(Value = "Pentagon")]
Pentagon,
// Inverted triangle marker.
/// <summary>
/// Renders an inverted triangular marker.
/// </summary>
[EnumMember(Value = "InvertedTriangle")]
InvertedTriangle,
// Image marker.
/// <summary>
/// Renders an image-based marker.
/// </summary>
[EnumMember(Value = "Image")]
Image,
// No marker.
/// <summary>
/// Disables the marker.
/// </summary>
[EnumMember(Value = "None")]
None
}
Expand Down
50 changes: 30 additions & 20 deletions src/Base/Globalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
namespace Syncfusion.Blazor.Toolkit.Internal
{
/// <summary>
/// A static class for common internationalization features and functionalities
/// Provides culture-aware formatting utilities for dates, numbers, currency symbols,
/// and calendar operations used across Syncfusion Blazor Toolkit components.
/// </summary>
/// <exclude />
internal static class Intl
{
/// <summary>
Expand All @@ -14,6 +16,7 @@ internal static class Intl
/// </summary>
/// <returns>A dictionary mapping ISO currency codes (for example "USD") to the culture-specific currency symbol (for example "$").</returns>
/// <remarks>Neutral cultures are excluded and exceptions thrown while obtaining region info are propagated as <see cref="ArgumentException"/>.</remarks>
/// <exclude />
internal static Dictionary<string, string> GetCurrencyData()
{
CurrencyData ??= CultureInfo.GetCultures(CultureTypes.AllCultures)
Expand All @@ -24,32 +27,24 @@ internal static Dictionary<string, string> GetCurrencyData()
{
return new RegionInfo(culture.Name);
}
catch (CultureNotFoundException)
catch (Exception e)
{
// Skip cultures that do not map to a RegionInfo
return null;
}
catch (ArgumentException)
{
// Skip invalid cultures
return null;
}
catch
{
// Preserve unexpected exceptions and their stack traces
throw;
throw new ArgumentException(e.Message);
}
})
.Where(ri => ri != null)
.GroupBy(ri => ri!.ISOCurrencySymbol)
.ToDictionary(x => x.Key, x => x.First()!.CurrencySymbol);
.GroupBy(ri => ri.ISOCurrencySymbol)
.ToDictionary(x => x.Key, x => x.First().CurrencySymbol);
return CurrencyData;
}

/// <summary>
/// Gets or sets the cached currency data mapping ISO currency codes to display symbols.
/// Can be populated via <see cref="GetCurrencyData"/>.
/// Gets or sets the cached dictionary mapping ISO currency codes to culture-specific display symbols.
/// </summary>
/// <value>
/// A dictionary initialized by <see cref="GetCurrencyData"/> and reused for subsequent calls.
/// </value>
/// <exclude />
internal static Dictionary<string, string> CurrencyData { get; set; } = default!;

/// <summary>
Expand All @@ -59,6 +54,12 @@ internal static Dictionary<string, string> GetCurrencyData()
/// <param name="date">The value to format.</param>
/// <param name="format">A .NET format string. When not specified, the culture's default is used.</param>
/// <returns>A culture-aware formatted date string.</returns>
/// <remarks>
/// If the current culture uses a date separator other than <c>/</c>, the separator character
/// in <paramref name="format"/> is escaped so it is treated as a literal rather than a
/// format specifier. ASCII digits are also replaced with the culture's native digits when available.
/// </remarks>
/// <exception cref="InvalidOperationException">Thrown when the formatting operation fails.</exception>
internal static string GetDateFormat<T>(T date, string? format = null)
{
try
Expand Down Expand Up @@ -95,6 +96,11 @@ internal static string GetDateFormat<T>(T date, string? format = null)
/// <param name="format">A .NET numeric format string.</param>
/// <param name="currencyCode">Optional ISO currency code to use its symbol during formatting.</param>
/// <returns>A string with the formatted numeric value according to the resolved culture and format.</returns>
/// <remarks>
/// When <paramref name="currencyCode"/> is provided, the culture's <see cref="NumberFormatInfo.CurrencySymbol"/>
/// is temporarily replaced with the resolved symbol and restored after formatting to avoid side effects.
/// </remarks>
/// <exception cref="InvalidOperationException">Thrown when the formatting operation fails.</exception>
internal static string GetNumericFormat<T>(T numberValue, string? format = null, string? currencyCode = null)
{
try
Expand Down Expand Up @@ -139,6 +145,7 @@ internal static string GetNumericFormat<T>(T numberValue, string? format = null,
/// <param name="isLastDayOfWeek">If <c>true</c> treat the date as the last day of the week for calculation; otherwise use the culture's first day of week.</param>
/// <param name="weekRule">The <see cref="CalendarWeekRule"/> to apply when computing the week number.</param>
/// <returns>The computed week-of-year as an integer.</returns>
/// <exclude />
internal static int GetWeekOfYear(DateTime dateValue, bool isLastDayOfWeek = false, CalendarWeekRule weekRule = CalendarWeekRule.FirstDay)
{
CultureInfo currentCulture = GetCulture();
Expand All @@ -152,6 +159,7 @@ internal static int GetWeekOfYear(DateTime dateValue, bool isLastDayOfWeek = fal
/// Returns an ordered list of narrow day names (single-character abbreviations) for the specified culture.
/// </summary>
/// <returns>A list of single-character strings representing narrow day names in culture order.</returns>
/// <exclude />
internal static List<string> GetNarrowDayNames()
{
List<string> narrowDays = [];
Expand All @@ -169,6 +177,7 @@ internal static List<string> GetNarrowDayNames()
/// If <see cref="CultureInfo.CurrentCulture"/> is <c>null</c> for any reason, a fallback
/// <see cref="CultureInfo"/> for <c>en-US</c> is returned.
/// </summary>
/// <exclude />
/// <returns>The resolved <see cref="CultureInfo"/> (the current culture or the <c>en-US</c> fallback).</returns>
internal static CultureInfo GetCulture()
{
Expand All @@ -179,8 +188,9 @@ internal static CultureInfo GetCulture()
/// Replaces ASCII digit characters in the provided formatted string with culture-specific native digits.
/// </summary>
/// <param name="formatValue">A formatted numeric or date string containing ASCII digits 0-9.</param>
/// <param name="nativeDigits">An array of 10 strings representing the culture's native digits for 0-9.</param>
/// <returns>The input string with ASCII digits replaced by the corresponding native digits.</returns>
/// <param name="nativeDigits">An array of 10 strings representing the culture's native digits for 0-9. If the array does not contain exactly 10 elements, the original string is returned unchanged.</param>
/// <returns>The input string with ASCII digits replaced by the corresponding native digits, or the original string if replacement is not possible.</returns>
/// <exclude />
internal static string GetNativeDigits(string formatValue, string[] nativeDigits)
{
if (string.IsNullOrEmpty(formatValue) || nativeDigits == null || nativeDigits.Length != 10)
Expand Down
26 changes: 26 additions & 0 deletions src/Base/HijriParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ namespace Syncfusion.Blazor.Toolkit.Internal
/// <summary>
/// Represents a Hijri date.
/// </summary>
/// <exclude />
internal class HijriDate
{
/// <summary>
/// Gets or sets the year of the Hijri date.
/// </summary>
/// <exclude />
[JsonPropertyName("year")]
internal int Year { get; set; }

/// <summary>
/// Gets or sets the month of the Hijri date.
/// </summary>
/// <exclude />
[JsonPropertyName("month")]
internal int Month { get; set; }

/// <summary>
/// Gets or sets the day of the Hijri date.
/// </summary>
/// <exclude />
[JsonPropertyName("date")]
internal int Date { get; set; }
}
Expand All @@ -30,35 +34,56 @@ internal class HijriDate
/// Provides utility methods for converting between Hijri (Islamic) and Gregorian calendar dates.
/// Uses astronomical algorithms and correction tables for accurate date conversions.
/// </summary>
/// <exclude />
internal static class HijriParser
{
/// <summary>
/// Constants for Julian date calculations used when converting between Gregorian and Julian day counts.
/// </summary>
/// <exclude />
private const double JULIAN_EPOCH_OFFSET = 1867216.25;
/// <exclude />
private const double JULIAN_CENTURY_DAYS = 36524.25;
/// <exclude />
private const double GREGORIAN_YEAR_DAYS = 365.25;
/// <exclude />
private const double MONTH_APPROXIMATION = 30.6001;
/// <exclude />
private const int JULIAN_CALENDAR_ADJUSTMENT = 1524;
/// <exclude />
private const int GREGORIAN_CALENDAR_BASE = 122;
/// <exclude />
private const int YEAR_BASE_OFFSET = 4716;
/// <exclude />
private const int MODIFIED_JULIAN_DATE_OFFSET = 2400000;

/// <summary>
/// Constants used for Hijri (Islamic) calendar calculations, including
/// cycle lengths, epoch offsets and approximations used by the algorithms.
/// </summary>
/// <exclude />
private const double HIJRI_CYCLE_DAYS = 10631.0;
/// <exclude />
private const int HIJRI_CYCLE_YEARS = 30;
/// <exclude />
private const int HIJRI_EPOCH_OFFSET = 1948084;
/// <exclude />
private const double HIJRI_MONTH_APPROXIMATION = 29.5;
/// <exclude />
private const double HIJRI_CALCULATION_OFFSET = 0.1335;
/// <exclude />
private const double HIJRI_MONTH_OFFSET = 28.5001;
/// <exclude />
private const double HIJRI_DAY_OFFSET = 29.5001;
/// <exclude />
private const int HIJRI_LUNAR_NUMBER_OFFSET = 16260;
/// <exclude />
private const int MONTHS_PER_YEAR = 12;
/// <exclude />
private const int MAX_MONTH_VALUE = 13;
/// <exclude />
private const int MARCH_MONTH = 3;
/// <exclude />
private const int MAX_DAY_DIGITS = 2;

/// <summary>
Expand Down Expand Up @@ -201,6 +226,7 @@ internal static HijriDate ToHijriDate(DateTime gregorianDate)
/// </summary>
/// <param name="hijriDate">The Hijri date to convert.</param>
/// <returns>A <see cref="DateTime"/> representing the Gregorian calendar date.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="hijriDate"/> is <see langword="null"/>.</exception>
internal static DateTime ToGregorian(HijriDate hijriDate)
{
ArgumentNullException.ThrowIfNull(hijriDate);
Expand Down
Loading