pixelize-design-library 2.2.182 → 2.2.184

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.
@@ -16,7 +16,7 @@ var Pagination = function (_a) {
16
16
  // const isRightDisabled = currentPage >= pages - 1;
17
17
  var isLeftDisabled = dataLength === 0 || currentPage === 0;
18
18
  var isRightDisabled = dataLength === 0 || currentPage >= pages - 1;
19
- return (react_1.default.createElement(react_2.Flex, { justify: "flex-end", align: "center", minW: 0, overflow: "hidden", flexWrap: "nowrap" },
19
+ return (react_1.default.createElement(react_2.Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap" },
20
20
  (!isServerPagination || paginationSelectOptions) && (react_1.default.createElement(react_2.Select, { onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: 3, width: 20, isDisabled: dataLength === 0 },
21
21
  !paginationSelectOptions && dataLength < 100 ? react_1.default.createElement("option", { value: 0 }) : null,
22
22
  computedOptions.map(function (size, index) { return (react_1.default.createElement("option", { key: index, value: size }, String(size))); }))),
@@ -44,12 +44,63 @@ var TableLoading_1 = require("./TableLoading");
44
44
  var TableActions_1 = __importDefault(require("./TableActions"));
45
45
  var lucide_react_1 = require("lucide-react");
46
46
  var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
47
+ var TableRow = react_2.default.memo(function (_a) {
48
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
49
+ var row = _a.row, rowIndex = _a.rowIndex, index = _a.index, isChecked = _a.isChecked, isExpanded = _a.isExpanded, isContent = _a.isContent, isLink = _a.isLink, isCheckbox = _a.isCheckbox, isLoading = _a.isLoading, isActionFreeze = _a.isActionFreeze, columns = _a.columns, columnWidths = _a.columnWidths, noBorders = _a.noBorders, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, theme = _a.theme, handleCheckbox = _a.handleCheckbox, onRowClick = _a.onRowClick, toggleRowExpansion = _a.toggleRowExpansion;
50
+ return (react_2.default.createElement(react_2.default.Fragment, null,
51
+ react_2.default.createElement(react_1.Tr, { opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", sx: isChecked
52
+ ? {
53
+ "& td": {
54
+ backgroundColor: theme.colors.disabled[100],
55
+ },
56
+ }
57
+ : {} },
58
+ isContent && (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], color: freezedTextColor, position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" }, !!(row === null || row === void 0 ? void 0 : row.content) && (react_2.default.createElement(react_1.IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[600], icon: isExpanded ? (react_2.default.createElement(lucide_react_1.ChevronDown, { fontSize: 16 })) : (react_2.default.createElement(lucide_react_1.ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: function () { return toggleRowExpansion(rowIndex); }, variant: "ghost" })))),
59
+ isCheckbox && (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.background) === null || _g === void 0 ? void 0 : _g[50], textTransform: "capitalize", backgroundColor: (_j = (_h = theme.colors) === null || _h === void 0 ? void 0 : _h.background) === null || _j === void 0 ? void 0 : _j[50], position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_k = theme.colors) === null || _k === void 0 ? void 0 : _k.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
60
+ react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked }))),
61
+ columns.map(function (header, headerIndex) {
62
+ var _a, _b, _c, _d, _e, _f, _g;
63
+ if (header.isHidden)
64
+ return null;
65
+ var isFrozen = header.isFreeze;
66
+ var leftOffset = (0, table_1.TableCellCalculation)({
67
+ isFrozen: isFrozen,
68
+ columnWidths: columnWidths,
69
+ headerIndex: headerIndex,
70
+ isCheckbox: isCheckbox,
71
+ header: header,
72
+ row: row,
73
+ freezedBgColor: freezedBgColor,
74
+ index: index,
75
+ theme: theme,
76
+ }).leftOffset;
77
+ return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, height: 45, key: headerIndex + 1, onClick: function () {
78
+ return !header.node
79
+ ? onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row, { label: header.label, id: header.id })
80
+ : null;
81
+ }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: (_a = theme.colors.background) === null || _a === void 0 ? void 0 : _a[50], textOverflow: "ellipsis", borderBottom: noBorders
82
+ ? "none"
83
+ : "0.063rem solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: (_d = (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d[500], _hover: ((_e = row.cellStyle) === null || _e === void 0 ? void 0 : _e[header.id]) || row.rowStyle
84
+ ? {}
85
+ : {
86
+ backgroundColor: (_g = (_f = theme.colors.secondary) === null || _f === void 0 ? void 0 : _f.opacity) === null || _g === void 0 ? void 0 : _g[4],
87
+ } },
88
+ react_2.default.createElement(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word" }, (0, table_1.normalizeTableCellValue)(header.node ? header.node(row) : row[header.id]))));
89
+ }),
90
+ isLink && (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: (_m = (_l = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _l === void 0 ? void 0 : _l.background) === null || _m === void 0 ? void 0 : _m[50], color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_o = theme.colors) === null || _o === void 0 ? void 0 : _o.border[500]), boxSizing: "border-box", right: 0, zIndex: 1, className: "columns sticky-columns".concat(isActionFreeze ? "-right" : "") }, (row.onLink || row.onEdit || row.onDelete) && (react_2.default.createElement(TableActions_1.default, { row: row }))))),
91
+ row.content && isExpanded && (react_2.default.createElement(react_1.Tr, null,
92
+ react_2.default.createElement(react_1.Td, { colSpan: columns.length +
93
+ (isCheckbox ? 1 : 0) +
94
+ (isContent ? 1 : 0) +
95
+ (isLink ? 1 : 0), p: 2 },
96
+ react_2.default.createElement(react_1.Box, { p: 2, bg: theme.colors.white, borderRadius: "md" }, row === null || row === void 0 ? void 0 : row.content(row)))))));
97
+ });
47
98
  var TableBody = function (_a) {
48
- var _b, _c, _d;
99
+ var _b, _c, _d, _e, _f;
49
100
  var data = _a.data, isCheckbox = _a.isCheckbox, columns = _a.columns, startRow = _a.startRow, columnWidths = _a.columnWidths, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, selections = _a.selections, isLoading = _a.isLoading, onRowClick = _a.onRowClick, isContent = _a.isContent, isLink = _a.isLink, isActionFreeze = _a.isActionFreeze, loadingSkeletonRows = _a.loadingSkeletonRows;
50
101
  var theme = (0, useCustomTheme_1.useCustomTheme)();
51
- var _e = (0, react_2.useState)(new Set()), expandedRows = _e[0], setExpandedRows = _e[1];
52
- var toggleRowExpansion = function (rowIndex) {
102
+ var _g = (0, react_2.useState)(new Set()), expandedRows = _g[0], setExpandedRows = _g[1];
103
+ var toggleRowExpansion = (0, react_2.useCallback)(function (rowIndex) {
53
104
  setExpandedRows(function (prev) {
54
105
  var newSet = new Set(prev);
55
106
  if (newSet.has(rowIndex)) {
@@ -60,92 +111,33 @@ var TableBody = function (_a) {
60
111
  }
61
112
  return newSet;
62
113
  });
63
- };
64
- var handleRowClick = function (row, header) {
65
- onRowClick && onRowClick(row, header);
66
- };
67
- var RenderCheckbox = (0, react_2.useCallback)(function (_a) {
68
- var _b, _c, _d, _e, _f;
69
- var row = _a.row, isChecked = _a.isChecked;
70
- return (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], textTransform: "capitalize", backgroundColor: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.background) === null || _e === void 0 ? void 0 : _e[50], position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_f = theme.colors) === null || _f === void 0 ? void 0 : _f.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
71
- react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked })));
72
- }, [handleCheckbox, noBorders, theme.colors]);
73
- var RenderContent = (0, react_2.useCallback)(function (_a) {
74
- var _b, _c, _d, _e;
75
- var isExpanded = _a.isExpanded, rowIndex = _a.rowIndex, isContent = _a.isContent;
76
- return (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], color: freezedTextColor, position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" }, isContent && (react_2.default.createElement(react_1.IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[600], icon: isExpanded ? (react_2.default.createElement(lucide_react_1.ChevronDown, { fontSize: 16 })) : (react_2.default.createElement(lucide_react_1.ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: function () { return toggleRowExpansion(rowIndex); }, variant: "ghost" }))));
77
- }, [freezedTextColor, noBorders, theme.colors]);
78
- var RenderView = (0, react_2.useCallback)(function (_a) {
79
- var _b, _c, _d;
80
- var row = _a.row;
81
- return (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: (_c = (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), boxSizing: "border-box", right: 0, zIndex: 1, className: "columns sticky-columns".concat(isActionFreeze ? "-right" : "") }, (row.onLink || row.onEdit || row.onDelete) && (react_2.default.createElement(TableActions_1.default, { row: row }))));
82
- }, [freezedTextColor, noBorders, theme.colors, isActionFreeze]);
83
- var totalVisibleColumns = Object.values(columns).filter(function (o) { return !o.isHidden; }).length +
84
- (isCheckbox ? 1 : 0) +
85
- (isContent ? 1 : 0) +
86
- (isLink ? 1 : 0);
87
- if (isLoading) {
114
+ }, []);
115
+ var totalVisibleColumns = (0, react_2.useMemo)(function () {
116
+ return columns.filter(function (o) { return !o.isHidden; }).length +
117
+ (isCheckbox ? 1 : 0) +
118
+ (isContent ? 1 : 0) +
119
+ (isLink ? 1 : 0);
120
+ }, [columns, isCheckbox, isContent, isLink]);
121
+ if (isLoading && data.length === 0) {
88
122
  return (react_2.default.createElement(TableLoading_1.TableBodyLoading, { noOfColumns: totalVisibleColumns, borderColor: theme.colors.gray[300], rowsCount: typeof loadingSkeletonRows === "number" ? loadingSkeletonRows : 4 }));
89
123
  }
