@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
@@ -1,5 +1,5 @@
1
1
  import { TabProps as MTabProps, Theme, ThemeOptions } from "@mui/material";
2
- import { CellContext, ColumnSort, RowData, Table } from "@tanstack/react-table";
2
+ import { CellContext, ColumnMeta, ColumnSort, RowData, Table, TableOptions } from "@tanstack/react-table";
3
3
  import { JSXElementConstructor, ReactNode } from "react";
4
4
  import { SelectCategoryValueView, SelectedFilter } from "../common/entities";
5
5
  import { HeroTitle } from "../components/common/Title/title";
@@ -79,6 +79,7 @@ export interface ColumnConfig<T = any, C extends keyof JSX.IntrinsicElements | J
79
79
  disableSorting?: boolean;
80
80
  header: string;
81
81
  id: string;
82
+ meta?: ColumnMeta<T, unknown>;
82
83
  tooltip?: string;
83
84
  width: GridTrackSize;
84
85
  }
@@ -130,7 +131,7 @@ export interface EntityConfig<T = any, I = any> extends TabConfig {
130
131
  explorerTitle?: SiteConfig["explorerTitle"];
131
132
  getId?: GetIdFunction<T>;
132
133
  getTitle?: GetTitleFunction<T>;
133
- list: ListConfig;
134
+ list: ListConfig<T>;
134
135
  listView?: ListViewConfig;
135
136
  options?: Options;
136
137
  overrides?: Override[];
@@ -200,9 +201,10 @@ export type GridTrackSize = GridTrackAuto | GridTrackLength | GridTrackFlex | Gr
200
201
  /**
201
202
  * List configuration.
202
203
  */
203
- export interface ListConfig<T = any> {
204
+ export interface ListConfig<T extends RowData> {
204
205
  columns: ColumnConfig<T>[];
205
206
  defaultSort?: ColumnSort;
207
+ tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
206
208
  }
207
209
  /**
208
210
  * List view configuration.
@@ -95,10 +95,12 @@ function initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupCo
95
95
  * @returns column visibility.
96
96
  */
97
97
  function initColumnVisibility(entityConfig) {
98
- const { list: { columns }, listView: { enableRowSelection = false } = {}, } = entityConfig;
98
+ const { list: { columns, tableOptions: { initialState: { columnVisibility = {} } = {} } = {}, }, listView: { enableRowSelection = false } = {}, } = entityConfig;
99
99
  return {
100
+ [ACCESSOR_KEYS.ROW_POSITION]: false, // Explicitly setting row position to false; required - currently `columnVisibilty` is initialized from columns configuration.
100
101
  [ACCESSOR_KEYS.SELECT]: enableRowSelection,
101
102
  ...getInitialTableColumnVisibility(columns),
103
+ ...columnVisibility, // `columnVisibility` is managed by ExploreState; use table options to override this setting.
102
104
  };
103
105
  }
104
106
  /**
@@ -0,0 +1,7 @@
1
+ import { LinkProps } from "@mui/material";
2
+ type LinkPropsOptions = {
3
+ UNDERLINE: typeof UNDERLINE;
4
+ };
5
+ export declare const UNDERLINE: Record<string, LinkProps["underline"]>;
6
+ export declare const LINK_PROPS: LinkPropsOptions;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ export const UNDERLINE = {
2
+ ALWAYS: "always",
3
+ HOVER: "hover",
4
+ NONE: "none",
5
+ };
6
+ export const LINK_PROPS = {
7
+ UNDERLINE,
8
+ };
@@ -0,0 +1,13 @@
1
+ import { TableCellProps } from "@mui/material";
2
+ type TableCellPropsOptions = {
3
+ ALIGN: typeof ALIGN;
4
+ PADDING: typeof PADDING;
5
+ SIZE: typeof SIZE;
6
+ VARIANT: typeof VARIANT;
7
+ };
8
+ declare const ALIGN: Record<string, TableCellProps["align"]>;
9
+ declare const PADDING: Record<string, TableCellProps["padding"]>;
10
+ declare const SIZE: Record<string, TableCellProps["size"]>;
11
+ declare const VARIANT: Record<string, TableCellProps["variant"]>;
12
+ export declare const TABLE_CELL_PROPS: TableCellPropsOptions;
13
+ export {};
@@ -0,0 +1,27 @@
1
+ const ALIGN = {
2
+ CENTER: "center",
3
+ INHERIT: "inherit",
4
+ JUSTIFY: "justify",
5
+ LEFT: "left",
6
+ RIGHT: "right",
7
+ };
8
+ const PADDING = {
9
+ CHECKBOX: "checkbox",
10
+ NONE: "none",
11
+ NORMAL: "normal",
12
+ };
13
+ const SIZE = {
14
+ MEDIUM: "medium",
15
+ SMALL: "small",
16
+ };
17
+ const VARIANT = {
18
+ BODY: "body",
19
+ FOOTER: "footer",
20
+ HEAD: "head",
21
+ };
22
+ export const TABLE_CELL_PROPS = {
23
+ ALIGN,
24
+ PADDING,
25
+ SIZE,
26
+ VARIANT,
27
+ };
@@ -0,0 +1,2 @@
1
+ import { TypographyOwnProps } from "@mui/material";
2
+ export declare const VARIANT: Record<string, TypographyOwnProps["variant"]>;
@@ -0,0 +1,3 @@
1
+ export const VARIANT = {
2
+ INHERIT: "inherit",
3
+ };
@@ -195,12 +195,6 @@ export declare const MuiSvgIcon: (theme: Theme) => Components["MuiSvgIcon"];
195
195
  * @returns MuiTab component theme styles.
196
196
  */
197
197
  export declare const MuiTab: (theme: Theme) => Components["MuiTab"];
198
- /**
199
- * MuiTableCell Component
200
- * @param theme - Theme.
201
- * @returns MuiTableCell component theme styles.
202
- */
203
- export declare const MuiTableCell: (theme: Theme) => Components["MuiTableCell"];
204
198
  /**
205
199
  * MuiTableSortLabel Component
206
200
  */
@@ -1233,37 +1233,6 @@ export const MuiTab = (theme) => {
1233
1233
  },
1234
1234
  };
1235
1235
  };
