@pdg/react-table 1.0.13 → 1.0.16
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/SearchTable/SearchTable.types.d.ts +2 -0
- package/dist/index.esm.js +31 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8343,7 +8343,7 @@ var equal = function (v1, v2) {
|
|
|
8343
8343
|
var TableCommonCell = function (_a) {
|
|
8344
8344
|
var children = _a.children, initClassName = _a.className, initStyle = _a.style, initSx = _a.sx, type = _a.type, column = _a.column, defaultAlign = _a.defaultAlign, initDefaultEllipsis = _a.defaultEllipsis, index = _a.index, item = _a.item, onClick = _a.onClick;
|
|
8345
8345
|
var align = React.useMemo(function () { return getTableColumnAlign(column, defaultAlign); }, [column, defaultAlign]);
|
|
8346
|
-
var ellipsis = React.useMemo(function () { return (column.ellipsis != null ? column.ellipsis : !!initDefaultEllipsis); }, [column, initDefaultEllipsis]);
|
|
8346
|
+
var ellipsis = React.useMemo(function () { return type !== 'head' && (column.ellipsis != null ? column.ellipsis : !!initDefaultEllipsis); }, [type, column, initDefaultEllipsis]);
|
|
8347
8347
|
var className = React.useMemo(function () {
|
|
8348
8348
|
var _a, _b, _c, _d, _e, _f;
|
|
8349
8349
|
var className;
|
|
@@ -8852,25 +8852,25 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8852
8852
|
var simpleBarStyle = React.useMemo(function () {
|
|
8853
8853
|
if (fullHeight) {
|
|
8854
8854
|
return {
|
|
8855
|
-
height: (containerHeight || 0) - (pagingHeight || 0),
|
|
8855
|
+
height: (containerHeight || 0) - (pagingHeight || 0) - 2,
|
|
8856
8856
|
flex: 1,
|
|
8857
8857
|
position: 'absolute',
|
|
8858
|
+
top: 1,
|
|
8858
8859
|
left: 0,
|
|
8859
8860
|
right: 0,
|
|
8860
|
-
marginBottom: pagingHeight,
|
|
8861
|
+
marginBottom: pagingHeight || 0,
|
|
8861
8862
|
};
|
|
8862
8863
|
}
|
|
8863
8864
|
else {
|
|
8864
|
-
return { height: height, minHeight: minHeight, maxHeight: maxHeight };
|
|
8865
|
+
return { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
|
|
8865
8866
|
}
|
|
8866
8867
|
}, [containerHeight, fullHeight, height, maxHeight, minHeight, pagingHeight]);
|
|
8867
8868
|
var pagingStyle = React.useMemo(function () {
|
|
8869
|
+
var style = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
|
|
8868
8870
|
if (fullHeight) {
|
|
8869
|
-
return { position: 'sticky',
|
|
8870
|
-
}
|
|
8871
|
-
else {
|
|
8872
|
-
return { padding: '13px 0' };
|
|
8871
|
+
return __assign$1({ position: 'sticky' }, style);
|
|
8873
8872
|
}
|
|
8873
|
+
return style;
|
|
8874
8874
|
}, [fullHeight]);
|
|
8875
8875
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
8876
8876
|
return finalColumns ? (React__default["default"].createElement(material.Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className), variant: 'outlined', style: style, sx: sx },
|
|
@@ -8891,9 +8891,10 @@ var Table = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
8891
8891
|
});
|
|
8892
8892
|
Table.displayName = 'Table';
|
|
8893
8893
|
Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var SearchTable = React__default["default"].forwardRef(function (_a, ref) {
|
|
8894
|
-
var
|
|
8894
|
+
var _b, _c;
|
|
8895
|
+
var color = _a.color, hash = _a.hash, stickyHeader = _a.stickyHeader, fullHeight = _a.fullHeight, search = _a.search, table = _a.table, betweenSearchTableComponent = _a.betweenSearchTableComponent, onGetData = _a.onGetData, onRequestHashChange = _a.onRequestHashChange,
|
|
8895
8896
|
// ---------------------------------------------------------------------------------------------------------------
|
|
8896
|
-
className = _a.className,
|
|
8897
|
+
className = _a.className, initStyle = _a.style, sx = _a.sx;
|
|
8897
8898
|
var searchRef = React.useRef();
|
|
8898
8899
|
var tableRef = React.useRef();
|
|
8899
8900
|
//------------------------------------------------------------------------------------------------------------------
|
|
@@ -8919,11 +8920,11 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
|
|
|
8919
8920
|
// Ref -------------------------------------------------------------------------------------------------------------
|
|
8920
8921
|
var lastGetDataDataRef = React.useRef({});
|
|
8921
8922
|
// State -----------------------------------------------------------------------------------------------------------
|
|
8922
|
-
var
|
|
8923
|
-
var
|
|
8923
|
+
var _d = React.useState(true), isFirstSearchSubmit = _d[0], setIsFirstSearchSubmit = _d[1];
|
|
8924
|
+
var _e = React.useState(), tableData = _e[0], setTableData = _e[1];
|
|
8924
8925
|
// searchInfo ------------------------------------------------------------------------------------------------------
|
|
8925
8926
|
var searchInfoFirstUseEffect = React.useRef(true);
|
|
8926
|
-
var
|
|
8927
|
+
var _f = React.useState(function () { return getSearchInfo(search); }), searchInfo = _f[0], setSearchInfo = _f[1];
|
|
8927
8928
|
React.useEffect(function () {
|
|
8928
8929
|
if (searchInfoFirstUseEffect.current) {
|
|
8929
8930
|
searchInfoFirstUseEffect.current = false;
|
|
@@ -8935,7 +8936,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
|
|
|
8935
8936
|
}, [search]);
|
|
8936
8937
|
// tableInfo -------------------------------------------------------------------------------------------------------
|
|
8937
8938
|
var tableInfoFirstUseEffect = React.useRef(true);
|
|
8938
|
-
var
|
|
8939
|
+
var _g = React.useState(function () { return getTableInfo(table); }), tableInfo = _g[0], setTableInfo = _g[1];
|
|
8939
8940
|
React.useEffect(function () {
|
|
8940
8941
|
if (tableInfoFirstUseEffect.current) {
|
|
8941
8942
|
tableInfoFirstUseEffect.current = false;
|
|
@@ -9174,6 +9175,20 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
|
|
|
9174
9175
|
}
|
|
9175
9176
|
}
|
|
9176
9177
|
}, [searchRef, hash, hashChange, getData, isFirstSearchSubmit]);
|
|
9178
|
+
// Memo --------------------------------------------------------------------------------------------------------------
|
|
9179
|
+
var style = React.useMemo(function () {
|
|
9180
|
+
if (fullHeight) {
|
|
9181
|
+
return __assign$1(__assign$1({}, initStyle), { flex: 1, display: 'flex' });
|
|
9182
|
+
}
|
|
9183
|
+
else {
|
|
9184
|
+
return initStyle;
|
|
9185
|
+
}
|
|
9186
|
+
}, [initStyle, fullHeight]);
|
|
9187
|
+
var tableContainerStyle = React.useMemo(function () {
|
|
9188
|
+
if (fullHeight) {
|
|
9189
|
+
return { flex: 1, display: 'flex', flexDirection: 'column' };
|
|
9190
|
+
}
|
|
9191
|
+
}, [fullHeight]);
|
|
9177
9192
|
//------------------------------------------------------------------------------------------------------------------
|
|
9178
9193
|
return (React__default["default"].createElement(material.Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: style, sx: sx },
|
|
9179
9194
|
React__default["default"].createElement(material.Grid, { item: true, sx: { display: searchInfo.searchGroups ? undefined : 'none' } },
|
|
@@ -9192,8 +9207,8 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
|
|
|
9192
9207
|
React__default["default"].createElement(reactForm.FormHidden, { name: 'page', value: 1 })),
|
|
9193
9208
|
searchInfo.searchGroups)),
|
|
9194
9209
|
betweenSearchTableComponent && React__default["default"].createElement(material.Grid, { item: true }, betweenSearchTableComponent),
|
|
9195
|
-
React__default["default"].createElement(material.Grid, { item: true },
|
|
9196
|
-
React__default["default"].createElement(Table, __assign$1({}, tableInfo.props, { ref: function (commands) {
|
|
9210
|
+
React__default["default"].createElement(material.Grid, { item: true, style: tableContainerStyle },
|
|
9211
|
+
React__default["default"].createElement(Table, __assign$1({}, tableInfo.props, { stickyHeader: stickyHeader || ((_b = tableInfo.props) === null || _b === void 0 ? void 0 : _b.stickyHeader), fullHeight: fullHeight || ((_c = tableInfo.props) === null || _c === void 0 ? void 0 : _c.fullHeight), ref: function (commands) {
|
|
9197
9212
|
if (tableInfo.ref) {
|
|
9198
9213
|
if (typeof tableInfo.ref === 'function') {
|
|
9199
9214
|
tableInfo.ref(commands);
|