@databiosphere/findable-ui 15.0.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +13 -0
  3. package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +3 -3
  4. package/lib/components/Detail/components/Table/table.js +7 -2
  5. package/lib/components/Export/components/ExportForm/exportForm.styles.js +1 -3
  6. package/lib/components/Layout/components/ContentLayout/contentLayout.d.ts +2 -2
  7. package/lib/components/Layout/components/ContentLayout/contentLayout.js +1 -1
  8. package/lib/components/Layout/components/ContentLayout/contentLayout.styles.d.ts +1 -0
  9. package/lib/components/Layout/components/ContentLayout/contentLayout.styles.js +11 -4
  10. package/lib/components/Table/common/columnDef.d.ts +2 -0
  11. package/lib/components/Table/common/columnDef.js +17 -0
  12. package/lib/components/Table/common/gridTable.styles.js +1 -2
  13. package/lib/components/Table/components/TableCell/common/utils.d.ts +9 -3
  14. package/lib/components/Table/components/TableCell/common/utils.js +16 -2
  15. package/lib/components/Table/components/TableCell/components/RowPositionCell/constants.d.ts +2 -0
  16. package/lib/components/Table/components/TableCell/components/RowPositionCell/constants.js +5 -0
  17. package/lib/components/Table/components/TableCell/components/RowPositionCell/rowPositionCell.d.ts +3 -0
  18. package/lib/components/Table/components/TableCell/components/RowPositionCell/rowPositionCell.js +6 -0
  19. package/lib/components/Table/components/TableHead/tableHead.js +3 -3
  20. package/lib/components/Table/components/TableRows/tableRows.js +3 -3
  21. package/lib/components/Table/features/RowPosition/constants.d.ts +2 -0
  22. package/lib/components/Table/features/RowPosition/constants.js +17 -0
  23. package/lib/components/Table/features/RowPosition/types.d.ts +3 -0
  24. package/lib/components/Table/features/RowPosition/types.js +1 -0
  25. package/lib/components/Table/features/RowPosition/utils.d.ts +21 -0
  26. package/lib/components/Table/features/RowPosition/utils.js +55 -0
  27. package/lib/components/Table/features/constants.d.ts +6 -0
  28. package/lib/components/Table/features/constants.js +8 -0
  29. package/lib/components/Table/features/entities.d.ts +2 -1
  30. package/lib/components/Table/table.d.ts +4 -2
  31. package/lib/components/Table/table.js +21 -3
  32. package/lib/components/TableCreator/common/constants.d.ts +1 -0
  33. package/lib/components/TableCreator/common/constants.js +1 -0
  34. package/lib/components/TableCreator/tableCreator.d.ts +3 -2
  35. package/lib/components/TableCreator/tableCreator.js +5 -2
  36. package/lib/components/common/Breadcrumbs/breadcrumbs.js +2 -1
  37. package/lib/components/common/Breadcrumbs/constants.d.ts +2 -0
  38. package/lib/components/common/Breadcrumbs/constants.js +4 -0
  39. package/lib/config/entities.d.ts +5 -3
  40. package/lib/providers/exploreState/initializer/utils.js +3 -1
  41. package/lib/styles/common/mui/link.d.ts +7 -0
  42. package/lib/styles/common/mui/link.js +8 -0
  43. package/lib/styles/common/mui/tableCell.d.ts +13 -0
  44. package/lib/styles/common/mui/tableCell.js +27 -0
  45. package/lib/styles/common/mui/typography.d.ts +2 -0
  46. package/lib/styles/common/mui/typography.js +3 -0
  47. package/lib/theme/common/components.d.ts +0 -6
  48. package/lib/theme/common/components.js +0 -31
  49. package/lib/theme/components/index.d.ts +1 -0
  50. package/lib/theme/components/index.js +1 -0
  51. package/lib/theme/components/muiTableCell.d.ts +2 -0
  52. package/lib/theme/components/muiTableCell.js +48 -0
  53. package/lib/theme/theme.js +1 -1
  54. package/lib/views/ContentView/contentView.d.ts +2 -1
  55. package/lib/views/ContentView/contentView.js +2 -2
  56. package/lib/views/ExploreView/exploreView.js +2 -2
  57. package/package.json +1 -1
  58. package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +8 -4
  59. package/src/components/Detail/components/Table/table.tsx +7 -2
  60. package/src/components/Export/components/ExportForm/exportForm.styles.ts +1 -7
  61. package/src/components/Layout/components/ContentLayout/contentLayout.styles.ts +13 -4
  62. package/src/components/Layout/components/ContentLayout/contentLayout.tsx +7 -3
  63. package/src/components/Table/common/columnDef.ts +19 -0
  64. package/src/components/Table/common/gridTable.styles.ts +1 -2
  65. package/src/components/Table/components/TableCell/common/utils.ts +22 -5
  66. package/src/components/Table/components/TableCell/components/RowPositionCell/constants.ts +7 -0
  67. package/src/components/Table/components/TableCell/components/RowPositionCell/rowPositionCell.tsx +16 -0
  68. package/src/components/Table/components/TableHead/tableHead.tsx +8 -4
  69. package/src/components/Table/components/TableRows/tableRows.tsx +8 -4
  70. package/src/components/Table/features/RowPosition/constants.ts +34 -0
  71. package/src/components/Table/features/RowPosition/types.ts +3 -0
  72. package/src/components/Table/features/RowPosition/utils.ts +80 -0
  73. package/src/components/Table/features/constants.ts +10 -0
  74. package/src/components/Table/features/entities.ts +2 -1
  75. package/src/components/Table/table.tsx +24 -3
  76. package/src/components/TableCreator/common/constants.ts +1 -0
  77. package/src/components/TableCreator/tableCreator.tsx +11 -1
  78. package/src/components/common/Breadcrumbs/breadcrumbs.tsx +2 -1
  79. package/src/components/common/Breadcrumbs/constants.ts +6 -0
  80. package/src/config/entities.ts +12 -3
  81. package/src/providers/exploreState/initializer/utils.ts +6 -1
  82. package/src/styles/common/mui/link.ts +15 -0
  83. package/src/styles/common/mui/tableCell.ts +40 -0
  84. package/src/styles/common/mui/typography.ts +5 -0
  85. package/src/theme/common/components.ts +0 -32
  86. package/src/theme/components/index.ts +1 -0
  87. package/src/theme/components/muiTableCell.ts +50 -0
  88. package/src/theme/theme.ts +1 -1
  89. package/src/views/ContentView/contentView.tsx +4 -1
  90. package/src/views/ExploreView/exploreView.tsx +2 -1
  91. package/types/data-explorer-ui.d.ts +2 -0
