Skip to content

Commit 8497e33

Browse files
committed
Fix Spreadsheet JS interop crash under trimming and raise version to 11.0.1
Anonymous objects passed to Radzen.createSpreadsheet/createSheetEditor failed with System.Text.Json ConstructorContainsNullParameterNames under trimming. Switched to positional interop arguments to match the existing convention.
1 parent e6a8ea9 commit 8497e33

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

Radzen.Blazor/Radzen.Blazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IsPackable>true</IsPackable>
1414
<PackageId>Radzen.Blazor</PackageId>
1515
<Product>Radzen.Blazor</Product>
16-
<Version>11.0.0</Version>
16+
<Version>11.0.1</Version>
1717
<Copyright>Radzen Ltd.</Copyright>
1818
<Authors>Radzen Ltd.</Authors>
1919
<Description>Radzen Blazor is the most sophisticated free UI component library for Blazor, featuring 110+ native components including DataGrid, Scheduler, Charts, and advanced theming with full support for Material Design and Fluent UI.</Description>

Radzen.Blazor/RadzenSpreadsheet.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
14651465
if (firstRender && JSRuntime != null)
14661466
{
14671467
dotNetRef = DotNetObjectReference.Create(this);
1468-
jsRef = await JSRuntime.InvokeAsync<IJSObjectReference>("Radzen.createSpreadsheet", new { Element, dotNetRef, shortcuts = shortcuts.Keys });
1468+
jsRef = await JSRuntime.InvokeAsync<IJSObjectReference>("Radzen.createSpreadsheet", Element, dotNetRef, shortcuts.Keys);
14691469
}
14701470
}
14711471

Radzen.Blazor/Spreadsheet/SheetEditor.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
8686
{
8787
dotNetRef = DotNetObjectReference.Create(this);
8888

89-
jsRef = await JSRuntime.InvokeAsync<IJSObjectReference>("Radzen.createSheetEditor", new { element, value, AutoFocus, dotNetRef });
89+
jsRef = await JSRuntime.InvokeAsync<IJSObjectReference>("Radzen.createSheetEditor", element, value, AutoFocus, dotNetRef);
9090
}
9191
else
9292
{

Radzen.Blazor/wwwroot/Radzen.Blazor.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5756,10 +5756,10 @@ Radzen.createUpload = function(el, url, auto, multiple, parameterName, method, s
57565756
}};
57575757
};
57585758
class Spreadsheet {
5759-
constructor(options) {
5760-
this.element = options.element;
5761-
this.dotNetRef = options.dotNetRef;
5762-
this.shortcuts = options.shortcuts;
5759+
constructor(element, dotNetRef, shortcuts) {
5760+
this.element = element;
5761+
this.dotNetRef = dotNetRef;
5762+
this.shortcuts = shortcuts;
57635763
this.element.addEventListener('keydown', this.onKeyDown);
57645764
this.element.addEventListener('pointerdown', this.onPointerDown);
57655765
this.element.addEventListener('dblclick', this.onDoubleClick);
@@ -6069,17 +6069,17 @@ Radzen.endRangePickKeyHandler = function () {
60696069
};
60706070

60716071
class SheetEditor {
6072-
constructor(options) {
6073-
this.element = options.element;
6074-
this.element.innerText = options.value;
6075-
this.dotNetRef = options.dotNetRef;
6072+
constructor(element, value, autoFocus, dotNetRef) {
6073+
this.element = element;
6074+
this.element.innerText = value;
6075+
this.dotNetRef = dotNetRef;
60766076
this.element.addEventListener('input', this.onInput);
60776077
this.element.addEventListener('keydown', this.onKeyDown);
60786078
this.element.addEventListener('blur', this.onBlur);
60796079
this.element.addEventListener('focus', this.onFocus);
60806080
this.element.addEventListener('paste', this.onPaste);
60816081
document.addEventListener('selectionchange', this.onSelectionChange);
6082-
if (options.autoFocus) {
6082+
if (autoFocus) {
60836083
this.focus();
60846084
}
60856085
}
@@ -6201,8 +6201,8 @@ class SheetEditor {
62016201

62026202

62036203

6204-
Radzen.createSheetEditor = (options) => new SheetEditor(options);
6205-
Radzen.createSpreadsheet = (options) => new Spreadsheet(options);
6204+
Radzen.createSheetEditor = (element, value, autoFocus, dotNetRef) => new SheetEditor(element, value, autoFocus, dotNetRef);
6205+
Radzen.createSpreadsheet = (element, dotNetRef, shortcuts) => new Spreadsheet(element, dotNetRef, shortcuts);
62066206
Radzen.createVirtualItemContainer = (scrollable, content, ref) => {
62076207
var height = scrollable.clientHeight;
62086208
var width = scrollable.clientWidth;

0 commit comments

Comments
 (0)