Skip to content

Commit

Permalink
Remove hasActions prop from basic/memory tables
Browse files Browse the repository at this point in the history
- will automatically be calculated if any `column.actions` exists, prop should no longer be needed
  • Loading branch information
cee-chen committed Mar 28, 2024
1 parent 9c5e147 commit 0b13d3b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion src-docs/src/views/tables/actions/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ export default () => {
pagination={pagination}
sorting={sorting}
selection={selection}
hasActions={customAction ? false : true}
onChange={onTableChange}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ export default () => {
itemId="id"
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
isExpandable={true}
hasActions={true}
columns={columnsWithExpandingRowToggle}
pagination={pagination}
sorting={sorting}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/tables/mobile/mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ export default () => {
pagination={pagination}
sorting={sorting}
selection={selection}
hasActions={true}
responsiveBreakpoint={isResponsive}
onChange={onTableChange}
/>
Expand Down
9 changes: 3 additions & 6 deletions src/components/basic_table/basic_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ interface BasicTableProps<T extends object>
* Indicates which column should be used as the identifying cell in each row. Should match a "field" prop in FieldDataColumn
*/
rowHeader?: string;
hasActions?: boolean;
isExpandable?: boolean;
/**
* Provides an infinite loading indicator
Expand Down Expand Up @@ -525,7 +524,6 @@ export class EuiBasicTable<T extends object = any> extends Component<
responsive,
responsiveBreakpoint,
isExpandable,
hasActions,
rowProps,
cellProps,
tableCaption,
Expand Down Expand Up @@ -977,7 +975,6 @@ export class EuiBasicTable<T extends object = any> extends Component<
const {
columns,
selection,
hasActions,
rowHeader,
itemIdToExpandedRowMap = {},
isExpandable,
Expand Down Expand Up @@ -1009,7 +1006,7 @@ export class EuiBasicTable<T extends object = any> extends Component<
rowSelectionDisabled = !!isDisabled;
}

let calculatedHasActions;
let hasActions;
columns.forEach((column: EuiBasicTableColumn<T>, columnIndex: number) => {
if ((column as EuiTableActionsColumnType<T>).actions) {
cells.push(
Expand All @@ -1020,7 +1017,7 @@ export class EuiBasicTable<T extends object = any> extends Component<
columnIndex
)
);
calculatedHasActions = true;
hasActions = true;
} else if ((column as EuiTableFieldDataColumnType<T>).field) {
const fieldDataColumn = column as EuiTableFieldDataColumnType<T>;
cells.push(
Expand Down Expand Up @@ -1080,7 +1077,7 @@ export class EuiBasicTable<T extends object = any> extends Component<
hasSelection={!!selection}
isSelectable={!rowSelectionDisabled}
isSelected={selected}
hasActions={hasActions == null ? calculatedHasActions : hasActions}
hasActions={hasActions}
isExpandable={isExpandable}
{...rowProps}
>
Expand Down
2 changes: 0 additions & 2 deletions src/components/basic_table/in_memory_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ export class EuiInMemoryTable<T extends object = object> extends Component<
message,
error,
selection,
hasActions,
compressed,
pagination: hasPagination,
sorting: hasSorting,
Expand Down Expand Up @@ -747,7 +746,6 @@ export class EuiInMemoryTable<T extends object = object> extends Component<
pagination={pagination}
sorting={sorting}
selection={selection}
hasActions={hasActions}
onChange={this.onTableChange}
error={error}
loading={loading}
Expand Down

0 comments on commit 0b13d3b

Please sign in to comment.