Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Migrate AuditTableVisualization to a typed function component (#78196)

Andrei Chernykh628eee6db4db
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx
deleted file mode 100644
index efbe7609109..00000000000
--- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx
+++ /dev/null
@@ -1,246 +0,0 @@
-import cx from "classnames";
-import PropTypes from "prop-types";
-import { Component } from "react";
-import { t } from "ttag";
-import _ from "underscore";
-
-import NoResults from "assets/img/no_results.svg";
-import { EmptyState } from "metabase/common/components/EmptyState";
-import AdminS from "metabase/css/admin.module.css";
-import CS from "metabase/css/core/index.css";
-import { Box, Checkbox, Icon } from "metabase/ui";
-import { displayNameForColumn } from "metabase/utils/formatting";
-import { registerVisualization } from "metabase/visualizations/index";
-import { formatValue } from "metabase/visualizations/lib/formatting";
-import { isColumnRightAligned } from "metabase/visualizations/lib/table";
-import { Table } from "metabase/visualizations/visualizations/Table/Table";
-
-import { getColumnName, getRowValuesByColumns } from "../../lib/mode";
-
-import S from "./AuditTableVisualization.module.css";
-
-const propTypes = {
- series: PropTypes.array,
- visualizationIsClickable: PropTypes.func,
- onVisualizationClick: PropTypes.func,
- onSortingChange: PropTypes.func,
- onRemoveRow: PropTypes.func,
- settings: PropTypes.object,
- isSortable: PropTypes.bool,
- sorting: PropTypes.shape({
- column: PropTypes.string.isRequired,
- isAscending: PropTypes.bool.isRequired,
- }),
- isSelectable: PropTypes.bool,
- rowChecked: PropTypes.object,
- onAllSelectClick: PropTypes.func,
- onRowSelectClick: PropTypes.func,
-};
-
-const ROW_ID_IDX = 0;
-
-export class AuditTableVisualization extends Component {
- static identifier = "audit-table";
- static noHeader = true;
- static hidden = true;
- static getUiName = () => "Audit Table";
-
- // copy Table's settings and columnSettings
- static settings = Table.settings;
- static columnSettings = Table.columnSettings;
-
- state = {
- rerender: {},
- };
-
- constructor(props) {
- super(props);
- }
-
- handleColumnHeaderClick = (column) => {
- const { isSortable, onSortingChange, sorting } = this.props;
-
- if (!isSortable || !onSortingChange) {
- return;
- }
-
- const columnName = getColumnName(column);
-
- onSortingChange({
- column: columnName,
- isAscending: columnName !== sorting.column || !sorting.isAscending,
- });
- };
-
- handleAllSelectClick = (e, rows) => {
- const { onAllSelectClick } = this.props;
- this.setState({ rerender: {} });
- onAllSelectClick({ ...e, rows });
- };
-
- handleRowSelectClick = (e, row, rowIndex) => {
- const { onRowSelectClick } = this.props;
- this.setState({ rerender: {} });
- onRowSelectClick({ ...e, row: row, rowIndex: rowIndex });
- };
-
- handleRemoveRowClick = (row, cols) => {
- const rowData = getRowValuesByColumns(row, cols);
- this.props.onRemoveRow(rowData);
- };
-
- render() {
- const {
- series: [
- {
- data: { cols, rows },
- },
- ],
- sorting,
- visualizationIsClickable,
- onVisualizationClick,
- settings,
- isSortable,
- isSelectable,
- rowChecked,
- } = this.props;
-
- const columnIndexes = settings["table.columns"]
- .filter(({ enabled }) => enabled)
- .map(({ name }) => _.findIndex(cols, (col) => col.name === name));
-
- if (rows.length === 0) {
- return (
- <EmptyState
- title={t`No results`}
- illustrationElement={<img src={NoResults} />}
- />
- );
- }
-
- return (
- <table className={AdminS.ContentTable}>
- <thead>
- <tr>
- {isSelectable && (
- <th>
- <Checkbox
- size="sm"
- checked={Object.values(rowChecked).some((elem) => elem)}
- onChange={(e) => this.handleAllSelectClick(e, rows)}
- />
- </th>
- )}
- {columnIndexes.map((colIndex) => {
- const column = cols[colIndex];
- const isSortedByColumn =
- sorting && sorting.column === getColumnName(column);
-
- return (
- <Box
- component="th"
- key={colIndex}
- className={cx(S.headerCell, {
- [S.sortable]: isSortable,
- [S.sortedByColumn]: isSortedByColumn,
- [S.rightAligned]: isColumnRightAligned(column),
- })}
- onClick={() => this.handleColumnHeaderClick(column)}
- >
- {displayNameForColumn(cols[colIndex])}
- {isSortedByColumn && (
- <Icon
- className={CS.ml1}
- name={sorting.isAscending ? "chevronup" : "chevrondown"}
- size={10}
- />
- )}
- </Box>
- );
- })}
- </tr>
- </thead>
- <tbody>
- {rows.map((row, rowIndex) => (
- <tr key={rowIndex}>
- {isSelectable && (
- <td>
- <Checkbox
- size="sm"
- checked={rowChecked[row[ROW_ID_IDX]] || false}
- onChange={(e) =>
- this.handleRowSelectClick(
- { ...e, originRow: rowIndex },
- row,
- rowIndex,
- )
- }
- />
- </td>
- )}
-
- {columnIndexes.map((colIndex) => {
- const value = row[colIndex];
- const column = cols[colIndex];
- const clicked = { column, value, origin: { row, cols } };
- const clickable = onVisualizationClick != null;
- const columnSettings = {
- ...settings.column(column),
- ...settings["table.columns"][colIndex],
- };
-
- const handleClick = () => {
- if (
- onVisualizationClick &&
- visualizationIsClickable(clicked)
- ) {
- onVisualizationClick(clicked);
- }
- };
-
- return (
- <Box
- component="td"
- key={colIndex}
- className={cx({
- [S.clickable]: clickable,
- [S.rightAligned]: isColumnRightAligned(column),
- })}
- onClick={handleClick}
- >
- <div
- className={cx({
- [cx(
- CS.rounded,
- CS.p1,
- CS.textDark,
- CS.textMonospace,
- CS.textSmall,
- CS.bgLight,
- )]: column["code"],
- })}
- >
- {formatValue(value, {
- ...columnSettings,
- type: "cell",
- jsx: true,
- rich: true,
- clicked: clicked,
- // always show timestamps in local time for the audit app
- local: true,
- })}
- </div>
- </Box>
- );
- })}
- </tr>
- ))}
- </tbody>
- </table>
- );
- }
-}
-
-AuditTableVisualization.propTypes = propTypes;
-
-registerVisualization(AuditTableVisualization);
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.tsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.tsx
new file mode 100644
index 00000000000..9308fc19789
--- /dev/null
+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.tsx
@@ -0,0 +1,229 @@
+import cx from "classnames";
+import { t } from "ttag";
+
+import NoResults from "assets/img/no_results.svg";
+import { EmptyState } from "metabase/common/components/EmptyState";
+import AdminS from "metabase/css/admin.module.css";
+import CS from "metabase/css/core/index.css";
+import { Box, Checkbox, Icon } from "metabase/ui";
+import { displayNameForColumn } from "metabase/utils/formatting";
+import { registerVisualization } from "metabase/visualizations/index";
+import { formatValue } from "metabase/visualizations/lib/formatting";
+import { isColumnRightAligned } from "metabase/visualizations/lib/table";
+import type {
+ AuditTableSorting,
+ ComputedVisualizationSettings,
+ VisualizationDefinition,
+} from "metabase/visualizations/types";
+import { TABLE_DEFINITION } from "metabase/visualizations/visualizations/Table/definition";
+import type { ClickObject } from "metabase-lib";
+import type { DatasetColumn, RowValues, Series } from "metabase-types/api";
+
+import S from "./AuditTableVisualization.module.css";
+
+const ROW_ID_IDX = 0;
+
+const getColumnName = (column: DatasetColumn) =>
+ column.remapped_to || column.name;
+
+// audit queries mark native query text columns with a custom `code` flag
+type AuditDatasetColumn = DatasetColumn & {
+ code?: boolean;
+};
+
+interface AuditTableVisualizationProps {
+ series: Series;
+ settings: ComputedVisualizationSettings;
+ visualizationIsClickable: (clicked: ClickObject | null) => boolean;
+ onVisualizationClick: (clicked: ClickObject | null) => void;
+ isSortable?: boolean;
+ sorting?: AuditTableSorting;
+ onSortingChange?: (sorting: AuditTableSorting) => void;
+ isSelectable?: boolean;
+ rowChecked?: Record<string, boolean>;
+ onAllSelectClick?: (event: { rows: RowValues[] }) => void;
+ onRowSelectClick?: (event: { row: RowValues; rowIndex: number }) => void;
+}
+
+function AuditTableVisualizationInner({
+ series,
+ settings,
+ visualizationIsClickable,
+ onVisualizationClick,
+ isSortable,
+ sorting,
+ onSortingChange,
+ isSelectable,
+ rowChecked = {},
+ onAllSelectClick,
+ onRowSelectClick,
+}: AuditTableVisualizationProps) {
+ const [
+ {
+ data: { cols, rows },
+ },
+ ] = series;
+
+ const handleColumnHeaderClick = (column: DatasetColumn): void => {
+ if (!isSortable || !onSortingChange) {
+ return;
+ }
+
+ const columnName = getColumnName(column);
+
+ onSortingChange({
+ column: columnName,
+ isAscending: columnName !== sorting?.column || !sorting?.isAscending,
+ });
+ };
+
+ const tableColumnSettings = settings["table.columns"] ?? [];
+ const columnIndexes = tableColumnSettings
+ .filter(({ enabled }) => enabled)
+ .map(({ name }) => cols.findIndex((col) => col.name === name));
+
+ if (rows.length === 0) {
+ return (
+ <EmptyState
+ title={t`No results`}
+ illustrationElement={<img src={NoResults} />}
+ />
+ );
+ }
+
+ return (
+ <table className={AdminS.ContentTable}>
+ <thead>
+ <tr>
+ {isSelectable && (
+ <th>
+ <Checkbox
+ size="sm"
+ checked={Object.values(rowChecked).some((elem) => elem)}
+ onChange={() => onAllSelectClick?.({ rows })}
+ />
+ </th>
+ )}
+ {columnIndexes.map((colIndex) => {
+ const column = cols[colIndex];
+ const columnName = getColumnName(column);
+ const isSortedByColumn =
+ sorting != null && sorting.column === columnName;
+
+ return (
+ <Box
+ component="th"
+ key={colIndex}
+ className={cx(S.headerCell, {
+ [S.sortable]: isSortable,
+ [S.sortedByColumn]: isSortedByColumn,
+ [S.rightAligned]: isColumnRightAligned(column),
+ })}
+ onClick={() => handleColumnHeaderClick(column)}
+ >
+ {displayNameForColumn(column)}
+ {isSortedByColumn && (
+ <Icon
+ className={CS.ml1}
+ name={sorting.isAscending ? "chevronup" : "chevrondown"}
+ size={10}
+ />
+ )}
+ </Box>
+ );
+ })}
+ </tr>
+ </thead>
+ <tbody>
+ {rows.map((row, rowIndex) => (
+ <tr key={rowIndex}>
+ {isSelectable && (
+ <td>
+ <Checkbox
+ size="sm"
+ checked={rowChecked[String(row[ROW_ID_IDX])] ?? false}
+ onChange={() => onRowSelectClick?.({ row, rowIndex })}
+ />
+ </td>
+ )}
+
+ {columnIndexes.map((colIndex) => {
+ const value = row[colIndex];
+ const column: AuditDatasetColumn = cols[colIndex];
+ const clicked: ClickObject = {
+ column,
+ value,
+ origin: { row, cols },
+ };
+ const columnSettings = {
+ ...settings.column?.(column),
+ ...tableColumnSettings[colIndex],
+ };
+
+ const handleCellClick = () => {
+ if (visualizationIsClickable(clicked)) {
+ onVisualizationClick(clicked);
+ }
+ };
+
+ return (
+ <Box
+ component="td"
+ key={colIndex}
+ className={cx(S.clickable, {
+ [S.rightAligned]: isColumnRightAligned(column),
+ })}
+ onClick={handleCellClick}
+ >
+ <div
+ className={cx({
+ [cx(
+ CS.rounded,
+ CS.p1,
+ CS.textDark,
+ CS.textMonospace,
+ CS.textSmall,
+ CS.bgLight,
+ )]: column.code,
+ })}
+ >
+ {formatValue(value, {
+ ...columnSettings,
+ type: "cell",
+ jsx: true,
+ rich: true,
+ clicked: clicked,
+ // always show timestamps in local time for the audit app
+ local: true,
+ })}
+ </div>
+ </Box>
+ );
+ })}
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ );
+}
+
+const AuditTableVisualizationDef: VisualizationDefinition = {
+ getUiName: () => "Audit Table",
+ identifier: "audit-table",
+ iconName: "table2",
+ noHeader: true,
+ hidden: true,
+ // reuse Table's settings and columnSettings
+ settings: TABLE_DEFINITION.settings,
+ columnSettings: TABLE_DEFINITION.columnSettings,
+ checkRenderable: () => {
+ // audit table can always be rendered
+ },
+};
+
+export const AuditTableVisualization = Object.assign(
+ AuditTableVisualizationInner,
+ AuditTableVisualizationDef,
+);
+
+registerVisualization(AuditTableVisualization);
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.unit.spec.tsx
new file mode 100644
index 00000000000..a100559440c
--- /dev/null
+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.unit.spec.tsx
@@ -0,0 +1,196 @@
+import userEvent from "@testing-library/user-event";
+import type { ComponentProps } from "react";
+
+import { renderWithProviders, screen } from "__support__/ui";
+import { delay } from "__support__/utils";
+import Visualization from "metabase/visualizations/components/Visualization";
+import type { ComputedVisualizationSettings } from "metabase/visualizations/types";
+import type { RowValues, Series } from "metabase-types/api";
+import {
+ createMockColumn,
+ createMockSingleSeries,
+} from "metabase-types/api/mocks";
+
+import { AuditTableVisualization } from "./AuditTableVisualization";
+
+const CARD_ID_COLUMN = createMockColumn({
+ name: "card_id",
+ display_name: "Card ID",
+ base_type: "type/Integer",
+});
+
+const NAME_COLUMN = createMockColumn({
+ name: "name",
+ display_name: "Name",
+ base_type: "type/Text",
+});
+
+const DEFAULT_ROWS: RowValues[] = [
+ [1, "First question"],
+ [2, "Second question"],
+];
+
+const DEFAULT_SETTINGS: ComputedVisualizationSettings = {
+ "table.columns": [
+ { name: "card_id", enabled: true },
+ { name: "name", enabled: true },
+ ],
+ column: () => ({}),
+};
+
+type SetupOpts = Partial<ComponentProps<typeof AuditTableVisualization>> & {
+ rows?: RowValues[];
+};
+
+const setup = ({
+ rows = DEFAULT_ROWS,
+ settings = DEFAULT_SETTINGS,
+ ...props
+}: SetupOpts = {}) => {
+ const series: Series = [
+ createMockSingleSeries(
+ {},
+ { data: { cols: [CARD_ID_COLUMN, NAME_COLUMN], rows } },
+ ),
+ ];
+
+ const visualizationIsClickable = jest.fn().mockReturnValue(false);
+ const onVisualizationClick = jest.fn();
+
+ renderWithProviders(
+ <AuditTableVisualization
+ series={series}
+ settings={settings}
+ visualizationIsClickable={visualizationIsClickable}
+ onVisualizationClick={onVisualizationClick}
+ {...props}
+ />,
+ );
+
+ return { visualizationIsClickable, onVisualizationClick };
+};
+
+describe("AuditTableVisualization", () => {
+ it("renders enabled columns and cell values", () => {
+ setup();
+
+ expect(screen.getByText("Card ID")).toBeInTheDocument();
+ expect(screen.getByText("Name")).toBeInTheDocument();
+ expect(screen.getByText("First question")).toBeInTheDocument();
+ expect(screen.getByText("Second question")).toBeInTheDocument();
+ });
+
+ it("does not render disabled columns", () => {
+ setup({
+ settings: {
+ ...DEFAULT_SETTINGS,
+ "table.columns": [
+ { name: "card_id", enabled: false },
+ { name: "name", enabled: true },
+ ],
+ },
+ });
+
+ expect(screen.queryByText("Card ID")).not.toBeInTheDocument();
+ expect(screen.getByText("Name")).toBeInTheDocument();
+ });
+
+ it("renders an empty state when there are no rows", () => {
+ setup({ rows: [] });
+
+ expect(screen.getByText("No results")).toBeInTheDocument();
+ });
+
+ it("renders row checkboxes and reports selection clicks", async () => {
+ const onAllSelectClick = jest.fn();
+ const onRowSelectClick = jest.fn();
+ setup({
+ isSelectable: true,
+ rowChecked: { "1": true },
+ onAllSelectClick,
+ onRowSelectClick,
+ });
+
+ const [allCheckbox, firstRowCheckbox, secondRowCheckbox] =
+ screen.getAllByRole("checkbox");
+ expect(firstRowCheckbox).toBeChecked();
+ expect(secondRowCheckbox).not.toBeChecked();
+
+ await userEvent.click(secondRowCheckbox);
+ expect(onRowSelectClick).toHaveBeenCalledWith({
+ row: [2, "Second question"],
+ rowIndex: 1,
+ });
+
+ await userEvent.click(allCheckbox);
+ expect(onAllSelectClick).toHaveBeenCalledWith({ rows: DEFAULT_ROWS });
+ });
+
+ it("shows the sort direction on the sorted column and reports header clicks", async () => {
+ const onSortingChange = jest.fn();
+ setup({
+ isSortable: true,
+ sorting: { column: "card_id", isAscending: true },
+ onSortingChange,
+ });
+
+ expect(screen.getByLabelText("chevronup icon")).toBeInTheDocument();
+
+ await userEvent.click(screen.getByText("Name"));
+ expect(onSortingChange).toHaveBeenCalledWith({
+ column: "name",
+ isAscending: true,
+ });
+
+ await userEvent.click(screen.getByText("Card ID"));
+ expect(onSortingChange).toHaveBeenCalledWith({
+ column: "card_id",
+ isAscending: false,
+ });
+ });
+
+ it("reports clicks on clickable cells", async () => {
+ const { visualizationIsClickable, onVisualizationClick } = setup();
+ visualizationIsClickable.mockReturnValue(true);
+
+ await userEvent.click(screen.getByText("First question"));
+
+ expect(onVisualizationClick).toHaveBeenCalledWith(
+ expect.objectContaining({
+ column: NAME_COLUMN,
+ value: "First question",
+ }),
+ );
+ });
+
+ describe("when rendered through Visualization", () => {
+ it("receives the sorting props forwarded by Visualization", async () => {
+ const onSortingChange = jest.fn();
+ const rawSeries = [
+ createMockSingleSeries(
+ { display: "audit-table" },
+ { data: { cols: [CARD_ID_COLUMN, NAME_COLUMN], rows: DEFAULT_ROWS } },
+ ),
+ ];
+
+ renderWithProviders(
+ <Visualization
+ rawSeries={rawSeries}
+ isSortable
+ sorting={{ column: "card_id", isAscending: true }}
+ onSortingChange={onSortingChange}
+ />,
+ );
+ // the visualization isn't rendered until ExplicitSize measures it
+ await delay(0);
+
+ expect(screen.getByLabelText("chevronup icon")).toBeInTheDocument();
+
+ await userEvent.click(screen.getByText("Name"));
+ expect(onSortingChange).toHaveBeenCalledWith({
+ column: "name",
+ isAscending: true,
+ });
+ });
+ });
+});
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js b/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js
index 1521e676664..77c8e1193b3 100644
--- a/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js
+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js
@@ -2,18 +2,9 @@ import _ from "underscore";
import { push } from "metabase/router";
-export const getColumnName = (column) => column.remapped_to || column.name;
+const getColumnName = (column) => column.remapped_to || column.name;
-export const getRowValuesByColumns = (row, cols) =>
- cols.reduce((acc, col, index) => {
- const columnName = getColumnName(col);
- return {
- ...acc,
- [columnName]: row[index],
- };
- }, {});
-
-export const columnNameToUrl = {
+const columnNameToUrl = {
// No admin page for collections but still want to link to it
collection_id: (value) => `/collection/${value}`,
user_id: (value) => `/admin/audit/member/${value}`,
diff --git a/frontend/src/metabase-types/api/visualization.ts b/frontend/src/metabase-types/api/visualization.ts
index 0a6107d76ac..a719b8df3d8 100644
--- a/frontend/src/metabase-types/api/visualization.ts
+++ b/frontend/src/metabase-types/api/visualization.ts
@@ -55,7 +55,9 @@ export type QueryVisualizationDisplayType =
export type VisualizationDisplay =
| VirtualCardDisplay
- | QueryVisualizationDisplayType;
+ | QueryVisualizationDisplayType
+ // internal-only display registered by the audit app, not saveable on cards
+ | "audit-table";
export type TimeseriesDisplayType = Extract<
CardDisplayType,
diff --git a/frontend/src/metabase/metabot/utils/chart-analysis.ts b/frontend/src/metabase/metabot/utils/chart-analysis.ts
index 949646d080f..ab5a647fcfb 100644
--- a/frontend/src/metabase/metabot/utils/chart-analysis.ts
+++ b/frontend/src/metabase/metabot/utils/chart-analysis.ts
@@ -23,6 +23,7 @@ const CHART_ANALYSIS_ENABLED = {
waterfall: true,
// disabled
action: false,
+ "audit-table": false,
heading: false,
iframe: false,
link: false,
diff --git a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
index 502d5697535..06a67006954 100644
--- a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
+++ b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
@@ -714,6 +714,9 @@ class Visualization extends PureComponent<
rowChecked,
onAllSelectClick,
onRowSelectClick,
+ isSortable,
+ sorting,
+ onSortingChange,
visualizerRawSeries,
renderEmptyMessage,
renderLoadingView = LoadingView,
@@ -1016,6 +1019,9 @@ class Visualization extends PureComponent<
rowChecked={rowChecked}
onAllSelectClick={onAllSelectClick}
onRowSelectClick={onRowSelectClick}
+ isSortable={isSortable}
+ sorting={sorting}
+ onSortingChange={onSortingChange}
/>
</VisualizationRenderedWrapper>
{hasDevWatermark && <Watermark card={series[0].card} />}
diff --git a/frontend/src/metabase/visualizations/types/visualization.ts b/frontend/src/metabase/visualizations/types/visualization.ts
index 49dce7d3a17..ee17b365333 100644
--- a/frontend/src/metabase/visualizations/types/visualization.ts
+++ b/frontend/src/metabase/visualizations/types/visualization.ts
@@ -276,9 +276,17 @@ export type VisualizationPassThroughProps = {
* Props used for Audit Table visualization
*/
isSelectable?: boolean;
- rowChecked?: [];
- onAllSelectClick?: () => void;
- onRowSelectClick?: () => void;
+ rowChecked?: Record<string, boolean>;
+ onAllSelectClick?: (event: { rows: RowValues[] }) => void;
+ onRowSelectClick?: (event: { row: RowValues; rowIndex: number }) => void;
+ isSortable?: boolean;
+ sorting?: AuditTableSorting;
+ onSortingChange?: (sorting: AuditTableSorting) => void;
+};
+
+export type AuditTableSorting = {
+ column: string;
+ isAscending: boolean;
};
export type ColumnSettingDefinition<TValue, TProps = unknown> = {