90
- if (data.length === 0) {
124
+ if (!isLoading && data.length === 0) {
91
125
  return (react_2.default.createElement(react_1.Tr, { backgroundColor: (_b = theme.colors.background) === null || _b === void 0 ? void 0 : _b[50] },
92
126
  react_2.default.createElement(react_1.Td, { colSpan: totalVisibleColumns, textAlign: "center", py: 4 },
93
127
  react_2.default.createElement(react_1.Box, { textAlign: "center", fontSize: 14, color: (_d = (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d[500] },
94
128
  react_2.default.createElement("p", null, "No data found")))));
95
129
  }
96
- return (react_2.default.createElement(react_2.default.Fragment, null, data.map(function (row, index) {
97
- var _a;
98
- var rowIndex = startRow + index;
99
- var isExpanded = expandedRows.has(rowIndex);
100
- var isChecked = selections.includes(row.id);
101
- return (react_2.default.createElement(react_2.default.Fragment, { key: rowIndex },
102
- react_2.default.createElement(react_1.Tr, { key: index + 1, sx: isChecked
103
- ? {
104
- "& td": {
105
- backgroundColor: theme.colors.disabled[100],
106
- },
107
- }
108
- : {} },
109
- isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!((_a = row === null || row === void 0 ? void 0 : row.content) === null || _a === void 0 ? void 0 : _a.call(row)) })),
110
- isCheckbox && react_2.default.createElement(RenderCheckbox, { row: row, isChecked: isChecked }),
111
- columns.map(function (header, headerIndex) {
112
- var _a, _b, _c, _d, _e, _f, _g;
113
- if (header.isHidden)
114
- return null;
115
- var isFrozen = header.isFreeze;
116
- var leftOffset = (0, table_1.TableCellCalculation)({
117
- isFrozen: isFrozen,
118
- columnWidths: columnWidths,
119
- headerIndex: headerIndex,
120
- isCheckbox: isCheckbox,
121
- header: header,
122
- row: row,
123
- freezedBgColor: freezedBgColor,
124
- index: index,
125
- }).leftOffset;
126
- return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, height: 45, key: headerIndex + 1, onClick: function () {
127
- return !header.node
128
- ? handleRowClick(row, {
129
- label: header.label,
130
- id: header.id,
131
- })
132
- : null;
133
- }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: (_a = theme.colors.background) === null || _a === void 0 ? void 0 : _a[50], textOverflow: "ellipsis", borderBottom: noBorders
134
- ? "none"
135
- : "0.063rem solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: (_d = (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d[500], _hover: ((_e = row.cellStyle) === null || _e === void 0 ? void 0 : _e[header.id]) || row.rowStyle
136
- ? {}
137
- : {
138
- backgroundColor: (_g = (_f = theme.colors.secondary) === null || _f === void 0 ? void 0 : _f.opacity) === null || _g === void 0 ? void 0 : _g[4],
139
- } },
140
- react_2.default.createElement(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word" }, (0, table_1.normalizeTableCellValue)(header.node ? header.node(row) : row[header.id]))));
141
- }),
142
- isLink && react_2.default.createElement(RenderView, { row: row })),
143
- row.content && isExpanded && (react_2.default.createElement(react_1.Tr, null,
144
- react_2.default.createElement(react_1.Td, { colSpan: columns.length +
145
- (isCheckbox ? 1 : 0) +
146
- (isContent ? 1 : 0) +
147
- (isLink ? 1 : 0), p: 2 },
148
- react_2.default.createElement(react_1.Box, { p: 2, bg: theme.colors.white, borderRadius: "md" }, row === null || row === void 0 ? void 0 : row.content(row)))))));
149
- })));
130
+ return (react_2.default.createElement(react_2.default.Fragment, null,
131
+ isLoading && data.length > 0 && (react_2.default.createElement(react_1.Tr, null,
132
+ react_2.default.createElement(react_1.Td, { colSpan: totalVisibleColumns, p: 0, border: "none", position: "relative", height: 0 },
133
+ react_2.default.createElement(react_1.Box, { position: "absolute", top: 4, left: "50%", transform: "translateX(-50%)", zIndex: 10 },
134
+ react_2.default.createElement(react_1.Spinner, { size: "sm", color: ((_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.primary) === null || _f === void 0 ? void 0 : _f[500]) || "blue.500" }))))),
135
+ data.map(function (row, index) {
136
+ var _a;
137
+ var rowIndex = startRow + index;
138
+ var isExpanded = expandedRows.has(rowIndex);
139
+ var isChecked = selections.includes(row.id);
140
+ return (react_2.default.createElement(TableRow, { key: (_a = row.id) !== null && _a !== void 0 ? _a : rowIndex, row: row, rowIndex: rowIndex, index: index, isChecked: isChecked, isExpanded: isExpanded, isContent: isContent, isLink: isLink, isCheckbox: isCheckbox, isLoading: isLoading, isActionFreeze: isActionFreeze, columns: columns, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor, freezedTextColor: freezedTextColor, theme: theme, handleCheckbox: handleCheckbox, onRowClick: onRowClick, toggleRowExpansion: toggleRowExpansion }));
141
+ })));
150
142
  };
