@pdg/react-table 1.0.125 → 1.0.126
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 +28 -24
- package/dist/index.js +28 -24
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1359,7 +1359,6 @@ var deHash = function () {
|
|
|
1359
1359
|
/********************************************************************************************************************
|
|
1360
1360
|
* Ref
|
|
1361
1361
|
* ******************************************************************************************************************/
|
|
1362
|
-
var _b, _c;
|
|
1363
1362
|
var className = _a.className, initStyle = _a.style, sx = _a.sx, 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;
|
|
1364
1363
|
var initPathRef = useRef(window.location.pathname);
|
|
1365
1364
|
var searchRef = useRef(undefined);
|
|
@@ -1368,13 +1367,13 @@ var deHash = function () {
|
|
|
1368
1367
|
/********************************************************************************************************************
|
|
1369
1368
|
* State
|
|
1370
1369
|
* ******************************************************************************************************************/
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1370
|
+
var _b = useState(true), isFirstSearchSubmit = _b[0], setIsFirstSearchSubmit = _b[1];
|
|
1371
|
+
var _c = useState(), tableData = _c[0], setTableData = _c[1];
|
|
1373
1372
|
/********************************************************************************************************************
|
|
1374
1373
|
* searchInfo
|
|
1375
1374
|
* ******************************************************************************************************************/
|
|
1376
1375
|
var searchInfoFirstUseEffect = useRef(true);
|
|
1377
|
-
var
|
|
1376
|
+
var _d = useState(function () { return getSearchInfo(search); }), searchInfo = _d[0], setSearchInfo = _d[1];
|
|
1378
1377
|
useEffect(function () {
|
|
1379
1378
|
if (searchInfoFirstUseEffect.current) {
|
|
1380
1379
|
searchInfoFirstUseEffect.current = false;
|
|
@@ -1387,7 +1386,7 @@ var deHash = function () {
|
|
|
1387
1386
|
* tableInfo
|
|
1388
1387
|
* ******************************************************************************************************************/
|
|
1389
1388
|
var tableInfoFirstUseEffect = useRef(true);
|
|
1390
|
-
var
|
|
1389
|
+
var _e = useState(function () { return getTableInfo(table); }), tableInfo = _e[0], setTableInfo = _e[1];
|
|
1391
1390
|
useEffect(function () {
|
|
1392
1391
|
if (tableInfoFirstUseEffect.current) {
|
|
1393
1392
|
tableInfoFirstUseEffect.current = false;
|
|
@@ -1721,25 +1720,25 @@ var deHash = function () {
|
|
|
1721
1720
|
/********************************************************************************************************************
|
|
1722
1721
|
* Render
|
|
1723
1722
|
* ******************************************************************************************************************/
|
|
1724
|
-
return (React.createElement(Grid, {
|
|
1725
|
-
React.createElement(
|
|
1726
|
-
|
|
1727
|
-
if (searchInfo.ref) {
|
|
1728
|
-
|
|
1729
|
-
searchInfo.ref(commands);
|
|
1730
|
-
}
|
|
1731
|
-
else {
|
|
1732
|
-
searchInfo.ref.current = commands;
|
|
1733
|
-
}
|
|
1723
|
+
var searchView = useMemo(function () { return (React.createElement(Grid, { sx: { display: searchInfo.searchGroups ? undefined : 'none' } },
|
|
1724
|
+
React.createElement(Search, __assign({ color: color }, searchInfo.props, { ref: function (commands) {
|
|
1725
|
+
if (searchInfo.ref) {
|
|
1726
|
+
if (typeof searchInfo.ref === 'function') {
|
|
1727
|
+
searchInfo.ref(commands);
|
|
1734
1728
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1729
|
+
else {
|
|
1730
|
+
searchInfo.ref.current = commands;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
searchRef.current = commands || undefined;
|
|
1734
|
+
}, autoSubmit: true, onSubmit: handleSearchSubmit }),
|
|
1735
|
+
React.createElement(SearchGroup, { hidden: true },
|
|
1736
|
+
React.createElement(FormHidden, { name: 'page', value: 1 })),
|
|
1737
|
+
searchInfo.searchGroups))); }, [color, handleSearchSubmit, searchInfo]);
|
|
1738
|
+
var tableView = useMemo(function () {
|
|
1739
|
+
var _a, _b;
|
|
1740
|
+
return (React.createElement(Grid, { style: fullHeight ? { flex: 1, display: 'flex', flexDirection: 'column' } : undefined },
|
|
1741
|
+
React.createElement(Table, __assign({}, tableInfo.props, { stickyHeader: stickyHeader || ((_a = tableInfo.props) === null || _a === void 0 ? void 0 : _a.stickyHeader), fullHeight: fullHeight || ((_b = tableInfo.props) === null || _b === void 0 ? void 0 : _b.fullHeight), ref: function (commands) {
|
|
1743
1742
|
if (tableInfo.ref) {
|
|
1744
1743
|
if (typeof tableInfo.ref === 'function') {
|
|
1745
1744
|
tableInfo.ref(commands);
|
|
@@ -1749,7 +1748,12 @@ var deHash = function () {
|
|
|
1749
1748
|
}
|
|
1750
1749
|
}
|
|
1751
1750
|
tableRef.current = commands || undefined;
|
|
1752
|
-
}, items: tableData === null || tableData === void 0 ? void 0 : tableData.items, paging: tableData === null || tableData === void 0 ? void 0 : tableData.paging, onPageChange: handlePageChange }))))
|
|
1751
|
+
}, items: tableData === null || tableData === void 0 ? void 0 : tableData.items, paging: tableData === null || tableData === void 0 ? void 0 : tableData.paging, onPageChange: handlePageChange }))));
|
|
1752
|
+
}, [fullHeight, handlePageChange, stickyHeader, tableData === null || tableData === void 0 ? void 0 : tableData.items, tableData === null || tableData === void 0 ? void 0 : tableData.paging, tableInfo]);
|
|
1753
|
+
return (React.createElement(Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: fullHeight ? __assign(__assign({}, initStyle), { flex: 1, display: 'flex' }) : initStyle, sx: sx },
|
|
1754
|
+
searchView,
|
|
1755
|
+
betweenSearchTableComponent && React.createElement(Grid, null, betweenSearchTableComponent),
|
|
1756
|
+
tableView));
|
|
1753
1757
|
});var TableButton = React.forwardRef(function (_a, ref) {
|
|
1754
1758
|
var children = _a.children, className = _a.className, initSx = _a.sx, _b = _a.variant, variant = _b === void 0 ? 'outlined' : _b, _c = _a.color, color = _c === void 0 ? 'primary' : _c, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "variant", "color", "startIcon", "endIcon", "onClick"]);
|
|
1755
1759
|
return (React.createElement(PdgButton, __assign({ ref: ref, className: classNames(className, 'TableButton'), variant: variant, type: 'button', size: 'small', sx: __assign({ minWidth: 0, px: empty(startIcon) && empty(endIcon)
|
package/dist/index.js
CHANGED
|
@@ -1359,7 +1359,6 @@ var deHash = function () {
|
|
|
1359
1359
|
/********************************************************************************************************************
|
|
1360
1360
|
* Ref
|
|
1361
1361
|
* ******************************************************************************************************************/
|
|
1362
|
-
var _b, _c;
|
|
1363
1362
|
var className = _a.className, initStyle = _a.style, sx = _a.sx, 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;
|
|
1364
1363
|
var initPathRef = React.useRef(window.location.pathname);
|
|
1365
1364
|
var searchRef = React.useRef(undefined);
|
|
@@ -1368,13 +1367,13 @@ var deHash = function () {
|
|
|
1368
1367
|
/********************************************************************************************************************
|
|
1369
1368
|
* State
|
|
1370
1369
|
* ******************************************************************************************************************/
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1370
|
+
var _b = React.useState(true), isFirstSearchSubmit = _b[0], setIsFirstSearchSubmit = _b[1];
|
|
1371
|
+
var _c = React.useState(), tableData = _c[0], setTableData = _c[1];
|
|
1373
1372
|
/********************************************************************************************************************
|
|
1374
1373
|
* searchInfo
|
|
1375
1374
|
* ******************************************************************************************************************/
|
|
1376
1375
|
var searchInfoFirstUseEffect = React.useRef(true);
|
|
1377
|
-
var
|
|
1376
|
+
var _d = React.useState(function () { return getSearchInfo(search); }), searchInfo = _d[0], setSearchInfo = _d[1];
|
|
1378
1377
|
React.useEffect(function () {
|
|
1379
1378
|
if (searchInfoFirstUseEffect.current) {
|
|
1380
1379
|
searchInfoFirstUseEffect.current = false;
|
|
@@ -1387,7 +1386,7 @@ var deHash = function () {
|
|
|
1387
1386
|
* tableInfo
|
|
1388
1387
|
* ******************************************************************************************************************/
|
|
1389
1388
|
var tableInfoFirstUseEffect = React.useRef(true);
|
|
1390
|
-
var
|
|
1389
|
+
var _e = React.useState(function () { return getTableInfo(table); }), tableInfo = _e[0], setTableInfo = _e[1];
|
|
1391
1390
|
React.useEffect(function () {
|
|
1392
1391
|
if (tableInfoFirstUseEffect.current) {
|
|
1393
1392
|
tableInfoFirstUseEffect.current = false;
|
|
@@ -1721,25 +1720,25 @@ var deHash = function () {
|
|
|
1721
1720
|
/********************************************************************************************************************
|
|
1722
1721
|
* Render
|
|
1723
1722
|
* ******************************************************************************************************************/
|
|
1724
|
-
return (React.createElement(material.Grid, {
|
|
1725
|
-
React.createElement(
|
|
1726
|
-
|
|
1727
|
-
if (searchInfo.ref) {
|
|
1728
|
-
|
|
1729
|
-
searchInfo.ref(commands);
|
|
1730
|
-
}
|
|
1731
|
-
else {
|
|
1732
|
-
searchInfo.ref.current = commands;
|
|
1733
|
-
}
|
|
1723
|
+
var searchView = React.useMemo(function () { return (React.createElement(material.Grid, { sx: { display: searchInfo.searchGroups ? undefined : 'none' } },
|
|
1724
|
+
React.createElement(reactForm.Search, __assign({ color: color }, searchInfo.props, { ref: function (commands) {
|
|
1725
|
+
if (searchInfo.ref) {
|
|
1726
|
+
if (typeof searchInfo.ref === 'function') {
|
|
1727
|
+
searchInfo.ref(commands);
|
|
1734
1728
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1729
|
+
else {
|
|
1730
|
+
searchInfo.ref.current = commands;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
searchRef.current = commands || undefined;
|
|
1734
|
+
}, autoSubmit: true, onSubmit: handleSearchSubmit }),
|
|
1735
|
+
React.createElement(reactForm.SearchGroup, { hidden: true },
|
|
1736
|
+
React.createElement(reactForm.FormHidden, { name: 'page', value: 1 })),
|
|
1737
|
+
searchInfo.searchGroups))); }, [color, handleSearchSubmit, searchInfo]);
|
|
1738
|
+
var tableView = React.useMemo(function () {
|
|
1739
|
+
var _a, _b;
|
|
1740
|
+
return (React.createElement(material.Grid, { style: fullHeight ? { flex: 1, display: 'flex', flexDirection: 'column' } : undefined },
|
|
1741
|
+
React.createElement(Table, __assign({}, tableInfo.props, { stickyHeader: stickyHeader || ((_a = tableInfo.props) === null || _a === void 0 ? void 0 : _a.stickyHeader), fullHeight: fullHeight || ((_b = tableInfo.props) === null || _b === void 0 ? void 0 : _b.fullHeight), ref: function (commands) {
|
|
1743
1742
|
if (tableInfo.ref) {
|
|
1744
1743
|
if (typeof tableInfo.ref === 'function') {
|
|
1745
1744
|
tableInfo.ref(commands);
|
|
@@ -1749,7 +1748,12 @@ var deHash = function () {
|
|
|
1749
1748
|
}
|
|
1750
1749
|
}
|
|
1751
1750
|
tableRef.current = commands || undefined;
|
|
1752
|
-
}, items: tableData === null || tableData === void 0 ? void 0 : tableData.items, paging: tableData === null || tableData === void 0 ? void 0 : tableData.paging, onPageChange: handlePageChange }))))
|
|
1751
|
+
}, items: tableData === null || tableData === void 0 ? void 0 : tableData.items, paging: tableData === null || tableData === void 0 ? void 0 : tableData.paging, onPageChange: handlePageChange }))));
|
|
1752
|
+
}, [fullHeight, handlePageChange, stickyHeader, tableData === null || tableData === void 0 ? void 0 : tableData.items, tableData === null || tableData === void 0 ? void 0 : tableData.paging, tableInfo]);
|
|
1753
|
+
return (React.createElement(material.Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: fullHeight ? __assign(__assign({}, initStyle), { flex: 1, display: 'flex' }) : initStyle, sx: sx },
|
|
1754
|
+
searchView,
|
|
1755
|
+
betweenSearchTableComponent && React.createElement(material.Grid, null, betweenSearchTableComponent),
|
|
1756
|
+
tableView));
|
|
1753
1757
|
});var TableButton = React.forwardRef(function (_a, ref) {
|
|
1754
1758
|
var children = _a.children, className = _a.className, initSx = _a.sx, _b = _a.variant, variant = _b === void 0 ? 'outlined' : _b, _c = _a.color, color = _c === void 0 ? 'primary' : _c, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "variant", "color", "startIcon", "endIcon", "onClick"]);
|
|
1755
1759
|
return (React.createElement(reactComponent.PdgButton, __assign({ ref: ref, className: classNames(className, 'TableButton'), variant: variant, type: 'button', size: 'small', sx: __assign({ minWidth: 0, px: util.empty(startIcon) && util.empty(endIcon)
|