@databiosphere/findable-ui 45.0.0 → 46.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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +36 -0
- package/lib/components/Detail/components/Table/common/utils.js +1 -1
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +1 -1
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +1 -1
- package/lib/components/Detail/components/Table/table.js +7 -1
- package/lib/components/Index/components/EntityView/components/layout/Summary/summary.js +1 -1
- package/lib/components/Index/table/hook.js +7 -1
- package/lib/components/Layout/components/Outline/outline.js +3 -1
- package/lib/components/Layout/components/Outline/types.d.ts +1 -1
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/constants.d.ts +2 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/constants.js +13 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.js +12 -8
- package/lib/components/Table/components/TableRow/tableRow.styles.d.ts +2 -0
- package/lib/components/Table/components/TableRow/tableRow.styles.js +15 -1
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +1 -1
- package/lib/components/Table/components/TableRows/tableRows.js +1 -1
- package/lib/components/Table/features/RowSelectionValidation/constants.d.ts +2 -0
- package/lib/components/Table/features/RowSelectionValidation/constants.js +14 -0
- package/lib/components/Table/features/RowSelectionValidation/types.d.ts +8 -0
- package/lib/components/Table/features/RowSelectionValidation/types.js +1 -0
- package/lib/components/Table/features/RowSelectionValidation/utils.d.ts +8 -0
- package/lib/components/Table/features/RowSelectionValidation/utils.js +11 -0
- package/lib/components/Table/features/entities.d.ts +3 -2
- package/lib/components/TableCreator/options/hook.js +0 -3
- package/lib/components/common/Button/components/FileDownloadButton/fileDownloadButton.d.ts +5 -0
- package/lib/components/common/Button/components/FileDownloadButton/fileDownloadButton.js +14 -0
- package/lib/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.d.ts +2 -0
- package/lib/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.js +8 -0
- package/lib/utils/mdx/files/mapMDXSlugByFilePaths.d.ts +8 -0
- package/lib/utils/mdx/files/mapMDXSlugByFilePaths.js +39 -0
- package/lib/utils/mdx/files/resolveRelativeDirs.d.ts +6 -0
- package/lib/utils/mdx/files/resolveRelativeDirs.js +9 -0
- package/lib/utils/mdx/frontmatter/getMatter.d.ts +8 -0
- package/lib/utils/mdx/frontmatter/getMatter.js +12 -0
- package/lib/utils/mdx/frontmatter/types.d.ts +7 -0
- package/lib/utils/mdx/frontmatter/types.js +1 -0
- package/lib/utils/mdx/frontmatter/validateMatter.d.ts +8 -0
- package/lib/utils/mdx/frontmatter/validateMatter.js +13 -0
- package/lib/utils/mdx/plugins/rehypeSlug.d.ts +6 -0
- package/lib/utils/mdx/plugins/rehypeSlug.js +34 -0
- package/lib/utils/mdx/plugins/remarkHeadings.d.ts +29 -0
- package/lib/utils/mdx/plugins/remarkHeadings.js +50 -0
- package/lib/utils/mdx/plugins/utils.d.ts +13 -0
- package/lib/utils/mdx/plugins/utils.js +25 -0
- package/lib/utils/mdx/staticGeneration/staticPaths.d.ts +8 -0
- package/lib/utils/mdx/staticGeneration/staticPaths.js +12 -0
- package/lib/utils/mdx/staticGeneration/staticProps.d.ts +5 -0
- package/lib/utils/mdx/staticGeneration/staticProps.js +44 -0
- package/lib/utils/mdx/staticGeneration/types.d.ts +12 -0
- package/lib/utils/mdx/staticGeneration/types.js +1 -0
- package/lib/utils/mdx/staticGeneration/utils.d.ts +15 -0
- package/lib/utils/mdx/staticGeneration/utils.js +26 -0
- package/package.json +8 -5
- package/src/components/Detail/components/Table/common/utils.ts +1 -1
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -0
- package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +2 -0
- package/src/components/Detail/components/Table/table.tsx +7 -1
- package/src/components/Index/components/EntityView/components/layout/Summary/summary.tsx +8 -6
- package/src/components/Index/table/hook.ts +7 -1
- package/src/components/Layout/components/Outline/outline.tsx +6 -1
- package/src/components/Layout/components/Outline/types.ts +1 -1
- package/src/components/Table/components/TableCell/components/RowSelectionCell/constants.ts +15 -0
- package/src/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.tsx +25 -13
- package/src/components/Table/components/TableRow/tableRow.styles.ts +19 -1
- package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -0
- package/src/components/Table/components/TableRows/tableRows.tsx +2 -0
- package/src/components/Table/features/RowSelectionValidation/constants.ts +24 -0
- package/src/components/Table/features/RowSelectionValidation/types.ts +10 -0
- package/src/components/Table/features/RowSelectionValidation/utils.ts +15 -0
- package/src/components/Table/features/entities.ts +10 -2
- package/src/components/TableCreator/options/hook.ts +0 -3
- package/src/components/common/Button/components/FileDownloadButton/fileDownloadButton.tsx +27 -0
- package/src/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.tsx +27 -0
- package/src/utils/mdx/files/mapMDXSlugByFilePaths.ts +48 -0
- package/src/utils/mdx/files/resolveRelativeDirs.ts +10 -0
- package/src/utils/mdx/frontmatter/getMatter.ts +13 -0
- package/src/utils/mdx/frontmatter/types.ts +7 -0
- package/src/utils/mdx/frontmatter/validateMatter.ts +20 -0
- package/src/utils/mdx/plugins/rehypeSlug.ts +36 -0
- package/src/utils/mdx/plugins/remarkHeadings.ts +67 -0
- package/src/utils/mdx/plugins/utils.ts +27 -0
- package/src/utils/mdx/staticGeneration/staticPaths.ts +18 -0
- package/src/utils/mdx/staticGeneration/staticProps.ts +62 -0
- package/src/utils/mdx/staticGeneration/types.ts +16 -0
- package/src/utils/mdx/staticGeneration/utils.ts +32 -0
- package/tests/chart.test.tsx +4 -2
- package/tests/markdownCell.test.tsx +1 -2
- package/tests/rowSelectionValidation.test.ts +282 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [46.0.0](https://github.com/DataBiosphere/findable-ui/compare/v45.1.0...v46.0.0) (2025-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* add get static props helper function ([#691](https://github.com/DataBiosphere/findable-ui/issues/691)) (#692)
|
|
9
|
+
* add helper functions remarkHeadings and rehypeSlug ([#684](https://github.com/DataBiosphere/findable-ui/issues/684)) (#685)
|
|
10
|
+
* add get static paths helper function ([#688](https://github.com/DataBiosphere/findable-ui/issues/688)) (#693)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add get static paths helper function ([#688](https://github.com/DataBiosphere/findable-ui/issues/688)) ([#693](https://github.com/DataBiosphere/findable-ui/issues/693)) ([887b1d8](https://github.com/DataBiosphere/findable-ui/commit/887b1d82770ce472957e03b483aeeacb06ab8fdd))
|
|
15
|
+
* add get static props helper function ([#691](https://github.com/DataBiosphere/findable-ui/issues/691)) ([#692](https://github.com/DataBiosphere/findable-ui/issues/692)) ([71b2927](https://github.com/DataBiosphere/findable-ui/commit/71b2927059e5e55b6e03bda6dc87dad009533fe9))
|
|
16
|
+
* add helper functions remarkHeadings and rehypeSlug ([#684](https://github.com/DataBiosphere/findable-ui/issues/684)) ([#685](https://github.com/DataBiosphere/findable-ui/issues/685)) ([b130b3c](https://github.com/DataBiosphere/findable-ui/commit/b130b3c4a2527566eadcdab174c937e95338a394))
|
|
17
|
+
* update entity list summary component to optionally display summary label ([#679](https://github.com/DataBiosphere/findable-ui/issues/679)) ([#681](https://github.com/DataBiosphere/findable-ui/issues/681)) ([e57e366](https://github.com/DataBiosphere/findable-ui/commit/e57e3660d92e0c155f5cdb56dcd5769bfc0ca2b0))
|
|
18
|
+
* update outline component prop 'outline' to be optional ([#686](https://github.com/DataBiosphere/findable-ui/issues/686)) ([#687](https://github.com/DataBiosphere/findable-ui/issues/687)) ([eaba690](https://github.com/DataBiosphere/findable-ui/commit/eaba690d4277e69e88f3a6cd11d558c9e27918e6))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* reintstate file download button component ([#667](https://github.com/DataBiosphere/findable-ui/issues/667)) ([#678](https://github.com/DataBiosphere/findable-ui/issues/678)) ([aa538a3](https://github.com/DataBiosphere/findable-ui/commit/aa538a39f64b07e02f4bc512c51c25fb1234fb89))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Chores
|
|
27
|
+
|
|
28
|
+
* upgrade packages (minor) and fix security warnings ([#671](https://github.com/DataBiosphere/findable-ui/issues/671)) ([#673](https://github.com/DataBiosphere/findable-ui/issues/673)) ([6b067d5](https://github.com/DataBiosphere/findable-ui/commit/6b067d5e189d72253e6b39551c1ab5d49aa8126a))
|
|
29
|
+
|
|
30
|
+
## [45.1.0](https://github.com/DataBiosphere/findable-ui/compare/v45.0.0...v45.1.0) (2025-09-18)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* extend row selection feature to handle validation messages for each row ([#666](https://github.com/DataBiosphere/findable-ui/issues/666)) ([#669](https://github.com/DataBiosphere/findable-ui/issues/669)) ([04fc041](https://github.com/DataBiosphere/findable-ui/commit/04fc0411cae9f1ae9c47d8f384e599413cffe639))
|
|
36
|
+
* update row selection component to display disabled state ([#663](https://github.com/DataBiosphere/findable-ui/issues/663)) ([#667](https://github.com/DataBiosphere/findable-ui/issues/667)) ([c2c9fb2](https://github.com/DataBiosphere/findable-ui/commit/c2c9fb24e458858dd6d26be2be8e74f4e3e976da))
|
|
37
|
+
* update table row to display disabled state ([#665](https://github.com/DataBiosphere/findable-ui/issues/665)) ([#668](https://github.com/DataBiosphere/findable-ui/issues/668)) ([2c6000f](https://github.com/DataBiosphere/findable-ui/commit/2c6000f86d0066b91409032f9970284f6b4b6443))
|
|
38
|
+
|
|
3
39
|
## [45.0.0](https://github.com/DataBiosphere/findable-ui/compare/v44.0.0...v45.0.0) (2025-09-10)
|
|
4
40
|
|
|
5
41
|
|
|
@@ -10,7 +10,7 @@ export const CollapsableRows = ({ rows: leafOrSubRows, tableInstance, }) => {
|
|
|
10
10
|
return (React.createElement(Fragment, null, (leafOrSubRows || rows).map((row) => {
|
|
11
11
|
if (row.depth > 0 && !leafOrSubRows)
|
|
12
12
|
return null; // Hide sub rows that are not already leaf or sub rows.
|
|
13
|
-
return (React.createElement(StyledTableRow, { key: row.id, id: row.id, isPreview: row.getIsPreview() },
|
|
13
|
+
return (React.createElement(StyledTableRow, { key: row.id, id: row.id, isPreview: row.getIsPreview(), isSelected: row.getIsSelected() },
|
|
14
14
|
React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row })));
|
|
15
15
|
})));
|
|
16
16
|
};
|
|
@@ -10,7 +10,7 @@ export const TableRows = ({ rows: leafOrSubRows, tableInstance, tableView, }) =>
|
|
|
10
10
|
const { tableCell } = tableView || {};
|
|
11
11
|
const { size: tableCellSize = "medium" } = tableCell || {};
|
|
12
12
|
return (React.createElement(Fragment, null, (leafOrSubRows || rows).map((row) => {
|
|
13
|
-
return (React.createElement(StyledTableRow, { key: row.id, id: row.id, canExpand: row.getCanExpand(), isExpanded: row.getIsExpanded(), isGrouped: row.getIsGrouped(), isPreview: row.getIsPreview(), onClick: () => handleToggleExpanded(row) }, row.getVisibleCells().map((cell) => {
|
|
13
|
+
return (React.createElement(StyledTableRow, { key: row.id, id: row.id, canExpand: row.getCanExpand(), canSelect: row.getCanSelect(), isExpanded: row.getIsExpanded(), isGrouped: row.getIsGrouped(), isPreview: row.getIsPreview(), isSelected: row.getIsSelected(), onClick: () => handleToggleExpanded(row) }, row.getVisibleCells().map((cell) => {
|
|
14
14
|
if (cell.getIsAggregated())
|
|
15
15
|
return null; // Display of aggregated cells is currently not supported.
|
|
16
16
|
if (cell.getIsPlaceholder())
|
|
@@ -9,6 +9,7 @@ import { TableHead } from "../../../Table/components/TableHead/tableHead";
|
|
|
9
9
|
import { TABLE_DOWNLOAD_OPTIONS } from "../../../Table/featureOptions/tableDownload/constants";
|
|
10
10
|
import { ROW_POSITION } from "../../../Table/features/RowPosition/constants";
|
|
11
11
|
import { ROW_PREVIEW } from "../../../Table/features/RowPreview/constants";
|
|
12
|
+
import { ROW_SELECTION_VALIDATION } from "../../../Table/features/RowSelectionValidation/constants";
|
|
12
13
|
import { TABLE_DOWNLOAD } from "../../../Table/features/TableDownload/constants";
|
|
13
14
|
import { GridTable } from "../../../Table/table.styles";
|
|
14
15
|
import { generateColumnDefinitions } from "./common/utils";
|
|
@@ -20,7 +21,12 @@ export const Table = ({ className, collapsable = true, columns, gridTemplateColu
|
|
|
20
21
|
const { stickyHeader = false } = table || {};
|
|
21
22
|
const { sx: tableContainerSx } = tableContainer || {};
|
|
22
23
|
const tableInstance = useReactTable({
|
|
23
|
-
_features: [
|
|
24
|
+
_features: [
|
|
25
|
+
ROW_POSITION,
|
|
26
|
+
ROW_PREVIEW,
|
|
27
|
+
ROW_SELECTION_VALIDATION,
|
|
28
|
+
TABLE_DOWNLOAD,
|
|
29
|
+
],
|
|
24
30
|
columns: generateColumnDefinitions([
|
|
25
31
|
COLUMN_DEF.ROW_POSITION,
|
|
26
32
|
...columns,
|
|
@@ -12,5 +12,5 @@ export const Summary = ({ className, }) => {
|
|
|
12
12
|
return (React.createElement(StyledGrid, { ...GRID_PROPS, className: className, "data-testid": TEST_IDS.ENTITY_SUMMARY }, summaries.map(([count, label], i) => (React.createElement(Fragment, { key: i },
|
|
13
13
|
i !== 0 && React.createElement(StyledDot, null),
|
|
14
14
|
React.createElement(Typography, { variant: TYPOGRAPHY_PROPS.VARIANT.BODY_SMALL_500 }, count),
|
|
15
|
-
React.createElement(Typography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, variant: TYPOGRAPHY_PROPS.VARIANT.BODY_SMALL_400 }, label))))));
|
|
15
|
+
label && (React.createElement(Typography, { color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, variant: TYPOGRAPHY_PROPS.VARIANT.BODY_SMALL_400 }, label)))))));
|
|
16
16
|
};
|
|
@@ -14,6 +14,7 @@ import { getFacetedMinMaxValues } from "../../Table/featureOptions/facetedColumn
|
|
|
14
14
|
import { TABLE_DOWNLOAD_OPTIONS } from "../../Table/featureOptions/tableDownload/constants";
|
|
15
15
|
import { ROW_POSITION } from "../../Table/features/RowPosition/constants";
|
|
16
16
|
import { ROW_PREVIEW } from "../../Table/features/RowPreview/constants";
|
|
17
|
+
import { ROW_SELECTION_VALIDATION } from "../../Table/features/RowSelectionValidation/constants";
|
|
17
18
|
import { TABLE_DOWNLOAD } from "../../Table/features/TableDownload/constants";
|
|
18
19
|
import { buildBaseColumnDef } from "../../TableCreator/common/utils";
|
|
19
20
|
import { useTableOptions } from "../../TableCreator/options/hook";
|
|
@@ -99,7 +100,12 @@ export const useTable = ({ entityListType, }) => {
|
|
|
99
100
|
* - This will simplify the configuration structure and centralize table state definitions, reducing redundancy and improving clarity.
|
|
100
101
|
*/
|
|
101
102
|
const table = useReactTable({
|
|
102
|
-
_features: [
|
|
103
|
+
_features: [
|
|
104
|
+
ROW_POSITION,
|
|
105
|
+
ROW_PREVIEW,
|
|
106
|
+
ROW_SELECTION_VALIDATION,
|
|
107
|
+
TABLE_DOWNLOAD,
|
|
108
|
+
],
|
|
103
109
|
columns: columnDefs,
|
|
104
110
|
data: listItems || [],
|
|
105
111
|
enableColumnFilters: true, // client-side filtering.
|
|
@@ -3,7 +3,9 @@ import { DEFAULT_TAB_VALUE } from "./hooks/UseTabs/constants";
|
|
|
3
3
|
import { useTabs } from "./hooks/UseTabs/hook";
|
|
4
4
|
import { StyledTab, StyledTabs } from "./outline.styles";
|
|
5
5
|
export const Outline = ({ className, Contents, outline, ...props /* MuiTabsProps */ }) => {
|
|
6
|
-
const { indicatorColor, onChange, orientation, value } = useTabs(outline);
|
|
6
|
+
const { indicatorColor, onChange, orientation, value } = useTabs(outline ?? []);
|
|
7
|
+
if (!outline?.length)
|
|
8
|
+
return null;
|
|
7
9
|
return (React.createElement(StyledTabs, { className: className, indicatorColor: indicatorColor, onChange: onChange, orientation: orientation, value: value, ...props },
|
|
8
10
|
React.createElement(Contents, { value: DEFAULT_TAB_VALUE }),
|
|
9
11
|
outline.map(({ depth, disabled, hash, value }) => (React.createElement(StyledTab, { depth: depth, disabled: disabled, key: hash, label: value, value: hash })))));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const TOOLTIP_PROPS = {
|
|
2
|
+
arrow: true,
|
|
3
|
+
disableInteractive: true,
|
|
4
|
+
slotProps: {
|
|
5
|
+
popper: {
|
|
6
|
+
modifiers: [
|
|
7
|
+
{ name: "offset", options: { offset: [0, -4] } },
|
|
8
|
+
{ name: "preventOverflow", options: { padding: 8 } },
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
tooltip: { sx: { maxWidth: "220px" } },
|
|
12
|
+
},
|
|
13
|
+
};
|
package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { Checkbox as MCheckbox } from "@mui/material";
|
|
1
|
+
import { Checkbox as MCheckbox, Tooltip } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { CheckedIcon } from "../../../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
|
|
4
|
+
import { UncheckedDisabledIcon } from "../../../../../common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon";
|
|
4
5
|
import { UncheckedIcon } from "../../../../../common/CustomIcon/components/UncheckedIcon/uncheckedIcon";
|
|
6
|
+
import { TOOLTIP_PROPS } from "./constants";
|
|
5
7
|
export const RowSelectionCell = ({ row, }) => {
|
|
6
|
-
const { getIsSelected, getToggleSelectedHandler } = row;
|
|
7
|
-
return (React.createElement(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const { getCanSelect, getIsSelected, getSelectionValidation, getToggleSelectedHandler, } = row;
|
|
9
|
+
return (React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: getSelectionValidation?.() },
|
|
10
|
+
React.createElement("span", null,
|
|
11
|
+
React.createElement(MCheckbox, { checked: getIsSelected(), checkedIcon: React.createElement(CheckedIcon, null), disabled: !getCanSelect(), icon: getCanSelect() ? React.createElement(UncheckedIcon, null) : React.createElement(UncheckedDisabledIcon, null),
|
|
12
|
+
/*
|
|
13
|
+
* Prevents click events from bubbling up to parent components
|
|
14
|
+
* (such as CardActionArea or Accordion) when the checkbox is activated.
|
|
15
|
+
*/
|
|
16
|
+
onClick: (e) => e.stopPropagation(), onChange: getToggleSelectedHandler() }))));
|
|
13
17
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export interface StyledTableRowProps {
|
|
2
2
|
canExpand?: boolean;
|
|
3
|
+
canSelect?: boolean;
|
|
3
4
|
isExpanded?: boolean;
|
|
4
5
|
isGrouped?: boolean;
|
|
5
6
|
isPreview?: boolean;
|
|
7
|
+
isSelected?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare const StyledTableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
8
10
|
ref?: ((instance: HTMLTableRowElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
@@ -5,9 +5,11 @@ import { FONT } from "../../../../styles/common/constants/font";
|
|
|
5
5
|
import { PALETTE } from "../../../../styles/common/constants/palette";
|
|
6
6
|
export const StyledTableRow = styled(MTableRow, {
|
|
7
7
|
shouldForwardProp: (prop) => prop !== "canExpand" &&
|
|
8
|
+
prop !== "canSelect" &&
|
|
8
9
|
prop !== "isExpanded" &&
|
|
10
|
+
prop !== "isGrouped" &&
|
|
9
11
|
prop !== "isPreview" &&
|
|
10
|
-
prop !== "
|
|
12
|
+
prop !== "isSelected",
|
|
11
13
|
}) `
|
|
12
14
|
&& {
|
|
13
15
|
transition: background-color 300ms ease-in;
|
|
@@ -42,5 +44,17 @@ export const StyledTableRow = styled(MTableRow, {
|
|
|
42
44
|
css `
|
|
43
45
|
background-color: ${PALETTE.PRIMARY_LIGHTEST};
|
|
44
46
|
`}
|
|
47
|
+
|
|
48
|
+
${({ isSelected }) => isSelected &&
|
|
49
|
+
css `
|
|
50
|
+
background-color: ${PALETTE.PRIMARY_LIGHTEST};
|
|
51
|
+
`}
|
|
52
|
+
|
|
53
|
+
${({ canSelect }) => !canSelect &&
|
|
54
|
+
css `
|
|
55
|
+
.MuiTableCell-root {
|
|
56
|
+
color: ${PALETTE.INK_LIGHT};
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
45
59
|
}
|
|
46
60
|
`;
|
package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js
CHANGED
|
@@ -13,7 +13,7 @@ export const CollapsableRows = ({ rows, tableInstance, virtualizer, }) => {
|
|
|
13
13
|
const row = rows[rowIndex];
|
|
14
14
|
if (grouping.length > 0 && row.depth > 0)
|
|
15
15
|
return null; // TODO(cc) hide sub rows -- sub-rows are within collapsed content -- UI TBD.
|
|
16
|
-
return (React.createElement(StyledTableRow, { key: row.id, "data-index": rowIndex, ref: virtualizer.measureElement, isPreview: row.getIsPreview() },
|
|
16
|
+
return (React.createElement(StyledTableRow, { key: row.id, "data-index": rowIndex, ref: virtualizer.measureElement, isPreview: row.getIsPreview(), isSelected: row.getIsSelected() },
|
|
17
17
|
React.createElement(CollapsableCell, { isDisabled: isCollapsableRowDisabled(tableInstance), row: row })));
|
|
18
18
|
})));
|
|
19
19
|
};
|
|
@@ -11,7 +11,7 @@ export const TableRows = ({ rows, virtualizer, }) => {
|
|
|
11
11
|
const rowIndex = virtualRow.index;
|
|
12
12
|
const row = rows[rowIndex];
|
|
13
13
|
const { getCanExpand, getIsExpanded, getIsGrouped, getIsPreview } = row;
|
|
14
|
-
return (React.createElement(StyledTableRow, { key: row.id, canExpand: getCanExpand(), "data-index": rowIndex, isExpanded: getIsExpanded(), isGrouped: getIsGrouped(), isPreview: getIsPreview(), onClick: () => handleToggleExpanded(row), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell, i) => {
|
|
14
|
+
return (React.createElement(StyledTableRow, { key: row.id, canExpand: getCanExpand(), canSelect: row.getCanSelect(), "data-index": rowIndex, isExpanded: getIsExpanded(), isGrouped: getIsGrouped(), isPreview: getIsPreview(), isSelected: row.getIsSelected(), onClick: () => handleToggleExpanded(row), ref: virtualizer.measureElement }, row.getVisibleCells().map((cell, i) => {
|
|
15
15
|
if (cell.getIsAggregated())
|
|
16
16
|
return null; // Display of aggregated cells is currently not supported.
|
|
17
17
|
if (cell.getIsPlaceholder())
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getSelectionValidation } from "./utils";
|
|
2
|
+
export const ROW_SELECTION_VALIDATION = {
|
|
3
|
+
createRow: (row, table) => {
|
|
4
|
+
row.getSelectionValidation = () => {
|
|
5
|
+
return getSelectionValidation(row, table);
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
getDefaultOptions: () => {
|
|
9
|
+
return {
|
|
10
|
+
enableRowSelectionValidation: false,
|
|
11
|
+
getRowSelectionValidation: undefined,
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
2
|
+
export interface RowSelectionValidationOptions<T extends RowData> {
|
|
3
|
+
enableRowSelectionValidation?: boolean;
|
|
4
|
+
getRowSelectionValidation?: (row: Row<T>) => string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface RowSelectionValidationRow {
|
|
7
|
+
getSelectionValidation?: () => string | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Row, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the validation message for a row.
|
|
4
|
+
* @param row - Row.
|
|
5
|
+
* @param table - Table.
|
|
6
|
+
* @returns The validation message for the row.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSelectionValidation<T extends RowData>(row: Row<T>, table: Table<T>): string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the validation message for a row.
|
|
3
|
+
* @param row - Row.
|
|
4
|
+
* @param table - Table.
|
|
5
|
+
* @returns The validation message for the row.
|
|
6
|
+
*/
|
|
7
|
+
export function getSelectionValidation(row, table) {
|
|
8
|
+
if (!table.options.enableRowSelectionValidation)
|
|
9
|
+
return;
|
|
10
|
+
return table.options.getRowSelectionValidation?.(row);
|
|
11
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { RowData } from "@tanstack/react-table";
|
|
2
2
|
import { RowPositionOptions, RowPositionRow } from "./RowPosition/types";
|
|
3
3
|
import { RowPreviewInstance, RowPreviewOptions, RowPreviewRow, RowPreviewTableState } from "./RowPreview/entities";
|
|
4
|
+
import { RowSelectionValidationOptions, RowSelectionValidationRow } from "./RowSelectionValidation/types";
|
|
4
5
|
import { TableDownloadColumn, TableDownloadInstance, TableDownloadOptions } from "./TableDownload/types";
|
|
5
6
|
export type CustomFeatureColumn = TableDownloadColumn;
|
|
6
7
|
export interface CustomFeatureInstance<T extends RowData> extends TableDownloadInstance, RowPreviewInstance<T> {
|
|
7
8
|
}
|
|
8
9
|
export type CustomFeatureInitialTableState = Partial<RowPreviewTableState>;
|
|
9
|
-
export interface CustomFeatureOptions<T extends RowData> extends TableDownloadOptions<T>, RowPositionOptions, RowPreviewOptions {
|
|
10
|
+
export interface CustomFeatureOptions<T extends RowData> extends TableDownloadOptions<T>, RowPositionOptions, RowPreviewOptions, RowSelectionValidationOptions<T> {
|
|
10
11
|
}
|
|
11
|
-
export interface CustomFeatureRow extends RowPositionRow, RowPreviewRow {
|
|
12
|
+
export interface CustomFeatureRow extends RowPositionRow, RowPreviewRow, RowSelectionValidationRow {
|
|
12
13
|
}
|
|
13
14
|
export type CustomFeatureTableState = RowPreviewTableState;
|
|
@@ -2,7 +2,6 @@ import { useConfig } from "../../../hooks/useConfig";
|
|
|
2
2
|
import { useExpandedOptions } from "./expanded/hook";
|
|
3
3
|
import { useGroupingOptions } from "./grouping/hook";
|
|
4
4
|
import { useInitialState } from "./initialState/hook";
|
|
5
|
-
import { useRowSelectionOptions } from "./rowSelection/hook";
|
|
6
5
|
import { useSortingOptions } from "./sorting/hook";
|
|
7
6
|
import { useVisibilityOptions } from "./visibility/hook";
|
|
8
7
|
export function useTableOptions() {
|
|
@@ -10,14 +9,12 @@ export function useTableOptions() {
|
|
|
10
9
|
const tableOptions = entityConfig.list.tableOptions;
|
|
11
10
|
const expandedOptions = useExpandedOptions();
|
|
12
11
|
const groupingOptions = useGroupingOptions();
|
|
13
|
-
const rowSelectionOptions = useRowSelectionOptions();
|
|
14
12
|
const sortingOptions = useSortingOptions();
|
|
15
13
|
const visibilityOptions = useVisibilityOptions();
|
|
16
14
|
const initialState = useInitialState(tableOptions);
|
|
17
15
|
return {
|
|
18
16
|
...expandedOptions,
|
|
19
17
|
...groupingOptions,
|
|
20
|
-
...rowSelectionOptions,
|
|
21
18
|
...sortingOptions, // TODO(cc) merge of all sorting options.
|
|
22
19
|
...visibilityOptions,
|
|
23
20
|
...tableOptions,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import React, { useEffect, useRef } from "react";
|
|
3
|
+
export const FileDownloadButton = ({ fileName, fileUrl, }) => {
|
|
4
|
+
const downloadRef = useRef(null);
|
|
5
|
+
// Initiates file download when file url request is successful.
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (downloadRef.current && fileName && fileUrl) {
|
|
8
|
+
downloadRef.current.setAttribute("href", fileUrl);
|
|
9
|
+
downloadRef.current.setAttribute("download", fileName);
|
|
10
|
+
downloadRef.current.click();
|
|
11
|
+
}
|
|
12
|
+
}, [fileName, fileUrl]);
|
|
13
|
+
return (React.createElement(Box, { component: "a", download: true, ref: downloadRef, sx: { display: "none" } }));
|
|
14
|
+
};
|
package/lib/components/common/CustomIcon/components/UncheckedDisabledIcon/uncheckedDisabledIcon.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SvgIcon } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PALETTE } from "../../../../../styles/common/constants/palette";
|
|
4
|
+
export const UncheckedDisabledIcon = ({ fontSize = "xsmall", viewBox = "0 0 18 18", ...props }) => {
|
|
5
|
+
return (React.createElement(SvgIcon, { fontSize: fontSize, viewBox: viewBox, ...props },
|
|
6
|
+
React.createElement("path", { d: "M4 0.5H14C15.933 0.5 17.5 2.067 17.5 4V14C17.5 15.933 15.933 17.5 14 17.5H4C2.067 17.5 0.5 15.933 0.5 14V4C0.5 2.067 2.067 0.5 4 0.5Z", stroke: PALETTE.SMOKE_MAIN }),
|
|
7
|
+
React.createElement("rect", { x: "0.5", y: "0.5", width: "17", height: "17", rx: "3.5", fill: PALETTE.SMOKE_LIGHT, stroke: PALETTE.SMOKE_MAIN })));
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each MDX file path to its slug.
|
|
3
|
+
* @param docsDirectory - Docs directory.
|
|
4
|
+
* @param dirPath - Directory path.
|
|
5
|
+
* @param slugByFilePaths - Accumulator: Map of slug by mdx file path.
|
|
6
|
+
* @returns returns slug by mdx file path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapMDXSlugByFilePaths(docsDirectory: string, dirPath?: string, slugByFilePaths?: Map<string, string[]>): Map<string, string[]>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if the file is an MDX file.
|
|
5
|
+
* @param fileName - File name.
|
|
6
|
+
* @returns true if the file is an MDX file.
|
|
7
|
+
*/
|
|
8
|
+
function isMdxFile(fileName) {
|
|
9
|
+
return fileName.endsWith(".mdx");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Maps each MDX file path to its slug.
|
|
13
|
+
* @param docsDirectory - Docs directory.
|
|
14
|
+
* @param dirPath - Directory path.
|
|
15
|
+
* @param slugByFilePaths - Accumulator: Map of slug by mdx file path.
|
|
16
|
+
* @returns returns slug by mdx file path.
|
|
17
|
+
*/
|
|
18
|
+
export function mapMDXSlugByFilePaths(docsDirectory, dirPath = docsDirectory, slugByFilePaths = new Map()) {
|
|
19
|
+
const dirents = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
20
|
+
return dirents.reduce((acc, dirent) => {
|
|
21
|
+
/* Accumulate the slug for each MDX file. */
|
|
22
|
+
if (dirent.isFile() && isMdxFile(dirent.name)) {
|
|
23
|
+
const mdxPath = path.resolve(dirPath, dirent.name);
|
|
24
|
+
/* Build the slug from the file relative directory and file name. */
|
|
25
|
+
const mdxRelativePath = path.relative(docsDirectory, mdxPath);
|
|
26
|
+
const { dir, name } = path.parse(mdxRelativePath);
|
|
27
|
+
let slug = [];
|
|
28
|
+
if (dir)
|
|
29
|
+
slug = dir.split(path.sep);
|
|
30
|
+
slug.push(name);
|
|
31
|
+
acc.set(mdxPath, slug);
|
|
32
|
+
}
|
|
33
|
+
/* Recurse into subdirectories. */
|
|
34
|
+
if (dirent.isDirectory()) {
|
|
35
|
+
mapMDXSlugByFilePaths(docsDirectory, path.resolve(dirPath, dirent.name), acc);
|
|
36
|
+
}
|
|
37
|
+
return acc;
|
|
38
|
+
}, slugByFilePaths);
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves an absolute docs path from a single set of directory segments.
|
|
4
|
+
* @param relativeDirs - Directory segments relative to the docs root.
|
|
5
|
+
* @returns Absolute path.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveRelativeDirs(relativeDirs) {
|
|
8
|
+
return path.join(process.cwd(), ...relativeDirs);
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import matter from "gray-matter";
|
|
2
|
+
/**
|
|
3
|
+
* Returns matter object (frontmatter and content) from the given MD/MDX path.
|
|
4
|
+
* Server-only: uses Node fs, import only in SSG/SSR/build contexts.
|
|
5
|
+
* @param filePath - File path of MD/MDX file.
|
|
6
|
+
* @returns matter object.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getMatter(filePath: string): matter.GrayMatterFile<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import matter from "gray-matter";
|
|
3
|
+
/**
|
|
4
|
+
* Returns matter object (frontmatter and content) from the given MD/MDX path.
|
|
5
|
+
* Server-only: uses Node fs, import only in SSG/SSR/build contexts.
|
|
6
|
+
* @param filePath - File path of MD/MDX file.
|
|
7
|
+
* @returns matter object.
|
|
8
|
+
*/
|
|
9
|
+
export function getMatter(filePath) {
|
|
10
|
+
const markdownWithMeta = fs.readFileSync(filePath, "utf-8");
|
|
11
|
+
return matter(markdownWithMeta);
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import matter from "gray-matter";
|
|
2
|
+
import { FrontmatterProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the frontmatter from the given gray matter file data.
|
|
5
|
+
* @param data - Gray matter file data.
|
|
6
|
+
* @returns Frontmatter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateMatter<F extends object>(data: matter.GrayMatterFile<string>["data"]): FrontmatterProps<F> | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the frontmatter from the given gray matter file data.
|
|
3
|
+
* @param data - Gray matter file data.
|
|
4
|
+
* @returns Frontmatter.
|
|
5
|
+
*/
|
|
6
|
+
export function validateMatter(data) {
|
|
7
|
+
if ("title" in data &&
|
|
8
|
+
typeof data.title === "string" &&
|
|
9
|
+
"description" in data &&
|
|
10
|
+
typeof data.description === "string") {
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { visit } from "unist-util-visit";
|
|
2
|
+
import { getHeadingTextValue } from "./remarkHeadings";
|
|
3
|
+
import { generateUniqueId, slugifyHeading } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
* Rehype plugin to generate an ID for each heading in MDX content.
|
|
6
|
+
* @returns plugin to generate an ID for each heading in MDX content.
|
|
7
|
+
*/
|
|
8
|
+
export function rehypeSlug() {
|
|
9
|
+
return (tree) => {
|
|
10
|
+
const setOfIds = new Set();
|
|
11
|
+
visit(tree, "element", (node) => {
|
|
12
|
+
if (/^h[1-6]$/.test(node.tagName)) {
|
|
13
|
+
const headingText = getHeadingTextValue(node.children);
|
|
14
|
+
const headingSlug = slugifyHeading(headingText);
|
|
15
|
+
const id = generateUniqueId(setOfIds, headingSlug);
|
|
16
|
+
// Add the ID to the heading element.
|
|
17
|
+
node.properties.id = id;
|
|
18
|
+
node.properties.style = "position: relative;";
|
|
19
|
+
// Append AnchorLink to the heading element.
|
|
20
|
+
node.children.push({
|
|
21
|
+
attributes: [
|
|
22
|
+
{
|
|
23
|
+
name: "anchorLink",
|
|
24
|
+
type: "mdxJsxAttribute",
|
|
25
|
+
value: id,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
name: "AnchorLink",
|
|
29
|
+
type: "mdxJsxFlowElement",
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PhrasingContent } from "mdast";
|
|
2
|
+
import { Plugin } from "unified";
|
|
3
|
+
import { OutlineItem } from "../../../components/Layout/components/Outline/types";
|
|
4
|
+
interface Options {
|
|
5
|
+
depth?: {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
};
|
|
9
|
+
outline: OutlineItem[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Remark plugin to generate an outline from MDX content.
|
|
13
|
+
* The outline is a list of headings with their depth, hash, and value.
|
|
14
|
+
* @param options - Options.
|
|
15
|
+
* @param options.depth - Depth of the headings.
|
|
16
|
+
* @param options.depth.max - Maximum depth of the headings.
|
|
17
|
+
* @param options.depth.min - Minimum depth of the headings.
|
|
18
|
+
* @param options.outline - Outline items.
|
|
19
|
+
* @returns plugin to generate an outline from MDX content.
|
|
20
|
+
*/
|
|
21
|
+
export declare function remarkHeadings({ depth: { max, min }, outline, }: Options): Plugin;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the value of the heading.
|
|
24
|
+
* @param children - Phrasing content.
|
|
25
|
+
* @param value - List of heading text values.
|
|
26
|
+
* @returns heading text value.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getHeadingTextValue(children: PhrasingContent[], value?: string[]): string;
|
|
29
|
+
export {};
|