Skip to content

Commit

Permalink
Merge branch 'main' into fix-nuget-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rajsite authored Feb 22, 2024
2 parents 73cc05e + 1ad85c0 commit 477a27c
Show file tree
Hide file tree
Showing 28 changed files with 461 additions and 17 deletions.
15 changes: 15 additions & 0 deletions angular-workspace/projects/ni/nimble-angular/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@ni/nimble-angular",
"entries": [
{
"date": "Wed, 21 Feb 2024 23:32:45 GMT",
"version": "20.2.4",
"tag": "@ni/nimble-angular_v20.2.4",
"comments": {
"patch": [
{
"author": "beachball",
"package": "@ni/nimble-angular",
"comment": "Bump @ni/nimble-components to v21.6.1",
"commit": "not available"
}
]
}
},
{
"date": "Wed, 21 Feb 2024 21:18:20 GMT",
"version": "20.2.3",
Expand Down
10 changes: 9 additions & 1 deletion angular-workspace/projects/ni/nimble-angular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Change Log - @ni/nimble-angular

This log was last generated on Wed, 21 Feb 2024 21:18:20 GMT and should not be manually modified.
This log was last generated on Wed, 21 Feb 2024 23:32:45 GMT and should not be manually modified.

<!-- Start content -->

## 20.2.4

Wed, 21 Feb 2024 23:32:45 GMT

### Patches

- Bump @ni/nimble-components to v21.6.1

## 20.2.3

Wed, 21 Feb 2024 21:18:20 GMT
Expand Down
4 changes: 2 additions & 2 deletions angular-workspace/projects/ni/nimble-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ni/nimble-angular",
"version": "20.2.3",
"version": "20.2.4",
"description": "Angular components for the NI Nimble Design System",
"scripts": {
"invoke-publish": "cd ../../../ && npm run build:library && cd dist/ni/nimble-angular && npm publish"
Expand Down Expand Up @@ -31,7 +31,7 @@
"@angular/forms": "^15.2.10",
"@angular/localize": "^15.2.10",
"@angular/router": "^15.2.10",
"@ni/nimble-components": "^21.6.0"
"@ni/nimble-components": "^21.6.1"
},
"dependencies": {
"tslib": "^2.2.0"
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions packages/nimble-blazor/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@ni/nimble-blazor",
"entries": [
{
"date": "Wed, 21 Feb 2024 23:32:45 GMT",
"version": "14.3.0",
"tag": "@ni/nimble-blazor_v14.3.0",
"comments": {
"minor": [
{
"author": "20542556+mollykreis@users.noreply.github.com",
"package": "@ni/nimble-blazor",
"commit": "ff99d91bbe3dd65e8595770c9ac05cbb8ad5282d",
"comment": "Add support for delayed hierarchy in the table"
}
]
}
},
{
"date": "Mon, 19 Feb 2024 16:59:58 GMT",
"version": "14.2.0",
Expand Down
10 changes: 9 additions & 1 deletion packages/nimble-blazor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Change Log - @ni/nimble-blazor

This log was last generated on Mon, 19 Feb 2024 16:59:58 GMT and should not be manually modified.
This log was last generated on Wed, 21 Feb 2024 23:32:45 GMT and should not be manually modified.

<!-- Start content -->

## 14.3.0

Wed, 21 Feb 2024 23:32:45 GMT

### Minor changes

- Add support for delayed hierarchy in the table ([ni/nimble@ff99d91](https://github.com/ni/nimble/commit/ff99d91bbe3dd65e8595770c9ac05cbb8ad5282d))

## 14.2.0

Mon, 19 Feb 2024 16:59:58 GMT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@
</NimbleTable>
<NimbleButton class="table-update-button" @onclick=@(_ => AddTableRows(10))>Add rows</NimbleButton>
</div>
<div class="sub-container">
<div class="container-label">Table with delayed hierarchy</div>
<NimbleTable TData="PersonTableRecord" RowExpandToggle="OnRowExpandToggleAsync" @ref="_delayedHierarchyTable" IdFieldName="Id" ParentIdFieldName="ParentId" SelectionMode="TableRowSelectionMode.Multiple" class="table">
<NimbleTableColumnText FieldName="FirstName">First name</NimbleTableColumnText>
<NimbleTableColumnText FieldName="LastName">Last name</NimbleTableColumnText>
<NimbleTableColumnNumberText FieldName="Age" Format="NumberTextFormat.Decimal" DecimalDigits="0">Age</NimbleTableColumnNumberText>
</NimbleTable>
</div>
<div class="sub-container">
<div class="container-label">Tabs</div>
<NimbleTabs @bind-ActiveId="@ActiveTabId">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ public partial class ComponentsDemo
private string? DialogClosedReason { get; set; }
private NimbleDrawer<DialogResult>? _drawer;
private NimbleTable<SimpleTableRecord>? _table;
private NimbleTable<PersonTableRecord>? _delayedHierarchyTable;
private string? DrawerClosedReason { get; set; }
private string? SelectedRadio { get; set; } = "2";
private bool BannerOpen { get; set; }
private List<PersonTableRecord> _delayedHierarchyTableData = new List<PersonTableRecord>()
{
new PersonTableRecord("jacqueline-bouvier", null, "Jacqueline", "Bouvier", 80, true),
new PersonTableRecord("mona-simpson", null, "Mona", "Simpson", 77, true),
new PersonTableRecord("agnes-skinner", null, "Agnes", "Skinner", 88, true)
};
private HashSet<string> _recordsLoadingChildren = new HashSet<string>();
private HashSet<string> _recordsWithLoadedChildren = new HashSet<string>();

[NotNull]
public IEnumerable<SimpleTableRecord> TableData { get; set; } = Enumerable.Empty<SimpleTableRecord>();
Expand All @@ -38,9 +47,94 @@ public ComponentsDemo()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await _table!.SetDataAsync(TableData);
await UpdateDelayedHierarchyTableAsync();
await base.OnAfterRenderAsync(firstRender);
}

private async Task OnRowExpandToggleAsync(TableRowExpandToggleEventArgs e)
{
var recordId = e.RecordId;
if (e.NewState && !_recordsLoadingChildren.Contains(recordId) && !_recordsWithLoadedChildren.Contains(recordId))
{
var record = _delayedHierarchyTableData.Find(person => person.Id == recordId);
if (record == null)
{
return;
}

_recordsLoadingChildren.Add(recordId);
await UpdateDelayedHierarchyTableAsync(false);

await Task.Delay(1500);
_recordsLoadingChildren.Remove(recordId);
_recordsWithLoadedChildren.Add(recordId);
var childrenToAdd = GetChildren(recordId);
childrenToAdd.ForEach(child => _delayedHierarchyTableData.Add(child));
await UpdateDelayedHierarchyTableAsync();
}
}

private List<PersonTableRecord> GetChildren(string recordId)
{
switch (recordId)
{
case "jacqueline-bouvier":
return new List<PersonTableRecord>()
{
new PersonTableRecord("marge-simpson", recordId, "Marge", "Simpson", 35, true),
new PersonTableRecord("selma-bouvier", recordId, "Selma", "Bouvier", 45, false),
new PersonTableRecord("patty-bouvier", recordId, "Patty", "Bouvier", 45, false)
};
case "marge-simpson":
return new List<PersonTableRecord>()
{
new PersonTableRecord("bart-simpson", recordId, "Bart", "Simpson", 12, false),
new PersonTableRecord("lisa-bouvier", recordId, "Lisa", "Simpson", 10, false),
new PersonTableRecord("maggie-bouvier", recordId, "Maggie", "Simpson", 1, false)
};
case "mona-simpson":
return new List<PersonTableRecord>()
{
new PersonTableRecord("homer-simpson", recordId, "Homer", "Simpson", 35, false)
};
case "agnes-skinner":
return new List<PersonTableRecord>()
{
new PersonTableRecord("seymour-skinner", recordId, "Seymour", "Skinner", 42, false)
};
default:
return new List<PersonTableRecord>();
}
}

private async Task UpdateDelayedHierarchyTableAsync(bool setData = true)
{
if (setData)
{
await _delayedHierarchyTable!.SetDataAsync(_delayedHierarchyTableData);
}

List<TableSetRecordHierarchyOptions> options = new List<TableSetRecordHierarchyOptions>();
_delayedHierarchyTableData.ForEach(person =>
{
if (_recordsLoadingChildren.Contains(person.Id))
{
options.Add(
new TableSetRecordHierarchyOptions(
person.Id,
new TableRecordHierarchyOptions(TableRecordDelayedHierarchyState.LoadingChildren)));
}
else if (person.HasChildren && !_recordsWithLoadedChildren.Contains(person.Id))
{
options.Add(
new TableSetRecordHierarchyOptions(
person.Id,
new TableRecordHierarchyOptions(TableRecordDelayedHierarchyState.CanLoadChildren)));
}
});
await _delayedHierarchyTable!.SetRecordHierarchyOptionsAsync(options);
}

private string DrawerLocationAsString
{
get => _drawerLocation.ToString();
Expand Down Expand Up @@ -183,6 +277,26 @@ public SimpleTableRecord(
public double Duration { get; }
}

public class PersonTableRecord
{
public PersonTableRecord(string id, string? parentId, string firstName, string lastName, int age, bool hasChildren)
{
Id = id;
ParentId = parentId;
FirstName = firstName;
LastName = lastName;
Age = age;
HasChildren = hasChildren;
}

public string Id { get; }
public string? ParentId { get; }
public string FirstName { get; }
public string LastName { get; }
public int Age { get; }
public bool HasChildren { get; }
}

public enum DialogResult
{
OK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
group-select-all="@GroupSelectAll"
row-select="@RowSelect"
row-operation-column="@RowOperationColumn"
row-loading="@RowLoading"
@attributes="AdditionalAttributes">
</nimble-label-provider-table>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public partial class NimbleLabelProviderTable : ComponentBase
[Parameter]
public string? RowOperationColumn { get; set; }

[Parameter]
public string? RowLoading { get; set; }

/// <summary>
/// Gets or sets a collection of additional attributes that will be applied to the created element.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@onnimbleactionmenutoggle="(__value) => HandleActionMenuToggle(__value)"
@onnimbletablerowselectionchange="(__value) => HandleSelectionChange(__value)"
@onnimbletablecolumnconfigurationchange="(__value) => HandleColumnConfigurationChange(__value)"
@onnimbletablerowexpandtoggle="(__value) => HandleRowExpandToggle(__value)"
>
@ChildContent
</nimble-table>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public partial class NimbleTable<TData> : ComponentBase
internal static string SetSelectedRecordIdsMethodName = "NimbleBlazor.Table.setSelectedRecordIds";
internal static string CheckTableValidityMethodName = "NimbleBlazor.Table.checkValidity";
internal static string GetTableValidityMethodName = "NimbleBlazor.Table.getValidity";
internal static string SetRecordHierarchyOptionsMethodName = "NimbleBlazor.Table.setRecordHierarchyOptions";

[Inject]
private IJSRuntime? JSRuntime { get; set; }
Expand Down Expand Up @@ -65,6 +66,15 @@ public async Task SetSelectedRecordIdsAsync(IEnumerable<string> recordIds)
await JSRuntime!.InvokeAsync<TableValidity>(SetSelectedRecordIdsMethodName, _table, recordIds);
}

/// <summary>
/// Sets the hierarchy options for each record in the table.
/// </summary>
/// <param name="options">The hierarchy options</param>
public async Task SetRecordHierarchyOptionsAsync(IEnumerable<TableSetRecordHierarchyOptions> options)
{
await JSRuntime!.InvokeVoidAsync(SetRecordHierarchyOptionsMethodName, _table, options);
}

/// <summary>
/// Returns whether or not the table is valid.
/// </summary>
Expand Down Expand Up @@ -105,6 +115,12 @@ public async Task<ITableValidity> GetValidityAsync()
[Parameter]
public EventCallback<TableColumnConfigurationEventArgs> ColumnConfigurationChange { get; set; }

/// <summary>
/// Gets or sets a callback that's invoked when a column's configuration is changed.
/// </summary>
[Parameter]
public EventCallback<TableRowExpandToggleEventArgs> RowExpandToggle { get; set; }

/// <summary>
/// Called when 'action-menu-toggle' changes on the web component.
/// </summary>
Expand Down Expand Up @@ -140,4 +156,13 @@ protected async void HandleColumnConfigurationChange(TableColumnConfigurationEve
{
await ColumnConfigurationChange.InvokeAsync(eventArgs);
}

/// <summary>
/// Called when the 'row-expand-toggle' event is fired on the web component.
/// </summary>
/// <param name="eventArgs">The toggle state of a table row</param>
protected async void HandleRowExpandToggle(TableRowExpandToggleEventArgs eventArgs)
{
await RowExpandToggle.InvokeAsync(eventArgs);
}
}
8 changes: 8 additions & 0 deletions packages/nimble-blazor/NimbleBlazor/EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public class TableColumnConfiguration
public double? PixelWidth { get; set; }
}

public class TableRowExpandToggleEventArgs : EventArgs
{
public string RecordId { get; set; } = string.Empty;
public bool NewState { get; set; }
public bool OldState { get; set; }
}

public class WaferMapHoverDieChangedEventArgs : EventArgs
{
public WaferMapDie? CurrentDie { get; set; }
Expand All @@ -76,6 +83,7 @@ public class WaferMapHoverDieChangedEventArgs : EventArgs
[EventHandler("onnimbleactionmenubeforetoggle", typeof(TableActionMenuToggleEventArgs), enableStopPropagation: true, enablePreventDefault: false)]
[EventHandler("onnimbletablerowselectionchange", typeof(TableRowSelectionEventArgs), enableStopPropagation: true, enablePreventDefault: false)]
[EventHandler("onnimbletablecolumnconfigurationchange", typeof(TableColumnConfigurationEventArgs), enableStopPropagation: true, enablePreventDefault: false)]
[EventHandler("onnimbletablerowexpandtoggle", typeof(TableRowExpandToggleEventArgs), enableStopPropagation: true, enablePreventDefault: false)]
[EventHandler("onnimblewafermapdiehoverchange", typeof(WaferMapHoverDieChangedEventArgs), enableStopPropagation: true, enablePreventDefault: false)]
public static class EventHandlers
{
Expand Down
Loading

0 comments on commit 477a27c

Please sign in to comment.