Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions client/src/components/grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { AttuGridType } from './Types';
* @param title Render breadcrumbs
* @param openCheckBox control checkbox display. default is true
* @param disableSelect disable table row select. default false
* @param enableSelectAll control select all checkbox display. default true
* @param noData when table is empty, what tip we need to show.
* @param showHoverStyle control table row hover style display
* @param headEditable if true, user can edit header.
Expand Down Expand Up @@ -65,6 +66,7 @@ const AttuGrid: FC<AttuGridType> = props => {
title,
openCheckBox = true,
disableSelect = false,
enableSelectAll = true,
noData = commonTrans('grid.noData'),
showHoverStyle = true,
headEditable = false,
Expand Down Expand Up @@ -229,6 +231,7 @@ const AttuGrid: FC<AttuGridType> = props => {
rowHeight={rowHeight}
rowDecorator={rowDecorator}
addSpacerColumn={addSpacerColumn}
enableSelectAll={enableSelectAll}
></Table>
{rowCount && showPagination ? (
<TablePagination
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/grid/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const EnhancedTable: FC<TableType> = props => {
// set true as default
openCheckBox = true,
disableSelect,
enableSelectAll = true,
noData,
// whether change table row background color when mouse hover
// set true as default
Expand Down Expand Up @@ -119,6 +120,7 @@ const EnhancedTable: FC<TableType> = props => {
rowCount={rows.length}
openCheckBox={openCheckBox}
disableSelect={disableSelect}
enableSelectAll={enableSelectAll}
/>
) : (
<EditableTableHead editHeads={editHeads} />
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/grid/TableHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const EnhancedTableHead: FC<TableHeadType> = props => {
handleSort,
openCheckBox,
disableSelect,
enableSelectAll = true,
} = props;

const createSortHandler = (property: string) => (event: React.MouseEvent) => {
Expand All @@ -76,7 +77,7 @@ const EnhancedTableHead: FC<TableHeadType> = props => {
indeterminate={numSelected > 0 && numSelected < rowCount}
checked={rowCount > 0 && numSelected === rowCount}
onChange={onSelectAllClick}
disabled={disableSelect}
disabled={disableSelect || !enableSelectAll}
inputProps={{
'aria-label': 'select all desserts',
role: 'checkbox',
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/grid/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type TableHeadType = {
handleSort?: (e: any, p: string, col?: ColDefinitionsType) => void;
openCheckBox?: boolean;
disableSelect?: boolean;
enableSelectAll?: boolean;
};

export type TableEditableHeadType = {
Expand All @@ -87,6 +88,7 @@ export type TableType = {
primaryKey: string;
openCheckBox?: boolean;
disableSelect?: boolean;
enableSelectAll?: boolean;
rowDecorator?: (row: any) => SxProps<Theme> | React.CSSProperties;
noData?: string;
showHoverStyle?: boolean;
Expand Down Expand Up @@ -146,6 +148,7 @@ export type AttuGridType = ToolBarType & {
title?: string[];
openCheckBox?: boolean;
disableSelect?: boolean;
enableSelectAll?: boolean;
noData?: string;
showHoverStyle?: boolean;
headEditable?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ const Properties = (props: PropertiesProps) => {
order={order}
orderBy={orderBy}
handleSort={handleGridSort}
enableSelectAll={false}
labelDisplayedRows={getLabelDisplayedRows(
commonTrans(data.length > 1 ? 'grid.properties' : 'grid.property')
)}
Expand Down
Loading