react-science 18.0.2 → 19.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/lib/components/accordion/accordion_context_utils.d.ts +1 -1
- package/lib/components/accordion/accordion_context_utils.d.ts.map +1 -1
- package/lib/components/accordion/accordion_context_utils.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Alpha.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/CheckBoard.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/EditableInput.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Hue.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Saturation.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/interaction.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchFields.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchPresetColors.d.ts.map +1 -1
- package/lib/components/dialog/ConfirmDialog.d.ts.map +1 -1
- package/lib/components/dialog/ConfirmDialog.js +2 -1
- package/lib/components/dialog/ConfirmDialog.js.map +1 -1
- package/lib/components/doi/Logo.d.ts +6 -0
- package/lib/components/doi/Logo.d.ts.map +1 -0
- package/lib/components/doi/Logo.js +16 -0
- package/lib/components/doi/Logo.js.map +1 -0
- package/lib/components/doi/__tests__/parseDoi.test.d.ts +2 -0
- package/lib/components/doi/__tests__/parseDoi.test.d.ts.map +1 -0
- package/lib/components/doi/__tests__/parseDoi.test.js +19 -0
- package/lib/components/doi/__tests__/parseDoi.test.js.map +1 -0
- package/lib/components/doi/doi.d.ts +8 -0
- package/lib/components/doi/doi.d.ts.map +1 -0
- package/lib/components/doi/doi.js +17 -0
- package/lib/components/doi/doi.js.map +1 -0
- package/lib/components/doi/index.d.ts +2 -0
- package/lib/components/doi/index.d.ts.map +1 -0
- package/lib/components/doi/index.js +2 -0
- package/lib/components/doi/index.js.map +1 -0
- package/lib/components/doi/utils.d.ts +2 -0
- package/lib/components/doi/utils.d.ts.map +1 -0
- package/lib/components/doi/utils.js +6 -0
- package/lib/components/doi/utils.js.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib/components/info-panel/InfoPanel.js +2 -1
- package/lib/components/info-panel/InfoPanel.js.map +1 -1
- package/lib/components/inline_editable_renderer/inline_editable_renderer.d.ts.map +1 -1
- package/lib/components/root-layout/css-reset/customPreflight.d.ts.map +1 -1
- package/lib/components/split_pane/split_pane.d.ts.map +1 -1
- package/lib/components/split_pane/split_pane.js +4 -6
- package/lib/components/split_pane/split_pane.js.map +1 -1
- package/lib/components/table/index.d.ts +10 -0
- package/lib/components/table/index.d.ts.map +1 -1
- package/lib/components/table/index.js.map +1 -1
- package/lib/components/table/reorder_rows/drop_indicator.d.ts.map +1 -1
- package/lib/components/table/table_body.d.ts +2 -0
- package/lib/components/table/table_body.d.ts.map +1 -1
- package/lib/components/table/table_body.js +5 -5
- package/lib/components/table/table_body.js.map +1 -1
- package/lib/components/table/table_header_cell.js +1 -0
- package/lib/components/table/table_header_cell.js.map +1 -1
- package/lib/components/table/table_root.d.ts +8 -2
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js +8 -8
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/table/table_row_cell.d.ts +2 -0
- package/lib/components/table/table_row_cell.d.ts.map +1 -1
- package/lib/components/table/table_row_cell.js +4 -2
- package/lib/components/table/table_row_cell.js.map +1 -1
- package/lib/components/utils/shouldForwardPropExcept.d.ts +2 -0
- package/lib/components/utils/shouldForwardPropExcept.d.ts.map +1 -0
- package/lib/components/utils/shouldForwardPropExcept.js +7 -0
- package/lib/components/utils/shouldForwardPropExcept.js.map +1 -0
- package/package.json +44 -46
- package/src/components/accordion/accordion_context_utils.ts +1 -3
- package/src/components/dialog/ConfirmDialog.tsx +3 -2
- package/src/components/doi/Logo.tsx +33 -0
- package/src/components/doi/doi.tsx +35 -0
- package/src/components/doi/index.ts +1 -0
- package/src/components/doi/utils.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/components/info-panel/InfoPanel.tsx +2 -1
- package/src/components/split_pane/split_pane.tsx +4 -6
- package/src/components/table/index.ts +14 -0
- package/src/components/table/table_body.tsx +15 -6
- package/src/components/table/table_header_cell.tsx +1 -0
- package/src/components/table/table_root.tsx +18 -9
- package/src/components/table/table_row_cell.tsx +7 -2
- package/src/components/utils/shouldForwardPropExcept.ts +6 -0
|
@@ -5,6 +5,7 @@ import { getCoreRowModel, getSortedRowModel, useReactTable, } from '@tanstack/re
|
|
|
5
5
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
6
6
|
import { useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import { match } from 'ts-pattern';
|
|
8
|
+
import { shouldForwardPropExcept } from '../utils/shouldForwardPropExcept.js';
|
|
8
9
|
import { FlashedRowProvider } from './flash_row/flashed_row_provider.js';
|
|
9
10
|
import { PreviewTablePropsContextProvider } from './preview_table_context.js';
|
|
10
11
|
import { ItemOrderProvider } from './reorder_rows/item_order_provider.js';
|
|
@@ -12,13 +13,12 @@ import { TableBody } from './table_body.js';
|
|
|
12
13
|
import { TableHeader } from './table_header.js';
|
|
13
14
|
import { ScrollContainer } from './table_scroll_container.js';
|
|
14
15
|
import { useTableColumns } from './use_table_columns.js';
|
|
15
|
-
const nonForwardedProps = new Set([
|
|
16
|
-
'striped',
|
|
17
|
-
'stickyHeader',
|
|
18
|
-
'noHeader',
|
|
19
|
-
]);
|
|
20
16
|
const CustomHTMLTable = styled(HTMLTable, {
|
|
21
|
-
shouldForwardProp: (
|
|
17
|
+
shouldForwardProp: shouldForwardPropExcept([
|
|
18
|
+
'striped',
|
|
19
|
+
'stickyHeader',
|
|
20
|
+
'noHeader',
|
|
21
|
+
]),
|
|
22
22
|
}) `
|
|
23
23
|
/* When using a sticky header, ensure that the borders are located below the last header instead of above the first row. */
|
|
24
24
|
${(props) => match(props)
|
|
@@ -46,7 +46,7 @@ const CustomHTMLTable = styled(HTMLTable, {
|
|
|
46
46
|
}
|
|
47
47
|
`;
|
|
48
48
|
export function Table(props) {
|
|
49
|
-
const { data, columns, bordered = false, compact = false, interactive = false, striped = false, noHeader = false, stickyHeader = false, reactTable, tableProps, className, renderRowTr, renderHeaderCell, getTdProps, virtualizeRows, getRowId, onRowOrderChanged, renderRowPreview, scrollToRowRef, } = props;
|
|
49
|
+
const { data, columns, bordered = false, compact = false, interactive = false, striped = false, noHeader = false, stickyHeader = false, reactTable, tableProps, className, renderRowTr, renderHeaderCell, tdStyle, getTdProps, virtualizeRows, getRowId, onRowOrderChanged, renderRowPreview, scrollToRowRef, } = props;
|
|
50
50
|
const isReorderingEnabled = !!onRowOrderChanged;
|
|
51
51
|
const virtualScrollElementRef = useRef(null);
|
|
52
52
|
const columnDefs = useTableColumns(columns);
|
|
@@ -99,7 +99,7 @@ export function Table(props) {
|
|
|
99
99
|
// Props which are not forwarded to the HTMLTable component
|
|
100
100
|
striped: striped, noHeader: noHeader, stickyHeader: stickyHeader,
|
|
101
101
|
// Props which are forwarded to the HTMLTable component
|
|
102
|
-
ref: tableRef, bordered: bordered, compact: compact, interactive: interactive, ...tableProps, className: finalClassName, children: [!noHeader && (_jsx(TableHeader, { sticky: stickyHeader, headers: tableHeaders, renderHeaderCell: renderHeaderCell })), _jsx(TableBody, { rows: table.getRowModel().rows, renderRowTr: renderRowTr, getTdProps: getTdProps, virtualizer: tanstackVirtualizer, virtualizeRows: virtualizeRows, renderRowPreview: renderRowPreview, isReorderingEnabled: isReorderingEnabled })] }) }) }) }) }));
|
|
102
|
+
ref: tableRef, bordered: bordered, compact: compact, interactive: interactive, ...tableProps, className: finalClassName, children: [!noHeader && (_jsx(TableHeader, { sticky: stickyHeader, headers: tableHeaders, renderHeaderCell: renderHeaderCell })), _jsx(TableBody, { rows: table.getRowModel().rows, renderRowTr: renderRowTr, tdStyle: tdStyle, getTdProps: getTdProps, virtualizer: tanstackVirtualizer, virtualizeRows: virtualizeRows, renderRowPreview: renderRowPreview, isReorderingEnabled: isReorderingEnabled })] }) }) }) }) }));
|
|
103
103
|
}
|
|
104
104
|
function useCheckProps(props, headers) {
|
|
105
105
|
const { onRowOrderChanged, getRowId } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table_root.js","sourceRoot":"","sources":["../../../src/components/table/table_root.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAS9D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,
|
|
1
|
+
{"version":3,"file":"table_root.js","sourceRoot":"","sources":["../../../src/components/table/table_root.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,OAAO,EACL,eAA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AE,CAAC,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Cell, RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
2
3
|
import type { GetTdProps } from './table_utils.js';
|
|
3
4
|
interface TableRowCellProps<TData extends RowData> {
|
|
4
5
|
cell: Cell<TData, unknown>;
|
|
6
|
+
tdStyle: CSSProperties | undefined;
|
|
5
7
|
getTdProps: GetTdProps<TData> | undefined;
|
|
6
8
|
}
|
|
7
9
|
export declare function TableRowCell<TData extends RowData>(props: TableRowCellProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table_row_cell.d.ts","sourceRoot":"","sources":["../../../src/components/table/table_row_cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"table_row_cell.d.ts","sourceRoot":"","sources":["../../../src/components/table/table_row_cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,UAAU,iBAAiB,CAAC,KAAK,SAAS,OAAO;IAC/C,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3B,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;CAC3C;AAED,wBAAgB,YAAY,CAAC,KAAK,SAAS,OAAO,EAChD,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,2CAYhC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { flexRender } from '@tanstack/react-table';
|
|
3
3
|
export function TableRowCell(props) {
|
|
4
|
-
const { cell, getTdProps } = props;
|
|
5
|
-
|
|
4
|
+
const { cell, tdStyle, getTdProps } = props;
|
|
5
|
+
const tdProps = getTdProps?.(cell);
|
|
6
|
+
const style = { ...tdStyle, ...tdProps?.style };
|
|
7
|
+
return (_jsx("td", { ...tdProps, style: style, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }));
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=table_row_cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table_row_cell.js","sourceRoot":"","sources":["../../../src/components/table/table_row_cell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"table_row_cell.js","sourceRoot":"","sources":["../../../src/components/table/table_row_cell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAWnD,MAAM,UAAU,YAAY,CAC1B,KAA+B;IAE/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC;IAEhD,OAAO,CACL,gBAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,YAC1B,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,GACvD,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldForwardPropExcept.d.ts","sourceRoot":"","sources":["../../../src/components/utils/shouldForwardPropExcept.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,IAElD,UAAU,MAAM,aAGzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shouldForwardPropExcept.js","sourceRoot":"","sources":["../../../src/components/utils/shouldForwardPropExcept.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,UAAoB;IAC1D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,CAAC,QAAgB,EAAE,EAAE;QAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-science",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "React components to build scientific applications UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -48,89 +48,87 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/zakodium-oss/react-science#readme",
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@blueprintjs/core": "^
|
|
52
|
-
"@blueprintjs/icons": "^
|
|
53
|
-
"@blueprintjs/select": "^
|
|
51
|
+
"@blueprintjs/core": "^6.0.0",
|
|
52
|
+
"@blueprintjs/icons": "^6.0.0",
|
|
53
|
+
"@blueprintjs/select": "^6.0.0",
|
|
54
54
|
"fifo-logger": "^1.0.0",
|
|
55
55
|
"react": ">=18.0.0",
|
|
56
56
|
"react-dom": ">=18.0.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@atlaskit/pragmatic-drag-and-drop": "^1.
|
|
60
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.
|
|
61
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0
|
|
59
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.7.2",
|
|
60
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.1",
|
|
61
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
62
62
|
"@emotion/styled": "^11.14.0",
|
|
63
|
-
"@radix-ui/react-use-controllable-state": "^1.
|
|
64
|
-
"@tanstack/react-table": "^8.21.
|
|
65
|
-
"@tanstack/react-virtual": "^3.13.
|
|
63
|
+
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
64
|
+
"@tanstack/react-table": "^8.21.3",
|
|
65
|
+
"@tanstack/react-virtual": "^3.13.10",
|
|
66
66
|
"d3-scale-chromatic": "^3.1.0",
|
|
67
|
+
"react-d3-utils": "^3.1.0",
|
|
67
68
|
"react-dropzone": "^14.3.8",
|
|
68
69
|
"react-full-screen": "^1.1.1",
|
|
69
70
|
"react-icons": "^5.5.0",
|
|
70
71
|
"react-inspector": "^6.0.2",
|
|
71
72
|
"tinycolor2": "^1.6.0",
|
|
72
|
-
"ts-pattern": "^5.
|
|
73
|
-
"use-resize-observer": "^9.1.0"
|
|
73
|
+
"ts-pattern": "^5.7.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@blueprintjs/core": "
|
|
77
|
-
"@blueprintjs/icons": "
|
|
78
|
-
"@blueprintjs/select": "
|
|
79
|
-
"@floating-ui/react": "^0.27.
|
|
80
|
-
"@playwright/experimental-ct-react": "^1.
|
|
81
|
-
"@playwright/test": "^1.
|
|
82
|
-
"@storybook/addon-
|
|
83
|
-
"@storybook/
|
|
84
|
-
"@
|
|
85
|
-
"@storybook/blocks": "^8.6.2",
|
|
86
|
-
"@storybook/react": "^8.6.2",
|
|
87
|
-
"@storybook/react-vite": "^8.6.2",
|
|
88
|
-
"@tanstack/react-query": "^5.66.9",
|
|
76
|
+
"@blueprintjs/core": "6.0.0",
|
|
77
|
+
"@blueprintjs/icons": "6.0.0",
|
|
78
|
+
"@blueprintjs/select": "6.0.0",
|
|
79
|
+
"@floating-ui/react": "^0.27.12",
|
|
80
|
+
"@playwright/experimental-ct-react": "^1.53.0",
|
|
81
|
+
"@playwright/test": "^1.53.0",
|
|
82
|
+
"@storybook/addon-docs": "^9.0.8",
|
|
83
|
+
"@storybook/react-vite": "^9.0.8",
|
|
84
|
+
"@tanstack/react-query": "^5.80.7",
|
|
89
85
|
"@types/babel__core": "^7.20.5",
|
|
90
86
|
"@types/d3-scale-chromatic": "^3.1.0",
|
|
91
|
-
"@types/node": "^22.
|
|
87
|
+
"@types/node": "^22.15.29",
|
|
92
88
|
"@types/react": "^18.3.12",
|
|
93
89
|
"@types/react-dom": "^18.3.1",
|
|
94
90
|
"@types/tinycolor2": "^1.4.6",
|
|
95
|
-
"@vitejs/plugin-react": "^4.
|
|
96
|
-
"@vitest/coverage-v8": "^3.
|
|
91
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
92
|
+
"@vitest/coverage-v8": "^3.2.3",
|
|
97
93
|
"biologic-converter": "^0.6.0",
|
|
98
94
|
"cheminfo-font": "^1.13.1",
|
|
99
95
|
"cheminfo-types": "^1.8.1",
|
|
100
96
|
"cross-env": "^7.0.3",
|
|
101
|
-
"eslint": "^9.
|
|
102
|
-
"eslint-config-zakodium": "^
|
|
103
|
-
"eslint-plugin-storybook": "^0.
|
|
97
|
+
"eslint": "^9.28.0",
|
|
98
|
+
"eslint-config-zakodium": "^15.0.1",
|
|
99
|
+
"eslint-plugin-storybook": "^9.0.8",
|
|
104
100
|
"fifo-logger": "^1.0.0",
|
|
105
101
|
"filelist-utils": "^1.11.3",
|
|
106
102
|
"immer": "^10.1.1",
|
|
107
|
-
"jcampconverter": "^11.0.
|
|
103
|
+
"jcampconverter": "^11.0.3",
|
|
108
104
|
"ml-gsd": "^12.1.8",
|
|
109
105
|
"ml-peak-shape-generator": "^4.1.4",
|
|
110
106
|
"ml-signal-processing": "^1.2.0",
|
|
111
|
-
"ml-spectra-processing": "^14.
|
|
112
|
-
"ms-spectrum": "^3.
|
|
107
|
+
"ml-spectra-processing": "^14.12.0",
|
|
108
|
+
"ms-spectrum": "^3.9.0",
|
|
113
109
|
"netcdfjs": "^3.0.0",
|
|
114
110
|
"postcss-styled-syntax": "^0.7.1",
|
|
115
|
-
"prettier": "^3.5.
|
|
111
|
+
"prettier": "^3.5.3",
|
|
116
112
|
"react": "^18.3.1",
|
|
117
|
-
"react-d3-utils": "^3.0.0",
|
|
118
113
|
"react-dom": "^18.3.1",
|
|
119
|
-
"react-error-boundary": "^
|
|
114
|
+
"react-error-boundary": "^6.0.0",
|
|
120
115
|
"react-kbs": "^2.1.1",
|
|
121
|
-
"react-ocl": "^
|
|
122
|
-
"react-plot": "^3.
|
|
116
|
+
"react-ocl": "^8.0.0",
|
|
117
|
+
"react-plot": "^3.1.0",
|
|
123
118
|
"rimraf": "^6.0.1",
|
|
124
119
|
"spc-parser": "^1.0.0",
|
|
125
|
-
"storybook": "^
|
|
126
|
-
"stylelint": "^16.
|
|
127
|
-
"stylelint-config-standard": "^
|
|
128
|
-
"typescript": "^5.
|
|
129
|
-
"vite": "^6.
|
|
130
|
-
"vitest": "^3.
|
|
120
|
+
"storybook": "^9.0.8",
|
|
121
|
+
"stylelint": "^16.20.0",
|
|
122
|
+
"stylelint-config-standard": "^38.0.0",
|
|
123
|
+
"typescript": "^5.8.3",
|
|
124
|
+
"vite": "^6.3.5",
|
|
125
|
+
"vitest": "^3.2.3",
|
|
131
126
|
"wdf-parser": "^0.3.0"
|
|
132
127
|
},
|
|
133
128
|
"volta": {
|
|
134
|
-
"node": "22.
|
|
129
|
+
"node": "22.16.0"
|
|
130
|
+
},
|
|
131
|
+
"overrides": {
|
|
132
|
+
"storybook": "$storybook"
|
|
135
133
|
}
|
|
136
134
|
}
|
|
@@ -12,9 +12,7 @@ export interface AccordionItemContextValue {
|
|
|
12
12
|
controls: AccordionItemControls;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type AccordionItemSetIsOpen = Dispatch<
|
|
16
|
-
SetStateAction<boolean | undefined>
|
|
17
|
-
>;
|
|
15
|
+
export type AccordionItemSetIsOpen = Dispatch<SetStateAction<boolean>>;
|
|
18
16
|
|
|
19
17
|
interface AccordionRegisteredItem {
|
|
20
18
|
setIsOpen: AccordionItemSetIsOpen;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Classes, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
2
1
|
import type { DialogProps } from '@blueprintjs/core';
|
|
2
|
+
import { Classes, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
|
|
5
5
|
import { Button } from '../button/index.js';
|
|
6
|
+
import { shouldForwardPropExcept } from '../utils/shouldForwardPropExcept.js';
|
|
6
7
|
|
|
7
8
|
interface ConfirmDialogProps extends Omit<DialogProps, 'isCloseButtonShown'> {
|
|
8
9
|
onConfirm: () => void;
|
|
@@ -13,7 +14,7 @@ interface ConfirmDialogProps extends Omit<DialogProps, 'isCloseButtonShown'> {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const DialogWithHeaderColor = styled(Dialog, {
|
|
16
|
-
shouldForwardProp: (
|
|
17
|
+
shouldForwardProp: shouldForwardPropExcept(['headerColor']),
|
|
17
18
|
})<{ headerColor: string }>`
|
|
18
19
|
.${Classes.DIALOG_HEADER} {
|
|
19
20
|
background-color: ${(props) => props.headerColor};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
|
|
3
|
+
const Svg = styled.svg<{ size: string }>`
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
${(props) => {
|
|
6
|
+
return `
|
|
7
|
+
height: ${props.size};
|
|
8
|
+
width: ${props.size};
|
|
9
|
+
`;
|
|
10
|
+
}}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
interface LogoProps {
|
|
14
|
+
size: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Logo(props: LogoProps) {
|
|
18
|
+
const { size } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130 130" size={size}>
|
|
22
|
+
<circle fill="#fcb425" cx="65" cy="65" r="64" />
|
|
23
|
+
<path
|
|
24
|
+
fill="##231f20"
|
|
25
|
+
d="m 49.819127,84.559148 -11.854304,0 0,-4.825665 c -1.203594,1.510894 -4.035515,3.051053 -5.264716,3.742483 -2.151101,1.203585 -5.072066,1.987225 -7.812161,1.987225 -4.430246,0 -8.373925,-1.399539 -11.831057,-4.446924 -4.1229464,-3.636389 -6.0602455,-9.19576 -6.0602455,-15.188113 0,-6.094791 2.1126913,-10.960381 6.3380645,-14.59676 3.354695,-2.893745 7.457089,-5.209795 11.810505,-5.209795 2.535231,0 5.661807,0.227363 7.889738,1.302913 1.280414,0.614601 3.572628,2.060721 4.929872,3.469179 l 0,-25.420177 11.854304,0 z m -12.1199,-18.692584 c 0,-2.253538 -0.618258,-4.951555 -2.205973,-6.513663 -1.587724,-1.587724 -4.474153,-2.996182 -6.727691,-2.996182 -2.509615,0 -4.834476,1.825511 -6.447807,3.720535 -1.306031,1.536501 -1.959041,3.905269 -1.959041,5.877114 0,1.971835 0.740815,4.165004 2.046836,5.701505 1.587714,1.895025 3.297985,3.193739 5.833216,3.193739 2.279145,0 4.989965,-0.956662 6.552083,-2.51877 1.587714,-1.562108 2.908377,-4.185134 2.908377,-6.464278 z"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fill="#fff"
|
|
29
|
+
d="m 105.42764,25.617918 c -1.97184,0 -3.64919,0.69142 -5.03204,2.074271 -1.357247,1.357245 -2.035864,3.021779 -2.035864,4.993633 0,1.971835 0.678617,3.649193 2.035864,5.032034 1.38285,1.382861 3.0602,2.074281 5.03204,2.074281 1.99744,0 3.67479,-0.678627 5.03203,-2.035861 1.38285,-1.382861 2.07428,-3.073012 2.07428,-5.070454 0,-1.971854 -0.69143,-3.636388 -2.07428,-4.993633 -1.38285,-1.382851 -3.0602,-2.074271 -5.03203,-2.074271 z M 74.219383,45.507921 c -7.323992,0 -12.970625,2.283009 -16.939921,6.848949 -3.277876,3.782438 -4.916803,8.118252 -4.916803,13.008406 0,5.430481 1.626124,10.009834 4.878383,13.738236 3.943689,4.538918 9.475093,6.808622 16.59421,6.808622 7.093512,0 12.612122,-2.269704 16.555801,-6.808622 3.252259,-3.728402 4.878393,-8.1993 4.878393,-13.413648 0,-5.160323 -1.638938,-9.604602 -4.916803,-13.332994 -4.020509,-4.56594 -9.398263,-6.848949 -16.13326,-6.848949 z m 24.908603,1.386686 0,37.634676 12.599304,0 0,-37.634676 -12.599304,0 z M 73.835252,56.975981 c 2.304752,0 4.263793,0.852337 5.877124,2.554426 1.638928,1.675076 2.458402,3.727881 2.458402,6.159457 0,2.458578 -0.806671,4.538022 -2.419992,6.240111 -1.613331,1.675086 -3.585175,2.514099 -5.915534,2.514099 -2.612051,0 -4.737546,-1.027366 -6.376474,-3.080682 -1.331637,-1.648053 -1.997451,-3.539154 -1.997451,-5.673528 0,-2.107362 0.665814,-3.985138 1.997451,-5.633201 1.638928,-2.053316 3.764423,-3.080682 6.376474,-3.080682 z"
|
|
30
|
+
/>
|
|
31
|
+
</Svg>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { match } from 'ts-pattern';
|
|
2
|
+
|
|
3
|
+
import { Logo } from './Logo.js';
|
|
4
|
+
import { normalizeDOI } from './utils.js';
|
|
5
|
+
|
|
6
|
+
type DOISize = 'small' | 'medium' | 'large';
|
|
7
|
+
|
|
8
|
+
export interface DOIProps {
|
|
9
|
+
value: string;
|
|
10
|
+
size?: DOISize;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function DOI(props: DOIProps) {
|
|
14
|
+
const { value, size = 'small' } = props;
|
|
15
|
+
const normalizedValue = normalizeDOI(value);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<a
|
|
19
|
+
title={normalizedValue}
|
|
20
|
+
href={`https://doi.org/${normalizedValue}`}
|
|
21
|
+
target="_blank"
|
|
22
|
+
rel="noreferrer"
|
|
23
|
+
>
|
|
24
|
+
<Logo size={getDOISize(size)} />
|
|
25
|
+
</a>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getDOISize(size: DOISize): string {
|
|
30
|
+
return match(size)
|
|
31
|
+
.with('small', () => '1.25rem')
|
|
32
|
+
.with('medium', () => '2.5rem')
|
|
33
|
+
.with('large', () => '3.75rem')
|
|
34
|
+
.exhaustive();
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './doi.js';
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './accordion/index.js';
|
|
|
2
2
|
export * from './button/index.js';
|
|
3
3
|
export * from './color-picker/index.js';
|
|
4
4
|
export * from './dialog/index.js';
|
|
5
|
+
export * from './doi/index.js';
|
|
5
6
|
export * from './drop-zone/index.js';
|
|
6
7
|
export * from './forms/index.js';
|
|
7
8
|
export * from './fullscreen/index.js';
|
|
@@ -7,6 +7,7 @@ import { match, P } from 'ts-pattern';
|
|
|
7
7
|
import { Button } from '../button/Button.js';
|
|
8
8
|
import { SelectedTotal } from '../selected-total/index.js';
|
|
9
9
|
import { createTableColumnHelper, Table } from '../table/index.js';
|
|
10
|
+
import { shouldForwardPropExcept } from '../utils/shouldForwardPropExcept.js';
|
|
10
11
|
import * as ValueRenderers from '../value-renderers/index.js';
|
|
11
12
|
|
|
12
13
|
export interface InfoPanelData {
|
|
@@ -23,7 +24,7 @@ interface InfoPanelProps {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const AccordionButton = styled(Button, {
|
|
26
|
-
shouldForwardProp: (
|
|
27
|
+
shouldForwardProp: shouldForwardPropExcept(['open']),
|
|
27
28
|
})<{ open?: boolean }>`
|
|
28
29
|
z-index: 1;
|
|
29
30
|
position: sticky;
|
|
@@ -8,8 +8,8 @@ import type {
|
|
|
8
8
|
RefObject,
|
|
9
9
|
} from 'react';
|
|
10
10
|
import { useEffect, useReducer, useRef } from 'react';
|
|
11
|
+
import { useResizeObserver } from 'react-d3-utils';
|
|
11
12
|
import { match } from 'ts-pattern';
|
|
12
|
-
import useResizeObserver from 'use-resize-observer';
|
|
13
13
|
|
|
14
14
|
import type { SplitPaneSize, SplitPaneType } from './split_pane_helpers.js';
|
|
15
15
|
import { parseSize, serializeSize } from './split_pane_helpers.js';
|
|
@@ -138,11 +138,9 @@ export function SplitPane(props: SplitPaneProps) {
|
|
|
138
138
|
onResize,
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
// @ts-ignore Module exists.
|
|
143
|
-
const rootSize = useResizeObserver<HTMLDivElement>();
|
|
141
|
+
const [rootRef, rootSize] = useResizeObserver();
|
|
144
142
|
const mainDirectionSize =
|
|
145
|
-
direction === 'horizontal' ? rootSize
|
|
143
|
+
direction === 'horizontal' ? rootSize?.width : rootSize?.height;
|
|
146
144
|
|
|
147
145
|
useEffect(() => {
|
|
148
146
|
if (
|
|
@@ -172,7 +170,7 @@ export function SplitPane(props: SplitPaneProps) {
|
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
return (
|
|
175
|
-
<SplitPaneContainer direction={direction} ref={
|
|
173
|
+
<SplitPaneContainer direction={direction} ref={rootRef}>
|
|
176
174
|
{children[0] !== null && (
|
|
177
175
|
<SplitSide style={getSplitSideStyle('start')}>{children[0]}</SplitSide>
|
|
178
176
|
)}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import type { RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
|
|
1
4
|
export * from './table_root.js';
|
|
2
5
|
export * from './table_utils.js';
|
|
3
6
|
export * from './table_row.js';
|
|
4
7
|
export * from './reorder_rows/index.js';
|
|
8
|
+
|
|
9
|
+
declare module '@tanstack/react-table' {
|
|
10
|
+
// Declaration merging
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
13
|
+
/**
|
|
14
|
+
* Merged into the `style` prop of the default-rendered `<th>` element.
|
|
15
|
+
*/
|
|
16
|
+
thStyle?: CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Row, RowData } from '@tanstack/react-table';
|
|
2
2
|
import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
|
3
3
|
import { notUndefined } from '@tanstack/react-virtual';
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
4
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
5
5
|
import { Fragment } from 'react';
|
|
6
6
|
|
|
7
7
|
import { TableDraggableRowTr } from './reorder_rows/index.js';
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
|
|
17
17
|
interface TableBodyProps<TData extends RowData> {
|
|
18
18
|
rows: Array<Row<TData>>;
|
|
19
|
+
tdStyle?: CSSProperties;
|
|
19
20
|
getTdProps?: GetTdProps<TData>;
|
|
20
21
|
renderRowTr: TableRowTrRenderer<TData> | undefined;
|
|
21
22
|
virtualizeRows?: boolean;
|
|
@@ -27,6 +28,7 @@ interface TableBodyProps<TData extends RowData> {
|
|
|
27
28
|
export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
28
29
|
const {
|
|
29
30
|
rows,
|
|
31
|
+
tdStyle,
|
|
30
32
|
getTdProps,
|
|
31
33
|
renderRowTr = getDefaultRenderRowTr(
|
|
32
34
|
props.isReorderingEnabled,
|
|
@@ -57,10 +59,15 @@ export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
|
57
59
|
key={virtualItem.index}
|
|
58
60
|
row={rows[virtualItem.index]}
|
|
59
61
|
renderRowTr={(row) => {
|
|
60
|
-
const trProps = getTrRenderProps<TData>(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const trProps = getTrRenderProps<TData>(
|
|
63
|
+
row,
|
|
64
|
+
tdStyle,
|
|
65
|
+
getTdProps,
|
|
66
|
+
{
|
|
67
|
+
...virtualItem,
|
|
68
|
+
virtualIndex: index,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
64
71
|
return renderRowTr(trProps, row);
|
|
65
72
|
}}
|
|
66
73
|
/>
|
|
@@ -80,7 +87,7 @@ export function TableBody<TData extends RowData>(props: TableBodyProps<TData>) {
|
|
|
80
87
|
key={row.id}
|
|
81
88
|
row={row}
|
|
82
89
|
renderRowTr={(row) =>
|
|
83
|
-
renderRowTr(getTrRenderProps(row, getTdProps), row)
|
|
90
|
+
renderRowTr(getTrRenderProps(row, tdStyle, getTdProps), row)
|
|
84
91
|
}
|
|
85
92
|
/>
|
|
86
93
|
))}
|
|
@@ -109,6 +116,7 @@ type RenderRowVirtualItem = VirtualItem & {
|
|
|
109
116
|
|
|
110
117
|
function getTrRenderProps<TData extends RowData>(
|
|
111
118
|
row: Row<TData>,
|
|
119
|
+
tdStyle: CSSProperties | undefined,
|
|
112
120
|
getTdProps: GetTdProps<TData> | undefined,
|
|
113
121
|
virtualItem?: RenderRowVirtualItem,
|
|
114
122
|
): TableRowTrRenderProps {
|
|
@@ -124,6 +132,7 @@ function getTrRenderProps<TData extends RowData>(
|
|
|
124
132
|
<TableRowCell<TData>
|
|
125
133
|
key={cell.id}
|
|
126
134
|
cell={cell}
|
|
135
|
+
tdStyle={tdStyle}
|
|
127
136
|
getTdProps={getTdProps}
|
|
128
137
|
/>
|
|
129
138
|
)),
|
|
@@ -12,10 +12,12 @@ import {
|
|
|
12
12
|
useReactTable,
|
|
13
13
|
} from '@tanstack/react-table';
|
|
14
14
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
15
|
-
import type { RefObject, TableHTMLAttributes } from 'react';
|
|
15
|
+
import type { CSSProperties, RefObject, TableHTMLAttributes } from 'react';
|
|
16
16
|
import { useEffect, useMemo, useRef } from 'react';
|
|
17
17
|
import { match } from 'ts-pattern';
|
|
18
18
|
|
|
19
|
+
import { shouldForwardPropExcept } from '../utils/shouldForwardPropExcept.js';
|
|
20
|
+
|
|
19
21
|
import { FlashedRowProvider } from './flash_row/flashed_row_provider.js';
|
|
20
22
|
import type { PreviewTablePropsContextValue } from './preview_table_context.js';
|
|
21
23
|
import { PreviewTablePropsContextProvider } from './preview_table_context.js';
|
|
@@ -34,14 +36,12 @@ import type {
|
|
|
34
36
|
} from './table_utils.js';
|
|
35
37
|
import { useTableColumns } from './use_table_columns.js';
|
|
36
38
|
|
|
37
|
-
const nonForwardedProps = new Set<keyof TableProps<unknown>>([
|
|
38
|
-
'striped',
|
|
39
|
-
'stickyHeader',
|
|
40
|
-
'noHeader',
|
|
41
|
-
]) as Set<string>;
|
|
42
|
-
|
|
43
39
|
const CustomHTMLTable = styled(HTMLTable, {
|
|
44
|
-
shouldForwardProp: (
|
|
40
|
+
shouldForwardProp: shouldForwardPropExcept([
|
|
41
|
+
'striped',
|
|
42
|
+
'stickyHeader',
|
|
43
|
+
'noHeader',
|
|
44
|
+
]),
|
|
45
45
|
})<{ stickyHeader: boolean; noHeader: boolean }>`
|
|
46
46
|
/* When using a sticky header, ensure that the borders are located below the last header instead of above the first row. */
|
|
47
47
|
${(props) =>
|
|
@@ -143,9 +143,16 @@ interface TableBaseProps<TData extends RowData> {
|
|
|
143
143
|
renderHeaderCell?: HeaderCellRenderer<TData>;
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
|
-
* Pass custom
|
|
146
|
+
* Pass custom default style to the `<td>` elements.
|
|
147
|
+
* If `getTdProps` returns a `style` object, it will be merged with `tdStyle`.
|
|
148
|
+
*/
|
|
149
|
+
tdStyle?: CSSProperties;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Pass custom props to the `<td>` elements.
|
|
147
153
|
* The callback is called for each cell and receives the row's data.
|
|
148
154
|
* The returned properties are spread onto the `<td>` element.
|
|
155
|
+
* If `style` is returned, it will be merged with `tdStyle`.
|
|
149
156
|
*/
|
|
150
157
|
getTdProps?: GetTdProps<TData>;
|
|
151
158
|
|
|
@@ -226,6 +233,7 @@ export function Table<TData extends RowData>(props: TableProps<TData>) {
|
|
|
226
233
|
className,
|
|
227
234
|
renderRowTr,
|
|
228
235
|
renderHeaderCell,
|
|
236
|
+
tdStyle,
|
|
229
237
|
getTdProps,
|
|
230
238
|
|
|
231
239
|
virtualizeRows,
|
|
@@ -333,6 +341,7 @@ export function Table<TData extends RowData>(props: TableProps<TData>) {
|
|
|
333
341
|
<TableBody
|
|
334
342
|
rows={table.getRowModel().rows}
|
|
335
343
|
renderRowTr={renderRowTr}
|
|
344
|
+
tdStyle={tdStyle}
|
|
336
345
|
getTdProps={getTdProps}
|
|
337
346
|
virtualizer={tanstackVirtualizer}
|
|
338
347
|
virtualizeRows={virtualizeRows}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import type { Cell, RowData } from '@tanstack/react-table';
|
|
2
2
|
import { flexRender } from '@tanstack/react-table';
|
|
3
|
+
import type { CSSProperties } from 'react';
|
|
3
4
|
|
|
4
5
|
import type { GetTdProps } from './table_utils.js';
|
|
5
6
|
|
|
6
7
|
interface TableRowCellProps<TData extends RowData> {
|
|
7
8
|
cell: Cell<TData, unknown>;
|
|
9
|
+
tdStyle: CSSProperties | undefined;
|
|
8
10
|
getTdProps: GetTdProps<TData> | undefined;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export function TableRowCell<TData extends RowData>(
|
|
12
14
|
props: TableRowCellProps<TData>,
|
|
13
15
|
) {
|
|
14
|
-
const { cell, getTdProps } = props;
|
|
16
|
+
const { cell, tdStyle, getTdProps } = props;
|
|
17
|
+
|
|
18
|
+
const tdProps = getTdProps?.(cell);
|
|
19
|
+
const style = { ...tdStyle, ...tdProps?.style };
|
|
15
20
|
|
|
16
21
|
return (
|
|
17
|
-
<td {...
|
|
22
|
+
<td {...tdProps} style={style}>
|
|
18
23
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
19
24
|
</td>
|
|
20
25
|
);
|