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
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ function ResizeableTableComp<RecordType extends object>(props: CustomTableProps<
onClick: () => onCellClick(col.titleText, String(col.dataIndex)),
loading: customLoading,
customAlign: col.align,
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
}, [rowColorFn, rowHeightFn, columnsStyle, size, rowAutoHeight, onCellClick, customLoading]);

Expand All @@ -182,6 +184,8 @@ function ResizeableTableComp<RecordType extends object>(props: CustomTableProps<
onResizeStop: (e: React.SyntheticEvent, { size }: { size: { width: number } }) => {
handleResizeStop(size.width, index, col.onWidthResize);
},
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
}, [viewModeResizable, handleResize, handleResizeStop]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export const columnChildrenMap = {
align: HorizontalAlignmentControl,
tempHide: stateComp<boolean>(false),
fixed: dropdownControl(columnFixOptions, "close"),
// identifiers
className: StringControl,
dataTestId: StringControl,
editable: BoolControl,
background: withDefault(ColorControl, ""),
margin: withDefault(RadiusControl, ""),
Expand Down Expand Up @@ -162,6 +165,11 @@ const StyledFontFamilyIcon = styled(FontFamilyIcon)` width: 24px; margin: 0 8px
const StyledTextWeightIcon = styled(TextWeightIcon)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`;
const StyledBackgroundImageIcon = styled(ImageCompIcon)` width: 24px; margin: 0 0px 0 -12px;`;

const SectionHeading = styled.div`
font-weight: bold;
margin-bottom: 8px;
`;

/**
* export for test.
* Put it here temporarily to avoid circular dependencies
Expand Down Expand Up @@ -283,11 +291,7 @@ const ColumnPropertyView = React.memo(({
{(columnType === 'link' || columnType === 'links') && (
<>
<Divider style={{ margin: '12px 0' }} />
{controlItem({}, (
<div>
<b>{"Link Style"}</b>
</div>
))}
<SectionHeading>Link Style</SectionHeading>
{comp.children.linkColor.propertyView({
label: trans('text') // trans('style.background'),
})}
Expand All @@ -300,11 +304,7 @@ const ColumnPropertyView = React.memo(({
</>
)}
<Divider style={{ margin: '12px 0' }} />
{controlItem({}, (
<div>
<b>{"Column Style"}</b>
</div>
))}
<SectionHeading>Column Style</SectionHeading>
{comp.children.background.propertyView({
label: trans('style.background'),
})}
Expand Down Expand Up @@ -346,6 +346,14 @@ const ColumnPropertyView = React.memo(({
})}
{comp.children.textOverflow.getPropertyView()}
{comp.children.cellColor.getPropertyView()}
<Divider style={{ margin: '12px 0' }} />
<SectionHeading>Identifiers</SectionHeading>
{comp.children.className.propertyView({
label: trans("prop.className"),
})}
{comp.children.dataTestId.propertyView({
label: trans("prop.dataTestId"),
})}
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const TableCompView = React.memo((props: {
const onEvent = useMemo(() => compChildren.onEvent.getView(), [compChildren.onEvent]);
const currentExpandedRows = useMemo(() => compChildren.currentExpandedRows.getView(), [compChildren.currentExpandedRows]);
const dynamicColumn = compChildren.dynamicColumn.getView();
const className = compChildren.className.getView();
const dataTestId = compChildren.dataTestId.getView();

const dynamicColumnConfig = useMemo(
() => compChildren.dynamicColumnConfig.getView(),
Expand Down Expand Up @@ -360,6 +362,8 @@ export const TableCompView = React.memo((props: {
suffixNode={toolbar.position === "below" && !toolbar.fixedToolbar && !(tableMode.isAutoMode && showHorizontalScrollbar) && toolbarView}
>
<TableWrapper
className={className}
data-testid={dataTestId}
$style={style}
$rowStyle={rowStyle}
$headerStyle={headerStyle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
tooltip: trans("table.dynamicColumnConfigDesc"),
})}
</Section>

<Section name={trans("prop.component")}>
{comp.children.className.propertyView({ label: trans("prop.className") })}
{comp.children.dataTestId.propertyView({ label: trans("prop.dataTestId") })}
</Section>
</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ export const BackgroundWrapper = styled.div<{
`;

// TODO: find a way to limit the calc function for max-height only to first Margin value
export const TableWrapper = styled.div<{
export const TableWrapper = styled.div.attrs<{
className?: string;
"data-testid"?: string;
}>((props) => ({
className: props.className,
"data-testid": props["data-testid"],
}))<{
$style: TableStyleType;
$headerStyle: TableHeaderStyleType;
$toolbarStyle: TableToolbarStyleType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ export type CustomColumnType<RecordType> = ColumnType<RecordType> & {
style: TableColumnStyleType;
linkStyle: TableColumnLinkStyleType;
cellColorFn: CellColorViewType;
columnClassName?: string;
columnDataTestId?: string;
};

/**
Expand Down Expand Up @@ -400,6 +402,8 @@ export function columnsToAntdFormat(
align: column.align,
width: column.autoWidth === "auto" ? 0 : column.width,
fixed: column.fixed === "close" ? false : column.fixed,
columnClassName: column.className,
columnDataTestId: column.dataTestId,
style: {
background: column.background,
margin: column.margin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export const columnChildrenMap = {
align: HorizontalAlignmentControl,
tempHide: stateComp<boolean>(false),
fixed: dropdownControl(columnFixOptions, "close"),
// identifiers
className: StringControl,
dataTestId: StringControl,
background: withDefault(ColorControl, ""),
margin: withDefault(RadiusControl, ""),
text: withDefault(ColorControl, ""),
Expand Down Expand Up @@ -163,6 +166,11 @@ const StyledFontFamilyIcon = styled(FontFamilyIcon)` width: 24px; margin: 0 8px
const StyledTextWeightIcon = styled(TextWeightIcon)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`;
const StyledBackgroundImageIcon = styled(ImageCompIcon)` width: 24px; margin: 0 0px 0 -12px;`;

const SectionHeading = styled.div`
font-weight: bold;
margin-bottom: 8px;
`;

/**
* export for test.
* Put it here temporarily to avoid circular dependencies
Expand Down Expand Up @@ -285,11 +293,7 @@ const ColumnPropertyView = React.memo(({
{(columnType === 'link' || columnType === 'links') && (
<>
<Divider style={{ margin: '12px 0' }} />
{controlItem({}, (
<div>
<b>{"Link Style"}</b>
</div>
))}
<SectionHeading>Link Style</SectionHeading>
{comp.children.linkColor.propertyView({
label: trans('text') // trans('style.background'),
})}
Expand All @@ -302,11 +306,7 @@ const ColumnPropertyView = React.memo(({
</>
)}
<Divider style={{ margin: '12px 0' }} />
{controlItem({}, (
<div>
<b>{"Column Style"}</b>
</div>
))}
<SectionHeading>Column Style</SectionHeading>
{comp.children.background.propertyView({
label: trans('style.background'),
})}
Expand Down Expand Up @@ -348,6 +348,14 @@ const ColumnPropertyView = React.memo(({
})}
{comp.children.textOverflow.getPropertyView()}
{comp.children.cellColor.getPropertyView()}
<Divider style={{ margin: '12px 0' }} />
<SectionHeading>Identifiers</SectionHeading>
{comp.children.className.propertyView({
label: trans("prop.className"),
})}
{comp.children.dataTestId.propertyView({
label: trans("prop.dataTestId"),
})}
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ import React, {
onClick: () => onCellClick(col.titleText, String(col.dataIndex)),
loading: customLoading,
customAlign: col.align,
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
},
[
Expand Down Expand Up @@ -135,6 +137,8 @@ import React, {
) => {
handleResizeStop(size.width, index, col.onWidthResize);
},
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
},
[viewModeResizable, handleResize, handleResizeStop]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ function ResizeableTableComp<RecordType extends object>(
onClick: () => onCellClick(col.titleText, String(col.dataIndex)),
loading: customLoading,
customAlign: col.align,
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
},
[
Expand Down Expand Up @@ -138,6 +140,8 @@ function ResizeableTableComp<RecordType extends object>(
) => {
handleResizeStop(size.width, index, col.onWidthResize);
},
className: col.columnClassName,
'data-testid': col.columnDataTestId,
});
},
[viewModeResizable, handleResize, handleResizeStop]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import styled from 'styled-components';
import SimpleBar from 'simplebar-react';
// import 'simplebar-react/dist/simplebar.min.css';

const MainContainer = styled.div<{
const MainContainer = styled.div.attrs<{
className?: string;
"data-testid"?: string;
}>((props) => ({
className: props.className,
"data-testid": props["data-testid"],
}))<{
$mode: 'AUTO' | 'FIXED';
$showHorizontalScrollbar: boolean;
$showVerticalScrollbar: boolean;
Expand Down Expand Up @@ -114,6 +120,8 @@ interface TableContainerProps {
showVerticalScrollbar: boolean;
showHorizontalScrollbar: boolean;
virtual: boolean;
className?: string;
dataTestId?: string;
}

export const TableContainer: React.FC<TableContainerProps> = ({
Expand All @@ -126,7 +134,9 @@ export const TableContainer: React.FC<TableContainerProps> = ({
containerRef,
showVerticalScrollbar,
showHorizontalScrollbar,
virtual
virtual,
className,
dataTestId
}) => {
return (
<MainContainer
Expand All @@ -135,6 +145,8 @@ export const TableContainer: React.FC<TableContainerProps> = ({
$showHorizontalScrollbar={showHorizontalScrollbar}
$showVerticalScrollbar={showVerticalScrollbar}
$virtual={virtual}
className={className}
data-testid={dataTestId}
>
{/* Sticky above toolbar - always visible */}
{stickyToolbar && toolbarPosition === 'above' && showToolbar && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const TableCompView = React.memo((props: {
const headerStyle = compChildren.headerStyle.getView();
const toolbarStyle = compChildren.toolbarStyle.getView();
const showHRowGridBorder = compChildren.showHRowGridBorder.getView();
const className = compChildren.className.getView();
const dataTestId = compChildren.dataTestId.getView();
const columns = useMemo(() => compChildren.columns.getView(), [compChildren.columns]);
const columnViews = useMemo(() => columns.map((c) => c.getView()), [columns]);
const data = comp.filterData;
Expand Down Expand Up @@ -185,6 +187,8 @@ export const TableCompView = React.memo((props: {
showHorizontalScrollbar={compChildren.showHorizontalScrollbar.getView()}
virtual={virtualization.enabled}
containerRef={containerRef}
className={className}
dataTestId={dataTestId}
>
<EmptyContent text={trans("table.emptyColumns")} />
</TableContainer>
Expand All @@ -206,6 +210,8 @@ export const TableCompView = React.memo((props: {
showVerticalScrollbar={compChildren.showVerticalScrollbar.getView()}
showHorizontalScrollbar={compChildren.showHorizontalScrollbar.getView()}
virtual={virtualization.enabled}
className={className}
dataTestId={dataTestId}
>

<TableRenderer<any>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
tooltip: trans("table.dynamicColumnConfigDesc"),
})}
</Section>

<Section name={trans("prop.component")}>
{comp.children.className.propertyView({ label: trans("prop.className") })}
{comp.children.dataTestId.propertyView({ label: trans("prop.dataTestId") })}
</Section>
</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ export type CustomColumnType<RecordType> = ColumnType<RecordType> & {
style: TableColumnStyleType;
linkStyle: TableColumnLinkStyleType;
cellColorFn: CellColorViewType;
columnClassName?: string;
columnDataTestId?: string;
};

/**
Expand Down Expand Up @@ -539,6 +541,8 @@ export function columnsToAntdFormat(
fixed: column.fixed === "close" ? false : column.fixed,
style,
linkStyle,
columnClassName: column.className,
columnDataTestId: column.dataTestId,
cellColorFn: column.cellColor,
onWidthResize: column.onWidthResize,
render: buildRenderFn(
Expand Down
Loading