react-science 4.1.3 → 6.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/app/about/AboutDialogToolbarButton.d.ts +2 -2
- package/lib/app/about/AboutDialogToolbarButton.d.ts.map +1 -1
- package/lib/app/kinds/ir/IrPeaksPanel.d.ts.map +1 -1
- package/lib/app/kinds/ir/IrPeaksPanel.js +7 -18
- package/lib/app/kinds/ir/IrPeaksPanel.js.map +1 -1
- package/lib/app/panels/SignalProcessingPanel.d.ts.map +1 -1
- package/lib/app/panels/SignalProcessingPanel.js +52 -27
- package/lib/app/panels/SignalProcessingPanel.js.map +1 -1
- package/lib/app/panels/measurements/MeasurementsTable.d.ts.map +1 -1
- package/lib/app/panels/measurements/MeasurementsTable.js +6 -6
- package/lib/app/panels/measurements/MeasurementsTable.js.map +1 -1
- package/lib/app/panels/measurements/measurementPanelContext.d.ts +2 -1
- package/lib/app/panels/measurements/measurementPanelContext.d.ts.map +1 -1
- package/lib/app/panels/measurements/measurementPanelContext.js.map +1 -1
- package/lib/components/color-picker/gradient-select/GradientSelect.d.ts.map +1 -1
- package/lib/components/color-picker/gradient-select/GradientSelect.js +11 -38
- package/lib/components/color-picker/gradient-select/GradientSelect.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Swatch.d.ts +2 -2
- package/lib/components/color-picker/react-color/common/interaction.d.ts +2 -2
- package/lib/components/dialog/ConfirmDialog.js +3 -3
- package/lib/components/dialog/ConfirmDialog.js.map +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib/components/info-panel/InfoPanel.js +24 -19
- package/lib/components/info-panel/InfoPanel.js.map +1 -1
- package/lib/components/logger/FifoLoggerDialog.d.ts.map +1 -1
- package/lib/components/logger/FifoLoggerDialog.js +32 -9
- package/lib/components/logger/FifoLoggerDialog.js.map +1 -1
- package/lib/components/root-layout/css-reset/customPreflight.d.ts.map +1 -1
- package/lib/components/table/default_table_cell.d.ts +3 -0
- package/lib/components/table/default_table_cell.d.ts.map +1 -0
- package/lib/components/table/default_table_cell.js +46 -0
- package/lib/components/table/default_table_cell.js.map +1 -0
- package/lib/components/table/index.d.ts +2 -1
- package/lib/components/table/index.d.ts.map +1 -1
- package/lib/components/table/index.js +2 -1
- package/lib/components/table/index.js.map +1 -1
- package/lib/components/table/table_body.d.ts +9 -0
- package/lib/components/table/table_body.d.ts.map +1 -0
- package/lib/components/table/table_body.js +19 -0
- package/lib/components/table/table_body.js.map +1 -0
- package/lib/components/table/table_header.d.ts +8 -0
- package/lib/components/table/table_header.d.ts.map +1 -0
- package/lib/components/table/table_header.js +16 -0
- package/lib/components/table/table_header.js.map +1 -0
- package/lib/components/table/table_header_cell.d.ts +7 -0
- package/lib/components/table/table_header_cell.d.ts.map +1 -0
- package/lib/components/table/table_header_cell.js +22 -0
- package/lib/components/table/table_header_cell.js.map +1 -0
- package/lib/components/table/table_root.d.ts +18 -0
- package/lib/components/table/table_root.d.ts.map +1 -0
- package/lib/components/table/table_root.js +23 -0
- package/lib/components/table/table_root.js.map +1 -0
- package/lib/components/table/table_row_cell.d.ts +7 -0
- package/lib/components/table/table_row_cell.d.ts.map +1 -0
- package/lib/components/table/table_row_cell.js +10 -0
- package/lib/components/table/table_row_cell.js.map +1 -0
- package/lib/components/table/table_utils.d.ts +10 -0
- package/lib/components/table/table_utils.d.ts.map +1 -0
- package/lib/components/table/table_utils.js +8 -0
- package/lib/components/table/table_utils.js.map +1 -0
- package/lib/components/table/use_table_columns.d.ts +4 -0
- package/lib/components/table/use_table_columns.d.ts.map +1 -0
- package/lib/components/table/use_table_columns.js +17 -0
- package/lib/components/table/use_table_columns.js.map +1 -0
- package/lib/components/toolbar/PanelPreferencesToolbar.d.ts +2 -1
- package/lib/components/toolbar/PanelPreferencesToolbar.d.ts.map +1 -1
- package/lib/components/toolbar/PanelPreferencesToolbar.js.map +1 -1
- package/lib/components/toolbar/Toolbar.d.ts +2 -2
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js +2 -2
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib/components/value-renderers/index.d.ts +0 -1
- package/lib/components/value-renderers/index.d.ts.map +1 -1
- package/lib/components/value-renderers/index.js +1 -3
- package/lib/components/value-renderers/index.js.map +1 -1
- package/lib-esm/app/about/AboutDialogToolbarButton.d.ts +2 -2
- package/lib-esm/app/about/AboutDialogToolbarButton.d.ts.map +1 -1
- package/lib-esm/app/kinds/ir/IrPeaksPanel.d.ts.map +1 -1
- package/lib-esm/app/kinds/ir/IrPeaksPanel.js +9 -20
- package/lib-esm/app/kinds/ir/IrPeaksPanel.js.map +1 -1
- package/lib-esm/app/panels/SignalProcessingPanel.d.ts.map +1 -1
- package/lib-esm/app/panels/SignalProcessingPanel.js +54 -29
- package/lib-esm/app/panels/SignalProcessingPanel.js.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementsTable.d.ts.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementsTable.js +7 -7
- package/lib-esm/app/panels/measurements/MeasurementsTable.js.map +1 -1
- package/lib-esm/app/panels/measurements/measurementPanelContext.d.ts +2 -1
- package/lib-esm/app/panels/measurements/measurementPanelContext.d.ts.map +1 -1
- package/lib-esm/app/panels/measurements/measurementPanelContext.js.map +1 -1
- package/lib-esm/components/color-picker/gradient-select/GradientSelect.d.ts.map +1 -1
- package/lib-esm/components/color-picker/gradient-select/GradientSelect.js +11 -38
- package/lib-esm/components/color-picker/gradient-select/GradientSelect.js.map +1 -1
- package/lib-esm/components/color-picker/react-color/common/Swatch.d.ts +2 -2
- package/lib-esm/components/color-picker/react-color/common/interaction.d.ts +2 -2
- package/lib-esm/components/dialog/ConfirmDialog.js +1 -1
- package/lib-esm/components/dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib-esm/components/info-panel/InfoPanel.js +19 -14
- package/lib-esm/components/info-panel/InfoPanel.js.map +1 -1
- package/lib-esm/components/logger/FifoLoggerDialog.d.ts.map +1 -1
- package/lib-esm/components/logger/FifoLoggerDialog.js +31 -8
- package/lib-esm/components/logger/FifoLoggerDialog.js.map +1 -1
- package/lib-esm/components/root-layout/css-reset/customPreflight.d.ts.map +1 -1
- package/lib-esm/components/table/default_table_cell.d.ts +3 -0
- package/lib-esm/components/table/default_table_cell.d.ts.map +1 -0
- package/lib-esm/components/table/default_table_cell.js +20 -0
- package/lib-esm/components/table/default_table_cell.js.map +1 -0
- package/lib-esm/components/table/index.d.ts +2 -1
- package/lib-esm/components/table/index.d.ts.map +1 -1
- package/lib-esm/components/table/index.js +2 -1
- package/lib-esm/components/table/index.js.map +1 -1
- package/lib-esm/components/table/table_body.d.ts +9 -0
- package/lib-esm/components/table/table_body.d.ts.map +1 -0
- package/lib-esm/components/table/table_body.js +16 -0
- package/lib-esm/components/table/table_body.js.map +1 -0
- package/lib-esm/components/table/table_header.d.ts +8 -0
- package/lib-esm/components/table/table_header.d.ts.map +1 -0
- package/lib-esm/components/table/table_header.js +13 -0
- package/lib-esm/components/table/table_header.js.map +1 -0
- package/lib-esm/components/table/table_header_cell.d.ts +7 -0
- package/lib-esm/components/table/table_header_cell.d.ts.map +1 -0
- package/lib-esm/components/table/table_header_cell.js +19 -0
- package/lib-esm/components/table/table_header_cell.js.map +1 -0
- package/lib-esm/components/table/table_root.d.ts +18 -0
- package/lib-esm/components/table/table_root.d.ts.map +1 -0
- package/lib-esm/components/table/table_root.js +20 -0
- package/lib-esm/components/table/table_root.js.map +1 -0
- package/lib-esm/components/table/table_row_cell.d.ts +7 -0
- package/lib-esm/components/table/table_row_cell.d.ts.map +1 -0
- package/lib-esm/components/table/table_row_cell.js +7 -0
- package/lib-esm/components/table/table_row_cell.js.map +1 -0
- package/lib-esm/components/table/table_utils.d.ts +10 -0
- package/lib-esm/components/table/table_utils.d.ts.map +1 -0
- package/lib-esm/components/table/table_utils.js +5 -0
- package/lib-esm/components/table/table_utils.js.map +1 -0
- package/lib-esm/components/table/use_table_columns.d.ts +4 -0
- package/lib-esm/components/table/use_table_columns.d.ts.map +1 -0
- package/lib-esm/components/table/use_table_columns.js +14 -0
- package/lib-esm/components/table/use_table_columns.js.map +1 -0
- package/lib-esm/components/toolbar/PanelPreferencesToolbar.d.ts +2 -1
- package/lib-esm/components/toolbar/PanelPreferencesToolbar.d.ts.map +1 -1
- package/lib-esm/components/toolbar/PanelPreferencesToolbar.js.map +1 -1
- package/lib-esm/components/toolbar/Toolbar.d.ts +2 -2
- package/lib-esm/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib-esm/components/toolbar/Toolbar.js +2 -2
- package/lib-esm/components/toolbar/Toolbar.js.map +1 -1
- package/lib-esm/components/value-renderers/index.d.ts +0 -1
- package/lib-esm/components/value-renderers/index.d.ts.map +1 -1
- package/lib-esm/components/value-renderers/index.js +0 -1
- package/lib-esm/components/value-renderers/index.js.map +1 -1
- package/package.json +31 -31
- package/src/app/about/AboutDialogToolbarButton.tsx +2 -2
- package/src/app/kinds/ir/IrPeaksPanel.tsx +15 -51
- package/src/app/panels/SignalProcessingPanel.tsx +99 -82
- package/src/app/panels/measurements/MeasurementsTable.tsx +19 -21
- package/src/app/panels/measurements/measurementPanelContext.tsx +2 -2
- package/src/components/color-picker/gradient-select/GradientSelect.tsx +44 -71
- package/src/components/dialog/ConfirmDialog.tsx +1 -1
- package/src/components/info-panel/InfoPanel.tsx +33 -34
- package/src/components/logger/FifoLoggerDialog.tsx +53 -35
- package/src/components/table/default_table_cell.tsx +20 -0
- package/src/components/table/index.ts +2 -1
- package/src/components/table/table_body.tsx +37 -0
- package/src/components/table/table_header.tsx +31 -0
- package/src/components/table/table_header_cell.tsx +38 -0
- package/src/components/table/table_root.tsx +74 -0
- package/src/components/table/table_row_cell.tsx +17 -0
- package/src/components/table/table_utils.ts +24 -0
- package/src/components/table/use_table_columns.ts +19 -0
- package/src/components/toolbar/PanelPreferencesToolbar.tsx +2 -1
- package/src/components/toolbar/Toolbar.tsx +6 -7
- package/src/components/value-renderers/index.ts +0 -2
- package/lib/components/table/Table.d.ts +0 -17
- package/lib/components/table/Table.d.ts.map +0 -1
- package/lib/components/table/Table.js +0 -38
- package/lib/components/table/Table.js.map +0 -1
- package/lib/components/table/TableHeader.d.ts +0 -5
- package/lib/components/table/TableHeader.d.ts.map +0 -1
- package/lib/components/table/TableHeader.js +0 -16
- package/lib/components/table/TableHeader.js.map +0 -1
- package/lib/components/table/TableRow.d.ts +0 -5
- package/lib/components/table/TableRow.d.ts.map +0 -1
- package/lib/components/table/TableRow.js +0 -44
- package/lib/components/table/TableRow.js.map +0 -1
- package/lib/components/table/tableContext.d.ts +0 -7
- package/lib/components/table/tableContext.d.ts.map +0 -1
- package/lib/components/table/tableContext.js +0 -11
- package/lib/components/table/tableContext.js.map +0 -1
- package/lib/components/value-renderers/Header.d.ts +0 -7
- package/lib/components/value-renderers/Header.d.ts.map +0 -1
- package/lib/components/value-renderers/Header.js +0 -14
- package/lib/components/value-renderers/Header.js.map +0 -1
- package/lib-esm/components/table/Table.d.ts +0 -17
- package/lib-esm/components/table/Table.d.ts.map +0 -1
- package/lib-esm/components/table/Table.js +0 -35
- package/lib-esm/components/table/Table.js.map +0 -1
- package/lib-esm/components/table/TableHeader.d.ts +0 -5
- package/lib-esm/components/table/TableHeader.d.ts.map +0 -1
- package/lib-esm/components/table/TableHeader.js +0 -12
- package/lib-esm/components/table/TableHeader.js.map +0 -1
- package/lib-esm/components/table/TableRow.d.ts +0 -5
- package/lib-esm/components/table/TableRow.d.ts.map +0 -1
- package/lib-esm/components/table/TableRow.js +0 -40
- package/lib-esm/components/table/TableRow.js.map +0 -1
- package/lib-esm/components/table/tableContext.d.ts +0 -7
- package/lib-esm/components/table/tableContext.d.ts.map +0 -1
- package/lib-esm/components/table/tableContext.js +0 -7
- package/lib-esm/components/table/tableContext.js.map +0 -1
- package/lib-esm/components/value-renderers/Header.d.ts +0 -7
- package/lib-esm/components/value-renderers/Header.d.ts.map +0 -1
- package/lib-esm/components/value-renderers/Header.js +0 -11
- package/lib-esm/components/value-renderers/Header.js.map +0 -1
- package/src/components/table/Table.tsx +0 -70
- package/src/components/table/TableHeader.tsx +0 -24
- package/src/components/table/TableRow.tsx +0 -82
- package/src/components/table/tableContext.ts +0 -7
- package/src/components/value-renderers/Header.tsx +0 -18
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import type { TableProps } from './Table';
|
|
3
|
-
export type TableRowProps = TableProps & HTMLAttributes<HTMLTableRowElement>;
|
|
4
|
-
export declare const TableRow: ({ children, style, bordered, ...other }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
//# sourceMappingURL=TableRow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../src/components/table/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAIf,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC;AAE7E,eAAO,MAAM,QAAQ,4CAKlB,aAAa,4CAUf,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableRow = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const value_renderers_1 = require("../value-renderers");
|
|
7
|
-
const tableContext_1 = require("./tableContext");
|
|
8
|
-
const TableRow = ({ children, style = {}, bordered = false, ...other }) => {
|
|
9
|
-
const { cells } = useRowChildren(children);
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)("tr", { style: { border: bordered ? '1px solid black' : '', ...style }, ...other, children: cells }));
|
|
11
|
-
};
|
|
12
|
-
exports.TableRow = TableRow;
|
|
13
|
-
function useRowChildren(children) {
|
|
14
|
-
const cells = [];
|
|
15
|
-
const { color } = (0, tableContext_1.useTableContext)();
|
|
16
|
-
for (const child of react_1.Children.toArray(children)) {
|
|
17
|
-
if (typeof child === 'object' &&
|
|
18
|
-
(0, react_1.isValidElement)(child) &&
|
|
19
|
-
(child.type === value_renderers_1.Color ||
|
|
20
|
-
child.type === value_renderers_1.Boolean ||
|
|
21
|
-
child.type === value_renderers_1.Text ||
|
|
22
|
-
child.type === value_renderers_1.Number ||
|
|
23
|
-
child.type === value_renderers_1.Object ||
|
|
24
|
-
child.type === value_renderers_1.Header ||
|
|
25
|
-
child.type === value_renderers_1.Component)) {
|
|
26
|
-
if (child.type === value_renderers_1.Header) {
|
|
27
|
-
cells.push((0, jsx_runtime_1.jsx)("th", { style: { color }, children: child }, child.key));
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
cells.push((0, jsx_runtime_1.jsx)("td", { style: {
|
|
31
|
-
color,
|
|
32
|
-
position: 'relative',
|
|
33
|
-
}, children: child }, child.key));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// eslint-disable-next-line no-console
|
|
38
|
-
console.error('Invalid Row child:', child);
|
|
39
|
-
throw new Error('invalid Row child');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return { cells };
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=TableRow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/components/table/TableRow.tsx"],"names":[],"mappings":";;;;AAAA,iCAMe;AAEf,wDAQ4B;AAG5B,iDAAiD;AAI1C,MAAM,QAAQ,GAAG,CAAC,EACvB,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,KAAK,EAChB,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,EAAE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N,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableContext.d.ts","sourceRoot":"","sources":["../../../src/components/table/tableContext.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;EAA+B,CAAC;AACzD,wBAAgB,eAAe;;EAG9B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableContext = void 0;
|
|
4
|
-
exports.useTableContext = useTableContext;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
exports.TableContext = (0, react_1.createContext)({ color: '' });
|
|
7
|
-
function useTableContext() {
|
|
8
|
-
const context = (0, react_1.useContext)(exports.TableContext);
|
|
9
|
-
return context;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=tableContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableContext.js","sourceRoot":"","sources":["../../../src/components/table/tableContext.ts"],"names":[],"mappings":";;;AAGA,0CAGC;AAND,iCAAkD;AAErC,QAAA,YAAY,GAAG,IAAA,qBAAa,EAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AACzD,SAAgB,eAAe;IAC7B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,oBAAY,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TitleProps } from './Title';
|
|
2
|
-
interface HeaderProps extends TitleProps {
|
|
3
|
-
sorted?: 'asc' | 'desc' | false;
|
|
4
|
-
}
|
|
5
|
-
export declare function Header({ sorted, ...other }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/value-renderers/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,UAAU,WAAY,SAAQ,UAAU;IACtC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;CACjC;AACD,wBAAgB,MAAM,CAAC,EAAE,MAAc,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAY/D"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Header = Header;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const Title_1 = require("./Title");
|
|
6
|
-
function Header({ sorted = false, ...other }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(Title_1.Title, { ...other, children: "Header" }), sorted
|
|
8
|
-
? {
|
|
9
|
-
asc: ' 🔼',
|
|
10
|
-
desc: ' 🔽',
|
|
11
|
-
}[sorted]
|
|
12
|
-
: null] }));
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../src/components/value-renderers/Header.tsx"],"names":[],"mappings":";;AAKA,wBAYC;;AAjBD,mCAA4C;AAK5C,SAAgB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,KAAK,EAAe;IAC9D,OAAO,CACL,4CACE,uBAAC,aAAK,OAAK,KAAK,uBAAgB,EAC/B,MAAM;gBACL,CAAC,CAAC;oBACE,GAAG,EAAE,KAAK;oBACV,IAAI,EAAE,KAAK;iBACZ,CAAC,MAAM,CAAC;gBACX,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
bordered?: boolean;
|
|
5
|
-
compact?: boolean;
|
|
6
|
-
interactive?: boolean;
|
|
7
|
-
striped?: boolean;
|
|
8
|
-
color?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function Table(props: TableProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare namespace Table {
|
|
12
|
-
var Row: ({ children, style, bordered, ...other }: import("./TableRow").TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
var Header: ({ children, bordered, style, sticky, }: TableProps & {
|
|
14
|
-
sticky?: boolean;
|
|
15
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/table/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,SAAS,EAEV,MAAM,OAAO,CAAC;AAsBf,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,oDA2BtC;yBA3Be,KAAK;;;cA3Bc,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { HTMLTable } from '@blueprintjs/core';
|
|
4
|
-
import { Children, isValidElement, useMemo, } from 'react';
|
|
5
|
-
import { TableHeader } from './TableHeader';
|
|
6
|
-
import { TableRow } from './TableRow';
|
|
7
|
-
import { TableContext } from './tableContext';
|
|
8
|
-
function splitChildren(children) {
|
|
9
|
-
const Rows = [];
|
|
10
|
-
let Header = null;
|
|
11
|
-
for (const child of Children.toArray(children)) {
|
|
12
|
-
if (typeof child !== 'object' || !isValidElement(child)) {
|
|
13
|
-
throw new Error('invalid Table child');
|
|
14
|
-
}
|
|
15
|
-
else if (child.type === TableRow) {
|
|
16
|
-
Rows.push(child);
|
|
17
|
-
}
|
|
18
|
-
else if (child.type === TableHeader) {
|
|
19
|
-
Header = child;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
throw new Error('invalid Table child');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return { Rows, Header };
|
|
26
|
-
}
|
|
27
|
-
export function Table(props) {
|
|
28
|
-
const { bordered = false, compact = false, interactive = false, striped = false, color = '', children, ...tableProps } = props;
|
|
29
|
-
const { Header, Rows } = splitChildren(children);
|
|
30
|
-
const tableContextValue = useMemo(() => ({ color }), [color]);
|
|
31
|
-
return (_jsx(TableContext.Provider, { value: tableContextValue, children: _jsxs(HTMLTable, { bordered: bordered, compact: compact, interactive: interactive, striped: striped, ...tableProps, children: [Header, _jsx("tbody", { children: Rows })] }) }));
|
|
32
|
-
}
|
|
33
|
-
Table.Row = TableRow;
|
|
34
|
-
Table.Header = TableHeader;
|
|
35
|
-
//# sourceMappingURL=Table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/table/Table.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,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AAC,QAAQ,CAAC,CAAC;IAEjD,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,iBAAiB,YAC7C,MAAC,SAAS,IACR,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,KACZ,UAAU,aAEb,MAAM,EACP,0BAAQ,IAAI,GAAS,IACX,GACU,CACzB,CAAC;AACJ,CAAC;AAED,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC;AACrB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAU1C,eAAO,MAAM,WAAW,2CAKrB,UAAU,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,4CAQnC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TableRow } from './TableRow';
|
|
3
|
-
const headerStyle = {
|
|
4
|
-
position: 'sticky',
|
|
5
|
-
top: 0,
|
|
6
|
-
zIndex: 10,
|
|
7
|
-
backgroundColor: 'white',
|
|
8
|
-
};
|
|
9
|
-
export const TableHeader = ({ children, bordered, style, sticky, }) => {
|
|
10
|
-
return (_jsx("thead", { style: sticky ? headerStyle : undefined, children: _jsx(TableRow, { bordered: bordered, style: style, children: children }) }));
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=TableHeader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.js","sourceRoot":"","sources":["../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,GAAwB;IACvC,QAAQ,EAAE,QAAQ;IAClB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,EAAE;IACV,eAAe,EAAE,OAAO;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,GAC4B,EAAE,EAAE;IACtC,OAAO,CACL,gBAAO,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,YAC5C,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,YACvC,QAAQ,GACA,GACL,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import type { TableProps } from './Table';
|
|
3
|
-
export type TableRowProps = TableProps & HTMLAttributes<HTMLTableRowElement>;
|
|
4
|
-
export declare const TableRow: ({ children, style, bordered, ...other }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
//# sourceMappingURL=TableRow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../src/components/table/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAIf,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC;AAE7E,eAAO,MAAM,QAAQ,4CAKlB,aAAa,4CAUf,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Children, isValidElement, } from 'react';
|
|
3
|
-
import { Boolean, Color, Component, Header, Number, Object, Text, } from '../value-renderers';
|
|
4
|
-
import { useTableContext } from './tableContext';
|
|
5
|
-
export const TableRow = ({ children, style = {}, bordered = false, ...other }) => {
|
|
6
|
-
const { cells } = useRowChildren(children);
|
|
7
|
-
return (_jsx("tr", { style: { border: bordered ? '1px solid black' : '', ...style }, ...other, children: cells }));
|
|
8
|
-
};
|
|
9
|
-
function useRowChildren(children) {
|
|
10
|
-
const cells = [];
|
|
11
|
-
const { color } = useTableContext();
|
|
12
|
-
for (const child of Children.toArray(children)) {
|
|
13
|
-
if (typeof child === 'object' &&
|
|
14
|
-
isValidElement(child) &&
|
|
15
|
-
(child.type === Color ||
|
|
16
|
-
child.type === Boolean ||
|
|
17
|
-
child.type === Text ||
|
|
18
|
-
child.type === Number ||
|
|
19
|
-
child.type === Object ||
|
|
20
|
-
child.type === Header ||
|
|
21
|
-
child.type === Component)) {
|
|
22
|
-
if (child.type === Header) {
|
|
23
|
-
cells.push(_jsx("th", { style: { color }, children: child }, child.key));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
cells.push(_jsx("td", { style: {
|
|
27
|
-
color,
|
|
28
|
-
position: 'relative',
|
|
29
|
-
}, children: child }, child.key));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
|
-
console.error('Invalid Row child:', child);
|
|
35
|
-
throw new Error('invalid Row child');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return { cells };
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=TableRow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.js","sourceRoot":"","sources":["../../../src/components/table/TableRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAER,cAAc,GAGf,MAAM,OAAO,CAAC;AAEf,OAAO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ACjC,KAAK,IADC,KAAK,CAAC,GAAG,CAEb,CACN,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,IAAI,CACR,aAEE,KAAK,EAAE;wBACL,KAAK;wBACL,QAAQ,EAAE,UAAU;qBACrB,YAEA,KAAK,IAND,KAAK,CAAC,GAAG,CAOX,CACN,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableContext.d.ts","sourceRoot":"","sources":["../../../src/components/table/tableContext.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;EAA+B,CAAC;AACzD,wBAAgB,eAAe;;EAG9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableContext.js","sourceRoot":"","sources":["../../../src/components/table/tableContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AACzD,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TitleProps } from './Title';
|
|
2
|
-
interface HeaderProps extends TitleProps {
|
|
3
|
-
sorted?: 'asc' | 'desc' | false;
|
|
4
|
-
}
|
|
5
|
-
export declare function Header({ sorted, ...other }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/value-renderers/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,UAAU,WAAY,SAAQ,UAAU;IACtC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;CACjC;AACD,wBAAgB,MAAM,CAAC,EAAE,MAAc,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAY/D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Title } from './Title';
|
|
3
|
-
export function Header({ sorted = false, ...other }) {
|
|
4
|
-
return (_jsxs("div", { children: [_jsx(Title, { ...other, children: "Header" }), sorted
|
|
5
|
-
? {
|
|
6
|
-
asc: ' 🔼',
|
|
7
|
-
desc: ' 🔽',
|
|
8
|
-
}[sorted]
|
|
9
|
-
: null] }));
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../src/components/value-renderers/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AAK5C,MAAM,UAAU,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,KAAK,EAAe;IAC9D,OAAO,CACL,0BACE,KAAC,KAAK,OAAK,KAAK,uBAAgB,EAC/B,MAAM;gBACL,CAAC,CAAC;oBACE,GAAG,EAAE,KAAK;oBACV,IAAI,EAAE,KAAK;iBACZ,CAAC,MAAM,CAAC;gBACX,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { HTMLTable } from '@blueprintjs/core';
|
|
3
|
-
import {
|
|
4
|
-
Children,
|
|
5
|
-
isValidElement,
|
|
6
|
-
ReactElement,
|
|
7
|
-
ReactNode,
|
|
8
|
-
useMemo,
|
|
9
|
-
} from 'react';
|
|
10
|
-
|
|
11
|
-
import { TableHeader } from './TableHeader';
|
|
12
|
-
import { TableRow } from './TableRow';
|
|
13
|
-
import { TableContext } from './tableContext';
|
|
14
|
-
|
|
15
|
-
function splitChildren(children: ReactNode) {
|
|
16
|
-
const Rows: ReactElement[] = [];
|
|
17
|
-
let Header: ReactElement | null = null;
|
|
18
|
-
for (const child of Children.toArray(children)) {
|
|
19
|
-
if (typeof child !== 'object' || !isValidElement(child)) {
|
|
20
|
-
throw new Error('invalid Table child');
|
|
21
|
-
} else if (child.type === TableRow) {
|
|
22
|
-
Rows.push(child);
|
|
23
|
-
} else if (child.type === TableHeader) {
|
|
24
|
-
Header = child;
|
|
25
|
-
} else {
|
|
26
|
-
throw new Error('invalid Table child');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return { Rows, Header };
|
|
30
|
-
}
|
|
31
|
-
export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
32
|
-
children?: ReactNode;
|
|
33
|
-
bordered?: boolean;
|
|
34
|
-
compact?: boolean;
|
|
35
|
-
interactive?: boolean;
|
|
36
|
-
striped?: boolean;
|
|
37
|
-
color?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function Table(props: TableProps) {
|
|
41
|
-
const {
|
|
42
|
-
bordered = false,
|
|
43
|
-
compact = false,
|
|
44
|
-
interactive = false,
|
|
45
|
-
striped = false,
|
|
46
|
-
color = '',
|
|
47
|
-
children,
|
|
48
|
-
...tableProps
|
|
49
|
-
} = props;
|
|
50
|
-
const { Header, Rows } = splitChildren(children);
|
|
51
|
-
|
|
52
|
-
const tableContextValue = useMemo(() => ({ color }), [color]);
|
|
53
|
-
return (
|
|
54
|
-
<TableContext.Provider value={tableContextValue}>
|
|
55
|
-
<HTMLTable
|
|
56
|
-
bordered={bordered}
|
|
57
|
-
compact={compact}
|
|
58
|
-
interactive={interactive}
|
|
59
|
-
striped={striped}
|
|
60
|
-
{...tableProps}
|
|
61
|
-
>
|
|
62
|
-
{Header}
|
|
63
|
-
<tbody>{Rows}</tbody>
|
|
64
|
-
</HTMLTable>
|
|
65
|
-
</TableContext.Provider>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Table.Row = TableRow;
|
|
70
|
-
Table.Header = TableHeader;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { TableProps } from './Table';
|
|
2
|
-
import { TableRow } from './TableRow';
|
|
3
|
-
|
|
4
|
-
const headerStyle: React.CSSProperties = {
|
|
5
|
-
position: 'sticky',
|
|
6
|
-
top: 0,
|
|
7
|
-
zIndex: 10,
|
|
8
|
-
backgroundColor: 'white',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const TableHeader = ({
|
|
12
|
-
children,
|
|
13
|
-
bordered,
|
|
14
|
-
style,
|
|
15
|
-
sticky,
|
|
16
|
-
}: TableProps & { sticky?: boolean }) => {
|
|
17
|
-
return (
|
|
18
|
-
<thead style={sticky ? headerStyle : undefined}>
|
|
19
|
-
<TableRow bordered={bordered} style={style}>
|
|
20
|
-
{children}
|
|
21
|
-
</TableRow>
|
|
22
|
-
</thead>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Children,
|
|
3
|
-
HTMLAttributes,
|
|
4
|
-
isValidElement,
|
|
5
|
-
ReactElement,
|
|
6
|
-
ReactNode,
|
|
7
|
-
} from 'react';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
Boolean,
|
|
11
|
-
Color,
|
|
12
|
-
Component,
|
|
13
|
-
Header,
|
|
14
|
-
Number,
|
|
15
|
-
Object,
|
|
16
|
-
Text,
|
|
17
|
-
} from '../value-renderers';
|
|
18
|
-
|
|
19
|
-
import type { TableProps } from './Table';
|
|
20
|
-
import { useTableContext } from './tableContext';
|
|
21
|
-
|
|
22
|
-
export type TableRowProps = TableProps & HTMLAttributes<HTMLTableRowElement>;
|
|
23
|
-
|
|
24
|
-
export const TableRow = ({
|
|
25
|
-
children,
|
|
26
|
-
style = {},
|
|
27
|
-
bordered = false,
|
|
28
|
-
...other
|
|
29
|
-
}: TableRowProps) => {
|
|
30
|
-
const { cells } = useRowChildren(children);
|
|
31
|
-
return (
|
|
32
|
-
<tr
|
|
33
|
-
style={{ border: bordered ? '1px solid black' : '', ...style }}
|
|
34
|
-
{...other}
|
|
35
|
-
>
|
|
36
|
-
{cells}
|
|
37
|
-
</tr>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function useRowChildren(children: ReactNode) {
|
|
42
|
-
const cells: ReactElement[] = [];
|
|
43
|
-
const { color } = useTableContext();
|
|
44
|
-
for (const child of Children.toArray(children)) {
|
|
45
|
-
if (
|
|
46
|
-
typeof child === 'object' &&
|
|
47
|
-
isValidElement(child) &&
|
|
48
|
-
(child.type === Color ||
|
|
49
|
-
child.type === Boolean ||
|
|
50
|
-
child.type === Text ||
|
|
51
|
-
child.type === Number ||
|
|
52
|
-
child.type === Object ||
|
|
53
|
-
child.type === Header ||
|
|
54
|
-
child.type === Component)
|
|
55
|
-
) {
|
|
56
|
-
if (child.type === Header) {
|
|
57
|
-
cells.push(
|
|
58
|
-
<th key={child.key} style={{ color }}>
|
|
59
|
-
{child}
|
|
60
|
-
</th>,
|
|
61
|
-
);
|
|
62
|
-
} else {
|
|
63
|
-
cells.push(
|
|
64
|
-
<td
|
|
65
|
-
key={child.key}
|
|
66
|
-
style={{
|
|
67
|
-
color,
|
|
68
|
-
position: 'relative',
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{child}
|
|
72
|
-
</td>,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
// eslint-disable-next-line no-console
|
|
77
|
-
console.error('Invalid Row child:', child);
|
|
78
|
-
throw new Error('invalid Row child');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return { cells };
|
|
82
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Title, TitleProps } from './Title';
|
|
2
|
-
|
|
3
|
-
interface HeaderProps extends TitleProps {
|
|
4
|
-
sorted?: 'asc' | 'desc' | false;
|
|
5
|
-
}
|
|
6
|
-
export function Header({ sorted = false, ...other }: HeaderProps) {
|
|
7
|
-
return (
|
|
8
|
-
<div>
|
|
9
|
-
<Title {...other}>Header</Title>
|
|
10
|
-
{sorted
|
|
11
|
-
? {
|
|
12
|
-
asc: ' 🔼',
|
|
13
|
-
desc: ' 🔽',
|
|
14
|
-
}[sorted]
|
|
15
|
-
: null}
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|