@@ -0,0 +1,80 @@
1
+ import {
2
+ InitialTableState,
3
+ RowData,
4
+ RowModel,
5
+ Table,
6
+ TableState,
7
+ } from "@tanstack/react-table";
8
+ import { ACCESSOR_KEYS } from "../../../TableCreator/common/constants";
9
+ import { DEFAULT_PAGINATION } from "../constants";
10
+
11
+ /**
12
+ * Returns row model, with getter for row position.
13
+ * @param table - Table.
14
+ * @param getRowModel - Table getRowModel function.
15
+ * @returns row model.
16
+ */
17
+ export function getRowModel<T extends RowData>(
18
+ table: Table<T>,
19
+ getRowModel: Table<T>[`getRowModel`]
20
+ ): RowModel<T> {
21
+ const rowModel = getRowModel();
22
+ rowModel.rows.forEach(({ id }, i) => {
23
+ rowModel.rowsById[id].getRowPosition = (): number =>
24
+ calculateRowPosition(table, i);
25
+ });
26
+ return rowModel;
27
+ }
28
+
29
+ /**
30
+ * Returns the position of the row in the table.
31
+ * @param rowId - Row ID.
32
+ * @param table - Table.
33
+ * @returns row position.
34
+ */
35
+ export function getRowPosition<T extends RowData>(
36
+ rowId: string,
37
+ table: Table<T>
38
+ ): number {
39
+ const { getRowModel } = table;
40
+ const { rowsById } = getRowModel();
41
+ return rowsById[rowId].getRowPosition();
42
+ }
43
+
44
+ /**
45
+ * Calculates the position of the row in the table.
46
+ * @param table - Table.
47
+ * @param index - Row index.
48
+ * @returns row position.
49
+ */
50
+ function calculateRowPosition<T extends RowData>(
51
+ table: Table<T>,
52
+ index: number
53
+ ): number {
54
+ const { getState } = table;
55
+ const {
56
+ pagination: { pageIndex, pageSize },
57
+ } = getState();
58
+ return pageIndex * pageSize + (index + 1);
59
+ }
60
+
61
+ /**
62
+ * Returns the initial table state.
63
+ * @param initialState - Initial state.
64
+ * @returns initial state.
65
+ */
66
+ export function initInitialState(
67
+ initialState?: InitialTableState
68
+ ): Partial<TableState> {
69
+ return {
70
+ ...initialState,
71
+ columnVisibility: {
72
+ [ACCESSOR_KEYS.ROW_POSITION]: false,
73
+ ...initialState?.columnVisibility,
74
+ },
75
+ pagination: {
76
+ ...DEFAULT_PAGINATION,
77
+ ...initialState?.pagination,
78
+ },
79
+ };
80
+ }
@@ -0,0 +1,10 @@
1
+ import { PaginationState } from "@tanstack/react-table";
2
+
3
+ /**
4
+ * Default TanStack pagination state.
5
+ * See https://tanstack.com/table/latest/docs/guide/custom-features#getinitialstate.
6
+ */
7
+ export const DEFAULT_PAGINATION: PaginationState = {
8
+ pageIndex: 0,
9
+ pageSize: 10,
10
+ };
@@ -1,4 +1,5 @@
1
1
  import { RowData } from "@tanstack/react-table";
