Skip to content

feat!: type the filter condition, criteria, filtering type and search… - #71

Merged
damyanpetev merged 3 commits into
masterfrom
dpetev/filter-condition
Oct 8, 2026
Merged

damyanpetev merged 3 commits into
masterfrom
dpetev/filter-condition

Conversation

@damyanpetev

Copy link
Copy Markdown
Member

Settles the filter expression's value types before 1.0, where changing a property's type would be breaking.

Changes

Member Before After
IgbGridLiteFilterExpression.Condition object string, a grid-lite condition name
IgbGridLiteFilterExpression.Criteria string? GridLiteFilterCriteria? (And, Or)
IgbGridLiteFilteringEventArgs.Type string GridLiteFilteringType (Add, Modify, Remove)
IgbGridLiteFilteringEventArgs.Expressions, IgbGridLiteFilteredEventArgs.State List<IgbGridLiteFilterExpression> IReadOnlyList<IgbGridLiteFilterExpression>
SearchTerm in the Filtering / Filtered events JsonElement string, double or bool; JsonElement only for an array or object the app set itself
  • Condition is a name. grid-lite's condition is either a name or an operation object carrying a logic function, and only the name can cross to .NET. Before, Condition read back from the events as a JsonElement of that object. The names valid for each DataType, and which conditions take no SearchTerm, are listed in Condition's docs and the README. grid-lite is moving to names only as well. Its 0.11.0 still reports the object in event details, so the grid's script reduces each condition to its name before handing the details to .NET; that works with both forms.
  • Criteria and the filtering Type are enums. They are fixed sets in grid-lite, written in camelCase like GridLiteSortingDirection.
  • SearchTerm comes back as its value. Numbers always read as double, since JSON has a single number type: a term set as an int comes back as a double.
  • Trimming: Condition no longer goes through the reflection-based serializer; SearchTerm is the only filter value that still does (docs/TRIMMING.md).

The name Condition follows grid-lite. The full IgbGrid's IgbFilteringExpression holds the same names in ConditionName, so moving an expression across is a property rename with identical values (the full grid's …OrEqualTo number conditions aside).

Tests

  • Serialization: Condition and Criteria are written as plain strings; the event args read Type, Criteria and each kind of SearchTerm from grid-lite's payloads; the two enums reject integers.
  • Browser: a filtering event in grid-lite 0.11.0's shape, with a condition object, reaches the .NET handler as Add contains.

@damyanpetev
damyanpetev requested a balanced review from Copilot October 8, 2026 08:32
@damyanpetev damyanpetev added the 🪛 enhancement New feature or request label Oct 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation and coverage consistently enforce the new filtering contracts, with only a non-blocking comment wording correction identified.

1 open finding
What changed in this PR

Types filtering models before 1.0 and normalizes grid-lite event payloads for strongly typed .NET consumption.

Changes:

  • Adds typed filter criteria and filtering-operation enums.
  • Converts event search terms into appropriate primitive values.
  • Normalizes condition objects in JavaScript and expands serialization/integration coverage.
File Description
ModelSerializationTests.cs Tests updated filter payloads.
GridLiteJsInteropTests.cs Verifies typed criteria interop.
EnumSerializationTests.cs Tests new enum converters.
GridPage.razor Exposes filtering results for browser tests.
GridLiteTests.cs Tests condition-object normalization.
IgbGridLiteFilterExpression.cs Types conditions and criteria.
IgbGridLiteFilteringEventArgs.cs Types operation and expression collection.
IgbGridLiteFilteredEventArgs.cs Makes state read-only.
GridLiteJsonContext.cs Updates serialization documentation.
AppValueSerializer.cs Converts search terms to primitives.
igc-grid-lite-entry.js Normalizes event condition objects.
README.md Documents valid condition names.
docs/​TRIMMING.md Updates trimming guidance.
docs/​security/​threat-model.md Updates payload security description.
CHANGELOG.md Records breaking API changes.
.github/​copilot-instructions.md Updates serialization guidance.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@damyanpetev
damyanpetev added this pull request to stack #73 October 8, 2026 09:18
@damyanpetev
damyanpetev requested a review from MayaKirova October 8, 2026 11:01
/// </summary>
/// <remarks>
/// Typically matches the <see cref="IgbGridLiteColumn.DataType"/> holding a <see cref="string"/>,
/// a <see cref="double"/> (any number, including one set as an <see cref="int"/>) or a <see cref="bool"/>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a point to support and document the boolean type? Since the boolean expressions take no SeacrhTerm, just condition, like:

            new IgbGridLiteFilterExpression
            {
                Key = nameof(NwindDataItem.Discontinued),
                Condition = "true"
            }

Unless we support custom conditions somehow, but I don't think that we do?

@MayaKirova MayaKirova left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than wondering about the SearchTerm's boolean type LGTM.

@damyanpetev
damyanpetev merged commit 5a19734 into master Oct 8, 2026
6 checks passed
@damyanpetev
damyanpetev deleted the dpetev/filter-condition branch October 8, 2026 12:42
@damyanpetev damyanpetev mentioned this pull request Oct 8, 2026
2 of 18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants