-
Notifications
You must be signed in to change notification settings - Fork 12
Support Non-Nimble icons in the Nimble table #2813
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2a1ecff
HLD draft for non-nimble icons in the table
hellovolcano 4d03e44
change spec location
hellovolcano 59a10b1
cleanup
hellovolcano 6fcc0c0
Change files
hellovolcano 380ba30
move to ok, apply new template
hellovolcano 6c546be
Change files
hellovolcano 84ed3b3
change approach to separate Icon base class
hellovolcano 4f40bb0
Merge branch 'main' into users/vgleason/non-nimble-icons-hld
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-nimble-components-e24ccafe-f3e9-4a34-bd19-7696fb0d00d1.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": "none", | ||
| "comment": "HLD draft for non-nimble icons in the table", | ||
| "packageName": "@ni/nimble-components", | ||
| "email": "5265744+hellovolcano@users.noreply.github.com", | ||
| "dependentChangeType": "none" | ||
| } |
53 changes: 53 additions & 0 deletions
53
...mponents/src/mapping/icon/specs/nimble-table-column-mapping-custom-icons-hld.md
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,53 @@ | ||
| # Custom Icon Support for Table Column Mapping HLD | ||
|
|
||
| ## Problem Statement | ||
|
|
||
| Currently, the `nimble-table-column-mapping` component only supports Nimble icons through the `nimble-mapping-icon` element. Users need to add custom SVG and PNG icons in some applications that are leveraging the nimble table. | ||
|
|
||
| This design proposes adding two new mapping elements (`nimble-mapping-svg-icon` and `nimble-mapping-png-icon`) to enable custom icon support. | ||
|
|
||
| ## Implementation / Design | ||
|
|
||
| ### New Mapping Elements | ||
|
|
||
| Create two new mapping elements following the existing pattern: | ||
|
|
||
| #### `nimble-mapping-svg-icon` | ||
| - **Attributes:** | ||
| - `key`: string | number | boolean (same as existing mappings) | ||
| - `svg-content`: string - Raw SVG markup to render | ||
| - `severity`: IconSeverity - Controls color theming | ||
| - `text`: string - Tooltip and accessibility text | ||
| - `text-hidden`: boolean - Controls text visibility | ||
|
|
||
| #### `nimble-mapping-png-icon` | ||
| - **Attributes:** | ||
| - `key`: string | number | boolean (same as existing mappings) | ||
| - `src`: string - URL or data URL to PNG/image | ||
| - `alt`: string - Alt text for accessibility | ||
| - `text`: string - Tooltip and display text | ||
| - `text-hidden`: boolean - Controls text visibility | ||
|
|
||
| ### Supporting Infrastructure | ||
|
|
||
| - Add **`MappingSvgIconConfig`** and **`MappingPngIconConfig`** following existing `MappingIconConfig` pattern | ||
| - Custom ViewTemplates for rendering SVG content and images with proper styling and accessibility | ||
| - CSS classes to match nimble design tokens and severity theming | ||
| - Extend existing `TableColumnMappingCellView` and `TableColumnMappingGroupHeaderView` to handle new mapping types | ||
|
|
||
| ### Framework Integration | ||
|
|
||
| Update Angular, React, and Blazor integrations to support the new mapping elements using existing patterns. | ||
|
|
||
| ## Alternative Implementations / Designs | ||
|
|
||
| ### Alternative 1: Extend Existing `nimble-mapping-icon` | ||
| Add `svg-content`, `image-src`, and `image-alt` attributes to the existing `nimble-mapping-icon` element. | ||
|
|
||
| **Rejected because:** | ||
| Creates a confusing list of attributes, and a less-than-ideal developer experience. | ||
|
|
||
|
|
||
| ## Open Issues | ||
|
|
||
| - Do we need to add any security checks/validation for SVG content or PNG links? | ||
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.