1236
- /**
1237
- * MuiTableCell Component
1238
- * @param theme - Theme.
1239
- * @returns MuiTableCell component theme styles.
1240
- */
1241
- export const MuiTableCell = (theme) => {
1242
- return {
1243
- styleOverrides: {
1244
- body: {
1245
- ...theme.typography[TEXT_BODY_400],
1246
- },
1247
- head: {
1248
- ...theme.typography[TEXT_BODY_SMALL_500],
1249
- padding: "20px",
1250
- },
1251
- paddingCheckbox: {
1252
- paddingRight: 0,
1253
- width: "unset",
1254
- },
1255
- root: {
1256
- padding: "18px 20px",
1257
- },
1258
- sizeSmall: {
1259
- padding: "14px 20px",
1260
- },
1261
- stickyHeader: {
1262
- boxShadow: `0 1px 0 ${theme.palette.smoke.main}`,
1263
- },
1264
- },
1265
- };
1266
- };
1267
1236
  /**
1268
1237
  * MuiTableSortLabel Component
1269
1238
  */
@@ -1,2 +1,3 @@
1
1
  export { MuiAlert } from "./muiAlert";
2
2
  export { MuiAlertTitle } from "./muiAlertTitle";
3
+ export { MuiTableCell } from "./muiTableCell";
@@ -1,2 +1,3 @@
1
1
  export { MuiAlert } from "./muiAlert";
2
2
  export { MuiAlertTitle } from "./muiAlertTitle";
