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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This repository is the **source of the `IgniteUI.Blazor.GridLite` package**: a R
- PascalCase for public members; camelCase for private fields; `var` when the type is obvious; no `dynamic`
- `[Parameter]` for component inputs; `EventCallback<T>` for events
- Every public type and member has XML docs; overrides use `<inheritdoc/>`. The library builds its docs file and every warning is an error, so a missing doc fails the build (CS1591)
- Library-owned payloads serialize through the source-generated `GridLiteJsonContext`; app-owned values (`Data`, filter `Condition`/`SearchTerm`) go through `AppValueSerializer`, the only reflection-based serialization in `src/`
- Library-owned payloads serialize through the source-generated `GridLiteJsonContext`; app-owned values (`Data`, filter `SearchTerm`) go through `AppValueSerializer`, the only reflection-based serialization in `src/`
- Trim/AOT diagnostics (IL2xxx/IL3xxx) are build errors; suppress only on the smallest member, with `[UnconditionalSuppressMessage]` and a justification that says why the pattern is safe - never `#pragma` for ILxxxx, except IL3050 on dynamic code Native AOT is not claimed for (see docs/TRIMMING.md)

### JavaScript
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
_content/IgniteUI.Blazor.GridLite/themes/
```
matching the layout the `IgniteUI.Blazor` and `IgniteUI.Blazor.Lite` packages use. The old paths still work, through a stylesheet that imports the theme from its new location, and will be removed in a future release.
- **BREAKING**: `IgbGridLiteFilterExpression.Condition` is a `string`, the name of a grid-lite filter condition, instead of `object`. Its documentation and the README list the names for each column data type. In the `Filtering` and `Filtered` events it holds the condition's name; before, it held grid-lite's condition object as a `JsonElement`.
- **BREAKING**: In the `Filtering` and `Filtered` events, `IgbGridLiteFilterExpression.SearchTerm` holds a `string`, `double` or `bool` instead of a `JsonElement`. Numbers are always `double`, as JavaScript has one number type, so a search term set as an `int` comes back as a `double`.
- **BREAKING**: `IgbGridLiteFilterExpression.Criteria` is a `GridLiteFilterCriteria?` (`And`, `Or`) instead of a `string?`, and `IgbGridLiteFilteringEventArgs.Type` is a `GridLiteFilteringType` (`Add`, `Modify`, `Remove`) instead of a `string`.
- **BREAKING**: `IgbGridLiteFilteringEventArgs.Expressions` and `IgbGridLiteFilteredEventArgs.State` are `IReadOnlyList<IgbGridLiteFilterExpression>` instead of `List<IgbGridLiteFilterExpression>`.

## 0.10.0 - 2026-09-29

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ Configure pre-applied sorting and filtering when the grid first renders:
}
```

`Condition` is a grid-lite condition name. The names a column accepts depend on its `DataType`; a column without one counts as `String`:

| `DataType` | Condition names |
| :--------- | :---------------------------------------------------------------------------------------------------------------- |
| `String` | `contains`, `doesNotContain`, `startsWith`, `endsWith`, `equals`, `doesNotEqual`, `empty`, `notEmpty` |
| `Number` | `equals`, `doesNotEqual`, `greaterThan`, `lessThan`, `greaterThanOrEqual`, `lessThanOrEqual`, `empty`, `notEmpty` |
| `Boolean` | `all`, `true`, `false`, `empty`, `notEmpty` |

The `Boolean` conditions, `empty` and `notEmpty` take no `SearchTerm`.

### Sorting

Enable sorting on individual columns and optionally make sorting case-sensitive:
Expand Down
6 changes: 3 additions & 3 deletions docs/TRIMMING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Trimming support

`IgniteUI.Blazor.GridLite` is trim-compatible (`IsTrimmable=true`): the library builds warning-free under the .NET trim analyzer, and its own interop payloads serialize through source-generated `System.Text.Json` metadata. The only values it serializes with reflection are your app's own: the grid's `Data` items and the filter expressions' `Condition`/`SearchTerm`.
`IgniteUI.Blazor.GridLite` is trim-compatible (`IsTrimmable=true`): the library builds warning-free under the .NET trim analyzer, and its own interop payloads serialize through source-generated `System.Text.Json` metadata. The only values it serializes with reflection are your app's own: the grid's `Data` items and the filter expressions' `SearchTerm`.

## Are your types trimmed at all?

