pixelize-design-library 1.1.60 → 1.1.61
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableProps } from "./TableProps";
|
|
3
3
|
import "./Table.css";
|
|
4
|
-
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferencesUrl, preferencesKey, preferencesName, preferencesPage, authToken, paginationMode, noOfRowsPerPage, totalRecords, onPagination, }: TableProps): React.JSX.Element;
|
|
4
|
+
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferencesUrl, preferencesKey, preferencesName, preferencesPage, authToken, paginationMode, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, }: TableProps): React.JSX.Element;
|
|
@@ -40,17 +40,17 @@ var usePreferences_1 = require("../../Hooks/usePreferences");
|
|
|
40
40
|
var TableSettings_1 = __importDefault(require("./TableSettings/TableSettings"));
|
|
41
41
|
function Table(_a) {
|
|
42
42
|
var _b, _c, _d;
|
|
43
|
-
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _e = _a.isCheckbox, isCheckbox = _e === void 0 ? false : _e, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _f = _a.noBorders, noBorders = _f === void 0 ? false : _f, _g = _a.isPagination, isPagination = _g === void 0 ? true : _g, onRowClick = _a.onRowClick, selections = _a.selections, _h = _a.isActionFreeze, isActionFreeze = _h === void 0 ? true : _h, _j = _a.preferencesUrl, preferencesUrl = _j === void 0 ? "" : _j, _k = _a.preferencesKey, preferencesKey = _k === void 0 ? "" : _k, _l = _a.preferencesName, preferencesName = _l === void 0 ? "" : _l, _m = _a.preferencesPage, preferencesPage = _m === void 0 ? "" : _m, _o = _a.authToken, authToken = _o === void 0 ? "" : _o, _p = _a.paginationMode, paginationMode = _p === void 0 ? "client" : _p, _q = _a.noOfRowsPerPage, noOfRowsPerPage = _q === void 0 ? 50 : _q, _r = _a.totalRecords, totalRecords = _r === void 0 ? 0 : _r, onPagination = _a.onPagination;
|
|
43
|
+
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _e = _a.isCheckbox, isCheckbox = _e === void 0 ? false : _e, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _f = _a.noBorders, noBorders = _f === void 0 ? false : _f, _g = _a.isPagination, isPagination = _g === void 0 ? true : _g, onRowClick = _a.onRowClick, selections = _a.selections, _h = _a.isActionFreeze, isActionFreeze = _h === void 0 ? true : _h, _j = _a.preferencesUrl, preferencesUrl = _j === void 0 ? "" : _j, _k = _a.preferencesKey, preferencesKey = _k === void 0 ? "" : _k, _l = _a.preferencesName, preferencesName = _l === void 0 ? "" : _l, _m = _a.preferencesPage, preferencesPage = _m === void 0 ? "" : _m, _o = _a.authToken, authToken = _o === void 0 ? "" : _o, _p = _a.paginationMode, paginationMode = _p === void 0 ? "client" : _p, _q = _a.noOfRowsPerPage, noOfRowsPerPage = _q === void 0 ? 50 : _q, _r = _a.totalRecords, totalRecords = _r === void 0 ? 0 : _r, onPagination = _a.onPagination, _s = _a.isTableSettings, isTableSettings = _s === void 0 ? false : _s;
|
|
44
44
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
45
|
-
var
|
|
45
|
+
var _t = (0, react_1.useState)({}), columnsSearch = _t[0], setColumnsSearch = _t[1];
|
|
46
46
|
var isServerPagination = paginationMode === "server";
|
|
47
|
-
var
|
|
47
|
+
var _u = (0, usePreferences_1.useGetPreferences)({
|
|
48
48
|
baseUrl: preferencesUrl,
|
|
49
49
|
page: preferencesPage,
|
|
50
50
|
key: preferencesKey,
|
|
51
51
|
name: preferencesName,
|
|
52
52
|
authToken: authToken,
|
|
53
|
-
}), preferences =
|
|
53
|
+
}), preferences = _u.preferences, loading = _u.loading;
|
|
54
54
|
var savePreferences = (0, usePreferences_1.useSavePreferences)({
|
|
55
55
|
baseUrl: preferencesUrl,
|
|
56
56
|
page: preferencesPage,
|
|
@@ -67,7 +67,7 @@ function Table(_a) {
|
|
|
67
67
|
}
|
|
68
68
|
return {};
|
|
69
69
|
}, [preferences]);
|
|
70
|
-
var
|
|
70
|
+
var _v = (0, useTable_1.default)({
|
|
71
71
|
tableBorderColor: tableBorderColor,
|
|
72
72
|
data: data,
|
|
73
73
|
isPagination: isPagination,
|
|
@@ -79,7 +79,7 @@ function Table(_a) {
|
|
|
79
79
|
noOfRowsPerPage: noOfRowsPerPage,
|
|
80
80
|
totalRecords: totalRecords,
|
|
81
81
|
isServerPagination: isServerPagination,
|
|
82
|
-
}), tableData =
|
|
82
|
+
}), tableData = _v.tableData, tableContainerStyles = _v.tableContainerStyles, isContent = _v.isContent, isLink = _v.isLink, headerRefs = _v.headerRefs, columnWidths = _v.columnWidths, handleSort = _v.handleSort, handleCheckbox = _v.handleCheckbox, filteredData = _v.filteredData, startRow = _v.startRow, endRow = _v.endRow, selection = _v.selection, columnsSort = _v.columnsSort, currentPage = _v.currentPage, pages = _v.pages, rowsPerPage = _v.rowsPerPage, handlePageSizeChange = _v.handlePageSizeChange, setCurrentPage = _v.setCurrentPage, columnsList = _v.columnsList, handleColumnPreferences = _v.handleColumnPreferences;
|
|
83
83
|
var _filteredData = (0, react_1.useMemo)(function () {
|
|
84
84
|
return (0, table_1.searchAndSortData)(filteredData, columnsSearch);
|
|
85
85
|
}, [columnsSearch, filteredData]);
|
|
@@ -89,7 +89,7 @@ function Table(_a) {
|
|
|
89
89
|
}
|
|
90
90
|
}, [currentPage, onPagination, noOfRowsPerPage]);
|
|
91
91
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
92
|
-
react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return handleColumnPreferences(cols); } }),
|
|
92
|
+
isTableSettings && (react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return handleColumnPreferences(cols); } })),
|
|
93
93
|
react_1.default.createElement(react_2.TableContainer, { sx: tableContainerStyles },
|
|
94
94
|
react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", overflowX: "scroll", minW: "100%", className: "table_wrapper" },
|
|
95
95
|
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 2 },
|