Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ OverrideCellData.args = {
</div>
),
description: (props) => <em>{props.value}</em>,
hideColumns: ["createdDateTime"],
Comment thread
leo-belanger marked this conversation as resolved.
Outdated
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from "react";
import { useMemo } from "react";
import { CellProps } from "react-table";

import { IModelCellOverrides, IModelFull } from "../../types";
import { IModelCellColumn, IModelCellOverrides, IModelFull } from "../../types";
import {
_buildManagedContextMenuOptions,
ContextMenuBuilderItem,
Expand Down Expand Up @@ -52,7 +52,7 @@ export const useIModelTableConfig = ({
Header: "Table",
columns: [
{
id: "name",
id: IModelCellColumn.Name,
Header: strings.tableColumnName,
accessor: "name",
maxWidth: 350,
Expand All @@ -65,7 +65,7 @@ export const useIModelTableConfig = ({
),
},
{
id: "description",
id: IModelCellColumn.Description,
Header: strings.tableColumnDescription,
accessor: "description",
disableSortBy: true,
Expand All @@ -80,7 +80,7 @@ export const useIModelTableConfig = ({
),
},
{
id: "createdDateTime",
id: IModelCellColumn.CreatedDateTime,
Header: strings.tableColumnLastModified,
accessor: "createdDateTime",
maxWidth: 350,
Expand All @@ -94,7 +94,7 @@ export const useIModelTableConfig = ({
},
},
{
id: "options",
id: IModelCellColumn.Options,
disableSortBy: true,
maxWidth: 65,
Cell: (props: CellProps<IModelFull>) => {
Expand Down Expand Up @@ -130,7 +130,7 @@ export const useIModelTableConfig = ({
) : null;
},
},
],
].filter(({ id }) => !cellOverrides.hideColumns?.includes(id)),
},
],
[
Expand Down
8 changes: 8 additions & 0 deletions packages/modules/imodel-browser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ export type ViewType = "tile" | "cells";
// Remove this IModelViewType with next major release i.e 2.0
export type IModelViewType = ViewType;

/* Supported IModel cell columns */
export enum IModelCellColumn {
Name = "name",
Description = "description",
CreatedDateTime = "createdDateTime",
Options = "options",
}
export type IModelCellOverrides = {
name?: (cellData: CellProps<IModelFull>) => React.ReactNode;
description?: (cellData: CellProps<IModelFull>) => React.ReactNode;
createdDateTime?: (cellData: CellProps<IModelFull>) => React.ReactNode;
hideColumns?: IModelCellColumn[];
};

export type ITwinCellOverrides = {
Expand Down
Loading