pixelize-design-library 2.2.188 → 2.2.190
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/coverage/clover.xml +638 -0
- package/coverage/coverage-final.json +20 -0
- package/coverage/lcov-report/Table/CompactSelect.tsx.html +379 -0
- package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +514 -0
- package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +373 -0
- package/coverage/lcov-report/Table/Components/Pagination.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableActions.tsx.html +574 -0
- package/coverage/lcov-report/Table/Components/TableBody.tsx.html +1027 -0
- package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +397 -0
- package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +1060 -0
- package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +361 -0
- package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +337 -0
- package/coverage/lcov-report/Table/Components/index.html +266 -0
- package/coverage/lcov-report/Table/Components/useDebounce.ts.html +178 -0
- package/coverage/lcov-report/Table/Components/useTable.ts.html +778 -0
- package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +1810 -0
- package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +178 -0
- package/coverage/lcov-report/Table/Table.tsx.html +1567 -0
- package/coverage/lcov-report/Table/TableProps.tsx.html +658 -0
- package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +619 -0
- package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +229 -0
- package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +532 -0
- package/coverage/lcov-report/Table/TableSettings/index.html +146 -0
- package/coverage/lcov-report/Table/TableToDo.tsx.html +973 -0
- package/coverage/lcov-report/Table/TextOperationControls.tsx.html +271 -0
- package/coverage/lcov-report/Table/filterTypes.ts.html +97 -0
- package/coverage/lcov-report/Table/index.html +176 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +146 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +1836 -0
- package/debug-storybook.log +72 -0
- package/dist/Assets/defaultLogo.tsx +31 -0
- package/dist/Components/Editor/Editor.d.ts +2 -1
- package/dist/Components/Editor/Editor.js +39 -5
- package/dist/Components/KanbanBoard/AccountCard.d.ts +2 -2
- package/dist/Components/KanbanBoard/AccountCard.js +37 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +72 -35
- package/dist/Components/MultiSelect/MultiSelect.js +10 -19
- package/dist/Components/SearchSelect/SearchSelect.js +23 -16
- package/dist/Components/Table/Components/ActiveFilters.js +63 -22
- package/dist/Components/Table/Components/Pagination.d.ts +1 -1
- package/dist/Components/Table/Components/Pagination.js +41 -9
- package/dist/Components/Table/Components/TableFilters.js +11 -5
- package/dist/Components/Table/Components/useTable.js +36 -24
- package/dist/Theme/Dark/palette.d.ts +370 -0
- package/dist/Theme/Dark/palette.js +372 -0
- package/package.json +1 -1
|
@@ -10,47 +10,88 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
13
46
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
48
|
};
|
|
16
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 =
|
|
50
|
+
var react_1 = __importStar(require("react"));
|
|
18
51
|
var react_2 = require("@chakra-ui/react");
|
|
19
52
|
var lucide_react_1 = require("lucide-react");
|
|
20
53
|
var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
21
54
|
var Divider_1 = __importDefault(require("../../Divider/Divider"));
|
|
22
|
-
var ActiveFilters = function (_a) {
|
|
55
|
+
var ActiveFilters = react_1.default.memo(function (_a) {
|
|
23
56
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
57
|
var columns = _a.columns, columnsSearch = _a.columnsSearch, setColumnsSearch = _a.setColumnsSearch;
|
|
25
58
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
value
|
|
39
|
-
}
|
|
40
|
-
|
|
59
|
+
var columnLabelMap = (0, react_1.useMemo)(function () {
|
|
60
|
+
var map = new Map();
|
|
61
|
+
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
|
62
|
+
var col = columns_1[_i];
|
|
63
|
+
map.set(col.id, col.label);
|
|
64
|
+
}
|
|
65
|
+
return map;
|
|
66
|
+
}, [columns]);
|
|
67
|
+
var activeFilters = (0, react_1.useMemo)(function () {
|
|
68
|
+
return Object.entries(columnsSearch)
|
|
69
|
+
.filter(function (_a) {
|
|
70
|
+
var _ = _a[0], value = _a[1];
|
|
71
|
+
return value && value.trim() !== "";
|
|
72
|
+
})
|
|
73
|
+
.map(function (_a) {
|
|
74
|
+
var columnId = _a[0], value = _a[1];
|
|
75
|
+
return ({
|
|
76
|
+
columnId: columnId,
|
|
77
|
+
label: columnLabelMap.get(columnId) || columnId,
|
|
78
|
+
value: value.trim(),
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}, [columnsSearch, columnLabelMap]);
|
|
41
82
|
if (activeFilters.length === 0) {
|
|
42
83
|
return null;
|
|
43
84
|
}
|
|
44
|
-
var handleRemoveFilter = function (columnId) {
|
|
85
|
+
var handleRemoveFilter = (0, react_1.useCallback)(function (columnId) {
|
|
45
86
|
setColumnsSearch(function (prev) {
|
|
46
87
|
var newSearch = __assign({}, prev);
|
|
47
88
|
delete newSearch[columnId];
|
|
48
89
|
return newSearch;
|
|
49
90
|
});
|
|
50
|
-
};
|
|
51
|
-
var handleClearAll = function () {
|
|
91
|
+
}, [setColumnsSearch]);
|
|
92
|
+
var handleClearAll = (0, react_1.useCallback)(function () {
|
|
52
93
|
setColumnsSearch({});
|
|
53
|
-
};
|
|
94
|
+
}, [setColumnsSearch]);
|
|
54
95
|
return (react_1.default.createElement(react_2.Box, { px: 2, py: 1, bg: ((_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[100]) || ((_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray) === null || _e === void 0 ? void 0 : _e[50]), overflowX: "auto", sx: {
|
|
55
96
|
'&::-webkit-scrollbar': {
|
|
56
97
|
height: '6px',
|
|
@@ -87,5 +128,5 @@ var ActiveFilters = function (_a) {
|
|
|
87
128
|
activeFilters.length > 1 && (react_1.default.createElement(react_2.Text, { as: "p", className: "clear-all-text", "aria-label": "Clear All", fontSize: "sm", color: ((_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.blue) === null || _g === void 0 ? void 0 : _g[600]) || ((_j = (_h = theme.colors) === null || _h === void 0 ? void 0 : _h.primary) === null || _j === void 0 ? void 0 : _j[600]), cursor: "pointer", fontWeight: 500, onClick: handleClearAll, _hover: {
|
|
88
129
|
textDecoration: "underline",
|
|
89
130
|
}, flexShrink: 0, whiteSpace: "nowrap" }, "Clear All")))));
|
|
90
|
-
};
|
|
131
|
+
});
|
|
91
132
|
exports.default = ActiveFilters;
|
|
@@ -10,5 +10,5 @@ type PaginationProps = Pick<TableProps, "isVisiblity" | "columns" | "paginationS
|
|
|
10
10
|
dataLength: number;
|
|
11
11
|
isServerPagination: boolean;
|
|
12
12
|
};
|
|
13
|
-
declare const Pagination: ({ paginationText, handlePageSizeChange, rowsPerPage, currentPage, pages, setCurrentPage, dataLength, isServerPagination, paginationSelectOptions, }: PaginationProps) => React.JSX.Element
|
|
13
|
+
declare const Pagination: React.MemoExoticComponent<({ paginationText, handlePageSizeChange, rowsPerPage, currentPage, pages, setCurrentPage, dataLength, isServerPagination, paginationSelectOptions, }: PaginationProps) => React.JSX.Element>;
|
|
14
14
|
export default Pagination;
|
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var react_1 =
|
|
36
|
+
var react_1 = __importStar(require("react"));
|
|
7
37
|
var react_2 = require("@chakra-ui/react");
|
|
8
38
|
var table_1 = require("../../../Utils/table");
|
|
9
39
|
var lucide_react_1 = require("lucide-react");
|
|
10
|
-
var Pagination = function (_a) {
|
|
40
|
+
var Pagination = react_1.default.memo(function (_a) {
|
|
11
41
|
var paginationText = _a.paginationText, handlePageSizeChange = _a.handlePageSizeChange, rowsPerPage = _a.rowsPerPage, currentPage = _a.currentPage, pages = _a.pages, setCurrentPage = _a.setCurrentPage, dataLength = _a.dataLength, isServerPagination = _a.isServerPagination, paginationSelectOptions = _a.paginationSelectOptions;
|
|
12
|
-
var computedOptions =
|
|
13
|
-
|
|
14
|
-
|
|
42
|
+
var computedOptions = (0, react_1.useMemo)(function () {
|
|
43
|
+
return paginationSelectOptions && paginationSelectOptions.length
|
|
44
|
+
? paginationSelectOptions
|
|
45
|
+
: (0, table_1.pageSizeCalculation)(dataLength);
|
|
46
|
+
}, [paginationSelectOptions, dataLength]);
|
|
15
47
|
// const isLeftDisabled = currentPage === 0;
|
|
16
48
|
// const isRightDisabled = currentPage >= pages - 1;
|
|
17
49
|
var isLeftDisabled = dataLength === 0 || currentPage === 0;
|
|
@@ -32,5 +64,5 @@ var Pagination = function (_a) {
|
|
|
32
64
|
react_1.default.createElement(lucide_react_1.ChevronRight, null)),
|
|
33
65
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "last-page", color: isRightDisabled ? "gray" : "black", rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: function () { return setCurrentPage(pages - 1); } },
|
|
34
66
|
react_1.default.createElement(lucide_react_1.ChevronsRight, null))))));
|
|
35
|
-
};
|
|
67
|
+
});
|
|
36
68
|
exports.default = Pagination;
|
|
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
var react_1 = __importStar(require("react"));
|
|
37
37
|
var react_2 = require("@chakra-ui/react");
|
|
38
|
-
var table_1 = require("../../../Utils/table");
|
|
39
38
|
var lucide_react_1 = require("lucide-react");
|
|
40
39
|
var TableFilters = (0, react_1.memo)(function (_a) {
|
|
41
40
|
var _b, _c;
|
|
@@ -43,9 +42,16 @@ var TableFilters = (0, react_1.memo)(function (_a) {
|
|
|
43
42
|
var theme = (0, react_2.useTheme)();
|
|
44
43
|
var searchRef = (0, react_1.useRef)(null);
|
|
45
44
|
var _d = (0, react_1.useState)(false), refreshDataOnOpen = _d[0], setRefreshDataOnOpen = _d[1];
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
var setColumnsSearchRef = (0, react_1.useRef)(setColumnsSearch);
|
|
46
|
+
setColumnsSearchRef.current = setColumnsSearch;
|
|
47
|
+
var debounceTimerRef = (0, react_1.useRef)(null);
|
|
48
|
+
var debouncedSearch = (0, react_1.useCallback)(function (value) {
|
|
49
|
+
if (debounceTimerRef.current)
|
|
50
|
+
clearTimeout(debounceTimerRef.current);
|
|
51
|
+
debounceTimerRef.current = setTimeout(function () {
|
|
52
|
+
setColumnsSearchRef.current(value);
|
|
53
|
+
}, 700);
|
|
54
|
+
}, []);
|
|
49
55
|
(0, react_1.useEffect)(function () {
|
|
50
56
|
if (columnsSearch.length && searchRef.current) {
|
|
51
57
|
searchRef.current.value = columnsSearch;
|
|
@@ -77,7 +83,7 @@ var TableFilters = (0, react_1.memo)(function (_a) {
|
|
|
77
83
|
react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Search, color: "gray.400", boxSize: 4 })),
|
|
78
84
|
react_1.default.createElement(react_2.Input, { autoFocus: true, placeholder: "Search ".concat(header.label, "..."), size: "xs", ref: searchRef, onChange: function (e) {
|
|
79
85
|
e.stopPropagation();
|
|
80
|
-
|
|
86
|
+
debouncedSearch(e.target.value);
|
|
81
87
|
}, onFocus: function (e) { return e.stopPropagation(); } })))))));
|
|
82
88
|
});
|
|
83
89
|
exports.default = TableFilters;
|
|
@@ -38,14 +38,15 @@ var mergeColumnWithPreference = function (pref, originalCol) {
|
|
|
38
38
|
return next;
|
|
39
39
|
};
|
|
40
40
|
var useTable = function (_a) {
|
|
41
|
+
var _b, _c;
|
|
41
42
|
var tableBorderColor = _a.tableBorderColor, data = _a.data, isPagination = _a.isPagination, selections = _a.selections, onSelection = _a.onSelection, tablePreferences = _a.tablePreferences, savePreferences = _a.savePreferences, noOfRowsPerPage = _a.noOfRowsPerPage, isServerPagination = _a.isServerPagination, totalRecords = _a.totalRecords, columns = _a.columns, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, defaultVisibleColumns = _a.defaultVisibleColumns;
|
|
42
43
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
43
44
|
var headerRefs = (0, react_1.useRef)([]);
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
45
|
+
var _d = (0, react_1.useState)([]), columnWidths = _d[0], setColumnWidths = _d[1];
|
|
46
|
+
var _e = (0, react_1.useState)(selections !== null && selections !== void 0 ? selections : []), selection = _e[0], setSelection = _e[1];
|
|
47
|
+
var _f = (0, react_1.useState)([]), columnsSort = _f[0], setColumnsSort = _f[1];
|
|
48
|
+
var _g = (0, react_1.useState)(0), currentPage = _g[0], setCurrentPage = _g[1];
|
|
49
|
+
var _h = (0, react_1.useState)(noOfRowsPerPage !== null && noOfRowsPerPage !== void 0 ? noOfRowsPerPage : defaultPageSize), rowsPerPage = _h[0], setRowsPerPage = _h[1];
|
|
49
50
|
var prevRowsPerPageProp = (0, react_1.useRef)(noOfRowsPerPage);
|
|
50
51
|
if (noOfRowsPerPage !== prevRowsPerPageProp.current) {
|
|
51
52
|
prevRowsPerPageProp.current = noOfRowsPerPage;
|
|
@@ -54,12 +55,12 @@ var useTable = function (_a) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
var tableData = data;
|
|
57
|
-
var
|
|
58
|
+
var _j = (0, react_1.useState)(function () {
|
|
58
59
|
return columns.map(function (col, i) {
|
|
59
60
|
var _a;
|
|
60
61
|
return (__assign(__assign({}, col), { isHidden: defaultVisibleColumns ? i >= defaultVisibleColumns : ((_a = col.isHidden) !== null && _a !== void 0 ? _a : false) }));
|
|
61
62
|
});
|
|
62
|
-
}), columnsList =
|
|
63
|
+
}), columnsList = _j[0], setColumnsList = _j[1];
|
|
63
64
|
(0, react_1.useEffect)(function () {
|
|
64
65
|
var _a;
|
|
65
66
|
var columnPreference = (_a = tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.columns) !== null && _a !== void 0 ? _a : [];
|
|
@@ -90,8 +91,18 @@ var useTable = function (_a) {
|
|
|
90
91
|
overflowY: "auto",
|
|
91
92
|
});
|
|
92
93
|
}, [tableBorderColor, theme]);
|
|
93
|
-
var
|
|
94
|
-
var
|
|
94
|
+
var prevIsContent = (0, react_1.useRef)(false);
|
|
95
|
+
var prevIsLink = (0, react_1.useRef)(false);
|
|
96
|
+
var isContent = (0, react_1.useMemo)(function () {
|
|
97
|
+
var result = tableData.some(function (o) { return o.content; });
|
|
98
|
+
prevIsContent.current = result;
|
|
99
|
+
return result;
|
|
100
|
+
}, [tableData.length === 0 ? 0 : (_b = tableData[0]) === null || _b === void 0 ? void 0 : _b.id, tableData.length]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
101
|
+
var isLink = (0, react_1.useMemo)(function () {
|
|
102
|
+
var result = tableData.some(function (o) { return o.onLink || o.onDelete || o.onEdit; });
|
|
103
|
+
prevIsLink.current = result;
|
|
104
|
+
return result;
|
|
105
|
+
}, [tableData.length === 0 ? 0 : (_c = tableData[0]) === null || _c === void 0 ? void 0 : _c.id, tableData.length]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
95
106
|
(0, react_1.useEffect)(function () {
|
|
96
107
|
var widths = headerRefs.current.map(function (ref) { return (ref === null || ref === void 0 ? void 0 : ref.offsetWidth) || 0; });
|
|
97
108
|
setColumnWidths(widths);
|
|
@@ -128,24 +139,25 @@ var useTable = function (_a) {
|
|
|
128
139
|
var handleSort = (0, react_1.useCallback)(function (field, sort) {
|
|
129
140
|
if (!sort)
|
|
130
141
|
return;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
setColumnsSort(function (prev) {
|
|
143
|
+
var newSortState = __spreadArray([], prev, true);
|
|
144
|
+
var existingIndex = newSortState.findIndex(function (s) { return s.column === field; });
|
|
145
|
+
if (existingIndex === -1) {
|
|
146
|
+
newSortState.push({
|
|
147
|
+
column: field,
|
|
148
|
+
direction: "asc",
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
newSortState[existingIndex] = __assign(__assign({}, newSortState[existingIndex]), { direction: sort });
|
|
153
|
+
}
|
|
154
|
+
return newSortState;
|
|
155
|
+
});
|
|
156
|
+
}, []);
|
|
145
157
|
(0, react_1.useEffect)(function () {
|
|
146
158
|
setSelection(selections !== null && selections !== void 0 ? selections : []);
|
|
147
159
|
}, [selections]);
|
|
148
|
-
var
|
|
160
|
+
var _k = (0, react_1.useState)(false), isSelecting = _k[0], setIsSelecting = _k[1];
|
|
149
161
|
var selectionRef = (0, react_1.useRef)(selection);
|
|
150
162
|
selectionRef.current = selection;
|
|
151
163
|
var onSelectionRef = (0, react_1.useRef)(onSelection);
|