diff --git a/packages/components/src/components/data-grid/cell-handlers/actions-cell.tsx b/packages/components/src/components/data-grid/cell-handlers/actions-cell.tsx index be350c4068..a134239ec5 100644 --- a/packages/components/src/components/data-grid/cell-handlers/actions-cell.tsx +++ b/packages/components/src/components/data-grid/cell-handlers/actions-cell.tsx @@ -18,18 +18,22 @@ export const ActionsCell: Cell = { return (
{content.map((action) => { - const { label, ...props } = action; + const { label, iconName, tooltip, ...props } = action; + const tooltipProps = tooltip ? { title: tooltip } : {}; + const IconComponent = resolveIconComponent(iconName); if (typeof label === 'object' && '__html' in label) { return ( ); } return ( - + + {IconComponent} {label} ); @@ -38,3 +42,15 @@ export const ActionsCell: Cell = { ); }, }; + +function resolveIconComponent(iconName) { + switch (iconName) { + case 'edit': + return ; + case 'delete': + return ; + + default: + return null; + } +} diff --git a/packages/components/src/components/data-grid/readme.md b/packages/components/src/components/data-grid/readme.md index ba1f894f5b..c0e86b7f4b 100644 --- a/packages/components/src/components/data-grid/readme.md +++ b/packages/components/src/components/data-grid/readme.md @@ -62,6 +62,8 @@ - [scale-dropdown-select-item](../dropdown-select-item) - [scale-tag](../tag) - [scale-text-field](../text-field) +- [scale-icon-action-edit](../icons/action-edit) +- [scale-icon-action-remove](../icons/action-remove) ### Graph ```mermaid @@ -87,6 +89,8 @@ graph TD; scale-data-grid --> scale-dropdown-select-item scale-data-grid --> scale-tag scale-data-grid --> scale-text-field + scale-data-grid --> scale-icon-action-edit + scale-data-grid --> scale-icon-action-remove scale-menu-flyout-item --> scale-icon-action-checkmark scale-menu-flyout-item --> scale-icon-navigation-right scale-checkbox --> scale-icon-action-minus diff --git a/packages/components/src/components/date-picker/date-picker.tsx b/packages/components/src/components/date-picker/date-picker.tsx index 5a15423b68..44f2ab40fe 100644 --- a/packages/components/src/components/date-picker/date-picker.tsx +++ b/packages/components/src/components/date-picker/date-picker.tsx @@ -483,7 +483,7 @@ export class DatePicker { dateAdapter={this.dateAdapter} disabled={this.disabled} value={this.value} - ref={(element: HTMLElement & DuetDatePicker) => + ref={(element: HTMLDuetDatePickerElement & DuetDatePicker) => (this.duetInput = element) } >