@pdg/react-table 1.0.17 → 1.0.19
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/index.esm.js +12 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8228,9 +8228,6 @@ function useResizeDetector(props) {
|
|
|
8228
8228
|
};var StyledBodyRow$1 = material.styled(material.TableRow)(function (_a) {
|
|
8229
8229
|
var theme = _a.theme;
|
|
8230
8230
|
return ({
|
|
8231
|
-
'&:last-child > .MuiTableCell-root': {
|
|
8232
|
-
borderBottom: 0,
|
|
8233
|
-
},
|
|
8234
8231
|
'&.odd-color:nth-of-type(odd):not(:hover)': {
|
|
8235
8232
|
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
8236
8233
|
},
|
|
@@ -8546,9 +8543,6 @@ var TableBodyCell = function (_a) {
|
|
|
8546
8543
|
var templateObject_1;var StyledBodyRow = material.styled(material.TableRow)(function (_a) {
|
|
8547
8544
|
var theme = _a.theme;
|
|
8548
8545
|
return ({
|
|
8549
|
-
'&:last-child > .MuiTableCell-root': {
|
|
8550
|
-
borderBottom: 0,
|
|
8551
|
-
},
|
|
8552
8546
|
'&.odd-color:nth-of-type(odd):not(:hover)': {
|
|
8553
8547
|
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
8554
8548
|
},
|
|
@@ -8598,7 +8592,7 @@ TableBodyRow.defaultProps = TableBodyRowDefaultProps;var TableHeadCell = functio
|
|
|
8598
8592
|
return (_c = column.footer) === null || _c === void 0 ? void 0 : _c.value;
|
|
8599
8593
|
}
|
|
8600
8594
|
}, [column]);
|
|
8601
|
-
return (React__default["default"].createElement(TableCommonCell, { type: 'head', className: 'TableFooterCell', column: column, defaultAlign: defaultAlign
|
|
8595
|
+
return (React__default["default"].createElement(TableCommonCell, { type: 'head', className: 'TableFooterCell', column: column, defaultAlign: defaultAlign }, data));
|
|
8602
8596
|
};var TablePagination = function (_a) {
|
|
8603
8597
|
var className = _a.className, style = _a.style, sx = _a.sx, paging = _a.paging, align = _a.align, onChange = _a.onChange;
|
|
8604
8598
|
return (React__default["default"].createElement(material.Stack, { alignItems: align },
|
|
@@ -8841,6 +8835,8 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8841
8835
|
}
|
|
8842
8836
|
}, [onSortChange]);
|
|
8843
8837
|
// Memo --------------------------------------------------------------------------------------------------------------
|
|
8838
|
+
var isNoData = React.useMemo(function () { return !!sortableItems && sortableItems.length <= 0; }, [sortableItems]);
|
|
8839
|
+
var finalPagingHeight = React.useMemo(function () { return (paging && paging.total > 0 ? pagingHeight || 0 : 0); }, [paging, pagingHeight]);
|
|
8844
8840
|
var style = React.useMemo(function () {
|
|
8845
8841
|
if (fullHeight) {
|
|
8846
8842
|
return __assign$1(__assign$1({ width: '100%' }, initStyle), { flex: 1, justifyContent: 'flex-end', height: '100%', display: 'flex', flexDirection: 'column', position: 'relative' });
|
|
@@ -8850,7 +8846,6 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8850
8846
|
}
|
|
8851
8847
|
}, [initStyle, fullHeight]);
|
|
8852
8848
|
var simpleBarStyle = React.useMemo(function () {
|
|
8853
|
-
var finalPagingHeight = paging && paging.total > 0 ? pagingHeight : undefined;
|
|
8854
8849
|
if (fullHeight) {
|
|
8855
8850
|
return {
|
|
8856
8851
|
height: (containerHeight || 0) - (finalPagingHeight || 0) - 2,
|
|
@@ -8865,7 +8860,12 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8865
8860
|
else {
|
|
8866
8861
|
return { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
|
|
8867
8862
|
}
|
|
8868
|
-
}, [
|
|
8863
|
+
}, [fullHeight, containerHeight, finalPagingHeight, height, minHeight, maxHeight]);
|
|
8864
|
+
var tableStyle = React.useMemo(function () {
|
|
8865
|
+
if (fullHeight && isNoData) {
|
|
8866
|
+
return { flex: 1, height: (containerHeight || 0) - finalPagingHeight - 2 };
|
|
8867
|
+
}
|
|
8868
|
+
}, [fullHeight, isNoData, containerHeight, finalPagingHeight]);
|
|
8869
8869
|
var pagingStyle = React.useMemo(function () {
|
|
8870
8870
|
var style = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
|
|
8871
8871
|
if (fullHeight) {
|
|
@@ -8877,15 +8877,15 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8877
8877
|
return finalColumns ? (React__default["default"].createElement(material.Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className), variant: 'outlined', style: style, sx: sx },
|
|
8878
8878
|
React__default["default"].createElement(SimpleBar, { style: simpleBarStyle },
|
|
8879
8879
|
React__default["default"].createElement(core.DndContext, { sensors: sensors, collisionDetection: core.closestCenter, onDragEnd: handleDragEnd },
|
|
8880
|
-
React__default["default"].createElement(material.Table, { stickyHeader: stickyHeader, sx: tableSx },
|
|
8880
|
+
React__default["default"].createElement(material.Table, { stickyHeader: !isNoData && stickyHeader, sx: tableSx, style: tableStyle },
|
|
8881
8881
|
React__default["default"].createElement(material.TableHead, null,
|
|
8882
8882
|
React__default["default"].createElement(material.TableRow, null, finalColumns.map(function (column, idx) { return (React__default["default"].createElement(TableHeadCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))),
|
|
8883
8883
|
React__default["default"].createElement(material.TableBody, null, sortableItems ? (sortableItems.length > 0 ? (React__default["default"].createElement(sortable.SortableContext, { items: sortableItems, strategy: sortable.verticalListSortingStrategy }, sortableItems.map(function (item, idx) { return (React__default["default"].createElement(TableBodyRow, { key: item.id, className: classNames(!!showOddColor && 'odd-color', !!showEvenColor && 'even-color'), hover: true, sx: onGetBodyRowSx ? onGetBodyRowSx(item, idx) : undefined, id: item.id, index: idx, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, sortable: sortable$1, columns: finalColumns, item: item, onClick: onClick })); }))) : (React__default["default"].createElement(StyledBodyRow$1, null,
|
|
8884
|
-
React__default["default"].createElement(material.TableCell, { colSpan: finalColumns.length }, noData ? (noData) : (React__default["default"].createElement(StyledNoDataDiv, null,
|
|
8884
|
+
React__default["default"].createElement(material.TableCell, { colSpan: finalColumns.length, style: { flex: 1 } }, noData ? (noData) : (React__default["default"].createElement(StyledNoDataDiv, null,
|
|
8885
8885
|
React__default["default"].createElement("div", null,
|
|
8886
8886
|
React__default["default"].createElement(material.Icon, null, "error")),
|
|
8887
8887
|
React__default["default"].createElement("div", null, "\uAC80\uC0C9\uB41C \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."))))))) : undefined),
|
|
8888
|
-
footer && (React__default["default"].createElement(material.TableFooter, null,
|
|
8888
|
+
!isNoData && footer && (React__default["default"].createElement(material.TableFooter, null,
|
|
8889
8889
|
React__default["default"].createElement(material.TableRow, null, finalColumns.map(function (column, idx) { return (React__default["default"].createElement(TableFooterCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))))))),
|
|
8890
8890
|
paging && paging.total > 0 && (React__default["default"].createElement(material.Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
|
|
8891
8891
|
React__default["default"].createElement(TablePagination, { className: pagination === null || pagination === void 0 ? void 0 : pagination.className, style: pagination === null || pagination === void 0 ? void 0 : pagination.style, sx: pagination === null || pagination === void 0 ? void 0 : pagination.sx, paging: paging, align: pagingAlign, onChange: onPageChange }))))) : null;
|