3
+ export { MuiTableCell } from "./muiTableCell";
@@ -0,0 +1,2 @@
1
+ import { Components, Theme } from "@mui/material";
2
+ export declare const MuiTableCell: (theme: Theme) => Components["MuiTableCell"];
@@ -0,0 +1,48 @@
1
+ import { TABLE_CELL_PROPS } from "../../styles/common/mui/tableCell";
2
+ import { TEXT_BODY_400, TEXT_BODY_SMALL_500 } from "../common/typography";
3
+ export const MuiTableCell = (theme) => {
4
+ const paletteSmoke = theme.palette.smoke;
5
+ const typography = theme.typography;
6
+ return {
7
+ defaultProps: {},
8
+ styleOverrides: {
9
+ root: {
10
+ minHeight: 56,
11
+ stickyHeader: {
12
+ boxShadow: `0 1px 0 ${paletteSmoke.main}`,
13
+ },
14
+ variants: [
15
+ {
16
+ props: { size: TABLE_CELL_PROPS.SIZE.MEDIUM },
17
+ style: { padding: "10px 16px" },
18
+ },
19
+ {
20
+ props: { size: TABLE_CELL_PROPS.SIZE.SMALL },
21
+ style: { padding: "8px 16px" },
22
+ },
23
+ {
24
+ props: { padding: TABLE_CELL_PROPS.PADDING.CHECKBOX },
25
+ style: { paddingRight: 0, width: "unset" },
26
+ },
27
+ {
28
+ props: { padding: TABLE_CELL_PROPS.PADDING.NONE },
29
+ style: { padding: 0 },
30
+ },
31
+ {
32
+ props: { variant: TABLE_CELL_PROPS.VARIANT.BODY },
33
+ style: {
34
+ ...typography[TEXT_BODY_400],
35
+ },
36
+ },
37
+ {
38
+ props: { variant: TABLE_CELL_PROPS.VARIANT.HEAD },
39
+ style: {
40
+ ...typography[TEXT_BODY_SMALL_500],
41
+ backgroundColor: paletteSmoke.lightest,
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ },
47
+ };
48
+ };
@@ -95,7 +95,7 @@ export function createAppTheme(customOptions) {
95
95
  MuiSelect: C.MuiSelect,
96
96
  MuiSvgIcon: C.MuiSvgIcon(theme),
97
97
  MuiTab: C.MuiTab(theme),
98
- MuiTableCell: C.MuiTableCell(theme),
98
+ MuiTableCell: M.MuiTableCell(theme),
99
99
  MuiTableSortLabel: C.MuiTableSortLabel,
100
100
  MuiTabs: C.MuiTabs(theme),
101
101
  MuiToggleButton: C.MuiToggleButton(theme),
@@ -1,9 +1,10 @@
1
1
  import { ReactNode } from "react";
2
2
  import { LayoutStyle } from "../../components/Layout/components/ContentLayout/common/entities";
3
+ import { BaseComponentProps } from "../../components/types";
3
4
  export interface ContentViewProps {
4
5
  content: ReactNode;
5
6
  layoutStyle?: LayoutStyle;
6
7
  navigation?: ReactNode;
7
8
  outline?: ReactNode;
8
9
  }
9
- export declare const ContentView: ({ content, layoutStyle, navigation, outline, }: ContentViewProps) => JSX.Element;
10
+ export declare const ContentView: ({ className, content, layoutStyle, navigation, outline, }: BaseComponentProps & ContentViewProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  import { ContentLayout } from "../../components/Layout/components/ContentLayout/contentLayout";
3
- export const ContentView = ({ content, layoutStyle, navigation, outline, }) => {
4
- return (React.createElement(ContentLayout, { content: content, layoutStyle: layoutStyle, navigation: navigation, outline: outline }));
3
+ export const ContentView = ({ className, content, layoutStyle, navigation, outline, }) => {
4
+ return (React.createElement(ContentLayout, { className: className, content: content, layoutStyle: layoutStyle, navigation: navigation, outline: outline }));
5
5
  };
@@ -152,7 +152,7 @@ function renderComponent(componentsConfig, response) {
152
152
  function renderList(exploreState, entityConfig, entityListType) {
153
153
  const { listItems, loading, tabValue } = exploreState;
154
154
  const { getId: getRowId, list, listView } = entityConfig;
155
- const { columns: columnsConfig, defaultSort } = list;
155
+ const { columns: columnsConfig, defaultSort, tableOptions } = list;
156
156
  if (!exploreState || !tabValue) {
157
157
  return React.createElement(React.Fragment, null); //TODO: return the loading UI component
158
158
  }
@@ -161,7 +161,7 @@ function renderList(exploreState, entityConfig, entityListType) {
161
161
  // loads with the previous tabs data on the first render after switching tabs. (or similar)
162
162
  return React.createElement(React.Fragment, null);
163
163
  }
164
- return (React.createElement(TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items: listItems ?? [], listView: listView, loading: loading }));
164
+ return (React.createElement(TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items: listItems ?? [], listView: listView, loading: loading, tableOptions: tableOptions }));
165
165
  }
166
166
  /**
167
167
  * Renders Summaries component when all the following requirements are fulfilled:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "15.0.2",
3
+ "version": "16.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -1,7 +1,10 @@
1
- import { TableCell as MTableCell } from "@mui/material";
1
+ import { TableCell } from "@mui/material";
2
2
  import { flexRender, Row, RowData, Table } from "@tanstack/react-table";
3
3
  import React, { Fragment } from "react";
4
- import { getTableCellPadding } from "../../../../../Table/components/TableCell/common/utils";
4
+ import {
5
+ getTableCellAlign,
6
+ getTableCellPadding,
7
+ } from "../../../../../Table/components/TableCell/common/utils";
5
8
  import { TableRow } from "../../../../../Table/components/TableRow/tableRow.styles";
6
9
  import { TableView } from "../../table";
7
10
 
@@ -31,13 +34,14 @@ export const TableRows = <T extends RowData>({
31
34
  if (cell.getIsAggregated()) return null; // Display of aggregated cells is currently not supported.
32
35
  if (cell.getIsPlaceholder()) return null; // Display of placeholder cells is currently not supported.
33
36
  return (
34
- <MTableCell
37
+ <TableCell
35
38
  key={cell.id}
39
+ align={getTableCellAlign(cell.column)}
36
40
  padding={getTableCellPadding(cell.column.id)}
37
41
  size={tableCellSize}
38
42
  >
39
43
  {flexRender(cell.column.columnDef.cell, cell.getContext())}
40
- </MTableCell>
44
+ </TableCell>
41
45
  );
42
46
  })}
43
47
  </TableRow>
@@ -17,8 +17,10 @@ import {
17
17
  useBreakpointHelper,
18
18
  } from "../../../../hooks/useBreakpointHelper";
19
19
  import { TABLET } from "../../../../theme/common/breakpoints";
20
+ import { COLUMN_DEF } from "../../../Table/common/columnDef";
20
21
  import { ROW_DIRECTION } from "../../../Table/common/entities";
21
22
  import { TableHead } from "../../../Table/components/TableHead/tableHead";
23
+ import { ROW_POSITION } from "../../../Table/features/RowPosition/constants";
22
24
  import { ROW_PREVIEW } from "../../../Table/features/RowPreview/constants";
23
25
  import { GridTable } from "../../../Table/table.styles";
24
26
  import { generateColumnDefinitions } from "./common/utils";
@@ -56,8 +58,11 @@ export const Table = <T extends RowData>({
56
58
  const { stickyHeader = false } = table || {};
57
59
  const { sx: tableContainerSx } = tableContainer || {};
58
60
  const tableInstance = useReactTable({
59
- _features: [ROW_PREVIEW],
60
- columns: generateColumnDefinitions(columns),
61
+ _features: [ROW_POSITION, ROW_PREVIEW],
62
+ columns: generateColumnDefinitions([
63
+ COLUMN_DEF.ROW_POSITION as ColumnDef<T>,
64
+ ...columns,
65
+ ]),
61
66
  data: items,
62
67
  enableSorting: false,
63
68
  getCoreRowModel: getCoreRowModel(),
@@ -2,11 +2,7 @@ import { css } from "@emotion/react";
2
2
  import styled from "@emotion/styled";
3
3
  import { FormControl as MFormControl } from "@mui/material";
4
4
  import { mediaTabletUp } from "../../../../styles/common/mixins/breakpoints";
5
- import {
6
- inkMain,
7
- smokeLightest,
8
- smokeMain,
9
- } from "../../../../styles/common/mixins/colors";
5
+ import { inkMain, smokeMain } from "../../../../styles/common/mixins/colors";
10
6
  import { textBodyLarge500 } from "../../../../styles/common/mixins/fonts";
11
7
  import { ThemeProps } from "../../../../theme/theme";
12
8
  import {
@@ -75,8 +71,6 @@ export const TableFormControl = styled(FormControl)`
75
71
 
76
72
  .MuiTable-root {
77
73
  th {
78
- background-color: ${smokeLightest};
79
-
80
74
  .MuiFormControlLabel-label {
81
75
  font: inherit;
82
76
  }
@@ -30,6 +30,7 @@ const COLOR: Record<
30
30
  };
31
31
 
32
32
  interface LayoutProps {
33
+ hasNavigation?: boolean;
33
34
  panelColor?: PanelBackgroundColor;
34
35
  }
35
36
 
@@ -49,10 +50,18 @@ export const ContentLayout = styled.div<LayoutProps>`
49
50
  margin: 0 auto;
50
51
 
51
52
  ${mediaDesktopSmallUp} {
52
- grid-template-areas: "navigation content";
53
- grid-template-columns:
54
- ${NAV_GRID_WIDTH}px
55
- 1fr;
53
+ ${({ hasNavigation }) =>
54
+ hasNavigation
55
+ ? css`
56
+ grid-template-areas: "navigation content";
57
+ grid-template-columns:
58
+ ${NAV_GRID_WIDTH}px
59
+ 1fr;
60
+ `
61
+ : css`
62
+ grid-template-areas: "content";
63
+ grid-template-columns: 1fr;
64
+ `};
56
65
  }
57
66
 
58
67
  ${media1366Up} {
@@ -1,6 +1,7 @@
1
1
  import { useRouter } from "next/router";
2
2
  import React, { ReactNode } from "react";
3
3
  import { useLayoutState } from "../../../../hooks/useLayoutState";
4
+ import { BaseComponentProps } from "../../../types";
4
5
  import { LayoutStyle } from "./common/entities";
5
6
  import {
6
7
  Content,
@@ -14,7 +15,6 @@ import {
14
15
  } from "./contentLayout.styles";
15
16
 
16
17
  export interface ContentLayoutProps {
17
- className?: string;
18
18
  content: ReactNode;
19
19
  layoutStyle?: LayoutStyle;
20
20
  navigation?: ReactNode;
@@ -27,13 +27,17 @@ export const ContentLayout = ({
27
27
  layoutStyle,
28
28
  navigation,
29
29
  outline,
30
- }: ContentLayoutProps): JSX.Element => {
30
+ }: BaseComponentProps & ContentLayoutProps): JSX.Element => {
31
31
  const { asPath } = useRouter();
32
32
  const {
33
33
  layoutState: { headerHeight },
34
34
  } = useLayoutState();
35
35
  return (
36
- <Layout className={className} panelColor={layoutStyle?.content}>
36
+ <Layout
37
+ className={className}
38
+ hasNavigation={Boolean(navigation)}
39
+ panelColor={layoutStyle?.content}
40
+ >
37
41
  {navigation && (
38
42
  <NavigationGrid
39
43
  headerHeight={headerHeight}
@@ -0,0 +1,19 @@
1
+ import { ColumnDef, RowData } from "@tanstack/react-table";
2
+ import { TABLE_CELL_PROPS } from "../../../styles/common/mui/tableCell";
3
+ import { ACCESSOR_KEYS } from "../../TableCreator/common/constants";
4
+ import { RowPositionCell } from "../components/TableCell/components/RowPositionCell/rowPositionCell";
5
+
6
+ export const COLUMN_DEF: Record<string, ColumnDef<RowData>> = {
7
+ ROW_POSITION: {
8
+ cell: RowPositionCell,
9
+ enableHiding: false,
10
+ enableSorting: false,
11
+ header: "",
12
+ id: ACCESSOR_KEYS.ROW_POSITION,
13
+ meta: {
14
+ align: TABLE_CELL_PROPS.ALIGN.RIGHT,
15
+ header: "",
16
+ width: "max-content",
17
+ },
18
+ },
19
+ };
@@ -24,8 +24,7 @@ export const GridTable = styled(MTable, {
24
24
  background-color: ${white};
25
25
  }
26
26
 
27
- td,
28
- th {
27
+ td {
29
28
  background-color: inherit;
30
29
  }
31
30
 
@@ -1,7 +1,19 @@
1
- import { TableCellProps as MTableCellProps } from "@mui/material";
2
- import { CoreCell, CoreHeader, RowData } from "@tanstack/react-table";
1
+ import { TableCellProps } from "@mui/material";
2
+ import { Column, CoreCell, CoreHeader, RowData } from "@tanstack/react-table";
3
+ import { TABLE_CELL_PROPS } from "../../../../../styles/common/mui/tableCell";
3
4
  import { ACCESSOR_KEYS } from "../../../../TableCreator/common/constants";
4
5
 
6
+ /**
7
+ * Returns table cell alignment based on the cell.
8
+ * @param column - Column.
9
+ * @returns table cell alignment.
10
+ */
11
+ export function getTableCellAlign<T extends RowData, TValue>(
12
+ column: Column<T, TValue>
13
+ ): TableCellProps["align"] {
14
+ return column.columnDef.meta?.align;
15
+ }
16
+
5
17
  /**
6
18
  * Returns table cell padding based on the cell ID.
7
19
  * @param id - Cell ID.
@@ -9,8 +21,13 @@ import { ACCESSOR_KEYS } from "../../../../TableCreator/common/constants";
9
21
  */
10
22
  export function getTableCellPadding<T extends RowData, TValue>(
11
23
  id: CoreHeader<T, TValue>["id"] | CoreCell<T, TValue>["id"]
12
- ): MTableCellProps["padding"] {
13
- if (id === ACCESSOR_KEYS.SELECT) {
14
- return "checkbox";
24
+ ): TableCellProps["padding"] {
25
+ switch (id) {
26
+ case ACCESSOR_KEYS.ROW_POSITION:
27
+ return TABLE_CELL_PROPS.PADDING.NORMAL;
28
+ case ACCESSOR_KEYS.SELECT:
29
+ return TABLE_CELL_PROPS.PADDING.CHECKBOX;
30
+ default:
31
+ return TABLE_CELL_PROPS.PADDING.NORMAL;
15
32
  }
16
33
  }
@@ -0,0 +1,7 @@
1
+ import { TypographyOwnProps } from "@mui/material";
2
+ import { VARIANT } from "../../../../../../styles/common/mui/typography";
3
+
4
+ export const TYPOGRAPHY_PROPS: Partial<TypographyOwnProps> = {
5
+ sx: { marginRight: -2, paddingLeft: 2 },
6
+ variant: VARIANT.INHERIT,
7
+ };
@@ -0,0 +1,16 @@
1
+ import { Typography } from "@mui/material";
2
+ import { CellContext, RowData } from "@tanstack/react-table";
3
+ import React from "react";
4
+ import { BaseComponentProps } from "../../../../../types";
5
+ import { TYPOGRAPHY_PROPS } from "./constants";
6
+
7
+ export const RowPositionCell = <TData extends RowData, TValue>({
8
+ className,
9
+ ...cellContext
10
+ }: BaseComponentProps & CellContext<TData, TValue>): JSX.Element => {
11
+ return (
12
+ <Typography {...TYPOGRAPHY_PROPS} className={className} component="div">
13
+ {cellContext.row.getRowPosition()}
14
+ </Typography>
15
+ );
16
+ };
@@ -1,14 +1,17 @@
1
1
  import {
2
- TableCell as MTableCell,
3
2
  TableHead as MTableHead,
4
3
  TableRow as MTableRow,
4
+ TableCell,
5
5
  TableSortLabel,
6
6
  } from "@mui/material";
7
7
  import { flexRender, RowData, Table } from "@tanstack/react-table";
8
8
  import React, { Fragment } from "react";
9
9
  import { ROW_DIRECTION } from "../../common/entities";
10
10
  import { getTableSortLabelProps } from "../../common/utils";
11
- import { getTableCellPadding } from "../TableCell/common/utils";
11
+ import {
12
+ getTableCellAlign,
13
+ getTableCellPadding,
14
+ } from "../TableCell/common/utils";
12
15
 
13
16
  export interface TableHeadProps<T extends RowData> {
14
17
  rowDirection: ROW_DIRECTION;
@@ -34,8 +37,9 @@ export const TableHead = <T extends RowData>({
34
37
  },
35
38
  } = header;
36
39
  return header.column.getIsGrouped() ? null : (
37
- <MTableCell
40
+ <TableCell
38
41
  key={header.id}
42
+ align={getTableCellAlign(header.column)}
39
43
  padding={getTableCellPadding(header.id)}
40
44
  >
41
45
  {header.column.getCanSort() && enableSortingInteraction ? (
@@ -53,7 +57,7 @@ export const TableHead = <T extends RowData>({
53
57
  header.getContext()
54
58
  )
55
59
  )}
56
- </MTableCell>
60
+ </TableCell>
57
61
  );
58
62
  })}
59
63
  </MTableRow>
@@ -1,8 +1,11 @@
1
- import { TableCell as MTableCell } from "@mui/material";
1
+ import { TableCell } from "@mui/material";
2
2
  import { flexRender, Row, RowData, Table } from "@tanstack/react-table";
3
3
  import { Virtualizer } from "@tanstack/react-virtual";
4
4
  import React, { Fragment } from "react";
5
- import { getTableCellPadding } from "../TableCell/common/utils";
5
+ import {
6
+ getTableCellAlign,
7
+ getTableCellPadding,
8
+ } from "../TableCell/common/utils";
6
9
  import { TableRow } from "../TableRow/tableRow.styles";
7
10
 
8
11
  export interface TableRowsProps<T extends RowData> {
@@ -30,12 +33,13 @@ export const TableRows = <T extends RowData>({
30
33
  ref={virtualizer.measureElement}
31
34
  >
32
35
  {row.getVisibleCells().map((cell) => (
33
- <MTableCell
36
+ <TableCell
34
37
  key={cell.id}
38
+ align={getTableCellAlign(cell.column)}
35
39
  padding={getTableCellPadding(cell.column.id)}
36
40
  >
37
41
  {flexRender(cell.column.columnDef.cell, cell.getContext())}
38
- </MTableCell>
42
+ </TableCell>
39
43
  ))}
40
44
  </TableRow>
41
45
  );
@@ -0,0 +1,34 @@
1
+ import {
2
+ Cell,
3
+ Column,
4
+ Row,
5
+ RowData,
6
+ RowModel,
7
+ Table,
8
+ TableFeature,
9
+ TableState,
10
+ } from "@tanstack/react-table";
11
+ import { InitialTableState } from "@tanstack/table-core/src/types";
12
+ import { getRowModel, getRowPosition, initInitialState } from "./utils";
13
+
14
+ export const ROW_POSITION: TableFeature = {
15
+ createCell: <T extends RowData, TValue>(
16
+ cell: Cell<T, TValue>,
17
+ column: Column<T>,
18
+ row: Row<T>,
19
+ table: Table<T>
20
+ ): void => {
21
+ row.getRowPosition = (): number => {
22
+ return getRowPosition(row.id, table);
23
+ };
24
+ },
25
+ createTable: <T extends RowData>(table: Table<T>): void => {
26
+ const originalGetRowModel = table.getRowModel.bind(table);
27
+ table.getRowModel = (): RowModel<T> => {
28
+ return getRowModel(table, originalGetRowModel);
29
+ };
30
+ },
31
+ getInitialState: (initialState?: InitialTableState): Partial<TableState> => {
32
+ return initInitialState(initialState);
33
+ },
34
+ };
@@ -0,0 +1,3 @@
1
+ export interface RowPositionRow {
2
+ getRowPosition: () => number;
3
+ }