@mezzanine-ui/react 0.9.0 → 0.9.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/Table/TableBody.js
CHANGED
|
@@ -22,7 +22,7 @@ const TableBody = forwardRef(function TableBody(props, ref) {
|
|
|
22
22
|
const currentStartCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage ? ((paginationOptions.pageSize) * (currentPage - 1)) : 0;
|
|
23
23
|
const currentEndCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage && total ? (Math.min(((paginationOptions.pageSize) * currentPage), total)) : 0;
|
|
24
24
|
const currentDataSource = pagination && !disableAutoSlicing ? (dataSource.slice(currentStartCount, currentEndCount)) : dataSource;
|
|
25
|
-
return (jsxs("div", Object.assign({}, rest, { ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup" }, { children: [currentDataSource.length ? currentDataSource.map((rowData) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData }, (rowData.key || rowData.id)))) : (jsx(Empty, Object.assign({}, restEmptyProps, { className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight }, { children: emptyComponentChildren }), void 0)),
|
|
25
|
+
return (jsxs("div", Object.assign({}, rest, { ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup" }, { children: [currentDataSource.length ? currentDataSource.map((rowData, index) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData, rowIndex: index }, (rowData.key || rowData.id)))) : (jsx(Empty, Object.assign({}, restEmptyProps, { className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight }, { children: emptyComponentChildren }), void 0)),
|
|
26
26
|
(fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", Object.assign({ className: tableClasses.bodyFetchMore }, { children: jsx(Loading, { loading: true }, void 0) }), void 0)) : null,
|
|
27
27
|
jsx("div", Object.assign({ ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1 }, { children: jsx("div", { style: {
|
|
28
28
|
width: `${scrollBarSize}px`,
|
package/Table/TableBodyRow.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface TableBodyRowProps extends NativeElementPropsWithoutKeyAndRef<'d
|
|
|
6
6
|
* table body row dataSource
|
|
7
7
|
*/
|
|
8
8
|
rowData: TableDataSource;
|
|
9
|
+
rowIndex: number;
|
|
9
10
|
}
|
|
10
11
|
declare const TableBodyRow: import("react").ForwardRefExoticComponent<TableBodyRowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
12
|
export default TableBodyRow;
|
package/Table/TableBodyRow.js
CHANGED
|
@@ -12,7 +12,7 @@ import AccordionDetails from '../Accordion/AccordionDetails.js';
|
|
|
12
12
|
import cx from 'clsx';
|
|
13
13
|
|
|
14
14
|
const TableBodyRow = forwardRef(function TableBodyRow(props, ref) {
|
|
15
|
-
const { className, rowData, ...rest } = props;
|
|
15
|
+
const { className, rowData, rowIndex, ...rest } = props;
|
|
16
16
|
const { rowSelection, expanding, } = useContext(TableContext) || {};
|
|
17
17
|
const { columns, } = useContext(TableDataContext) || {};
|
|
18
18
|
/** Feature rowSelection */
|
|
@@ -31,11 +31,11 @@ const TableBodyRow = forwardRef(function TableBodyRow(props, ref) {
|
|
|
31
31
|
[tableClasses.bodyRowHighlight]: selected || expanded,
|
|
32
32
|
}, className), role: "row" }, { children: [rowSelection ? (jsx(TableRowSelection, { role: "gridcell", rowKey: (rowData.key || rowData.id), setChecked: (status) => setSelected(status), showDropdownIcon: false }, void 0)) : null,
|
|
33
33
|
expanding ? (jsx(TableExpandable, { expandable: isExpandable, expanded: expanded, role: "gridcell", setExpanded: setExpanded, onExpand: (status) => { var _a; return (_a = expanding.onExpand) === null || _a === void 0 ? void 0 : _a.call(expanding, rowData, status); } }, void 0)) : null,
|
|
34
|
-
(columns !== null && columns !== void 0 ? columns : []).map((column
|
|
34
|
+
(columns !== null && columns !== void 0 ? columns : []).map((column) => {
|
|
35
35
|
var _a, _b, _c, _d;
|
|
36
36
|
const ellipsis = !!(get(rowData, column.dataIndex)) && ((_a = column.ellipsis) !== null && _a !== void 0 ? _a : true);
|
|
37
37
|
const tooltipTitle = ((_c = (_b = column.renderTooltipTitle) === null || _b === void 0 ? void 0 : _b.call(column, rowData)) !== null && _c !== void 0 ? _c : get(rowData, column.dataIndex));
|
|
38
|
-
return (jsx("div", Object.assign({ className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle(column) }, { children: jsx(TableEditRenderWrapper, Object.assign({}, column, { rowData: rowData }, { children: jsx(TableCell, Object.assign({ ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle(column), tooltipTitle: tooltipTitle }, { children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, rowData,
|
|
38
|
+
return (jsx("div", Object.assign({ className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle(column) }, { children: jsx(TableEditRenderWrapper, Object.assign({}, column, { rowData: rowData }, { children: jsx(TableCell, Object.assign({ ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle(column), tooltipTitle: tooltipTitle }, { children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, rowData, rowIndex)) || get(rowData, column.dataIndex) }), void 0) }), void 0) }), `${column.dataIndex}-${column.title}`));
|
|
39
39
|
})] }), void 0),
|
|
40
40
|
renderedExpandedContent ? (jsx(Fragment$1, { children: typeof renderedExpandedContent === 'string' ? (jsx(AccordionDetails, Object.assign({ className: expanding.className, expanded: expanded }, { children: renderedExpandedContent }), void 0)) : (jsx(Fragment$1, { children: renderedExpandedContent.dataSource.length > 0 ? (jsx(AccordionDetails, Object.assign({ className: cx(expanding.className, tableClasses.bodyRowExpandedTableWrapper), expanded: expanded }, { children: jsx(TableExpandedTable, { renderedExpandedContent: renderedExpandedContent }, void 0) }), void 0)) : null }, void 0)) }, void 0)) : null] }, void 0));
|
|
41
41
|
});
|
|
@@ -10,7 +10,7 @@ import cx from 'clsx';
|
|
|
10
10
|
const TableExpandedTable = forwardRef(function TableExpandedTable(props, ref) {
|
|
11
11
|
const { renderedExpandedContent, } = props;
|
|
12
12
|
const { columns, } = useContext(TableDataContext) || {};
|
|
13
|
-
return (jsx("div", Object.assign({ className: tableClasses.bodyRowExpandedTable }, { children: renderedExpandedContent.dataSource.map((source) => {
|
|
13
|
+
return (jsx("div", Object.assign({ className: tableClasses.bodyRowExpandedTable }, { children: renderedExpandedContent.dataSource.map((source, sourceIndex) => {
|
|
14
14
|
var _a;
|
|
15
15
|
return (jsxs("div", Object.assign({ ref: ref, className: cx(tableClasses.bodyRow, tableClasses.bodyRowExpandedTableRow), role: "row" }, { children: [jsx(TableExpandable, { showIcon: false }, void 0),
|
|
16
16
|
((_a = (renderedExpandedContent.columns || columns)) !== null && _a !== void 0 ? _a : [])
|
|
@@ -18,7 +18,7 @@ const TableExpandedTable = forwardRef(function TableExpandedTable(props, ref) {
|
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
19
|
const ellipsis = !!(get(source, column.dataIndex)) && ((_a = column.ellipsis) !== null && _a !== void 0 ? _a : true);
|
|
20
20
|
const tooltipTitle = ((_c = (_b = column.renderTooltipTitle) === null || _b === void 0 ? void 0 : _b.call(column, source)) !== null && _c !== void 0 ? _c : get(source, column.dataIndex));
|
|
21
|
-
return (jsx("div", Object.assign({ className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle((columns !== null && columns !== void 0 ? columns : [])[index]) }, { children: jsx(TableCell, Object.assign({ ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle((columns !== null && columns !== void 0 ? columns : [])[index]), tooltipTitle: tooltipTitle || '' }, { children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, source,
|
|
21
|
+
return (jsx("div", Object.assign({ className: cx(tableClasses.bodyRowCellWrapper, column.bodyClassName), style: getColumnStyle((columns !== null && columns !== void 0 ? columns : [])[index]) }, { children: jsx(TableCell, Object.assign({ ellipsis: ellipsis, forceShownTooltipWhenHovered: column.forceShownTooltipWhenHovered, style: getCellStyle((columns !== null && columns !== void 0 ? columns : [])[index]), tooltipTitle: tooltipTitle || '' }, { children: ((_d = column.render) === null || _d === void 0 ? void 0 : _d.call(column, column, source, sourceIndex)) || get(source, column.dataIndex) }), void 0) }), `${column.dataIndex}-${index}`));
|
|
22
22
|
})] }), (source.key || source.id)));
|
|
23
23
|
}) }), void 0));
|
|
24
24
|
});
|