-
Notifications
You must be signed in to change notification settings - Fork 12
Add Ok Breakpoint Column #2963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hellovolcano
wants to merge
27
commits into
main
Choose a base branch
from
users/vgleason/breakpoint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,751
β6
Open
Add Ok Breakpoint Column #2963
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
03735ac
add breakpoint column
hellovolcano c4482c8
add events for context menu, cleanup accessibility
hellovolcano 5e9df87
lint errors
hellovolcano 6a89917
Change files
hellovolcano 0dfed81
fix context menu event
hellovolcano c70a4a4
add blazor example
hellovolcano 380d34d
update storybook docs
hellovolcano 172e23a
update docs
hellovolcano ebdfba1
lint
hellovolcano 04e871d
fix context menu
hellovolcano afe1e5c
Merge remote-tracking branch 'origin/main' into users/vgleason/breakpβ¦
hellovolcano 5e64d97
use new spright icons
hellovolcano 9d84a53
fix imports
hellovolcano 0f29771
cleanup
hellovolcano d727a82
fix test
hellovolcano 7906497
Apply suggestions from code review
hellovolcano d4c4709
pr feedback
hellovolcano 9cf5d1a
make code column unsortable
hellovolcano f475ef1
fix keyboard nav
hellovolcano 978f85a
make string observable
hellovolcano a4c9754
updating tests
hellovolcano cb4d912
Merge branch 'main' into users/vgleason/breakpoint
hellovolcano c08ca4e
document keyboard interactions
hellovolcano 184fac4
refactor to use anchored region
hellovolcano 431a7fa
fix blazor example
hellovolcano bcad109
Merge branch 'users/vgleason/breakpoint' of https://github.com/ni/nimβ¦
hellovolcano 8bb7170
Merge branch 'main' into users/vgleason/breakpoint
hellovolcano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-ok-blazor-39bf770b-9e85-4d46-ba51-c915ecd4c543.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "add breakpoint column", | ||
| "packageName": "@ni/ok-blazor", | ||
| "email": "5265744+hellovolcano@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@ni-ok-components-744c8788-8d43-48b6-9bff-7f72757113b5.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "add breakpoint column", | ||
| "packageName": "@ni/ok-components", | ||
| "email": "5265744+hellovolcano@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,5 +45,6 @@ | |
| <RectangleSection /> | ||
| <ExSection /> | ||
| <FvSection /> | ||
| <TsSection /> | ||
| </div> | ||
| </div> | ||
40 changes: 40 additions & 0 deletions
40
...es/blazor-workspace/Examples/Demo.Shared/Pages/Sections/Ts/TsBreakpointTableSection.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| @namespace Demo.Shared.Pages.Sections | ||
|
|
||
| <div> | ||
| <SubContainer Label="Breakpoint Table Column (Ok)"> | ||
| <NimbleTable TData="BreakpointTableRecord" @ref="_table" IdFieldName="Id" ParentIdFieldName="ParentId" class="breakpoint-table"> | ||
| <NimbleTableColumnText FieldName="Name" FractionalWidth="2">Name</NimbleTableColumnText> | ||
| <OkTsTableColumnBreakpoint | ||
| FieldName="BreakpointState" | ||
| MenuSlot="breakpoint-menu" | ||
| BreakpointContextMenu="OnBreakpointContextMenu" | ||
| BreakpointToggle="OnBreakpointToggle"> | ||
| </OkTsTableColumnBreakpoint> | ||
| <NimbleTableColumnNumberText FieldName="LineNumber">Line</NimbleTableColumnNumberText> | ||
|
|
||
| <NimbleMenu slot="breakpoint-menu"> | ||
| @if (_contextMenuRecordState == OkBlazor.BreakpointState.Off) | ||
| { | ||
| <NimbleMenuItem @onchange="@(_ => OnAddBreakpoint())">Add breakpoint</NimbleMenuItem> | ||
| <NimbleMenuItem @onchange="@(_ => OnAddConditionalBreakpoint())">Add conditional breakpoint</NimbleMenuItem> | ||
| } | ||
| else | ||
| { | ||
| <NimbleMenuItem @onchange="@(_ => OnRemoveBreakpoint())">Remove breakpoint</NimbleMenuItem> | ||
| @if (_contextMenuRecordState == OkBlazor.BreakpointState.Enabled | ||
| || _contextMenuRecordState == OkBlazor.BreakpointState.Conditional | ||
| || _contextMenuRecordState == OkBlazor.BreakpointState.Hit) | ||
| { | ||
| <NimbleMenuItem @onchange="@(_ => OnDisableBreakpoint())">Disable breakpoint</NimbleMenuItem> | ||
| } | ||
| @if (_contextMenuRecordState == OkBlazor.BreakpointState.Disabled | ||
| || _contextMenuRecordState == OkBlazor.BreakpointState.HitDisabled) | ||
| { | ||
| <NimbleMenuItem @onchange="@(_ => OnEnableBreakpoint())">Enable breakpoint</NimbleMenuItem> | ||
| } | ||
| } | ||
| </NimbleMenu> | ||
|
|
||
| </NimbleTable> | ||
| </SubContainer> | ||
| </div> |
99 changes: 99 additions & 0 deletions
99
...blazor-workspace/Examples/Demo.Shared/Pages/Sections/Ts/TsBreakpointTableSection.razor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| using NimbleBlazor; | ||
| using OkBlazor; | ||
|
|
||
| namespace Demo.Shared.Pages.Sections; | ||
|
|
||
| public partial class TsBreakpointTableSection | ||
| { | ||
| private NimbleTable<BreakpointTableRecord>? _table; | ||
| private string? _contextMenuRecordId; | ||
| private string _contextMenuRecordState = BreakpointState.Off; | ||
|
|
||
| private List<BreakpointTableRecord> _tableData = new() | ||
| { | ||
| new("1", null, "Main.cs", 12, BreakpointState.Enabled), | ||
| new("2", "1", "Helper.cs", 45, BreakpointState.Off), | ||
| new("3", "1", "Service.cs", 78, BreakpointState.Disabled), | ||
| new("4", null, "Controller.cs", 23, BreakpointState.Hit), | ||
| new("5", "4", "Model.cs", 91, BreakpointState.Conditional), | ||
| new("6", null, "Startup.cs", 5, BreakpointState.HitDisabled), | ||
| new("7", "6", "Program.cs", 1, BreakpointState.Off), | ||
| }; | ||
|
|
||
| protected override async Task OnAfterRenderAsync(bool firstRender) | ||
| { | ||
| await _table!.SetDataAsync(_tableData); | ||
| await base.OnAfterRenderAsync(firstRender); | ||
| } | ||
|
|
||
| private void OnBreakpointToggle(BreakpointColumnToggleEventArgs e) | ||
| { | ||
| var record = _tableData.FirstOrDefault(r => r.Id == e.RecordId); | ||
| if (record != null) | ||
| { | ||
| record.BreakpointState = e.NewState; | ||
| } | ||
| StateHasChanged(); | ||
| } | ||
|
|
||
| private void OnBreakpointContextMenu(BreakpointColumnContextMenuEventArgs e) | ||
| { | ||
| _contextMenuRecordId = e.RecordId; | ||
| _contextMenuRecordState = e.CurrentState; | ||
|
|
||
| StateHasChanged(); | ||
| } | ||
|
|
||
| private void OnAddBreakpoint() | ||
| { | ||
| SetRecordState(BreakpointState.Enabled); | ||
| } | ||
|
|
||
| private void OnAddConditionalBreakpoint() | ||
| { | ||
| SetRecordState(BreakpointState.Conditional); | ||
| } | ||
|
|
||
| private void OnRemoveBreakpoint() | ||
| { | ||
| SetRecordState(BreakpointState.Off); | ||
| } | ||
|
|
||
| private void OnDisableBreakpoint() | ||
| { | ||
| SetRecordState(BreakpointState.Disabled); | ||
| } | ||
|
|
||
| private void OnEnableBreakpoint() | ||
| { | ||
| SetRecordState(BreakpointState.Enabled); | ||
| } | ||
|
|
||
| private void SetRecordState(string newState) | ||
| { | ||
| var record = _tableData.FirstOrDefault(r => r.Id == _contextMenuRecordId); | ||
| if (record != null) | ||
| { | ||
| record.BreakpointState = newState; | ||
| } | ||
| StateHasChanged(); | ||
| } | ||
| } | ||
|
|
||
| public class BreakpointTableRecord | ||
| { | ||
| public BreakpointTableRecord(string id, string? parentId, string name, int lineNumber, string breakpointState) | ||
| { | ||
| Id = id; | ||
| ParentId = parentId; | ||
| Name = name; | ||
| LineNumber = lineNumber; | ||
| BreakpointState = breakpointState; | ||
| } | ||
|
|
||
| public string Id { get; set; } | ||
| public string? ParentId { get; set; } | ||
| public string Name { get; set; } | ||
| public int LineNumber { get; set; } | ||
| public string BreakpointState { get; set; } | ||
| } |
3 changes: 3 additions & 0 deletions
3
packages/blazor-workspace/Examples/Demo.Shared/Pages/Sections/Ts/TsSection.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @namespace Demo.Shared.Pages.Sections | ||
|
|
||
| <TsBreakpointTableSection /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/blazor-workspace/OkBlazor/Source/Ts/TableColumnBreakpoint/BreakpointEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| namespace OkBlazor; | ||
|
|
||
| /// <summary> | ||
| /// The possible states of a breakpoint indicator. | ||
| /// </summary> | ||
| public static class BreakpointState | ||
| { | ||
| public const string Off = "off"; | ||
| public const string Enabled = "enabled"; | ||
| public const string Disabled = "disabled"; | ||
| public const string Hit = "hit"; | ||
| public const string Conditional = "conditional"; | ||
| public const string HitDisabled = "hit-disabled"; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Event args for the breakpoint-column-toggle event. | ||
| /// </summary> | ||
| public class BreakpointColumnToggleEventArgs : EventArgs | ||
| { | ||
| public string RecordId { get; set; } = string.Empty; | ||
| public string NewState { get; set; } = string.Empty; | ||
| public string OldState { get; set; } = string.Empty; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Event args for the breakpoint-column-context-menu event. | ||
| /// </summary> | ||
| public class BreakpointColumnContextMenuEventArgs : EventArgs | ||
| { | ||
| public string RecordId { get; set; } = string.Empty; | ||
| public string CurrentState { get; set; } = string.Empty; | ||
| } |
11 changes: 11 additions & 0 deletions
11
...blazor-workspace/OkBlazor/Source/Ts/TableColumnBreakpoint/OkTsTableColumnBreakpoint.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| @namespace OkBlazor | ||
|
|
||
| <ok-ts-table-column-breakpoint | ||
| column-id="@ColumnId" | ||
| field-name="@FieldName" | ||
| column-hidden="@ColumnHidden" | ||
| menu-slot="@MenuSlot" | ||
| @onokbreakpointcolumntoggle="BreakpointToggle" | ||
| @onokbreakpointcolumncontextmenu="BreakpointContextMenu" | ||
| @attributes="AdditionalAttributes"> | ||
| </ok-ts-table-column-breakpoint> |
50 changes: 50 additions & 0 deletions
50
...zor-workspace/OkBlazor/Source/Ts/TableColumnBreakpoint/OkTsTableColumnBreakpoint.razor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.AspNetCore.Components; | ||
|
|
||
| namespace OkBlazor; | ||
|
|
||
| public partial class OkTsTableColumnBreakpoint : ComponentBase | ||
| { | ||
| /// <summary> | ||
| /// The ID of the column. | ||
| /// </summary> | ||
| [Parameter] | ||
| public string? ColumnId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the field in the data record that contains the breakpoint state value. | ||
| /// </summary> | ||
| [Parameter] | ||
| [DisallowNull] | ||
| public string FieldName { get; set; } = null!; | ||
|
|
||
| /// <summary> | ||
| /// The name of the slot in which to render the context menu for this breakpoint column. If not provided, no context menu will be rendered. | ||
| /// </summary> | ||
| [Parameter] | ||
| public string? MenuSlot { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether or not the column should be hidden. | ||
| /// </summary> | ||
| [Parameter] | ||
| public bool? ColumnHidden { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a callback invoked when a breakpoint is toggled (clicked). | ||
| /// </summary> | ||
| [Parameter] | ||
| public EventCallback<BreakpointColumnToggleEventArgs> BreakpointToggle { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a callback invoked when a context menu is requested on a breakpoint. | ||
| /// </summary> | ||
| [Parameter] | ||
| public EventCallback<BreakpointColumnContextMenuEventArgs> BreakpointContextMenu { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Any additional attributes that did not match known properties. | ||
| /// </summary> | ||
| [Parameter(CaptureUnmatchedValues = true)] | ||
| public IDictionary<string, object>? AdditionalAttributes { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| import './icon-dynamic'; | ||
| import './table-column/breakpoint'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.