151
143
  exports.default = TableBody;
@@ -41,6 +41,5 @@ declare const useTable: ({ tableBorderColor, data, isPagination, selections, onS
41
41
  setCurrentPage: import("react").Dispatch<import("react").SetStateAction<number>>;
42
42
  columnsList: TableHeaderProps[];
43
43
  handleColumnPreferences: (columns: any) => void;
44
- handleGlobalSearch: (query: string) => void;
45
44
  };
46
45
  export default useTable;
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  var react_1 = require("react");
24
24
  var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
25
25
  var table_1 = require("../../../Utils/table");
26
- var defaultPageSize = 50;
26
+ var defaultPageSize = 20;
27
27
  var mergeColumnWithPreference = function (pref, originalCol) {
28
28
  if (!pref || typeof pref !== "object") {
29
29
  return __assign({}, originalCol);
@@ -46,16 +46,17 @@ var useTable = function (_a) {
46
46
  var _d = (0, react_1.useState)([]), columnsSort = _d[0], setColumnsSort = _d[1];
47
47
  var _e = (0, react_1.useState)(0), currentPage = _e[0], setCurrentPage = _e[1];
48
48
  var _f = (0, react_1.useState)(noOfRowsPerPage !== null && noOfRowsPerPage !== void 0 ? noOfRowsPerPage : defaultPageSize), rowsPerPage = _f[0], setRowsPerPage = _f[1];
49
- (0, react_1.useEffect)(function () {
50
- if (noOfRowsPerPage !== undefined) {
49
+ var prevRowsPerPageProp = (0, react_1.useRef)(noOfRowsPerPage);
50
+ if (noOfRowsPerPage !== prevRowsPerPageProp.current) {
51
+ prevRowsPerPageProp.current = noOfRowsPerPage;
52
+ if (noOfRowsPerPage !== undefined && noOfRowsPerPage !== rowsPerPage) {
51
53
  setRowsPerPage(noOfRowsPerPage);
52
54
  }
53
- }, [noOfRowsPerPage]);
54
- var tableData = (0, react_1.useMemo)(function () { return data; }, [data]);
55
- var _g = (0, react_1.useState)(tableData), filteredData = _g[0], setFilteredData = _g[1];
56
- var _h = (0, react_1.useState)(function () {
55
+ }
56
+ var tableData = data;
57
+ var _g = (0, react_1.useState)(function () {
57
58
  return columns.map(function (col) { return (__assign({}, col)); });
58
- }), columnsList = _h[0], setColumnsList = _h[1];
59
+ }), columnsList = _g[0], setColumnsList = _g[1];
59
60
  (0, react_1.useEffect)(function () {
60
61
  var _a;
61
62
  var columnPreference = (_a = tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.columns) !== null && _a !== void 0 ? _a : [];
@@ -72,9 +73,6 @@ var useTable = function (_a) {
72
73
  setColumnsList(columns.map(function (col) { return (__assign({}, col)); }));
73
74
  }
74
75
  }, [tablePreferences, columns]);
75
- (0, react_1.useEffect)(function () {
76
- setFilteredData(tableData);
77
- }, [tableData]);
78
76
  var tableContainerStyles = (0, react_1.useMemo)(function () {
79
77
  var _a;
80
78
  return ({
@@ -106,13 +104,12 @@ var useTable = function (_a) {
106
104
  ]);
107
105
  var startRow = (0, react_1.useMemo)(function () { return (!isPagination ? 0 : currentPage * rowsPerPage); }, [currentPage, isPagination, rowsPerPage]);
108
106
  var endRow = (0, react_1.useMemo)(function () { return (!isPagination ? tableData.length : startRow + rowsPerPage); }, [isPagination, rowsPerPage, startRow, tableData.length]);
109
- (0, react_1.useEffect)(function () {
107
+ var filteredData = (0, react_1.useMemo)(function () {
110
108
  if (isServerPagination) {
111
- return setFilteredData(tableData);
109
+ return tableData;
112
110
  }
113
111
  var sortedData = (0, table_1.SortMultiColumnData)(tableData, columnsSort);
114
- var data = sortedData.slice(startRow, endRow);
115
- return setFilteredData(data);
112
+ return sortedData.slice(startRow, endRow);
116
113
  }, [columnsSort, startRow, endRow, tableData, isServerPagination]);
117
114
  var handlePageSizeChange = function (event) {
118
115
  var value = Number(event.target.value);
@@ -166,11 +163,6 @@ var useTable = function (_a) {
166
163
  savePreferences &&
167
164
  savePreferences(__assign(__assign({}, tablePreferences), { columns: columns }));
168
165
  };
169
- var handleGlobalSearch = function (query) {
170
- if (!query)
171
- setFilteredData(tableData);
172
- setFilteredData((0, table_1.globalSearchFilter)(tableData, query));
173
- };
174
166
  return {
175
167
  tableData: tableData,
176
168
  tableContainerStyles: tableContainerStyles,
@@ -192,7 +184,6 @@ var useTable = function (_a) {
192
184
  setCurrentPage: setCurrentPage,
193
185
  columnsList: columnsList,
194
186
  handleColumnPreferences: handleColumnPreferences,
195
- handleGlobalSearch: handleGlobalSearch,
196
187
  };
197
188
  };
198
189
  exports.default = useTable;
@@ -142,7 +142,7 @@ function Table(_a) {
142
142
  onPaginationRef.current(currentPage + 1, rowsPerPage, record, direction);
143
143
  prevPageRef.current = currentPage;
144
144
  }
145
- }, [currentPage, rowsPerPage, pages]);
145
+ }, [currentPage, rowsPerPage]);
146
146
  var tablePaginationText = "".concat(startRow + 1, " - ").concat(endRow > tableData.length ? tableData.length : endRow, " of ").concat(isServerPagination ? totalRecords : tableData.length);
147
147
  var controlsHeight = 45;
148
148
  var estimatedRowHeight = 45;
@@ -223,7 +223,7 @@ function Table(_a) {
223
223
  react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))) : null,
224
224
  react_1.default.createElement(ActiveFilters_1.default, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }),
225
225
  react_1.default.createElement(react_2.Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2 },
226
- (isPagination || isServerPagination) && !isCompactHeader && (react_1.default.createElement(react_2.Box, { flex: "0 1 280px", minW: 0, overflow: "hidden" },
226
+ (isPagination || isServerPagination) && !isCompactHeader && (react_1.default.createElement(react_2.Box, { flex: "0 0 auto" },
227
227
  react_1.default.createElement(Pagination_1.default, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }))),
228
228
  (isPagination || isServerPagination) && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
229
229
  react_1.default.createElement(react_2.PopoverTrigger, null,
@@ -23,8 +23,9 @@ type TableCellCalculationProps = {
23
23
  row: DataObject;
24
24
  freezedBgColor?: string;
25
25
  index: number;
26
+ theme: any;
26
27
  };
27
- export declare const TableCellCalculation: ({ isFrozen, columnWidths, headerIndex, isCheckbox, header, row, freezedBgColor, index, }: TableCellCalculationProps) => {
28
+ export declare const TableCellCalculation: ({ isFrozen, columnWidths, headerIndex, isCheckbox, header, row, freezedBgColor, index, theme, }: TableCellCalculationProps) => {
28
29
  leftOffset: number;
29
30
  cellBgColor: any;
30
31
  rowBgColor: any;
@@ -49,7 +49,6 @@ exports.debounce = debounce;
49
49
  exports.useDebounce = useDebounce;
50
50
  exports.globalSearchFilter = globalSearchFilter;
51
51
  var react_1 = __importStar(require("react"));
52
- var useCustomTheme_1 = require("../Theme/useCustomTheme");
53
52
  function SortMultiColumnData(data, sortConfig) {
54
53
  if (!sortConfig.length)
55
54
  return data;
@@ -210,8 +209,7 @@ var pageSizeCalculation = function (records) {
210
209
  exports.pageSizeCalculation = pageSizeCalculation;
211
210
  var TableCellCalculation = function (_a) {
212
211
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
213
- var isFrozen = _a.isFrozen, columnWidths = _a.columnWidths, headerIndex = _a.headerIndex, isCheckbox = _a.isCheckbox, header = _a.header, row = _a.row, freezedBgColor = _a.freezedBgColor, index = _a.index;
214
- var theme = (0, useCustomTheme_1.useCustomTheme)();
212
+ var isFrozen = _a.isFrozen, columnWidths = _a.columnWidths, headerIndex = _a.headerIndex, isCheckbox = _a.isCheckbox, header = _a.header, row = _a.row, freezedBgColor = _a.freezedBgColor, index = _a.index, theme = _a.theme;
215
213
  var leftOffset = isFrozen
216
214
  ? (0, exports.calculateLeftOffset)(columnWidths, headerIndex) + (isCheckbox ? 50 : 0)
217
215
  : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.2.182",
3
+ "version": "2.2.184",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",