[RAC] Expand cell footer button changes to prevent overflow (#110506)
* fix hover actions tooltip footer buttons overflow * reorder actions * override eui styles to match popover actions design
This commit is contained in:
parent
b74345cbb7
commit
e9c20f9802
|
@ -31,6 +31,15 @@ export const AppGlobalStyle = createGlobalStyle<{ theme: { eui: { euiColorPrimar
|
|||
z-index: 9950 !important;
|
||||
}
|
||||
|
||||
/*
|
||||
overrides the default styling of EuiDataGrid expand popover footer to
|
||||
make it a column of actions instead of the default actions row
|
||||
*/
|
||||
.euiDataGridRowCell__popover .euiPopoverFooter .euiFlexGroup {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/*
|
||||
overrides the default styling of euiComboBoxOptionsList because it's implemented
|
||||
as a popover, so it's not selectable as a child of the styled component
|
||||
|
|
|
@ -116,6 +116,36 @@ export const defaultCellActions: TGridCellAction[] = [
|
|||
fieldName: columnId,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{timelines.getHoverActions().getCopyButton({
|
||||
Component,
|
||||
field: columnId,
|
||||
isHoverAction: false,
|
||||
ownFocus: false,
|
||||
showTooltip: false,
|
||||
value,
|
||||
})}
|
||||
</>
|
||||
);
|
||||
},
|
||||
({ data, pageSize }: { data: TimelineNonEcsData[][]; pageSize: number }) => ({
|
||||
rowIndex,
|
||||
columnId,
|
||||
Component,
|
||||
}) => {
|
||||
const { timelines } = useKibanaServices();
|
||||
|
||||
const pageRowIndex = getPageRowIndex(rowIndex, pageSize);
|
||||
if (pageRowIndex >= data.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const value = getMappedNonEcsValue({
|
||||
data: data[pageRowIndex],
|
||||
fieldName: columnId,
|
||||
});
|
||||
|
||||
const dataProvider: DataProvider[] = useMemo(
|
||||
() =>
|
||||
value?.map((x) => ({
|
||||
|
@ -170,58 +200,30 @@ export const defaultCellActions: TGridCellAction[] = [
|
|||
fieldName: columnId,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{allowTopN({
|
||||
const showButton = useMemo(
|
||||
() =>
|
||||
allowTopN({
|
||||
browserField: getAllFieldsByName(browserFields)[columnId],
|
||||
fieldName: columnId,
|
||||
hideTopN: false,
|
||||
}) && (
|
||||
<ShowTopNButton
|
||||
Component={Component}
|
||||
enablePopOver
|
||||
data-test-subj="hover-actions-show-top-n"
|
||||
field={columnId}
|
||||
onClick={onClick}
|
||||
onFilterAdded={onFilterAdded}
|
||||
ownFocus={false}
|
||||
showTopN={showTopN}
|
||||
showTooltip={false}
|
||||
timelineId={timelineId}
|
||||
value={value}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
}),
|
||||
[columnId]
|
||||
);
|
||||
},
|
||||
({ data, pageSize }: { data: TimelineNonEcsData[][]; pageSize: number }) => ({
|
||||
rowIndex,
|
||||
columnId,
|
||||
Component,
|
||||
}) => {
|
||||
const { timelines } = useKibanaServices();
|
||||
|
||||
const pageRowIndex = getPageRowIndex(rowIndex, pageSize);
|
||||
if (pageRowIndex >= data.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const value = getMappedNonEcsValue({
|
||||
data: data[pageRowIndex],
|
||||
fieldName: columnId,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{timelines.getHoverActions().getCopyButton({
|
||||
Component,
|
||||
field: columnId,
|
||||
isHoverAction: false,
|
||||
ownFocus: false,
|
||||
showTooltip: false,
|
||||
value,
|
||||
})}
|
||||
</>
|
||||
);
|
||||
return showButton ? (
|
||||
<ShowTopNButton
|
||||
Component={Component}
|
||||
enablePopOver
|
||||
data-test-subj="hover-actions-show-top-n"
|
||||
field={columnId}
|
||||
onClick={onClick}
|
||||
onFilterAdded={onFilterAdded}
|
||||
ownFocus={false}
|
||||
showTopN={showTopN}
|
||||
showTooltip={false}
|
||||
timelineId={timelineId}
|
||||
value={value}
|
||||
/>
|
||||
) : null;
|
||||
},
|
||||
];
|
||||
|
|
|
@ -69,8 +69,8 @@ const CopyButton: React.FC<CopyProps> = React.memo(
|
|||
<Component
|
||||
aria-label={COPY_TO_CLIPBOARD}
|
||||
data-test-subj="copy-to-clipboard"
|
||||
icon="copyClipboard"
|
||||
iconType="copyClipboard"
|
||||
icon="copy"
|
||||
iconType="copy"
|
||||
onClick={handleOnClick}
|
||||
title={COPY_TO_CLIPBOARD}
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue