@redis-ui/table 3.3.2 → 3.4.1
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/dist/Table/Table.types.d.ts +5 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.cjs +21 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.d.ts +2 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.js +21 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.style.cjs +16 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.style.d.ts +3 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.style.js +14 -0
- package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.test.d.ts +1 -0
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.cjs +12 -3
- package/dist/Table/components/TableBodyCell/components/Compose/Compose.js +12 -3
- package/dist/Table/tanStackExtendedTypes.d.ts +3 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
1
2
|
import { TableExpandableRowParams } from './plugins/ExpandableRowPlugin';
|
|
2
3
|
import { TablePaginationParams } from './plugins/PaginationPlugin';
|
|
3
4
|
import { TableRowSelectionParams } from './plugins/RowSelectionPlugin';
|
|
@@ -18,3 +19,7 @@ export interface TableProps<T extends object> extends TableSortingParams, TableC
|
|
|
18
19
|
export type ColumnSizeUnit = 'fraction' | 'px' | 'rem';
|
|
19
20
|
/** @deprecated use {@link ColumnSizeUnit} instead */
|
|
20
21
|
export type CellSizingUnits = ColumnSizeUnit;
|
|
22
|
+
export type CellContainerComponent = ({ children }: {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}) => ReactElement;
|
|
25
|
+
export type ColumnCellContainer = 'flex' | 'ellipsis' | CellContainerComponent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../../../../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const CellContainers_style = require("./CellContainers.style.cjs");
|
|
5
|
+
const EllipsisContainer = (props) => jsxRuntime.jsxRuntimeExports.jsx(CellContainers_style.FlexContainer, {
|
|
6
|
+
children: jsxRuntime.jsxRuntimeExports.jsx(CellContainers_style.EllipsisContainer, {
|
|
7
|
+
...props,
|
|
8
|
+
ellipsis: true,
|
|
9
|
+
tooltipOnEllipsis: true
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
const containers = {
|
|
13
|
+
flex: CellContainers_style.FlexContainer,
|
|
14
|
+
ellipsis: EllipsisContainer
|
|
15
|
+
};
|
|
16
|
+
const getCellContainer = (containerOrType) => {
|
|
17
|
+
if (!containerOrType) return void 0;
|
|
18
|
+
if (typeof containerOrType === "string") return containers[containerOrType];
|
|
19
|
+
return containerOrType;
|
|
20
|
+
};
|
|
21
|
+
exports.getCellContainer = getCellContainer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { FlexContainer, EllipsisContainer as EllipsisContainer$1 } from "./CellContainers.style.js";
|
|
3
|
+
const EllipsisContainer = (props) => jsxRuntimeExports.jsx(FlexContainer, {
|
|
4
|
+
children: jsxRuntimeExports.jsx(EllipsisContainer$1, {
|
|
5
|
+
...props,
|
|
6
|
+
ellipsis: true,
|
|
7
|
+
tooltipOnEllipsis: true
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
const containers = {
|
|
11
|
+
flex: FlexContainer,
|
|
12
|
+
ellipsis: EllipsisContainer
|
|
13
|
+
};
|
|
14
|
+
const getCellContainer = (containerOrType) => {
|
|
15
|
+
if (!containerOrType) return void 0;
|
|
16
|
+
if (typeof containerOrType === "string") return containers[containerOrType];
|
|
17
|
+
return containerOrType;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
getCellContainer
|
|
21
|
+
};
|
package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.style.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const _styled = require("styled-components");
|
|
4
|
+
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
5
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
+
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
7
|
+
const FlexContainer = _styled__default.default(redisUiComponents.FlexGroup).withConfig({
|
|
8
|
+
displayName: "CellContainersstyle__FlexContainer",
|
|
9
|
+
componentId: "RedisUI__sc-1w37zg2-0"
|
|
10
|
+
})(["height:100%;width:100%;max-width:100%;overflow:hidden;svg{flex:none;}"]);
|
|
11
|
+
const EllipsisContainer = _styled__default.default(redisUiComponents.Typography.Base).withConfig({
|
|
12
|
+
displayName: "CellContainersstyle__EllipsisContainer",
|
|
13
|
+
componentId: "RedisUI__sc-1w37zg2-1"
|
|
14
|
+
})(["flex:0 1 auto;white-space:inherit;text-align:start;"]);
|
|
15
|
+
exports.EllipsisContainer = EllipsisContainer;
|
|
16
|
+
exports.FlexContainer = FlexContainer;
|
package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.style.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const FlexContainer: import("styled-components").StyledComponent<({ gap, direction, align, justify, wrap, ...restProps }: import("@redislabsdev/redis-ui-components").FlexGroupProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
3
|
+
export declare const EllipsisContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@redislabsdev/redis-ui-components").TypographyBaseProps & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _styled from "styled-components";
|
|
2
|
+
import { FlexGroup, Typography } from "@redislabsdev/redis-ui-components";
|
|
3
|
+
const FlexContainer = _styled(FlexGroup).withConfig({
|
|
4
|
+
displayName: "CellContainersstyle__FlexContainer",
|
|
5
|
+
componentId: "RedisUI__sc-1w37zg2-0"
|
|
6
|
+
})(["height:100%;width:100%;max-width:100%;overflow:hidden;svg{flex:none;}"]);
|
|
7
|
+
const EllipsisContainer = _styled(Typography.Base).withConfig({
|
|
8
|
+
displayName: "CellContainersstyle__EllipsisContainer",
|
|
9
|
+
componentId: "RedisUI__sc-1w37zg2-1"
|
|
10
|
+
})(["flex:0 1 auto;white-space:inherit;text-align:start;"]);
|
|
11
|
+
export {
|
|
12
|
+
EllipsisContainer,
|
|
13
|
+
FlexContainer
|
|
14
|
+
};
|
package/dist/Table/components/TableBodyCell/components/CellContainers/CellContainers.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,14 +3,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("../../../../../node_modules/react/jsx-runtime.cjs");
|
|
4
4
|
const redisUiComponents = require("@redislabsdev/redis-ui-components");
|
|
5
5
|
const table_utils = require("../../../../utils/table.utils.cjs");
|
|
6
|
+
const CellContainers = require("../CellContainers/CellContainers.cjs");
|
|
6
7
|
const Table_style = require("../../../../Table.style.cjs");
|
|
7
8
|
const TableBodyCellCompose = redisUiComponents.forwardRefWithGenerics(({
|
|
8
9
|
cell,
|
|
9
10
|
style,
|
|
11
|
+
children,
|
|
10
12
|
...restProps
|
|
11
13
|
}, ref) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
const {
|
|
15
|
+
getCellProps,
|
|
16
|
+
cellContainer
|
|
17
|
+
} = cell.column.columnDef;
|
|
18
|
+
const columnCellProps = getCellProps == null ? void 0 : getCellProps(cell.row.original, cell);
|
|
19
|
+
const CellContainer = CellContainers.getCellContainer(cellContainer);
|
|
14
20
|
return jsxRuntime.jsxRuntimeExports.jsx(Table_style.TableBodyCell, {
|
|
15
21
|
...restProps,
|
|
16
22
|
...columnCellProps,
|
|
@@ -19,7 +25,10 @@ const TableBodyCellCompose = redisUiComponents.forwardRefWithGenerics(({
|
|
|
19
25
|
width: table_utils.getWidth(cell.column),
|
|
20
26
|
...style,
|
|
21
27
|
...columnCellProps == null ? void 0 : columnCellProps.style
|
|
22
|
-
}
|
|
28
|
+
},
|
|
29
|
+
children: CellContainer ? jsxRuntime.jsxRuntimeExports.jsx(CellContainer, {
|
|
30
|
+
children
|
|
31
|
+
}) : children
|
|
23
32
|
});
|
|
24
33
|
});
|
|
25
34
|
exports.TableBodyCellCompose = TableBodyCellCompose;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../../../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import { forwardRefWithGenerics } from "@redislabsdev/redis-ui-components";
|
|
3
3
|
import { getWidth } from "../../../../utils/table.utils.js";
|
|
4
|
+
import { getCellContainer } from "../CellContainers/CellContainers.js";
|
|
4
5
|
import { TableBodyCell } from "../../../../Table.style.js";
|
|
5
6
|
const TableBodyCellCompose = forwardRefWithGenerics(({
|
|
6
7
|
cell,
|
|
7
8
|
style,
|
|
9
|
+
children,
|
|
8
10
|
...restProps
|
|
9
11
|
}, ref) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
const {
|
|
13
|
+
getCellProps,
|
|
14
|
+
cellContainer
|
|
15
|
+
} = cell.column.columnDef;
|
|
16
|
+
const columnCellProps = getCellProps == null ? void 0 : getCellProps(cell.row.original, cell);
|
|
17
|
+
const CellContainer = getCellContainer(cellContainer);
|
|
12
18
|
return jsxRuntimeExports.jsx(TableBodyCell, {
|
|
13
19
|
...restProps,
|
|
14
20
|
...columnCellProps,
|
|
@@ -17,7 +23,10 @@ const TableBodyCellCompose = forwardRefWithGenerics(({
|
|
|
17
23
|
width: getWidth(cell.column),
|
|
18
24
|
...style,
|
|
19
25
|
...columnCellProps == null ? void 0 : columnCellProps.style
|
|
20
|
-
}
|
|
26
|
+
},
|
|
27
|
+
children: CellContainer ? jsxRuntimeExports.jsx(CellContainer, {
|
|
28
|
+
children
|
|
29
|
+
}) : children
|
|
21
30
|
});
|
|
22
31
|
});
|
|
23
32
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@tanstack/table-core';
|
|
2
2
|
import { Cell, Header } from '@tanstack/react-table';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
|
-
import { ColumnSizeUnit } from './Table.types';
|
|
4
|
+
import { ColumnCellContainer, ColumnSizeUnit } from './Table.types';
|
|
5
5
|
declare module '@tanstack/table-core' {
|
|
6
6
|
interface StringHeaderIdentifier {
|
|
7
7
|
isHeaderHidden?: boolean;
|
|
@@ -9,6 +9,7 @@ declare module '@tanstack/table-core' {
|
|
|
9
9
|
sizeUnit?: ColumnSizeUnit;
|
|
10
10
|
getHeaderCellProps?: VoidFunction;
|
|
11
11
|
getCellProps?: VoidFunction;
|
|
12
|
+
cellContainer?: ColumnCellContainer;
|
|
12
13
|
}
|
|
13
14
|
interface IdIdentifier<TData, TValue> {
|
|
14
15
|
isHeaderHidden?: boolean;
|
|
@@ -16,5 +17,6 @@ declare module '@tanstack/table-core' {
|
|
|
16
17
|
sizeUnit?: ColumnSizeUnit;
|
|
17
18
|
getHeaderCellProps?: (header: Header<TData, unknown>) => HTMLAttributes<HTMLTableCellElement> & Record<string, unknown>;
|
|
18
19
|
getCellProps?: (data: TData, cell: Cell<TData, unknown>) => HTMLAttributes<HTMLTableCellElement> & Record<string, unknown>;
|
|
20
|
+
cellContainer?: ColumnCellContainer;
|
|
19
21
|
}
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis-ui/table",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://npm.pkg.github.com/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@redis-ui/styles": "^14.4.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@redis-ui/components": "^
|
|
35
|
+
"@redis-ui/components": "^42.0.0",
|
|
36
36
|
"@redis-ui/icons": "^6.6.0",
|
|
37
37
|
"@tanstack/react-table": "^8.9.8",
|
|
38
38
|
"type-fest": "^3.13.1"
|