Added TableRow customized style option (#1437)
This commit is contained in:
@@ -1266,3 +1266,12 @@ export const textStyleUtils: any = {
|
|||||||
color: "#8399AB",
|
color: "#8399AB",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// These classes are meant to be used as React.CSSProperties for TableWrapper
|
||||||
|
export const TableRowPredefStyles: any = {
|
||||||
|
deleted: {
|
||||||
|
color: "#ACACAC",
|
||||||
|
backgroundColor: "#FDFDFD",
|
||||||
|
fontStyle: "italic",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import history from "../../../../history";
|
|||||||
import {
|
import {
|
||||||
checkboxIcons,
|
checkboxIcons,
|
||||||
radioIcons,
|
radioIcons,
|
||||||
|
TableRowPredefStyles,
|
||||||
} from "../FormComponents/common/styleLibrary";
|
} from "../FormComponents/common/styleLibrary";
|
||||||
|
|
||||||
//Interfaces for table Items
|
//Interfaces for table Items
|
||||||
@@ -104,6 +105,11 @@ interface TableWrapperProps {
|
|||||||
sortConfig?: ISortConfig;
|
sortConfig?: ISortConfig;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onSelectAll?: () => void;
|
onSelectAll?: () => void;
|
||||||
|
rowStyle?: ({
|
||||||
|
index,
|
||||||
|
}: {
|
||||||
|
index: number;
|
||||||
|
}) => "deleted" | "" | React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
const borderColor = "#9c9c9c80";
|
const borderColor = "#9c9c9c80";
|
||||||
@@ -458,6 +464,7 @@ const TableWrapper = ({
|
|||||||
autoScrollToBottom = false,
|
autoScrollToBottom = false,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
onSelectAll,
|
onSelectAll,
|
||||||
|
rowStyle,
|
||||||
}: TableWrapperProps) => {
|
}: TableWrapperProps) => {
|
||||||
const [columnSelectorOpen, setColumnSelectorOpen] = useState<boolean>(false);
|
const [columnSelectorOpen, setColumnSelectorOpen] = useState<boolean>(false);
|
||||||
const [anchorEl, setAnchorEl] = React.useState<any>(null);
|
const [anchorEl, setAnchorEl] = React.useState<any>(null);
|
||||||
@@ -637,6 +644,19 @@ const TableWrapper = ({
|
|||||||
scrollToIndex={
|
scrollToIndex={
|
||||||
autoScrollToBottom ? records.length - 1 : -1
|
autoScrollToBottom ? records.length - 1 : -1
|
||||||
}
|
}
|
||||||
|
rowStyle={(r) => {
|
||||||
|
if (rowStyle) {
|
||||||
|
const returnElement = rowStyle(r);
|
||||||
|
|
||||||
|
if (typeof returnElement === "string") {
|
||||||
|
return get(TableRowPredefStyles, returnElement, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{hasSelect && (
|
{hasSelect && (
|
||||||
<Column
|
<Column
|
||||||
|
|||||||
Reference in New Issue
Block a user