Expand Down Expand Up @@ -28,7 +28,7 @@ public partial class ProductGrid<[DynamicallyAccessedMembers(DynamicallyAccessed

- **Complex types reachable from the item type.** If `Product` has a `Supplier` property whose members a column shows (`Field="Supplier.Name"`), `Supplier` needs its public properties preserved as well, and so does every complex type below it. The annotation on `TItem` covers the item type itself, not the types of its properties.
- **Members outside the public properties.** A public field opted into serialization with `[JsonInclude]`, or a non-public `[JsonInclude]` member, is not covered by the annotation.
- **App-defined filter values.** A `Condition` or `SearchTerm` of a built-in type (string, number, date, `Guid`, enum) needs nothing. A value of an app-defined type needs its public properties preserved.
- **App-defined filter search terms.** A `SearchTerm` of a built-in type (string, number, date, `Guid`, enum) needs nothing. A value of an app-defined type needs its public properties preserved.

Preserve such types with a `DynamicDependency` attribute on any method that is kept, such as your root component or `Program.Main`:

Expand All @@ -47,7 +47,7 @@ or with a [trimmer root descriptor](https://learn.microsoft.com/dotnet/core/depl

## Native AOT

Not claimed. The library builds warning-free under the [AOT analyzer](https://learn.microsoft.com/dotnet/core/deploying/native-aot/) (`EnableAotAnalyzer`, errors via `.editorconfig`), but the `Data` items and the filter values are serialized with reflection, which Native AOT does not guarantee, and Blazor itself is not AOT-compatible yet (`Microsoft.AspNetCore.Components` ships `IsTrimmable` only; [dotnet/aspnetcore#51598](https://github.com/dotnet/aspnetcore/issues/51598) tracks it). What this means per deployment model:
Not claimed. The library builds warning-free under the [AOT analyzer](https://learn.microsoft.com/dotnet/core/deploying/native-aot/) (`EnableAotAnalyzer`, errors via `.editorconfig`), but the `Data` items and the filter search terms are serialized with reflection, which Native AOT does not guarantee, and Blazor itself is not AOT-compatible yet (`Microsoft.AspNetCore.Components` ships `IsTrimmable` only; [dotnet/aspnetcore#51598](https://github.com/dotnet/aspnetcore/issues/51598) tracks it). What this means per deployment model:

- **Blazor WebAssembly**: unaffected. Both the default interpreter and `RunAOTCompilation=true` publishes run on Mono with the interpreter retained, so no Native AOT semantics apply. The manual `Wasm AOT Smoke` workflow runs the trimmed-publish browser checks against a `RunAOTCompilation` publish.
- **Blazor Server**: unaffected; it runs on CoreCLR.
Expand Down
2 changes: 1 addition & 1 deletion docs/security/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The consuming application must first apply Microsoft's guidance for its hosting
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| A client forges a call targeting another user's components | Impossible under Interactive Server. The interop callback object is handed to the browser as a reference scoped to one circuit, because the framework binds a `DotNetObjectReference` to the circuit that issued it; there is one per grid and no shared registry on the .NET side to address. On WebAssembly and Hybrid there is one user per runtime and nothing to forge across. |
| A client raises an event the application did not subscribe to | Dropped. An event is dispatched only if the application bound the matching `EventCallback`; the interop module attaches a listener only for events that have one, and each callback returns before parsing when none is bound. |
| A client-supplied payload activates an arbitrary .NET type or executes code | Not possible. Payloads are parsed with source-generated `System.Text.Json` into types the library itself defines, with the object-typed filter members (`Condition`, `SearchTerm`) kept as `JsonElement`; there is no polymorphic deserialization and no arbitrary type activation. |
| A client-supplied payload activates an arbitrary .NET type or executes code | Not possible. Payloads are parsed with source-generated `System.Text.Json` into types the library itself defines, with the object-typed filter `SearchTerm` read as a `string`, `double` or `bool`, or else kept as `JsonElement`; there is no polymorphic deserialization and no arbitrary type activation. |
| A client answers the column query with arbitrary content | Bounded to the column configuration type. The result is parsed through the same source-generated context, and anything that is not an array yields an empty result. |
| Resource exhaustion through interop floods or oversized payloads | Bounded per payload and per connection, not per rate. `MaximumReceiveMessageSize` bounds each payload and `CircuitOptions` bounds retained circuits and unacknowledged render batches. The framework dispatches inbound invocations one at a time per connection, so one client's calls queue rather than interleave; each callback awaits the application's handler, whose work draws on shared server CPU and memory, and the library keeps no per-call state on the .NET side. Neither the framework nor the library caps the call rate; see [§5](#5-guidance-for-application-developers). |

Expand Down
24 changes: 16 additions & 8 deletions src/IgniteUI.Blazor.GridLite/Internal/AppValueSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
namespace IgniteUI.Blazor.Controls.Internal;

/// <summary>
/// Reflection-based metadata for the values whose types belong to the app: the <c>Data</c> items and the
/// object-typed filter values, which are compared against them. Everything else goes through
/// Reflection-based metadata for the values whose types belong to the app: the <c>Data</c> items and the filter
/// expressions' <c>SearchTerm</c>, which is compared against them. Everything else goes through
/// <see cref="GridLiteJsonContext"/>.
/// </summary>
internal static class AppValueSerializer
Expand All @@ -21,9 +21,9 @@ public static JsonTypeInfo<IEnumerable<TItem>> GetDataTypeInfo<TItem>()

[UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
Justification = "The grid's DynamicallyAccessedMembers(PublicProperties) annotation on TItem keeps the "
+ "item type's public properties in trimmed apps, and filter values of built-in types need no "
+ "item type's public properties in trimmed apps, and filter search terms of built-in types need no "
+ "preserved members. Any other type reached here (a complex type nested in TItem, an app-defined "
+ "filter value) belongs to the consuming app, and the trimming docs make preserving it the app's "
+ "filter search term) belongs to the consuming app, and the trimming docs make preserving it the app's "
+ "responsibility.")]
private static JsonSerializerOptions CreateOptions()
{
Expand All @@ -41,14 +41,22 @@ private static JsonSerializerOptions CreateOptions()
}

/// <summary>
/// Writes an <see cref="object"/>-typed payload member (the filter <c>Condition</c> and <c>SearchTerm</c>) by
/// its runtime type, the way the <c>Data</c> items are written, and reads it back as a
/// <see cref="JsonElement"/>.
/// Writes the filter expressions' <c>SearchTerm</c>, the only <see cref="object"/>-typed payload member, by
/// its runtime type, the way the <c>Data</c> items are written, and reads it back as the primitive it is.
/// </summary>
internal sealed class FilterValueConverter : JsonConverter<object>
{
// JSON has one number type OOB, so every number reads as a double. An array or object can only be a value
// the app set itself; it stays a JsonElement.
public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
=> JsonElement.ParseValue(ref reader);
=> reader.TokenType switch
{
JsonTokenType.String => reader.GetString()!,
JsonTokenType.Number => reader.GetDouble(),
JsonTokenType.True => true,
JsonTokenType.False => false,
_ => JsonElement.ParseValue(ref reader),
};

public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options)
=> JsonSerializer.Serialize(writer, value, AppValueSerializer.GetValueTypeInfo(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace IgniteUI.Blazor.Controls.Internal;
/// <summary>
/// Source-generated serializer metadata for every payload the library owns. The app-owned values inside
/// them go through <see cref="AppValueSerializer"/>: <c>Data</c> through <see cref="GridLiteDataPayload"/>,
/// the object-typed filter values through <see cref="FilterValueConverter"/>.
/// the filter expressions' <c>SearchTerm</c> through <see cref="FilterValueConverter"/>.
/// </summary>
[JsonSourceGenerationOptions(
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public class IgbGridLiteFilteredEventArgs
/// The filter state of the column after the operation.
/// </summary>
[JsonPropertyName("state")]
public required List<IgbGridLiteFilterExpression> State { get; init; }
public required IReadOnlyList<IgbGridLiteFilterExpression> State { get; init; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using IgniteUI.Blazor.Controls.Internal;

namespace IgniteUI.Blazor.Controls;

Expand All @@ -17,14 +18,27 @@ public class IgbGridLiteFilteringEventArgs
/// The filter expression(s) to apply.
/// </summary>
[JsonPropertyName("expressions")]
public required List<IgbGridLiteFilterExpression> Expressions { get; init; }
public required IReadOnlyList<IgbGridLiteFilterExpression> Expressions { get; init; }

/// <summary>
/// The type of modification which will be applied to the filter state of the column.
/// 'add' - a new filter expression will be added to the state of the column.
/// 'modify' - an existing filter expression will be modified.
/// 'remove' - the expression(s) will be removed from the state of the column.
/// </summary>
[JsonPropertyName("type")]
public required string Type { get; init; } // TODO: "add", "modify", or "remove"
public required GridLiteFilteringType Type { get; init; }
}

/// <summary>
/// The type of modification a filter operation applies to the filter state of a column.
/// </summary>
[JsonConverter(typeof(CamelCaseEnumConverter<GridLiteFilteringType>))]
public enum GridLiteFilteringType
{
/// <summary>A new filter expression will be added to the state of the column.</summary>
Add,

/// <summary>An existing filter expression will be modified.</summary>
Modify,

/// <summary>The expression(s) will be removed from the state of the column.</summary>
Remove,
}
Loading
Loading