@pdg/react-table 1.0.17 → 1.0.18
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 +11 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8841,6 +8841,8 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
8841
8841
|
}
|
|
8842
8842
|
}, [onSortChange]);
|
|
8843
8843
|
// Memo --------------------------------------------------------------------------------------------------------------
|
|
8844
|
+
var isNoData = useMemo(function () { return !!sortableItems && sortableItems.length <= 0; }, [sortableItems]);
|
|
8845
|
+
var finalPagingHeight = useMemo(function () { return (paging && paging.total > 0 ? pagingHeight || 0 : 0); }, [paging, pagingHeight]);
|
|
8844
8846
|
var style = useMemo(function () {
|
|
8845
8847
|
if (fullHeight) {
|
|
8846
8848
|
return __assign$1(__assign$1({ width: '100%' }, initStyle), { flex: 1, justifyContent: 'flex-end', height: '100%', display: 'flex', flexDirection: 'column', position: 'relative' });
|
|
@@ -8850,7 +8852,6 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
8850
8852
|
}
|
|
8851
8853
|
}, [initStyle, fullHeight]);
|
|
8852
8854
|
var simpleBarStyle = useMemo(function () {
|
|
8853
|
-
var finalPagingHeight = paging && paging.total > 0 ? pagingHeight : undefined;
|
|
8854
8855
|
if (fullHeight) {
|
|
8855
8856
|
return {
|
|
8856
8857
|
height: (containerHeight || 0) - (finalPagingHeight || 0) - 2,
|
|
@@ -8865,7 +8866,12 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
8865
8866
|
else {
|
|
8866
8867
|
return { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
|
|
8867
8868
|
}
|
|
8868
|
-
}, [
|
|
8869
|
+
}, [fullHeight, containerHeight, finalPagingHeight, height, minHeight, maxHeight]);
|
|
8870
|
+
var tableStyle = useMemo(function () {
|
|
8871
|
+
if (fullHeight && isNoData) {
|
|
8872
|
+
return { flex: 1, height: (containerHeight || 0) - finalPagingHeight - 2 };
|
|
8873
|
+
}
|
|
8874
|
+
}, [fullHeight, isNoData, containerHeight, finalPagingHeight]);
|
|
8869
8875
|
var pagingStyle = useMemo(function () {
|
|
8870
8876
|
var style = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
|
|
8871
8877
|
if (fullHeight) {
|
|
@@ -8877,15 +8883,15 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
8877
8883
|
return finalColumns ? (React__default.createElement(Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className), variant: 'outlined', style: style, sx: sx },
|
|
8878
8884
|
React__default.createElement(SimpleBar, { style: simpleBarStyle },
|
|
8879
8885
|
React__default.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd },
|
|
8880
|
-
React__default.createElement(Table$1, { stickyHeader: stickyHeader, sx: tableSx },
|
|
8886
|
+
React__default.createElement(Table$1, { stickyHeader: !isNoData && stickyHeader, sx: tableSx, style: tableStyle },
|
|
8881
8887
|
React__default.createElement(TableHead, null,
|
|
8882
8888
|
React__default.createElement(TableRow, null, finalColumns.map(function (column, idx) { return (React__default.createElement(TableHeadCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))),
|
|
8883
8889
|
React__default.createElement(TableBody, null, sortableItems ? (sortableItems.length > 0 ? (React__default.createElement(SortableContext, { items: sortableItems, strategy: verticalListSortingStrategy }, sortableItems.map(function (item, idx) { return (React__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, columns: finalColumns, item: item, onClick: onClick })); }))) : (React__default.createElement(StyledBodyRow$1, null,
|
|
8884
|
-
React__default.createElement(TableCell, { colSpan: finalColumns.length }, noData ? (noData) : (React__default.createElement(StyledNoDataDiv, null,
|
|
8890
|
+
React__default.createElement(TableCell, { colSpan: finalColumns.length, style: { flex: 1 } }, noData ? (noData) : (React__default.createElement(StyledNoDataDiv, null,
|
|
8885
8891
|
React__default.createElement("div", null,
|
|
8886
8892
|
React__default.createElement(Icon, null, "error")),
|
|
8887
8893
|
React__default.createElement("div", null, "\uAC80\uC0C9\uB41C \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."))))))) : undefined),
|
|
8888
|
-
footer && (React__default.createElement(TableFooter, null,
|
|
8894
|
+
!isNoData && footer && (React__default.createElement(TableFooter, null,
|
|
8889
8895
|
React__default.createElement(TableRow, null, finalColumns.map(function (column, idx) { return (React__default.createElement(TableFooterCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))))))),
|
|
8890
8896
|
paging && paging.total > 0 && (React__default.createElement(Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
|
|
8891
8897
|
React__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;
|