pixelize-design-library 1.1.49 → 1.1.50
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/Components/Table/Components/TableActions.d.ts +3 -0
- package/dist/Components/Table/Components/TableActions.js +30 -0
- package/dist/Components/Table/Components/TableBody.d.ts +1 -1
- package/dist/Components/Table/Components/TableBody.js +11 -7
- package/dist/Components/Table/Components/TableHeader.d.ts +1 -1
- package/dist/Components/Table/Components/TableHeader.js +10 -3
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +21 -21
- package/dist/Components/Table/TableProps.d.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var react_2 = require("@chakra-ui/react");
|
|
8
|
+
var fa_1 = require("react-icons/fa");
|
|
9
|
+
var md_1 = require("react-icons/md");
|
|
10
|
+
var icons_1 = require("@chakra-ui/icons");
|
|
11
|
+
var TableActions = function (_a) {
|
|
12
|
+
var row = _a.row;
|
|
13
|
+
return (react_1.default.createElement(react_2.Popover, { placement: "bottom-start" },
|
|
14
|
+
react_1.default.createElement(react_2.PopoverTrigger, null,
|
|
15
|
+
react_1.default.createElement(react_2.IconButton, { "aria-label": "Link", color: "black", icon: react_1.default.createElement(fa_1.FaEllipsisV, { fontSize: 12 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" } })),
|
|
16
|
+
react_1.default.createElement(react_2.Portal, null,
|
|
17
|
+
react_1.default.createElement(react_2.PopoverContent, { w: "auto", minW: "150px", boxShadow: "lg", p: 0, zIndex: 999 },
|
|
18
|
+
react_1.default.createElement(react_2.PopoverBody, null,
|
|
19
|
+
react_1.default.createElement(react_2.VStack, { align: "stretch", spacing: 1 },
|
|
20
|
+
row.onLink && (react_1.default.createElement(react_2.Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, onClick: function () { return row === null || row === void 0 ? void 0 : row.onLink(row); } },
|
|
21
|
+
react_1.default.createElement(icons_1.ExternalLinkIcon, null),
|
|
22
|
+
" View")),
|
|
23
|
+
row.onEdit && (react_1.default.createElement(react_2.Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", gap: 2, onClick: function () { var _a; return (_a = row === null || row === void 0 ? void 0 : row.onEdit) === null || _a === void 0 ? void 0 : _a.call(row, row); } },
|
|
24
|
+
react_1.default.createElement(icons_1.EditIcon, null),
|
|
25
|
+
" Edit")),
|
|
26
|
+
row.onDelete && (react_1.default.createElement(react_2.Button, { size: "sm", variant: "ghost", justifyContent: "flex-start", colorScheme: "red", gap: 2, onClick: function () { var _a; return (_a = row === null || row === void 0 ? void 0 : row.onDelete) === null || _a === void 0 ? void 0 : _a.call(row, row); } },
|
|
27
|
+
react_1.default.createElement(md_1.MdDelete, null),
|
|
28
|
+
"Delete"))))))));
|
|
29
|
+
};
|
|
30
|
+
exports.default = TableActions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableBodyPageProps } from "../TableProps";
|
|
3
|
-
declare const TableBody: ({ data, isCheckbox, columns, visibleColumns, startRow, endRow, columnWidths, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, }: TableBodyPageProps) => React.JSX.Element;
|
|
3
|
+
declare const TableBody: ({ data, isCheckbox, columns, visibleColumns, startRow, endRow, columnWidths, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, }: TableBodyPageProps) => React.JSX.Element;
|
|
4
4
|
export default TableBody;
|
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
var react_1 = require("@chakra-ui/react");
|
|
27
30
|
var react_2 = __importStar(require("react"));
|
|
@@ -29,10 +32,10 @@ var table_1 = require("../../../Utils/table");
|
|
|
29
32
|
var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
30
33
|
var TableLoading_1 = require("./TableLoading");
|
|
31
34
|
var fa_1 = require("react-icons/fa");
|
|
32
|
-
var
|
|
35
|
+
var TableActions_1 = __importDefault(require("./TableActions"));
|
|
33
36
|
var TableBody = function (_a) {
|
|
34
37
|
var _b;
|
|
35
|
-
var data = _a.data, isCheckbox = _a.isCheckbox, columns = _a.columns, visibleColumns = _a.visibleColumns, startRow = _a.startRow, endRow = _a.endRow, 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;
|
|
38
|
+
var data = _a.data, isCheckbox = _a.isCheckbox, columns = _a.columns, visibleColumns = _a.visibleColumns, startRow = _a.startRow, endRow = _a.endRow, 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;
|
|
36
39
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
37
40
|
var _c = (0, react_2.useState)(new Set()), expandedRows = _c[0], setExpandedRows = _c[1];
|
|
38
41
|
var toggleRowExpansion = function (rowIndex) {
|
|
@@ -68,10 +71,10 @@ var TableBody = function (_a) {
|
|
|
68
71
|
return (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: freezedBgColor, color: freezedTextColor, position: "sticky", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), 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: (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], icon: isExpanded ? (react_2.default.createElement(fa_1.FaAngleDown, { fontSize: 16 })) : (react_2.default.createElement(fa_1.FaAngleRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: function () { return toggleRowExpansion(rowIndex); }, variant: "ghost" }))));
|
|
69
72
|
}, [freezedBgColor, freezedTextColor, noBorders, theme.colors.gray]);
|
|
70
73
|
var RenderView = (0, react_2.useCallback)(function (_a) {
|
|
71
|
-
var _b
|
|
72
|
-
var row = _a.row;
|
|
73
|
-
return (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: freezedBgColor, color: freezedTextColor, position: "sticky", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), boxSizing: "border-box", right: 0, zIndex: 1, className: "columns sticky-columns"
|
|
74
|
-
}, [freezedBgColor, freezedTextColor, noBorders, theme.colors]);
|
|
74
|
+
var _b;
|
|
75
|
+
var row = _a.row, bgcolor = _a.bgcolor;
|
|
76
|
+
return (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: isActionFreeze ? freezedBgColor : bgcolor, color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), 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 }))));
|
|
77
|
+
}, [freezedBgColor, freezedTextColor, noBorders, theme.colors, isActionFreeze]);
|
|
75
78
|
if (isLoading) {
|
|
76
79
|
var totalVisibleColumns = Object.values(visibleColumns).filter(Boolean).length +
|
|
77
80
|
(isCheckbox ? 1 : 0);
|
|
@@ -91,6 +94,7 @@ var TableBody = function (_a) {
|
|
|
91
94
|
var rowIndex = startRow + index;
|
|
92
95
|
var isExpanded = expandedRows.has(rowIndex);
|
|
93
96
|
var isChecked = selections.includes(row.id);
|
|
97
|
+
var freezeViewColor = index % 2 === 1 ? theme.colors.backgroundColor.light : "white";
|
|
94
98
|
return (react_2.default.createElement(react_2.default.Fragment, { key: rowIndex },
|
|
95
99
|
react_2.default.createElement(react_1.Tr, { key: index + 1, sx: isChecked
|
|
96
100
|
? {
|
|
@@ -128,7 +132,7 @@ var TableBody = function (_a) {
|
|
|
128
132
|
: "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: isFrozen ? freezedTextColor : undefined },
|
|
129
133
|
react_2.default.createElement(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block", overflow: "hidden" }, header.node ? header.node(row) : row[header.id]))));
|
|
130
134
|
}),
|
|
131
|
-
isLink && react_2.default.createElement(RenderView, { row: row })),
|
|
135
|
+
isLink && react_2.default.createElement(RenderView, { row: row, bgcolor: freezeViewColor })),
|
|
132
136
|
row.content && isExpanded && (react_2.default.createElement(react_1.Tr, null,
|
|
133
137
|
react_2.default.createElement(react_1.Td, { colSpan: columns.length +
|
|
134
138
|
(isCheckbox ? 1 : 0) +
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableHeaderPageProps } from "../TableProps";
|
|
3
|
-
declare const TableHeader: ({ columns, isCheckbox, visibleColumns, handleSort, headerRefs, columnWidths, columnsSort, headerBgColor, headerTextColor, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, checked, isLoading, isContent, isLink, onColumnSearch, columnFilters, }: TableHeaderPageProps) => React.JSX.Element;
|
|
3
|
+
declare const TableHeader: ({ columns, isCheckbox, visibleColumns, handleSort, headerRefs, columnWidths, columnsSort, headerBgColor, headerTextColor, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, checked, isLoading, isContent, isLink, onColumnSearch, columnFilters, isActionFreeze, }: TableHeaderPageProps) => React.JSX.Element;
|
|
4
4
|
export default TableHeader;
|
|
@@ -33,7 +33,7 @@ var pi_1 = require("react-icons/pi");
|
|
|
33
33
|
var lu_1 = require("react-icons/lu");
|
|
34
34
|
var TableHeader = function (_a) {
|
|
35
35
|
var _b;
|
|
36
|
-
var columns = _a.columns, isCheckbox = _a.isCheckbox, visibleColumns = _a.visibleColumns, handleSort = _a.handleSort, headerRefs = _a.headerRefs, columnWidths = _a.columnWidths, columnsSort = _a.columnsSort, headerBgColor = _a.headerBgColor, headerTextColor = _a.headerTextColor, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, checked = _a.checked, isLoading = _a.isLoading, isContent = _a.isContent, isLink = _a.isLink, onColumnSearch = _a.onColumnSearch, _c = _a.columnFilters, columnFilters = _c === void 0 ? {} : _c;
|
|
36
|
+
var columns = _a.columns, isCheckbox = _a.isCheckbox, visibleColumns = _a.visibleColumns, handleSort = _a.handleSort, headerRefs = _a.headerRefs, columnWidths = _a.columnWidths, columnsSort = _a.columnsSort, headerBgColor = _a.headerBgColor, headerTextColor = _a.headerTextColor, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, checked = _a.checked, isLoading = _a.isLoading, isContent = _a.isContent, isLink = _a.isLink, onColumnSearch = _a.onColumnSearch, _c = _a.columnFilters, columnFilters = _c === void 0 ? {} : _c, isActionFreeze = _a.isActionFreeze;
|
|
37
37
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
38
38
|
var _d = (0, react_2.useState)(null), openPopoverId = _d[0], setOpenPopoverId = _d[1];
|
|
39
39
|
var handleSearchChange = (0, react_2.useCallback)(function (columnId, value) {
|
|
@@ -80,10 +80,17 @@ var TableHeader = function (_a) {
|
|
|
80
80
|
}, [freezedBgColor, noBorders, theme.colors.gray]);
|
|
81
81
|
var RenderView = (0, react_2.useCallback)(function () {
|
|
82
82
|
var _a;
|
|
83
|
-
|
|
83
|
+
var BgColor = isActionFreeze ? freezedBgColor : headerBgColor;
|
|
84
|
+
return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, backgroundColor: BgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: isActionFreeze ? "sticky" : "relative", className: "columns sticky-columns", right: "0px", zIndex: 1, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
|
|
84
85
|
react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "center" },
|
|
85
86
|
react_2.default.createElement(lu_1.LuFileSymlink, { fontSize: 16 }))));
|
|
86
|
-
}, [
|
|
87
|
+
}, [
|
|
88
|
+
freezedBgColor,
|
|
89
|
+
noBorders,
|
|
90
|
+
theme.colors.gray,
|
|
91
|
+
headerBgColor,
|
|
92
|
+
isActionFreeze,
|
|
93
|
+
]);
|
|
87
94
|
var Sorting = (0, react_2.useCallback)(function (_a) {
|
|
88
95
|
var _b;
|
|
89
96
|
var isSorting = _a.isSorting, header = _a.header;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableProps } from "./TableProps";
|
|
3
|
-
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagintaion, onRowClick, selections, }: TableProps): React.JSX.Element;
|
|
3
|
+
export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagintaion, onRowClick, selections, isActionFreeze, }: TableProps): React.JSX.Element;
|
|
@@ -58,23 +58,23 @@ var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
|
58
58
|
var defaultPageSize = 5;
|
|
59
59
|
function Table(_a) {
|
|
60
60
|
var _b;
|
|
61
|
-
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _c = _a.isCheckbox, isCheckbox = _c === void 0 ? false : _c, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _d = _a.noBorders, noBorders = _d === void 0 ? false : _d, _e = _a.isPagintaion, isPagintaion = _e === void 0 ? true : _e, onRowClick = _a.onRowClick, selections = _a.selections;
|
|
61
|
+
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _c = _a.isCheckbox, isCheckbox = _c === void 0 ? false : _c, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _d = _a.noBorders, noBorders = _d === void 0 ? false : _d, _e = _a.isPagintaion, isPagintaion = _e === void 0 ? true : _e, onRowClick = _a.onRowClick, selections = _a.selections, _f = _a.isActionFreeze, isActionFreeze = _f === void 0 ? true : _f;
|
|
62
62
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
63
|
-
var
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var
|
|
63
|
+
var _g = (0, react_4.useState)(selections !== null && selections !== void 0 ? selections : []), selection = _g[0], setSelection = _g[1];
|
|
64
|
+
var _h = (0, react_4.useState)(0), currentPage = _h[0], setCurrentPage = _h[1];
|
|
65
|
+
var _j = (0, react_4.useState)(defaultPageSize), rowsPerPage = _j[0], setRowsPerPage = _j[1];
|
|
66
|
+
var _k = (0, react_4.useState)({}), columnFilters = _k[0], setColumnFilters = _k[1];
|
|
67
|
+
var _l = (0, react_4.useState)(data), filteredData = _l[0], setFilteredData = _l[1];
|
|
68
68
|
(0, react_1.useEffect)(function () {
|
|
69
69
|
setSelection(selections !== null && selections !== void 0 ? selections : []);
|
|
70
70
|
}, [selections]);
|
|
71
|
-
var
|
|
71
|
+
var _m = (0, react_4.useState)(columns.reduce(function (acc, curr) {
|
|
72
72
|
var _a;
|
|
73
73
|
return (__assign(__assign({}, acc), (_a = {}, _a[curr.label] = true, _a)));
|
|
74
|
-
}, {})), visibleColumns =
|
|
75
|
-
var
|
|
74
|
+
}, {})), visibleColumns = _m[0], setVisibleColumns = _m[1];
|
|
75
|
+
var _o = (0, react_4.useState)([]), columnWidths = _o[0], setColumnWidths = _o[1];
|
|
76
76
|
var headerRefs = (0, react_1.useRef)([]);
|
|
77
|
-
var
|
|
77
|
+
var _p = (0, react_4.useState)([]), columnsSort = _p[0], setColumnsSort = _p[1];
|
|
78
78
|
(0, react_1.useEffect)(function () {
|
|
79
79
|
// Measure widths after the component mounts
|
|
80
80
|
var widths = headerRefs.current.map(function (ref) { return (ref === null || ref === void 0 ? void 0 : ref.offsetWidth) || 0; });
|
|
@@ -103,24 +103,24 @@ function Table(_a) {
|
|
|
103
103
|
setColumnsSort(newSortState);
|
|
104
104
|
}, [columnsSort]);
|
|
105
105
|
var handleCheckbox = function (id) {
|
|
106
|
+
var selectedItems = [];
|
|
106
107
|
if (id === 0) {
|
|
107
108
|
if (selection.length === data.length) {
|
|
108
|
-
|
|
109
|
+
selectedItems = [];
|
|
109
110
|
}
|
|
110
111
|
else {
|
|
111
|
-
|
|
112
|
+
selectedItems = data.map(function (item) { return item.id; });
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
else if (selection.includes(id)) {
|
|
115
|
-
|
|
116
|
+
selectedItems = selection.filter(function (item) { return item !== id; });
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
118
|
-
|
|
119
|
+
selectedItems = __spreadArray(__spreadArray([], selection, true), [id], false);
|
|
119
120
|
}
|
|
121
|
+
setSelection(selectedItems);
|
|
122
|
+
onSelection && onSelection(selectedItems);
|
|
120
123
|
};
|
|
121
|
-
(0, react_1.useEffect)(function () {
|
|
122
|
-
onSelection && onSelection(selection);
|
|
123
|
-
}, [selection, onSelection]);
|
|
124
124
|
var pages = isPagintaion ? Math.ceil(data.length / rowsPerPage) : 0;
|
|
125
125
|
var startRow = !isPagintaion ? 0 : currentPage * rowsPerPage;
|
|
126
126
|
var endRow = !isPagintaion ? data.length : startRow + rowsPerPage;
|
|
@@ -153,19 +153,19 @@ function Table(_a) {
|
|
|
153
153
|
setFilteredData(filtered);
|
|
154
154
|
};
|
|
155
155
|
var isContent = (0, react_1.useMemo)(function () { return data.some(function (o) { return o.content; }); }, [data]);
|
|
156
|
-
var isLink = (0, react_1.useMemo)(function () { return data.some(function (o) { return o.onLink; }); }, [data]);
|
|
156
|
+
var isLink = (0, react_1.useMemo)(function () { return data.some(function (o) { return o.onLink || o.onDelete || o.onEdit; }); }, [data]);
|
|
157
157
|
var RenderTable = function (_a) {
|
|
158
158
|
var _b, _c, _d;
|
|
159
159
|
var columns = _a.columns;
|
|
160
160
|
return (react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", overflowX: "scroll", minW: "100%", className: "sticky-columns" },
|
|
161
|
-
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex:
|
|
161
|
+
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 2 },
|
|
162
162
|
react_1.default.createElement(TableHeader_1.default, { columns: columns, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], visibleColumns: visibleColumns, handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isLoading, checked: data.length !== 0 && selection.length === data.length
|
|
163
163
|
? true
|
|
164
164
|
: selection.length === 0
|
|
165
165
|
? false
|
|
166
|
-
: "indeterminate", isContent: isContent, isLink: isLink, onColumnSearch: handleColumnSearch, columnFilters: columnFilters })),
|
|
166
|
+
: "indeterminate", isContent: isContent, isLink: isLink, onColumnSearch: handleColumnSearch, columnFilters: columnFilters, isActionFreeze: isActionFreeze })),
|
|
167
167
|
react_1.default.createElement(react_3.Tbody, null,
|
|
168
|
-
react_1.default.createElement(TableBody_1.default, { data: filteredData, columns: columns, startRow: startRow, endRow: endRow, visibleColumns: visibleColumns, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isLoading, onRowClick: onRowClick, isContent: isContent, isLink: isLink }))));
|
|
168
|
+
react_1.default.createElement(TableBody_1.default, { data: filteredData, columns: columns, startRow: startRow, endRow: endRow, visibleColumns: visibleColumns, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isLoading, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze }))));
|
|
169
169
|
};
|
|
170
170
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
171
171
|
react_1.default.createElement(react_2.TableContainer, { sx: {
|
|
@@ -18,6 +18,7 @@ export type TableProps = {
|
|
|
18
18
|
isPagintaion?: boolean;
|
|
19
19
|
selections?: (string | number)[];
|
|
20
20
|
onRowClick?: (row: DataObject, header: Record<string | number, string | number>) => void;
|
|
21
|
+
isActionFreeze?: boolean;
|
|
21
22
|
};
|
|
22
23
|
export type DataObject = {
|
|
23
24
|
[key: string]: string | number | any;
|
|
@@ -38,7 +39,7 @@ export type ColumnSortingProps = {
|
|
|
38
39
|
column: string | number;
|
|
39
40
|
direction: "asc" | "desc" | "none";
|
|
40
41
|
};
|
|
41
|
-
export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading"> & {
|
|
42
|
+
export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "isActionFreeze"> & {
|
|
42
43
|
visibleColumns: Record<string, boolean>;
|
|
43
44
|
handleSort: (label: string | number, type: "asc" | "desc" | "none") => void;
|
|
44
45
|
activeHeader?: string | null;
|
|
@@ -56,7 +57,7 @@ export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "
|
|
|
56
57
|
onColumnSearch?: (columnId: string, searchValue: string) => void;
|
|
57
58
|
columnFilters?: Record<string, string>;
|
|
58
59
|
};
|
|
59
|
-
export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "data" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "onRowClick"> & {
|
|
60
|
+
export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "data" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "onRowClick" | "isActionFreeze"> & {
|
|
60
61
|
visibleColumns: Record<string, boolean>;
|
|
61
62
|
startRow: number;
|
|
62
63
|
endRow: number;
|