pixelize-design-library 2.1.63 → 2.1.65
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/KanbanBoard/AccountCard.d.ts +3 -1
- package/dist/Components/KanbanBoard/AccountCard.js +15 -10
- package/dist/Components/KanbanBoard/KanbanBoard.d.ts +1 -1
- package/dist/Components/KanbanBoard/KanbanBoard.js +96 -29
- package/dist/Components/KanbanBoard/KanbanBoardProps.d.ts +1 -0
- package/dist/Components/SearchSelect/SearchSelect.js +12 -12
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +10 -6
- package/dist/Components/Table/TableProps.d.ts +1 -0
- package/dist/Components/Table/TableSettings/ManageColumns.js +26 -21
- package/dist/Pages/kanbanboard.js +54 -114
- package/dist/Pages/searchSelect.js +37 -2
- package/dist/Pages/table.js +1 -1
- package/dist/index.d.mts +1468 -0
- package/dist/index.mjs +263 -0
- package/package.json +1 -1
- package/dist/Components/KaTable/CustomHeader.d.ts +0 -14
- package/dist/Components/KaTable/CustomHeader.js +0 -69
- package/dist/Components/KaTable/KaTable.d.ts +0 -13
- package/dist/Components/KaTable/KaTable.js +0 -111
- package/dist/Components/KaTable/KaTableProps.d.ts +0 -23
- package/dist/Components/KaTable/KaTableProps.js +0 -2
- package/dist/Components/KaTable/SelectionCell.d.ts +0 -8
- package/dist/Components/KaTable/SelectionCell.js +0 -38
- package/dist/Components/KaTable/SelectionHeader.d.ts +0 -3
- package/dist/Components/KaTable/SelectionHeader.js +0 -56
- package/dist/Components/KaTable/ka-table.css +0 -27
- package/dist/Components/KaTable/useMergedChildComponents.d.ts +0 -14
- package/dist/Components/KaTable/useMergedChildComponents.js +0 -224
- package/dist/Components/Table/Table.css +0 -16
- package/dist/Pages/KaTableExample.d.ts +0 -3
- package/dist/Pages/KaTableExample.js +0 -259
- package/dist/Theme/Default/fonts.d.ts +0 -35
- package/dist/Theme/Default/fonts.js +0 -37
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Account, KanbanBoardProps } from "./KanbanBoardProps";
|
|
3
|
-
declare const AccountCard: ({ account, index, onDelete, onOpen, }: {
|
|
3
|
+
declare const AccountCard: ({ account, index, onDelete, onOpen, isExpanded, onToggleExpand, }: {
|
|
4
4
|
account: Account;
|
|
5
5
|
index: number;
|
|
6
6
|
onDelete: KanbanBoardProps['onDelete'];
|
|
7
7
|
onOpen: KanbanBoardProps['onOpen'];
|
|
8
|
+
isExpanded?: boolean | undefined;
|
|
9
|
+
onToggleExpand?: (() => void) | undefined;
|
|
8
10
|
}) => React.JSX.Element;
|
|
9
11
|
export default AccountCard;
|
|
@@ -45,30 +45,35 @@ var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
|
45
45
|
var AccountRow_1 = __importDefault(require("./AccountRow"));
|
|
46
46
|
var excludeKeys = ["id", "details"];
|
|
47
47
|
var AccountCard = function (_a) {
|
|
48
|
-
var account = _a.account, index = _a.index, onDelete = _a.onDelete, onOpen = _a.onOpen;
|
|
48
|
+
var account = _a.account, index = _a.index, onDelete = _a.onDelete, onOpen = _a.onOpen, _b = _a.isExpanded, isExpanded = _b === void 0 ? false : _b, onToggleExpand = _a.onToggleExpand;
|
|
49
49
|
var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
|
|
50
|
-
var
|
|
50
|
+
var _c = (0, react_1.useState)(false), showMore = _c[0], setShowMore = _c[1];
|
|
51
51
|
var keys = Object.keys(account).filter(function (key) { return typeof account[key] === "string" && !excludeKeys.includes(key); });
|
|
52
|
-
var visibleKeys =
|
|
52
|
+
var visibleKeys = isExpanded ? keys : keys.slice(0, 4);
|
|
53
|
+
// Handle the show more/less toggle
|
|
54
|
+
var handleToggle = function () {
|
|
55
|
+
setShowMore(!showMore);
|
|
56
|
+
onToggleExpand === null || onToggleExpand === void 0 ? void 0 : onToggleExpand();
|
|
57
|
+
};
|
|
53
58
|
return (react_1.default.createElement(dnd_1.Draggable, { draggableId: account.id.toString(), index: index }, function (provided) {
|
|
54
59
|
var _a, _b, _c, _d, _e, _f;
|
|
55
|
-
return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { width: "16.5rem", borderRadius: "0.25rem", borderWidth: "0.063rem", background: (_a = colors === null || colors === void 0 ? void 0 : colors.background) === null || _a === void 0 ? void 0 : _a[500], border: "0.1rem solid ".concat((_b = colors.gray) === null || _b === void 0 ? void 0 : _b[200]), p: 2, mt: 3 }),
|
|
60
|
+
return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { width: "16.5rem", borderRadius: "0.25rem", borderWidth: "0.063rem", background: (_a = colors === null || colors === void 0 ? void 0 : colors.background) === null || _a === void 0 ? void 0 : _a[500], border: "0.1rem solid ".concat((_b = colors.gray) === null || _b === void 0 ? void 0 : _b[200]), p: 2, mt: 3, minHeight: isExpanded ? "180px" : "100px" }),
|
|
56
61
|
react_1.default.createElement(react_2.VStack, { align: "start", spacing: 2, fontSize: "0.875rem", color: (_c = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _c === void 0 ? void 0 : _c[700], overflow: "none" },
|
|
57
62
|
visibleKeys.map(function (key) { return (react_1.default.createElement(AccountRow_1.default, { key: key, label: key.replace(/\b\w/g, function (c) { return c.toUpperCase(); }), value: account[key] })); }),
|
|
58
|
-
react_1.default.createElement(react_2.Collapse, { in:
|
|
63
|
+
react_1.default.createElement(react_2.Collapse, { in: isExpanded && account.details !== undefined, animateOpacity: true },
|
|
59
64
|
react_1.default.createElement(react_2.Text, { pt: 2 }, account.details)),
|
|
60
65
|
keys.length > 4 && (react_1.default.createElement(react_2.Flex, { justify: "space-between", w: "full", pt: 2, alignItems: "center" },
|
|
61
|
-
react_1.default.createElement(react_2.Text, { color: (_d = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _d === void 0 ? void 0 : _d[500], fontSize: "sm", fontWeight: "medium", cursor: "pointer", onClick:
|
|
66
|
+
react_1.default.createElement(react_2.Text, { color: (_d = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _d === void 0 ? void 0 : _d[500], fontSize: "sm", fontWeight: "medium", cursor: "pointer", onClick: handleToggle, display: "flex", alignItems: "center", gap: 2 },
|
|
62
67
|
"Show ",
|
|
63
|
-
|
|
68
|
+
isExpanded ? "less" : "more",
|
|
64
69
|
" ",
|
|
65
|
-
|
|
70
|
+
isExpanded ? (react_1.default.createElement(lucide_react_1.ChevronUp, { size: 14 })) : (react_1.default.createElement(lucide_react_1.ChevronDown, { size: 14 }))),
|
|
66
71
|
react_1.default.createElement(react_2.Spacer, null),
|
|
67
72
|
react_1.default.createElement(react_2.HStack, { spacing: 2 },
|
|
68
73
|
react_1.default.createElement(react_2.Tooltip, { label: "Delete" },
|
|
69
|
-
react_1.default.createElement(lucide_react_1.Trash2, { size: 16, color: (_e = colors === null || colors === void 0 ? void 0 : colors.red) === null || _e === void 0 ? void 0 : _e[600], onClick: function () { return onDelete === null || onDelete === void 0 ? void 0 : onDelete(account); } })),
|
|
74
|
+
react_1.default.createElement(lucide_react_1.Trash2, { size: 16, color: (_e = colors === null || colors === void 0 ? void 0 : colors.red) === null || _e === void 0 ? void 0 : _e[600], onClick: function () { return onDelete === null || onDelete === void 0 ? void 0 : onDelete(account); }, cursor: "pointer" })),
|
|
70
75
|
react_1.default.createElement(react_2.Tooltip, { label: "Open" },
|
|
71
|
-
react_1.default.createElement(lucide_react_1.ExternalLink, { size: 16, color: (_f = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _f === void 0 ? void 0 : _f[600], onClick: function () { return onOpen === null || onOpen === void 0 ? void 0 : onOpen(account); } }))))))));
|
|
76
|
+
react_1.default.createElement(lucide_react_1.ExternalLink, { size: 16, color: (_f = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _f === void 0 ? void 0 : _f[600], onClick: function () { return onOpen === null || onOpen === void 0 ? void 0 : onOpen(account); }, cursor: "pointer" }))))))));
|
|
72
77
|
}));
|
|
73
78
|
};
|
|
74
79
|
exports.default = AccountCard;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { KanbanBoardProps } from "./KanbanBoardProps";
|
|
3
|
-
declare const KanbanBoard: ({ data, onDrag, onDelete, onOpen, onColumnDelete, isLoading, kanbanSelect, kanbanEdit, kanbanCreate }: KanbanBoardProps) => React.JSX.Element;
|
|
3
|
+
declare const KanbanBoard: ({ data, onDrag, onDelete, onOpen, onColumnDelete, isLoading, kanbanSelect, kanbanEdit, kanbanCreate, virtualization, }: KanbanBoardProps) => React.JSX.Element;
|
|
4
4
|
export default KanbanBoard;
|
|
@@ -50,14 +50,59 @@ var react_1 = __importStar(require("react"));
|
|
|
50
50
|
var react_2 = require("@chakra-ui/react");
|
|
51
51
|
var dnd_1 = require("@hello-pangea/dnd");
|
|
52
52
|
var lucide_react_1 = require("lucide-react");
|
|
53
|
+
var react_window_1 = require("react-window");
|
|
53
54
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
54
55
|
var AccountCard_1 = __importDefault(require("./AccountCard"));
|
|
55
56
|
var HeaderActions_1 = __importDefault(require("../Header/HeaderActions"));
|
|
57
|
+
// base row height and expanded height
|
|
58
|
+
var BASE_ROW_HEIGHT = 180;
|
|
59
|
+
var EXPANDED_ROW_HEIGHT = 280;
|
|
56
60
|
var KanbanBoard = function (_a) {
|
|
57
|
-
var _b
|
|
58
|
-
var data = _a.data, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete,
|
|
61
|
+
var _b;
|
|
62
|
+
var data = _a.data, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete, _c = _a.isLoading, isLoading = _c === void 0 ? false : _c, kanbanSelect = _a.kanbanSelect, kanbanEdit = _a.kanbanEdit, kanbanCreate = _a.kanbanCreate, virtualization = _a.virtualization;
|
|
59
63
|
var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
|
|
60
|
-
var
|
|
64
|
+
var _d = (0, react_1.useState)(data), columns = _d[0], setColumns = _d[1];
|
|
65
|
+
var _e = (0, react_1.useState)(600), containerHeight = _e[0], setContainerHeight = _e[1];
|
|
66
|
+
// Responsive column width
|
|
67
|
+
var columnWidth = (0, react_2.useBreakpointValue)({
|
|
68
|
+
base: "16rem",
|
|
69
|
+
md: "17.5rem",
|
|
70
|
+
lg: "19rem",
|
|
71
|
+
});
|
|
72
|
+
// store expanded row heights (id → boolean)
|
|
73
|
+
var _f = (0, react_1.useState)({}), expanded = _f[0], setExpanded = _f[1];
|
|
74
|
+
// ref for VariableSizeList
|
|
75
|
+
var listRefs = (0, react_1.useRef)({});
|
|
76
|
+
var containerRef = (0, react_1.useRef)(null);
|
|
77
|
+
// Calculate container height based on available space
|
|
78
|
+
(0, react_1.useEffect)(function () {
|
|
79
|
+
var calculateHeight = function () {
|
|
80
|
+
var _a;
|
|
81
|
+
if (containerRef.current) {
|
|
82
|
+
var headerHeight = ((_a = document.querySelector('header')) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
|
|
83
|
+
var availableHeight = window.innerHeight - headerHeight - 100; // Adjust for padding/margins
|
|
84
|
+
setContainerHeight(Math.max(500, availableHeight));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
calculateHeight();
|
|
88
|
+
window.addEventListener('resize', calculateHeight);
|
|
89
|
+
return function () {
|
|
90
|
+
window.removeEventListener('resize', calculateHeight);
|
|
91
|
+
};
|
|
92
|
+
}, []);
|
|
93
|
+
// toggle expand/collapse
|
|
94
|
+
var toggleExpand = function (id, colId, index) {
|
|
95
|
+
setExpanded(function (prev) {
|
|
96
|
+
var _a;
|
|
97
|
+
var newExpanded = __assign(__assign({}, prev), (_a = {}, _a[id] = !prev[id], _a));
|
|
98
|
+
// tell react-window to recompute sizes
|
|
99
|
+
if (listRefs.current[colId]) {
|
|
100
|
+
listRefs.current[colId].resetAfterIndex(index);
|
|
101
|
+
}
|
|
102
|
+
return newExpanded;
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
// ✅ drag end handler
|
|
61
106
|
var onDragEnd = function (result) {
|
|
62
107
|
var _a, _b;
|
|
63
108
|
var source = result.source, destination = result.destination;
|
|
@@ -72,16 +117,14 @@ var KanbanBoard = function (_a) {
|
|
|
72
117
|
var copiedItems = __spreadArray([], sourceCol.items, true);
|
|
73
118
|
copiedItems.splice(source.index, 1);
|
|
74
119
|
copiedItems.splice(destination.index, 0, draggedItem);
|
|
75
|
-
|
|
76
|
-
setColumns(newCol);
|
|
120
|
+
setColumns(__assign(__assign({}, columns), (_a = {}, _a[source.droppableId] = __assign(__assign({}, sourceCol), { items: copiedItems }), _a)));
|
|
77
121
|
}
|
|
78
122
|
else {
|
|
79
123
|
var sourceItems = __spreadArray([], sourceCol.items, true);
|
|
80
124
|
var destItems = __spreadArray([], destCol.items, true);
|
|
81
125
|
sourceItems.splice(source.index, 1);
|
|
82
126
|
destItems.splice(destination.index, 0, draggedItem);
|
|
83
|
-
|
|
84
|
-
setColumns(updatedCols);
|
|
127
|
+
setColumns(__assign(__assign({}, columns), (_b = {}, _b[source.droppableId] = __assign(__assign({}, sourceCol), { items: sourceItems }), _b[destination.droppableId] = __assign(__assign({}, destCol), { items: destItems }), _b)));
|
|
85
128
|
onDrag === null || onDrag === void 0 ? void 0 : onDrag({
|
|
86
129
|
from: source.droppableId,
|
|
87
130
|
to: destination.droppableId,
|
|
@@ -94,30 +137,54 @@ var KanbanBoard = function (_a) {
|
|
|
94
137
|
var columnIds = ((_b = (_a = columns[colId]) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (item) { return item.id; })) || [];
|
|
95
138
|
onColumnDelete === null || onColumnDelete === void 0 ? void 0 : onColumnDelete(columnIds);
|
|
96
139
|
};
|
|
140
|
+
// ✅ row renderer for react-window
|
|
141
|
+
var Row = function (_a) {
|
|
142
|
+
var index = _a.index, style = _a.style, data = _a.data;
|
|
143
|
+
var items = data.items, colId = data.colId;
|
|
144
|
+
var account = items[index];
|
|
145
|
+
return (react_1.default.createElement("div", { style: style },
|
|
146
|
+
react_1.default.createElement(dnd_1.Draggable, { draggableId: account.id.toString(), index: index, key: account.id }, function (provided) { return (react_1.default.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }),
|
|
147
|
+
react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen, isExpanded: expanded[account.id], onToggleExpand: function () { return toggleExpand(account.id, colId, index); } }))); })));
|
|
148
|
+
};
|
|
149
|
+
// ✅ dynamic row size calculator
|
|
150
|
+
var getItemSize = (0, react_1.useCallback)(function (index, items) {
|
|
151
|
+
var account = items[index];
|
|
152
|
+
return expanded[account.id] ? EXPANDED_ROW_HEIGHT : BASE_ROW_HEIGHT;
|
|
153
|
+
}, [expanded]);
|
|
97
154
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
98
155
|
react_1.default.createElement(HeaderActions_1.default, { select: kanbanSelect, edit: kanbanEdit, create: kanbanCreate }),
|
|
99
156
|
react_1.default.createElement(dnd_1.DragDropContext, { onDragEnd: onDragEnd },
|
|
100
|
-
react_1.default.createElement(react_2.Flex, { gap: 4, p: 4, mt: 2, bg: (_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200], minH: "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
react_1.default.createElement(react_2.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var
|
|
109
|
-
return (react_1.default.createElement(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
157
|
+
react_1.default.createElement(react_2.Flex, { ref: containerRef, gap: 4, p: 4, mt: 2, bg: (_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200], minH: "".concat(containerHeight, "px"), overflowX: "auto", maxWidth: "100vw" }, isLoading
|
|
158
|
+
? Array.from({ length: 5 }).map(function (_, idx) {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
return (react_1.default.createElement(react_2.Box, { key: idx, width: columnWidth, p: 4, borderRadius: "0.5rem", bg: (_a = colors === null || colors === void 0 ? void 0 : colors.background) === null || _a === void 0 ? void 0 : _a[100], border: "0.125rem solid ".concat((_b = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _b === void 0 ? void 0 : _b[200]), flexShrink: 0 },
|
|
161
|
+
react_1.default.createElement(react_2.Skeleton, { height: "2.75rem", mb: 4, borderRadius: "0.25rem" }),
|
|
162
|
+
react_1.default.createElement(react_2.SkeletonText, { mt: "4", noOfLines: 5, spacing: "4" })));
|
|
163
|
+
})
|
|
164
|
+
: Object.entries(columns).map(function (_a) {
|
|
165
|
+
var colId = _a[0], column = _a[1];
|
|
166
|
+
return (react_1.default.createElement(dnd_1.Droppable, { droppableId: colId, key: colId, mode: virtualization ? "virtual" : "standard", renderClone: function (provided, snapshot, rubric) {
|
|
167
|
+
var item = column.items[rubric.source.index];
|
|
168
|
+
return (react_1.default.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }),
|
|
169
|
+
react_1.default.createElement(AccountCard_1.default, { key: item.id, account: item, index: rubric.source.index, onDelete: onDelete, onOpen: onOpen, isExpanded: expanded[item.id], onToggleExpand: function () { return toggleExpand(item.id, colId, rubric.source.index); } })));
|
|
170
|
+
} }, function (provided, snapshot) {
|
|
171
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
172
|
+
return (react_1.default.createElement(react_2.Box, __assign({ ref: provided.innerRef }, provided.droppableProps, { width: columnWidth, borderRadius: "0.5rem", borderWidth: "0.063rem", background: snapshot.isDraggingOver
|
|
173
|
+
? (_a = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _a === void 0 ? void 0 : _a[50]
|
|
174
|
+
: (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[100], border: "".concat(snapshot.isDraggingOver
|
|
175
|
+
? "0.5px dashed " + ((_c = colors === null || colors === void 0 ? void 0 : colors.blue) === null || _c === void 0 ? void 0 : _c[500])
|
|
176
|
+
: "0.125rem solid " + ((_d = colors.gray) === null || _d === void 0 ? void 0 : _d[200])), display: "flex", flexDirection: "column", flexShrink: 0, overflow: "hidden", height: "".concat(containerHeight, "px") }),
|
|
177
|
+
react_1.default.createElement(react_2.Flex, { width: "100%", height: "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (_e = column.color) !== null && _e !== void 0 ? _e : (_f = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _f === void 0 ? void 0 : _f[500], background: (_g = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _g === void 0 ? void 0 : _g[100], align: "center", px: 3, flexShrink: 0, justifyContent: "space-between" },
|
|
178
|
+
react_1.default.createElement(react_2.Text, { fontWeight: "600", fontSize: "1rem", color: (_h = colors === null || colors === void 0 ? void 0 : colors.text) === null || _h === void 0 ? void 0 : _h[700] }, column.title),
|
|
179
|
+
react_1.default.createElement(react_2.Box, { as: lucide_react_1.Trash2, size: 16, cursor: "pointer", color: (_j = colors === null || colors === void 0 ? void 0 : colors.text) === null || _j === void 0 ? void 0 : _j[600], _hover: { color: (_k = colors === null || colors === void 0 ? void 0 : colors.red) === null || _k === void 0 ? void 0 : _k[600] }, onClick: function () { return handleColumnDelete(colId); } })),
|
|
180
|
+
react_1.default.createElement(react_2.Box, { px: 2, pb: 2, flex: "1", overflow: "auto", width: "100%" },
|
|
181
|
+
virtualization ? (react_1.default.createElement(react_window_1.VariableSizeList, { ref: function (el) {
|
|
182
|
+
if (el)
|
|
183
|
+
listRefs.current[colId] = el;
|
|
184
|
+
}, height: containerHeight - 100, itemCount: column.items.length, itemSize: function (index) { return getItemSize(index, column.items); }, width: "100%", itemData: { items: column.items, colId: colId } }, Row)) : (react_1.default.createElement(react_2.Box, { height: "100%", overflow: "auto" }, column.items.map(function (account, index) { return (react_1.default.createElement(dnd_1.Draggable, { draggableId: account.id.toString(), index: index, key: account.id }, function (provided) { return (react_1.default.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }),
|
|
185
|
+
react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen, isExpanded: expanded[account.id], onToggleExpand: function () { return toggleExpand(account.id, colId, index); } }))); })); }))),
|
|
186
|
+
provided.placeholder)));
|
|
187
|
+
}));
|
|
188
|
+
})))));
|
|
122
189
|
};
|
|
123
190
|
exports.default = KanbanBoard;
|
|
@@ -69,18 +69,18 @@ var normalizeMultiValue = function (val) {
|
|
|
69
69
|
return [];
|
|
70
70
|
};
|
|
71
71
|
var SearchSelect = function (_a) {
|
|
72
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
73
|
-
var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch,
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
72
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
73
|
+
var id = _a.id, label = _a.label, options = _a.options, onSelect = _a.onSelect, onSearch = _a.onSearch, _k = _a.isOptionLoading, isOptionLoading = _k === void 0 ? false : _k, _l = _a.isLoading, isLoading = _l === void 0 ? false : _l, _m = _a.loadingText, loadingText = _m === void 0 ? 'Loading...' : _m, _o = _a.placeholder, placeholder = _o === void 0 ? 'Select' : _o, value = _a.value, _p = _a.searchQuery, searchQuery = _p === void 0 ? '' : _p, _q = _a.isMultiple, isMultiple = _q === void 0 ? false : _q, _r = _a.isRequired, isRequired = _r === void 0 ? false : _r, _s = _a.error, error = _s === void 0 ? false : _s, errorMessage = _a.errorMessage, helperText = _a.helperText, _t = _a.width, width = _t === void 0 ? '100%' : _t, _u = _a.height, height = _u === void 0 ? "2.75rem" : _u, _v = _a.size, size = _v === void 0 ? 'md' : _v, chip = _a.chip, information = _a.information, rightIcon = _a.rightIcon, addNew = _a.addNew, _w = _a.isSelectAll, isSelectAll = _w === void 0 ? false : _w, pagination = _a.pagination, insideSelect = _a.insideSelect, isRemoveAllIcon = _a.isRemoveAllIcon;
|
|
74
|
+
var _x = (0, react_1.useState)(searchQuery), inputValue = _x[0], setInputValue = _x[1];
|
|
75
|
+
var _y = (0, react_1.useState)(false), isOpen = _y[0], setIsOpen = _y[1];
|
|
76
|
+
var _z = (0, react_1.useState)(true), hasMore = _z[0], setHasMore = _z[1];
|
|
77
77
|
var inputRef = (0, react_1.useRef)(null);
|
|
78
78
|
var containerRef = (0, react_1.useRef)(null);
|
|
79
79
|
var scrollTimeoutRef = (0, react_1.useRef)(null);
|
|
80
|
-
var
|
|
81
|
-
var
|
|
80
|
+
var _0 = (0, react_1.useState)(false), focused = _0[0], setFocused = _0[1];
|
|
81
|
+
var _1 = (0, react_1.useState)(false), customSelectOpen = _1[0], setCustomSelectOpen = _1[1];
|
|
82
82
|
var customSelectRef = (0, react_1.useRef)(null);
|
|
83
|
-
var
|
|
83
|
+
var _2 = (0, react_1.useState)({ top: 0, left: 0, width: 0 }), customSelectPos = _2[0], setCustomSelectPos = _2[1];
|
|
84
84
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
85
85
|
(0, react_2.useOutsideClick)({
|
|
86
86
|
ref: containerRef,
|
|
@@ -203,13 +203,13 @@ var SearchSelect = function (_a) {
|
|
|
203
203
|
return (react_1.default.createElement(react_2.Box, { ref: containerRef, width: width, position: "relative" },
|
|
204
204
|
label && (react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isRequired: isRequired, isInformation: information === null || information === void 0 ? void 0 : information.isInformation, informationMessage: information === null || information === void 0 ? void 0 : information.informationMessage })),
|
|
205
205
|
react_1.default.createElement(react_2.InputGroup, { size: size },
|
|
206
|
-
react_1.default.createElement(react_2.Box, { as: "div", w: "100%", minH: "2.85rem", px: 3, display: "flex", alignItems: "center", flexWrap: "wrap", gap: "0.375rem", border: "0.063rem solid", borderColor: error ? theme.colors.semantic.error[500] : focused ? theme.colors.primary[500] : (_b = theme.colors.boxborder) === null || _b === void 0 ? void 0 : _b[500], borderRadius: "0.25rem", bg: (_c = theme.colors.gray) === null || _c === void 0 ? void 0 : _c[50], boxShadow: focused ? error ? "0 0 0 0.125rem ".concat((_d = theme.colors.boxShadow) === null || _d === void 0 ? void 0 : _d.error) : "0 0 0 0.125rem ".concat((_e = theme.colors.boxShadow) === null || _e === void 0 ? void 0 : _e.primary) : 'none', transition: "box-shadow 0.2s, border-color 0.2s" },
|
|
206
|
+
react_1.default.createElement(react_2.Box, { as: "div", w: "100%", minH: "2.85rem", px: 3, display: "flex", alignItems: "center", flexWrap: "wrap", gap: "0.375rem", border: "0.063rem solid", borderColor: error ? theme.colors.semantic.error[500] : focused ? theme.colors.primary[500] : (_b = theme.colors.boxborder) === null || _b === void 0 ? void 0 : _b[500], borderRadius: "0.25rem", bg: (_c = theme.colors.gray) === null || _c === void 0 ? void 0 : _c[50], boxShadow: focused ? error ? "0 0 0 0.125rem ".concat((_d = theme.colors.boxShadow) === null || _d === void 0 ? void 0 : _d.error) : "0 0 0 0.125rem ".concat((_e = theme.colors.boxShadow) === null || _e === void 0 ? void 0 : _e.primary) : error ? "0 0 0 0.125rem ".concat((_f = theme.colors.boxShadow) === null || _f === void 0 ? void 0 : _f.error) : 'none', transition: "box-shadow 0.2s, border-color 0.2s" },
|
|
207
207
|
insideSelect && (react_1.default.createElement(react_2.Box, { position: "relative", ref: customSelectRef, backgroundColor: theme.colors.gray[200], ml: "-0.75rem", h: "-webkit-fill-available", borderRadius: "0.25rem 0 0 0.25rem", onClick: function () { return setCustomSelectOpen(function (prev) { return !prev; }); } },
|
|
208
208
|
react_1.default.createElement(react_2.Box, { minW: "5rem", cursor: "pointer", display: "flex", justifyContent: "space-between", alignItems: "center", width: insideSelect.width, height: height, pl: "0.5rem", pr: "0.5rem" },
|
|
209
|
-
react_1.default.createElement(SelectTruncatedLabel_1.default, { label: (
|
|
209
|
+
react_1.default.createElement(SelectTruncatedLabel_1.default, { label: (_h = (_g = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.value) === null || _g === void 0 ? void 0 : _g.label) !== null && _h !== void 0 ? _h : "", maxWidth: (insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.width) || "6rem" }),
|
|
210
210
|
customSelectOpen ? react_1.default.createElement(lucide_react_1.ChevronUp, { size: 16 }) : react_1.default.createElement(lucide_react_1.ChevronDown, { size: 16 })),
|
|
211
211
|
customSelectOpen && (react_1.default.createElement(react_2.Portal, null,
|
|
212
|
-
react_1.default.createElement(react_2.Box, { id: "custom-select-portal", position: "absolute", top: "".concat(customSelectPos.top, "px"), left: "".concat(customSelectPos.left, "px"), zIndex: 1400, bg: theme.colors.white, border: "0.063rem solid", borderColor: theme.colors.gray[300], borderRadius: "md", boxShadow: "md", minW: "10rem", maxW: "38rem" }, (
|
|
212
|
+
react_1.default.createElement(react_2.Box, { id: "custom-select-portal", position: "absolute", top: "".concat(customSelectPos.top, "px"), left: "".concat(customSelectPos.left, "px"), zIndex: 1400, bg: theme.colors.white, border: "0.063rem solid", borderColor: theme.colors.gray[300], borderRadius: "md", boxShadow: "md", minW: "10rem", maxW: "38rem" }, (_j = insideSelect === null || insideSelect === void 0 ? void 0 : insideSelect.option) === null || _j === void 0 ? void 0 : _j.map(function (item) { return (react_1.default.createElement(react_2.Box, { key: item.id, display: "flex", alignItems: "center", height: "2.5rem", px: "0.75rem", fontSize: "sm", _hover: { bg: theme.colors.gray[100] }, cursor: "pointer", onClick: function (e) {
|
|
213
213
|
e.stopPropagation();
|
|
214
214
|
handleCustomSelect(item);
|
|
215
215
|
} }, item.label)); })))))),
|
|
@@ -225,7 +225,7 @@ var SearchSelect = function (_a) {
|
|
|
225
225
|
(isMultiple || inputValue || !selectedValues.length || !isMultiple) && (react_1.default.createElement(react_2.Input, { ref: inputRef, variant: "unstyled", flex: "1", minW: "5rem", value: inputValue, onChange: function (e) { return setInputValue(e.target.value); }, onFocus: function () {
|
|
226
226
|
setFocused(true);
|
|
227
227
|
setIsOpen(true);
|
|
228
|
-
}, onBlur: function () { return setFocused(false); }, placeholder: placeholder })),
|
|
228
|
+
}, onBlur: function () { return setFocused(false); }, placeholder: selectedValues.length ? "" : placeholder })),
|
|
229
229
|
react_1.default.createElement(react_2.Box, { ml: "auto", display: "flex", alignItems: "center", gap: 1 },
|
|
230
230
|
isRemoveAllIcon && selectedValues.length > 0 && (react_1.default.createElement(ToolTip_1.default, { placement: "top", label: "Remove All", hasArrow: true, bg: theme.colors.gray[600], color: theme.colors.white, fontSize: "0.75rem" },
|
|
231
231
|
react_1.default.createElement(react_2.IconButton, { icon: react_1.default.createElement(lucide_react_1.X, { size: 12, color: theme.colors.black }), "aria-label": "Clear all", variant: "ghost", size: "sm", onClick: handleClearAll, sx: {
|
|
@@ -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, isPagination, onRowClick, selections, isActionFreeze, preferencesUrl, preferencesKey, preferencesName, preferencesPage, authToken, paginationMode, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, headerActions, onGlobalSearch, }: TableProps): React.JSX.Element;
|
|
3
|
+
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, headerActions, onGlobalSearch, onColumnFilter }: TableProps): React.JSX.Element;
|
|
@@ -34,7 +34,6 @@ var TableHeader_1 = __importDefault(require("./Components/TableHeader"));
|
|
|
34
34
|
var TableBody_1 = __importDefault(require("./Components/TableBody"));
|
|
35
35
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
36
36
|
var useTable_1 = __importDefault(require("./Components/useTable"));
|
|
37
|
-
var table_1 = require("../../Utils/table");
|
|
38
37
|
var usePreferences_1 = require("../../Hooks/usePreferences");
|
|
39
38
|
var TableSettings_1 = __importDefault(require("./TableSettings/TableSettings"));
|
|
40
39
|
var HeaderActions_1 = __importDefault(require("./Components/HeaderActions"));
|
|
@@ -42,9 +41,14 @@ var Divider_1 = __importDefault(require("../Divider/Divider"));
|
|
|
42
41
|
var TableSearch_1 = __importDefault(require("./Components/TableSearch"));
|
|
43
42
|
function Table(_a) {
|
|
44
43
|
var _b, _c, _d, _e, _f, _g;
|
|
45
|
-
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _h = _a.isCheckbox, isCheckbox = _h === void 0 ? false : _h, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _j = _a.noBorders, noBorders = _j === void 0 ? false : _j, _k = _a.isPagination, isPagination = _k === void 0 ? true : _k, onRowClick = _a.onRowClick, selections = _a.selections, _l = _a.isActionFreeze, isActionFreeze = _l === void 0 ? true : _l, _m = _a.preferencesUrl, preferencesUrl = _m === void 0 ? "" : _m, _o = _a.preferencesKey, preferencesKey = _o === void 0 ? "" : _o, _p = _a.preferencesName, preferencesName = _p === void 0 ? "" : _p, _q = _a.preferencesPage, preferencesPage = _q === void 0 ? "" : _q, _r = _a.authToken, authToken = _r === void 0 ? "" : _r, _s = _a.paginationMode, paginationMode = _s === void 0 ? "client" : _s, _t = _a.noOfRowsPerPage, noOfRowsPerPage = _t === void 0 ? 50 : _t, _u = _a.totalRecords, totalRecords = _u === void 0 ? 0 : _u, onPagination = _a.onPagination, _v = _a.isTableSettings, isTableSettings = _v === void 0 ? false : _v, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch;
|
|
44
|
+
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _h = _a.isCheckbox, isCheckbox = _h === void 0 ? false : _h, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _j = _a.noBorders, noBorders = _j === void 0 ? false : _j, _k = _a.isPagination, isPagination = _k === void 0 ? true : _k, onRowClick = _a.onRowClick, selections = _a.selections, _l = _a.isActionFreeze, isActionFreeze = _l === void 0 ? true : _l, _m = _a.preferencesUrl, preferencesUrl = _m === void 0 ? "" : _m, _o = _a.preferencesKey, preferencesKey = _o === void 0 ? "" : _o, _p = _a.preferencesName, preferencesName = _p === void 0 ? "" : _p, _q = _a.preferencesPage, preferencesPage = _q === void 0 ? "" : _q, _r = _a.authToken, authToken = _r === void 0 ? "" : _r, _s = _a.paginationMode, paginationMode = _s === void 0 ? "client" : _s, _t = _a.noOfRowsPerPage, noOfRowsPerPage = _t === void 0 ? 50 : _t, _u = _a.totalRecords, totalRecords = _u === void 0 ? 0 : _u, onPagination = _a.onPagination, _v = _a.isTableSettings, isTableSettings = _v === void 0 ? false : _v, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onColumnFilter = _a.onColumnFilter;
|
|
46
45
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
47
46
|
var _w = (0, react_1.useState)({}), columnsSearch = _w[0], setColumnsSearch = _w[1];
|
|
47
|
+
(0, react_1.useEffect)(function () {
|
|
48
|
+
if (onColumnFilter) {
|
|
49
|
+
onColumnFilter(columnsSearch);
|
|
50
|
+
}
|
|
51
|
+
}, [columnsSearch, onColumnFilter]);
|
|
48
52
|
var isServerPagination = paginationMode === "server";
|
|
49
53
|
var _x = (0, usePreferences_1.useGetPreferences)({
|
|
50
54
|
baseUrl: preferencesUrl,
|
|
@@ -82,9 +86,9 @@ function Table(_a) {
|
|
|
82
86
|
totalRecords: totalRecords,
|
|
83
87
|
isServerPagination: isServerPagination,
|
|
84
88
|
}), tableData = _y.tableData, isContent = _y.isContent, isLink = _y.isLink, headerRefs = _y.headerRefs, columnWidths = _y.columnWidths, handleSort = _y.handleSort, handleCheckbox = _y.handleCheckbox, filteredData = _y.filteredData, startRow = _y.startRow, endRow = _y.endRow, selection = _y.selection, columnsSort = _y.columnsSort, currentPage = _y.currentPage, pages = _y.pages, rowsPerPage = _y.rowsPerPage, handlePageSizeChange = _y.handlePageSizeChange, setCurrentPage = _y.setCurrentPage, columnsList = _y.columnsList, handleColumnPreferences = _y.handleColumnPreferences;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, [columnsSearch, filteredData]);
|
|
89
|
+
// const _filteredData = useMemo(() => {
|
|
90
|
+
// return searchAndSortData(filteredData, columnsSearch);
|
|
91
|
+
// }, [columnsSearch, filteredData]);
|
|
88
92
|
(0, react_1.useEffect)(function () {
|
|
89
93
|
if (onPagination) {
|
|
90
94
|
onPagination(currentPage + 1, noOfRowsPerPage);
|
|
@@ -124,6 +128,6 @@ function Table(_a) {
|
|
|
124
128
|
? false
|
|
125
129
|
: "indeterminate", isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch })),
|
|
126
130
|
react_1.default.createElement(react_3.Tbody, null,
|
|
127
|
-
react_1.default.createElement(TableBody_1.default, { data:
|
|
131
|
+
react_1.default.createElement(TableBody_1.default, { data: filteredData, columns: columnsList, startRow: startRow, endRow: endRow, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_g = theme.colors) === null || _g === void 0 ? void 0 : _g.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze }))))));
|
|
128
132
|
}
|
|
129
133
|
exports.default = Table;
|
|
@@ -31,6 +31,7 @@ export type TableProps = {
|
|
|
31
31
|
isTableSettings?: boolean;
|
|
32
32
|
headerActions?: HeaderActionsProps;
|
|
33
33
|
onGlobalSearch?: (searchVal: string) => void;
|
|
34
|
+
onColumnFilter?: (filters: Record<string, any>) => void;
|
|
34
35
|
};
|
|
35
36
|
export type HeaderActionsProps = {
|
|
36
37
|
isDelete?: {
|
|
@@ -54,20 +54,19 @@ var lucide_react_1 = require("lucide-react");
|
|
|
54
54
|
var ManageColumns = function (_a) {
|
|
55
55
|
var columns = _a.columns, childInputMethodsRef = _a.childInputMethodsRef;
|
|
56
56
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
57
|
-
|
|
57
|
+
// ✅ keep isHidden as it is (true = hidden, false = visible)
|
|
58
|
+
var _b = (0, react_1.useState)(columns), items = _b[0], setItems = _b[1];
|
|
58
59
|
var _c = (0, react_1.useState)(""), searchTerm = _c[0], setSearchTerm = _c[1];
|
|
59
60
|
var _d = (0, react_1.useState)(null), draggedItemIndex = _d[0], setDraggedItemIndex = _d[1];
|
|
60
61
|
var _e = (0, react_1.useState)(null), error = _e[0], setError = _e[1];
|
|
61
62
|
(0, react_1.useImperativeHandle)(childInputMethodsRef, function () {
|
|
62
63
|
return {
|
|
63
64
|
getManageColumnsData: function () {
|
|
64
|
-
return items
|
|
65
|
+
return items;
|
|
65
66
|
},
|
|
66
67
|
};
|
|
67
68
|
}, [items]);
|
|
68
|
-
var handleDragStart = function (index) {
|
|
69
|
-
setDraggedItemIndex(index);
|
|
70
|
-
};
|
|
69
|
+
var handleDragStart = function (index) { return setDraggedItemIndex(index); };
|
|
71
70
|
var handleDragOver = function (e, index) {
|
|
72
71
|
e.preventDefault();
|
|
73
72
|
if (draggedItemIndex === null || draggedItemIndex === index)
|
|
@@ -79,13 +78,12 @@ var ManageColumns = function (_a) {
|
|
|
79
78
|
setDraggedItemIndex(index);
|
|
80
79
|
setItems(newItems);
|
|
81
80
|
};
|
|
82
|
-
var handleDragEnd = function () {
|
|
83
|
-
|
|
84
|
-
};
|
|
81
|
+
var handleDragEnd = function () { return setDraggedItemIndex(null); };
|
|
82
|
+
// ✅ Prevent unchecking last visible column
|
|
85
83
|
var toggleCheckbox = function (index) {
|
|
86
84
|
var newItems = __spreadArray([], items, true);
|
|
87
|
-
var visibleCount = newItems.filter(function (i) { return i.isHidden; }).length;
|
|
88
|
-
if (
|
|
85
|
+
var visibleCount = newItems.filter(function (i) { return !i.isHidden; }).length; // count visible
|
|
86
|
+
if (!newItems[index].isHidden && visibleCount === 1) {
|
|
89
87
|
setError("At least one column must remain visible.");
|
|
90
88
|
return;
|
|
91
89
|
}
|
|
@@ -96,21 +94,28 @@ var ManageColumns = function (_a) {
|
|
|
96
94
|
var filteredItems = items.filter(function (item) {
|
|
97
95
|
return item.label.toString().toLowerCase().includes(searchTerm.toLowerCase());
|
|
98
96
|
});
|
|
97
|
+
// ✅ Select all logic
|
|
98
|
+
var allChecked = items.every(function (item) { return !item.isHidden; });
|
|
99
|
+
var someChecked = items.some(function (item) { return !item.isHidden; }) && !allChecked;
|
|
100
|
+
var handleSelectAll = function () {
|
|
101
|
+
if (allChecked) {
|
|
102
|
+
// if all visible → keep first visible, hide rest
|
|
103
|
+
setItems(items.map(function (item, i) { return (__assign(__assign({}, item), { isHidden: i === 0 ? false : true })); }));
|
|
104
|
+
setError("At least one column must remain visible.");
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// make all visible
|
|
108
|
+
setItems(items.map(function (item) { return (__assign(__assign({}, item), { isHidden: false })); }));
|
|
109
|
+
setError(null);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
99
112
|
return (react_1.default.createElement(react_2.Box, { mt: "5" },
|
|
100
113
|
react_1.default.createElement(react_2.Input, { placeholder: "Search", mb: "4", value: searchTerm, onChange: function (e) { return setSearchTerm(e.target.value); } }),
|
|
101
114
|
!searchTerm.length && (react_1.default.createElement(react_2.Flex, { align: "center", mb: "2" },
|
|
102
|
-
react_1.default.createElement(Checkbox_1.default, { label: "Select all", isChecked:
|
|
103
|
-
|
|
104
|
-
if (allChecked) {
|
|
105
|
-
setError("At least one column must remain visible.");
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
setItems(items.map(function (item) { return (__assign(__assign({}, item), { isHidden: !allChecked })); }));
|
|
109
|
-
setError(null);
|
|
110
|
-
} }))),
|
|
111
|
-
react_1.default.createElement(react_2.List, { spacing: "2" }, filteredItems.length > 0 ? (filteredItems.map(function (item, index) { return (react_1.default.createElement(react_2.ListItem, { key: item.id, draggable: true, onDragStart: function () { return handleDragStart(index); }, onDragOver: function (e) { return handleDragOver(e, index); }, onDragEnd: handleDragEnd, bg: theme.colors.gray[50], display: "flex", alignItems: "center", borderRadius: "md", border: "1px solid", borderColor: "gray.200", cursor: "grab", position: "relative", fontSize: 14 },
|
|
115
|
+
react_1.default.createElement(Checkbox_1.default, { label: "Select all", isChecked: allChecked, isIndeterminate: someChecked, onChange: handleSelectAll }))),
|
|
116
|
+
react_1.default.createElement(react_2.List, { spacing: "2" }, filteredItems.length > 0 ? (filteredItems.map(function (item, index) { return (react_1.default.createElement(react_2.ListItem, { key: item.id, draggable: true, onDragStart: function () { return handleDragStart(index); }, onDragOver: function (e) { return handleDragOver(e, index); }, onDragEnd: handleDragEnd, bg: theme.colors.gray[50], display: "flex", alignItems: "center", borderRadius: "md", border: "1px solid", borderColor: "gray.200", cursor: "grab", position: "relative", fontSize: 14, px: "2", py: "1" },
|
|
112
117
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "Drag", icon: react_1.default.createElement(lucide_react_1.GripVertical, null), variant: "ghost", cursor: "grab", mr: "1" }),
|
|
113
|
-
react_1.default.createElement(Checkbox_1.default, { isChecked: item.isHidden, label: String(item.label), onChange: function () { return toggleCheckbox(index); }, sx: { marginRight: "4" } }))); })) : (react_1.default.createElement(react_2.Text, { color: "gray.500", textAlign: "center" }, "No items found"))),
|
|
118
|
+
react_1.default.createElement(Checkbox_1.default, { isChecked: !item.isHidden, label: String(item.label), onChange: function () { return toggleCheckbox(index); }, sx: { marginRight: "4" } }))); })) : (react_1.default.createElement(react_2.Text, { color: "gray.500", textAlign: "center" }, "No items found"))),
|
|
114
119
|
error && (react_1.default.createElement(react_2.Text, { color: "red.500", mt: "3", fontSize: "sm" }, error))));
|
|
115
120
|
};
|
|
116
121
|
exports.default = ManageColumns;
|