2
+ import { RowPositionRow } from "./RowPosition/types";
2
3
  import {
3
4
  RowPreviewInstance,
4
5
  RowPreviewOptions,
@@ -9,5 +10,5 @@ import {
9
10
  export type CustomFeatureInitialTableState = Partial<RowPreviewTableState>;
10
11
  export type CustomFeatureInstance<T extends RowData> = RowPreviewInstance<T>;
11
12
  export type CustomFeatureOptions = RowPreviewOptions;
12
- export type CustomFeatureRow = RowPreviewRow;
13
+ export type CustomFeatureRow = RowPositionRow & RowPreviewRow;
13
14
  export type CustomFeatureTableState = RowPreviewTableState;
@@ -24,7 +24,7 @@ import {
24
24
  PAGINATION_DIRECTION,
25
25
  SORT_DIRECTION,
26
26
  } from "../../common/analytics/entities";
27
- import { ListViewConfig } from "../../config/entities";
27
+ import { ListConfig, ListViewConfig } from "../../config/entities";
28
28
  import {
29
29
  BREAKPOINT_FN_NAME,
30
30
  useBreakpointHelper,
@@ -49,6 +49,7 @@ import { Pagination as DXPagination } from "./components/Pagination/pagination";
49
49
  import { TableBody } from "./components/TableBody/tableBody";
50
50
  import { TableHead } from "./components/TableHead/tableHead";
51
51
  import { TableToolbar } from "./components/TableToolbar/tableToolbar";
52
+ import { ROW_POSITION } from "./features/RowPosition/constants";
52
53
  import { ROW_PREVIEW } from "./features/RowPreview/constants";
53
54
  import { RowPreviewState } from "./features/RowPreview/entities";
54
55
  import { GridTable } from "./table.styles";
@@ -60,6 +61,7 @@ export interface TableProps<T extends RowData> {
60
61
  items: T[];
61
62
  listView?: ListViewConfig;
62
63
  loading?: boolean;
64
+ tableOptions?: ListConfig<T>["tableOptions"];
63
65
  }
64
66
 
65
67
  /**
@@ -72,6 +74,7 @@ export interface TableProps<T extends RowData> {
72
74
  * @param tableProps.initialState - Initial table state.
73
75
  * @param tableProps.items - Row data to display.
74
76
  * @param tableProps.listView - List view configuration.
77
+ * @param tableProps.tableOptions - TanStack table options.
75
78
  * @returns Configured table element for display.
76
79
  */
77
80
  export const TableComponent = <T extends RowData>({
@@ -80,6 +83,7 @@ export const TableComponent = <T extends RowData>({
80
83
  initialState,
81
84
  items,
82
85
  listView,
86
+ tableOptions,
83
87
  }: // eslint-disable-next-line sonarjs/cognitive-complexity -- TODO fix component length / complexity
84
88
  TableProps<T>): JSX.Element => {
85
89
  const tabletDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, TABLET);
@@ -154,8 +158,24 @@ TableProps<T>): JSX.Element => {
154
158
  rowSelection,
155
159
  sorting,
156
160
  };
161
+ /**
162
+ * TODO: Refactor `ListConfig` to follow the API patterns of the TanStack Table library.
163
+ * TODO: Update `ColumnConfig` to follow the `ColumnDef` API of TanStack Table.
164
+ * - Standardize column definitions to leverage the full power of TanStack Table's feature set and improve compatibility.
165
+ * TODO: Deprecate the following properties:
166
+ * - `defaultSort` in `ListConfig`: Replace this with TanStack Table's `tableOptions.initialState.sorting` feature.
167
+ * - `columnVisible` in `ColumnConfig`: Replace this with TanStack Table's `tableOptions.initialState.columnVisibility` feature.
168
+ * TODO: Define `columnVisibility` and `sorting` directly within `ListConfig` via the `tableOptions.initialState` property.
169
+ * - This will simplify the configuration structure and centralize table state definitions, reducing redundancy and improving clarity.
170
+ * - It will also allow for direct configuration of other TanStack Table options such as `columnOrder` via `tableOptions.initialState.columnOrder`.
171
+ *
172
+ * Current Workaround:
173
+ * - The `initialState` property from `tableOptions` is destructured to separate it from other options. This allows the remaining properties in `tableOptions` to be passed directly to the TanStack Table configuration without breaking the current ListConfig `defaultSort` and `columnVisible` properties.
174
+ */
175
+ const { initialState: _initialState, ...restTableOptions } =
176
+ tableOptions ?? {};
157
177
  const tableInstance = useReactTable({
158
- _features: [ROW_PREVIEW],
178
+ _features: [ROW_POSITION, ROW_PREVIEW],
159
179
  columns,
160
180
  data: items,
161
181
  enableColumnFilters: true, // client-side filtering.
@@ -174,7 +194,7 @@ TableProps<T>): JSX.Element => {
174
194
  getPaginationRowModel: getPaginationRowModel(),
175
195
  getRowId,
176
196
  getSortedRowModel: clientFiltering ? getSortedRowModel() : undefined,
177
- initialState,
197
+ initialState: { ...initialState, ..._initialState }, // `sorting` and `columnVisibility` are managed by the ExploreState.
178
198
  manualPagination: true,
179
199
  manualSorting: !clientFiltering,
180
200
  onColumnVisibilityChange,
@@ -183,6 +203,7 @@ TableProps<T>): JSX.Element => {
183
203
  onSortingChange,
184
204
  pageCount,
185
205
  state,
206
+ ...restTableOptions,
186
207
  });
187
208
  const {
188
209
  getAllColumns,
@@ -3,6 +3,7 @@ import { RowSelectionCell } from "../../Table/components/TableCell/components/Ro
3
3
  import { BaseColumnConfig } from "./entities";
4
4
 
5
5
  export const ACCESSOR_KEYS = {
6
+ ROW_POSITION: "rowPosition",
6
7
  SELECT: "select",
7
8
  };
8
9
 
@@ -7,10 +7,15 @@ import {
7
7
  RowData,
8
8
  } from "@tanstack/react-table";
9
9
  import React, { useMemo } from "react";
10
- import { ColumnConfig, ListViewConfig } from "../../config/entities";
10
+ import {
11
+ ColumnConfig,
12
+ ListConfig,
13
+ ListViewConfig,
14
+ } from "../../config/entities";
11
15
  import { PAPER_PANEL_STYLE } from "../common/Paper/paper";
12
16
  import { ComponentCreator } from "../ComponentCreator/ComponentCreator";
13
17
  import { Loading } from "../Loading/loading";
18
+ import { COLUMN_DEF } from "../Table/common/columnDef";
14
19
  import {
15
20
  arrIncludesSome,
16
21
  getInitialState,
@@ -30,6 +35,7 @@ export interface TableCreatorProps<T> {
30
35
  items: T[];
31
36
  listView?: ListViewConfig;
32
37
  loading?: boolean;
38
+ tableOptions?: ListConfig<T>["tableOptions"];
33
39
  }
34
40
 
35
41
  const createCell = <T extends RowData = RowData, TData = unknown>(
@@ -62,6 +68,7 @@ export const TableCreator = <T extends RowData>({
62
68
  items,
63
69
  listView,
64
70
  loading,
71
+ tableOptions,
65
72
  }: TableCreatorProps<T>): JSX.Element => {
66
73
  const columnDefs: ColumnDef<T>[] = useMemo(
67
74
  () =>
@@ -76,6 +83,8 @@ export const TableCreator = <T extends RowData>({
76
83
  return acc;
77
84
  },
78
85
  [
86
+ /* Initialize column definitions with the "row position" column */
87
+ COLUMN_DEF.ROW_POSITION,
79
88
  /* Initialize column definitions with the "select" column */
80
89
  {
81
90
  ...buildBaseColumnDef(COLUMN_CONFIGS.SELECT),
@@ -101,6 +110,7 @@ export const TableCreator = <T extends RowData>({
101
110
  items={items}
102
111
  listView={listView}
103
112
  loading={loading}
113
+ tableOptions={tableOptions}
104
114
  />
105
115
  </TableCreatorContainer>
106
116
  );
@@ -3,6 +3,7 @@ import { Link, Breadcrumbs as MBreadcrumbs, Typography } from "@mui/material";
3
3
  import NLink from "next/link";
4
4
  import React, { ReactNode } from "react";
5
5
  import { BaseComponentProps } from "../../types";
6
+ import { LINK_PROPS } from "./constants";
6
7
 
7
8
  export interface Breadcrumb {
8
9
  path: string;
@@ -25,7 +26,7 @@ export const Breadcrumbs = ({
25
26
  <MBreadcrumbs className={className} separator={Separator}>
26
27
  {breadcrumbs.map(({ path, text }, b) =>
27
28
  path ? (
28
- <Link component={NLink} key={b} href={path}>
29
+ <Link {...LINK_PROPS} component={NLink} key={b} href={path}>
29
30
  {text}
30
31
  </Link>
31
32
  ) : (
@@ -0,0 +1,6 @@
1
+ import { LinkProps } from "@mui/material";
2
+ import { LINK_PROPS as MUI_LINK_PROPS } from "../../../styles/common/mui/link";
3
+
4
+ export const LINK_PROPS: Partial<LinkProps> = {
5
+ underline: MUI_LINK_PROPS.UNDERLINE.HOVER,
6
+ };
@@ -1,5 +1,12 @@
1
1
  import { TabProps as MTabProps, Theme, ThemeOptions } from "@mui/material";
2
- import { CellContext, ColumnSort, RowData, Table } from "@tanstack/react-table";
2
+ import {
3
+ CellContext,
4
+ ColumnMeta,
5
+ ColumnSort,
6
+ RowData,
7
+ Table,
8
+ TableOptions,
9
+ } from "@tanstack/react-table";
3
10
  import { JSXElementConstructor, ReactNode } from "react";
4
11
  import { SelectCategoryValueView, SelectedFilter } from "../common/entities";
5
12
  import { HeroTitle } from "../components/common/Title/title";
@@ -94,6 +101,7 @@ export interface ColumnConfig<
94
101
  disableSorting?: boolean; // Disables sorting for the column.
95
102
  header: string;
96
103
  id: string; // The unique identifier for the column.
104
+ meta?: ColumnMeta<T, unknown>;
97
105
  tooltip?: string; // TODO review need to define `tooltip` field - it is currently not in use.
98
106
  width: GridTrackSize;
99
107
  }
@@ -161,7 +169,7 @@ export interface EntityConfig<T = any, I = any> extends TabConfig {
161
169
  explorerTitle?: SiteConfig["explorerTitle"];
162
170
  getId?: GetIdFunction<T>;
163
171
  getTitle?: GetTitleFunction<T>;
164
- list: ListConfig;
172
+ list: ListConfig<T>;
165
173
  listView?: ListViewConfig;
166
174
  options?: Options;
167
175
  overrides?: Override[];
@@ -249,9 +257,10 @@ export type GridTrackSize =
249
257
  * List configuration.
250
258
  */
251
259
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- This config model can receive any model as type
252
- export interface ListConfig<T = any> {
260
+ export interface ListConfig<T extends RowData> {
253
261
  columns: ColumnConfig<T>[];
254
262
  defaultSort?: ColumnSort; // Establishes initial table state "sorting" state.
263
+ tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">; // Additional TanStack Table's options.
255
264
  }
256
265
 
257
266
  /**
@@ -143,12 +143,17 @@ function initCategoryGroups(
143
143
  */
144
144
  function initColumnVisibility(entityConfig: EntityConfig): VisibilityState {
145
145
  const {
146
- list: { columns },
146
+ list: {
147
+ columns,
148
+ tableOptions: { initialState: { columnVisibility = {} } = {} } = {},
149
+ },
147
150
  listView: { enableRowSelection = false } = {},
148
151
  } = entityConfig;
149
152
  return {
153
+ [ACCESSOR_KEYS.ROW_POSITION]: false, // Explicitly setting row position to false; required - currently `columnVisibilty` is initialized from columns configuration.
150
154
  [ACCESSOR_KEYS.SELECT]: enableRowSelection,
151
155
  ...getInitialTableColumnVisibility(columns),
156
+ ...columnVisibility, // `columnVisibility` is managed by ExploreState; use table options to override this setting.
152
157
  };
153
158
  }
154
159
 
@@ -0,0 +1,15 @@
1
+ import { LinkProps } from "@mui/material";
2
+
3
+ type LinkPropsOptions = {
4
+ UNDERLINE: typeof UNDERLINE;
5
+ };
6
+
7
+ export const UNDERLINE: Record<string, LinkProps["underline"]> = {
8
+ ALWAYS: "always",
9
+ HOVER: "hover",
10
+ NONE: "none",
11
+ };
12
+
13
+ export const LINK_PROPS: LinkPropsOptions = {
14
+ UNDERLINE,
15
+ };
@@ -0,0 +1,40 @@
1
+ import { TableCellProps } from "@mui/material";
2
+
3
+ type TableCellPropsOptions = {
4
+ ALIGN: typeof ALIGN;
5
+ PADDING: typeof PADDING;
6
+ SIZE: typeof SIZE;
7
+ VARIANT: typeof VARIANT;
8
+ };
9
+
10
+ const ALIGN: Record<string, TableCellProps["align"]> = {
11
+ CENTER: "center",
12
+ INHERIT: "inherit",
13
+ JUSTIFY: "justify",
14
+ LEFT: "left",
15
+ RIGHT: "right",
16
+ };
17
+
18
+ const PADDING: Record<string, TableCellProps["padding"]> = {
19
+ CHECKBOX: "checkbox",
20
+ NONE: "none",
21
+ NORMAL: "normal",
22
+ };
23
+
24
+ const SIZE: Record<string, TableCellProps["size"]> = {
25
+ MEDIUM: "medium",
26
+ SMALL: "small",
27
+ };
28
+
29
+ const VARIANT: Record<string, TableCellProps["variant"]> = {
30
+ BODY: "body",
31
+ FOOTER: "footer",
32
+ HEAD: "head",
33
+ };
34
+
35
+ export const TABLE_CELL_PROPS: TableCellPropsOptions = {
36
+ ALIGN,
37
+ PADDING,
38
+ SIZE,
39
+ VARIANT,
40
+ };
@@ -0,0 +1,5 @@
1
+ import { TypographyOwnProps } from "@mui/material";
2
+
3
+ export const VARIANT: Record<string, TypographyOwnProps["variant"]> = {
4
+ INHERIT: "inherit",
5
+ };
@@ -1302,38 +1302,6 @@ export const MuiTab = (theme: Theme): Components["MuiTab"] => {
1302
1302
  };
1303
1303
  };
1304
1304
 
1305
- /**
1306
- * MuiTableCell Component
1307
- * @param theme - Theme.
1308
- * @returns MuiTableCell component theme styles.
1309
- */
1310
- export const MuiTableCell = (theme: Theme): Components["MuiTableCell"] => {
1311
- return {
1312
- styleOverrides: {
1313
- body: {
1314
- ...theme.typography[TEXT_BODY_400],
1315
- },
1316
- head: {
1317
- ...theme.typography[TEXT_BODY_SMALL_500],
1318
- padding: "20px",
1319
- },
1320
- paddingCheckbox: {
1321
- paddingRight: 0,
1322
- width: "unset",
1323
- },
1324
- root: {
1325
- padding: "18px 20px",
1326
- },
1327
- sizeSmall: {
1328
- padding: "14px 20px",
1329
- },
1330
- stickyHeader: {
1331
- boxShadow: `0 1px 0 ${theme.palette.smoke.main}`,
1332
- },
1333
- },
1334
- };
1335
- };
1336
-
1337
1305
  /**
1338
1306
  * MuiTableSortLabel Component
1339
1307
  */
@@ -1,2 +1,3 @@
1
1
  export { MuiAlert } from "./muiAlert";
2
2
  export { MuiAlertTitle } from "./muiAlertTitle";
3
+ export { MuiTableCell } from "./muiTableCell";
@@ -0,0 +1,50 @@
1
+ import { Components, Theme } from "@mui/material";
2
+ import { TABLE_CELL_PROPS } from "../../styles/common/mui/tableCell";
3
+ import { TEXT_BODY_400, TEXT_BODY_SMALL_500 } from "../common/typography";
4
+
5
+ export const MuiTableCell = (theme: Theme): Components["MuiTableCell"] => {
6
+ const paletteSmoke = theme.palette.smoke;
7
+ const typography = theme.typography;
8
+ return {
9
+ defaultProps: {},
10
+ styleOverrides: {
11
+ root: {
12
+ minHeight: 56,
13
+ stickyHeader: {
14
+ boxShadow: `0 1px 0 ${paletteSmoke.main}`,
15
+ },
16
+ variants: [
17
+ {
18
+ props: { size: TABLE_CELL_PROPS.SIZE.MEDIUM },
19
+ style: { padding: "10px 16px" },
20
+ },
21
+ {
22
+ props: { size: TABLE_CELL_PROPS.SIZE.SMALL },
23
+ style: { padding: "8px 16px" },
24
+ },
25
+ {
26
+ props: { padding: TABLE_CELL_PROPS.PADDING.CHECKBOX },
27
+ style: { paddingRight: 0, width: "unset" },
28
+ },
29
+ {
30
+ props: { padding: TABLE_CELL_PROPS.PADDING.NONE },
31
+ style: { padding: 0 },
32
+ },
33
+ {
34
+ props: { variant: TABLE_CELL_PROPS.VARIANT.BODY },
35
+ style: {
36
+ ...typography[TEXT_BODY_400],
37
+ },
38
+ },
39
+ {
40
+ props: { variant: TABLE_CELL_PROPS.VARIANT.HEAD },
41
+ style: {
42
+ ...typography[TEXT_BODY_SMALL_500],
43
+ backgroundColor: paletteSmoke.lightest,
44
+ },
45
+ },
46
+ ],
47
+ },
48
+ },
49
+ };
50
+ };
@@ -107,7 +107,7 @@ export function createAppTheme(customOptions?: ThemeOptions): Theme {
107
107
  MuiSelect: C.MuiSelect,
108
108
  MuiSvgIcon: C.MuiSvgIcon(theme),
109
109
  MuiTab: C.MuiTab(theme),
110
- MuiTableCell: C.MuiTableCell(theme),
110
+ MuiTableCell: M.MuiTableCell(theme),
111
111
  MuiTableSortLabel: C.MuiTableSortLabel,
112
112
  MuiTabs: C.MuiTabs(theme),
113
113
  MuiToggleButton: C.MuiToggleButton(theme),
@@ -1,6 +1,7 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import { LayoutStyle } from "../../components/Layout/components/ContentLayout/common/entities";
3
3
  import { ContentLayout } from "../../components/Layout/components/ContentLayout/contentLayout";
4
+ import { BaseComponentProps } from "../../components/types";
4
5
 
5
6
  export interface ContentViewProps {
6
7
  content: ReactNode;
@@ -10,13 +11,15 @@ export interface ContentViewProps {
10
11
  }
11
12
 
12
13
  export const ContentView = ({
14
+ className,
13
15
  content,
14
16
  layoutStyle,
15
17
  navigation,
16
18
  outline,
17
- }: ContentViewProps): JSX.Element => {
19
+ }: BaseComponentProps & ContentViewProps): JSX.Element => {
18
20
  return (
19
21
  <ContentLayout
22
+ className={className}
20
23
  content={content}
21
24
  layoutStyle={layoutStyle}
22
25
  navigation={navigation}
@@ -248,7 +248,7 @@ function renderList(
248
248
  ): JSX.Element {
249
249
  const { listItems, loading, tabValue } = exploreState;
250
250
  const { getId: getRowId, list, listView } = entityConfig;
251
- const { columns: columnsConfig, defaultSort } = list;
251
+ const { columns: columnsConfig, defaultSort, tableOptions } = list;
252
252
 
253
253
  if (!exploreState || !tabValue) {
254
254
  return <></>; //TODO: return the loading UI component
@@ -268,6 +268,7 @@ function renderList(
268
268
  items={listItems ?? []}
269
269
  listView={listView}
270
270
  loading={loading}
271
+ tableOptions={tableOptions}
271
272
  />
272
273
  );
273
274
  }
@@ -11,6 +11,7 @@ import type {} from "@mui/material/styles/createPalette";
11
11
  import { PaletteColorOptions } from "@mui/material/styles/createPalette";
12
12
  import { TypographyStyleOptions } from "@mui/material/styles/createTypography";
13
13
  import type {} from "@mui/material/SvgIcon";
14
+ import type {} from "@mui/material/TableCell";
14
15
  import type {} from "@mui/material/Tabs";
15
16
  import type {} from "@mui/material/Toolbar";
16
17
  import type {} from "@mui/material/Typography";
@@ -266,6 +267,7 @@ declare module "@emotion/react" {
266
267
  declare module "@tanstack/react-table" {
267
268
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TData and TValue are unused variables.
268
269
  interface ColumnMeta<TData extends RowData, TValue> {
270
+ align?: TableCellProps["align"];
269
271
  columnPinned?: boolean;
270
272
  enableSortingInteraction?: boolean; // Flag to enable sorting interaction UI (e.g. sort icon) button; defaults to true.
271
273
  header?: string;