pixelize-design-library 2.2.199 → 2.3.1-beta.10
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/.claude/settings.local.json +44 -0
- 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/dist/Assets/defaultLogo.tsx +31 -0
- package/dist/Components/Accordion/Accordion.js +26 -5
- package/dist/Components/Button/Button.styles.js +44 -3
- package/dist/Components/Button/ButtonProps.d.ts +1 -1
- package/dist/Components/ButtonGroupIcon/ButtonGoupIconProps.d.ts +2 -2
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +50 -38
- package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -1
- package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
- package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +0 -1
- package/dist/Components/Checkbox/Checkbox.js +2 -2
- package/dist/Components/Checkbox/Checkbox.styles.js +2 -0
- package/dist/Components/Common/FormLabel.d.ts +2 -1
- package/dist/Components/Common/FormLabel.js +8 -9
- package/dist/Components/Common/fieldStyles.d.ts +22 -0
- package/dist/Components/Common/fieldStyles.js +42 -0
- package/dist/Components/DatePicker/CalendarPanel.d.ts +2 -0
- package/dist/Components/DatePicker/CalendarPanel.js +104 -65
- package/dist/Components/DatePicker/RangeDatePicker.js +37 -16
- package/dist/Components/DatePicker/SingleDatePicker.js +16 -16
- package/dist/Components/DatePicker/TimePicker.js +4 -4
- package/dist/Components/Input/Input/Input.d.ts +1 -1
- package/dist/Components/Input/Input/Input.js +5 -4
- package/dist/Components/Input/Input/InputProps.d.ts +2 -0
- package/dist/Components/Input/TextInput.styles.js +2 -1
- package/dist/Components/InputTextArea/InputTextArea.style.js +2 -1
- package/dist/Components/KanbanBoard/AccountCard.js +17 -14
- package/dist/Components/KanbanBoard/KanbanBoard.js +93 -78
- package/dist/Components/MultiSelect/MultiSelect.js +11 -12
- package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
- package/dist/Components/NavigationBar/NavigationBar.js +57 -30
- package/dist/Components/NavigationBar/NavigationBarProps.d.ts +1 -0
- package/dist/Components/NoteTextArea/NoteTextArea.js +44 -40
- package/dist/Components/NumberInput/NumberInput.styles.js +2 -1
- package/dist/Components/PinInput/PinInput.d.ts +1 -1
- package/dist/Components/PinInput/PinInput.js +3 -2
- package/dist/Components/PinInput/PinInputProps.d.ts +4 -0
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.d.ts +1 -1
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +42 -24
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +2 -0
- package/dist/Components/RadioButton/RadioButton.js +1 -1
- package/dist/Components/SearchSelect/SearchSelect.d.ts +1 -1
- package/dist/Components/SearchSelect/SearchSelect.js +56 -24
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +2 -0
- package/dist/Components/Select/Select.styles.js +2 -1
- package/dist/Components/SelectSearch/SelectSearch.js +7 -4
- package/dist/Components/SideBar/SecondaryBar.js +20 -18
- package/dist/Components/SideBar/SideBar.d.ts +1 -1
- package/dist/Components/SideBar/SideBar.js +58 -43
- package/dist/Components/SideBar/SideBarProps.d.ts +14 -3
- package/dist/Components/SideBar/components/MenuItemBox.js +28 -24
- package/dist/Components/SideBar/components/MenuItems.js +16 -2
- package/dist/Components/SideBar/components/MenuPopoverContent.js +16 -16
- package/dist/Components/SideBar/components/OtherApps.js +16 -14
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +234 -38
- package/dist/Components/Table/TableProps.d.ts +42 -2
- package/dist/Components/Table/{Components → components}/TableActions.d.ts +2 -2
- package/dist/Components/Table/{Components → components}/TableActions.js +5 -4
- package/dist/Components/Table/{Components → components}/TableBody.d.ts +5 -1
- package/dist/Components/Table/components/TableBody.js +369 -0
- package/dist/Components/Table/components/TableGroupRow.d.ts +15 -0
- package/dist/Components/Table/components/TableGroupRow.js +27 -0
- package/dist/Components/Table/{Components → components}/TableHeader.js +18 -8
- package/dist/Components/Table/{LeftFilterPane.js → filters/LeftFilterPane.js} +3 -3
- package/dist/Components/Table/{Components → hooks}/useTable.d.ts +1 -1
- package/dist/Components/Table/{Components → hooks}/useTable.js +8 -7
- package/dist/Components/Table/settings/TableSettings.d.ts +11 -0
- package/dist/Components/Table/settings/TableSettings.js +165 -0
- package/dist/Components/Timeline/Timeline.d.ts +1 -1
- package/dist/Components/Timeline/Timeline.js +145 -78
- package/dist/Components/Toaster/Toaster.js +40 -20
- package/dist/Theme/Default/palette.d.ts +4 -0
- package/dist/Theme/Default/palette.js +3 -0
- package/dist/Theme/Emerald/palette.d.ts +4 -0
- package/dist/Theme/Emerald/palette.js +2 -1
- package/dist/Theme/Meadow/palette.d.ts +4 -0
- package/dist/Theme/Meadow/palette.js +2 -1
- package/dist/Theme/Radiant/palette.d.ts +4 -0
- package/dist/Theme/Radiant/palette.js +2 -1
- package/dist/Theme/Rosewood/palette.d.ts +4 -0
- package/dist/Theme/Rosewood/palette.js +2 -1
- package/dist/Theme/Skyline/palette.d.ts +4 -0
- package/dist/Theme/Skyline/palette.js +2 -1
- package/dist/Theme/Slate/palette.d.ts +4 -0
- package/dist/Theme/Slate/palette.js +2 -1
- package/dist/Theme/themeProps.d.ts +4 -0
- package/dist/Utils/table.d.ts +26 -0
- package/dist/Utils/table.js +142 -38
- package/package.json +2 -2
- package/dist/Components/Table/Components/TableBody.js +0 -201
- package/dist/Components/Table/TableSettings/TableFilters.d.ts +0 -10
- package/dist/Components/Table/TableSettings/TableFilters.js +0 -69
- package/dist/Components/Table/TableSettings/TableFilters.test.d.ts +0 -1
- package/dist/Components/Table/TableSettings/TableFilters.test.js +0 -109
- package/dist/Components/Table/TableSettings/TableSettings.d.ts +0 -8
- package/dist/Components/Table/TableSettings/TableSettings.js +0 -141
- package/dist/Components/Table/TableToDo.d.ts +0 -2
- package/dist/Components/Table/TableToDo.js +0 -291
- /package/dist/Components/Table/{Components → components}/HeaderActions.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/HeaderActions.js +0 -0
- /package/dist/Components/Table/{Components → components}/Pagination.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/Pagination.js +0 -0
- /package/dist/Components/Table/{Components → components}/TableBody.virtualize.test.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/TableBody.virtualize.test.js +0 -0
- /package/dist/Components/Table/{Components → components}/TableHeader.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/TableLoading.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/TableLoading.js +0 -0
- /package/dist/Components/Table/{Components → components}/TableSearch.d.ts +0 -0
- /package/dist/Components/Table/{Components → components}/TableSearch.js +0 -0
- /package/dist/Components/Table/{Components → filters}/ActiveFilters.d.ts +0 -0
- /package/dist/Components/Table/{Components → filters}/ActiveFilters.js +0 -0
- /package/dist/Components/Table/{CompactSelect.d.ts → filters/CompactSelect.d.ts} +0 -0
- /package/dist/Components/Table/{CompactSelect.js → filters/CompactSelect.js} +0 -0
- /package/dist/Components/Table/{LeftFilterPane.d.ts → filters/LeftFilterPane.d.ts} +0 -0
- /package/dist/Components/Table/{SelectOperationControls.d.ts → filters/SelectOperationControls.d.ts} +0 -0
- /package/dist/Components/Table/{SelectOperationControls.js → filters/SelectOperationControls.js} +0 -0
- /package/dist/Components/Table/{Components → filters}/TableFilters.d.ts +0 -0
- /package/dist/Components/Table/{Components → filters}/TableFilters.js +0 -0
- /package/dist/Components/Table/{TextOperationControls.d.ts → filters/TextOperationControls.d.ts} +0 -0
- /package/dist/Components/Table/{TextOperationControls.js → filters/TextOperationControls.js} +0 -0
- /package/dist/Components/Table/{Components → hooks}/useDebounce.d.ts +0 -0
- /package/dist/Components/Table/{Components → hooks}/useDebounce.js +0 -0
- /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.d.ts +0 -0
- /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.js +0 -0
- /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.test.d.ts +0 -0
- /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.test.js +0 -0
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -32,6 +43,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
43
|
return result;
|
|
33
44
|
};
|
|
34
45
|
})();
|
|
46
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
47
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
48
|
+
if (ar || !(i in from)) {
|
|
49
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
50
|
+
ar[i] = from[i];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
54
|
+
};
|
|
35
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
57
|
};
|
|
@@ -41,46 +61,47 @@ var react_1 = __importStar(require("react"));
|
|
|
41
61
|
var react_2 = require("@chakra-ui/react");
|
|
42
62
|
var react_3 = require("@chakra-ui/react");
|
|
43
63
|
var framer_motion_1 = require("framer-motion");
|
|
44
|
-
var LeftFilterPane_1 = __importDefault(require("./LeftFilterPane"));
|
|
45
|
-
var Pagination_1 = __importDefault(require("./
|
|
46
|
-
var TableHeader_1 = __importDefault(require("./
|
|
47
|
-
var TableBody_1 = __importDefault(require("./
|
|
64
|
+
var LeftFilterPane_1 = __importDefault(require("./filters/LeftFilterPane"));
|
|
65
|
+
var Pagination_1 = __importDefault(require("./components/Pagination"));
|
|
66
|
+
var TableHeader_1 = __importDefault(require("./components/TableHeader"));
|
|
67
|
+
var TableBody_1 = __importDefault(require("./components/TableBody"));
|
|
48
68
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
49
|
-
var useTable_1 = __importDefault(require("./
|
|
69
|
+
var useTable_1 = __importDefault(require("./hooks/useTable"));
|
|
50
70
|
var table_1 = require("../../Utils/table");
|
|
51
71
|
var usePreferences_1 = require("../../Hooks/usePreferences");
|
|
52
|
-
var TableSettings_1 = __importDefault(require("./
|
|
53
|
-
var HeaderActions_1 = __importDefault(require("./
|
|
72
|
+
var TableSettings_1 = __importDefault(require("./settings/TableSettings"));
|
|
73
|
+
var HeaderActions_1 = __importDefault(require("./components/HeaderActions"));
|
|
54
74
|
var Divider_1 = __importDefault(require("../Divider/Divider"));
|
|
55
|
-
var TableSearch_1 = __importDefault(require("./
|
|
56
|
-
var ActiveFilters_1 = __importDefault(require("./
|
|
75
|
+
var TableSearch_1 = __importDefault(require("./components/TableSearch"));
|
|
76
|
+
var ActiveFilters_1 = __importDefault(require("./filters/ActiveFilters"));
|
|
77
|
+
var Button_1 = __importDefault(require("../Button/Button"));
|
|
57
78
|
var lucide_react_1 = require("lucide-react");
|
|
58
79
|
var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
|
|
59
80
|
function Table(_a) {
|
|
60
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
61
|
-
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading,
|
|
81
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
82
|
+
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _14 = _a.isCheckbox, isCheckbox = _14 === void 0 ? false : _14, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _15 = _a.noBorders, noBorders = _15 === void 0 ? false : _15, _16 = _a.isPagination, isPagination = _16 === void 0 ? true : _16, onRowClick = _a.onRowClick, selections = _a.selections, _17 = _a.isActionFreeze, isActionFreeze = _17 === void 0 ? true : _17, _18 = _a.preferences, preferences = _18 === void 0 ? {
|
|
62
83
|
url: "",
|
|
63
84
|
token: "",
|
|
64
85
|
key: "",
|
|
65
86
|
name: "",
|
|
66
87
|
page: "",
|
|
67
88
|
orgId: "",
|
|
68
|
-
} :
|
|
89
|
+
} : _18, _19 = _a.paginationMode, paginationMode = _19 === void 0 ? "client" : _19, _20 = _a.infiniteScroll, infiniteScroll = _20 === void 0 ? false : _20, hasMore = _a.hasMore, _21 = _a.isLoadingMore, isLoadingMore = _21 === void 0 ? false : _21, _22 = _a.groupLoadMore, groupLoadMore = _22 === void 0 ? false : _22, _23 = _a.loadMoreText, loadMoreText = _23 === void 0 ? "Load more" : _23, _24 = _a.loadMorePosition, loadMorePosition = _24 === void 0 ? "top" : _24, loadMoreChunkSize = _a.loadMoreChunkSize, _25 = _a.noOfRowsPerPage, noOfRowsPerPage = _25 === void 0 ? 50 : _25, _26 = _a.totalRecords, totalRecords = _26 === void 0 ? 0 : _26, onPagination = _a.onPagination, _27 = _a.isTableSettings, isTableSettings = _27 === void 0 ? false : _27, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, paginationSelectOptions = _a.paginationSelectOptions, tableMaxHeight = _a.tableMaxHeight, minVisibleRows = _a.minVisibleRows, maxVisibleRows = _a.maxVisibleRows, autoFitViewport = _a.autoFitViewport, tableSettings = _a.tableSettings, filterSidebar = _a.filterSidebar, loadingSkeletonRows = _a.loadingSkeletonRows, defaultVisibleColumns = _a.defaultVisibleColumns, _28 = _a.density, density = _28 === void 0 ? "normal" : _28, stripe = _a.stripe, groupColors = _a.groupColors, onAddItem = _a.onAddItem, emptyState = _a.emptyState;
|
|
69
90
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
70
|
-
var
|
|
91
|
+
var _29 = (0, react_1.useState)({}), columnsSearch = _29[0], setColumnsSearch = _29[1];
|
|
71
92
|
var tableContainerRef = (0, react_1.useRef)(null);
|
|
72
|
-
var
|
|
93
|
+
var _30 = (0, react_2.useDisclosure)(), isFilterModalOpen = _30.isOpen, onFilterModalOpen = _30.onOpen, onFilterModalClose = _30.onClose;
|
|
73
94
|
var filterMode = (_b = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.filterMode) !== null && _b !== void 0 ? _b : "sidebar";
|
|
74
|
-
var
|
|
95
|
+
var _31 = (0, react_1.useState)(500), viewportAvailableH = _31[0], setViewportAvailableH = _31[1];
|
|
75
96
|
var isServerPagination = paginationMode === "server";
|
|
76
|
-
var
|
|
97
|
+
var _32 = (0, usePreferences_1.useGetPreferences)({
|
|
77
98
|
baseUrl: preferences.url,
|
|
78
99
|
page: preferences.page,
|
|
79
100
|
key: preferences.key,
|
|
80
101
|
name: preferences.name,
|
|
81
102
|
authToken: preferences.token,
|
|
82
103
|
orgId: preferences.orgId,
|
|
83
|
-
}), tablePreferencesData =
|
|
104
|
+
}), tablePreferencesData = _32.preferences, loading = _32.loading;
|
|
84
105
|
var savePreferences = (0, usePreferences_1.useSavePreferences)({
|
|
85
106
|
baseUrl: preferences.url,
|
|
86
107
|
page: preferences.page,
|
|
@@ -98,7 +119,7 @@ function Table(_a) {
|
|
|
98
119
|
}
|
|
99
120
|
return {};
|
|
100
121
|
}, [tablePreferencesData]);
|
|
101
|
-
var
|
|
122
|
+
var _33 = (0, useTable_1.default)({
|
|
102
123
|
tableBorderColor: tableBorderColor,
|
|
103
124
|
data: data,
|
|
104
125
|
isPagination: isPagination,
|
|
@@ -112,10 +133,116 @@ function Table(_a) {
|
|
|
112
133
|
isServerPagination: isServerPagination,
|
|
113
134
|
onNoOfRowsPerPageChange: onNoOfRowsPerPageChange,
|
|
114
135
|
defaultVisibleColumns: defaultVisibleColumns,
|
|
115
|
-
}), tableData =
|
|
136
|
+
}), tableData = _33.tableData, isContent = _33.isContent, isLink = _33.isLink, headerRefs = _33.headerRefs, columnWidths = _33.columnWidths, handleSort = _33.handleSort, handleCheckbox = _33.handleCheckbox, filteredData = _33.filteredData, startRow = _33.startRow, endRow = _33.endRow, selection = _33.selection, columnsSort = _33.columnsSort, currentPage = _33.currentPage, pages = _33.pages, rowsPerPage = _33.rowsPerPage, handlePageSizeChange = _33.handlePageSizeChange, setCurrentPage = _33.setCurrentPage, columnsList = _33.columnsList, handleColumnPreferences = _33.handleColumnPreferences, isSelecting = _33.isSelecting;
|
|
137
|
+
// Density + grouping are managed here so the Table Settings tabs can change +
|
|
138
|
+
// persist them (seeded from the prop / saved preferences when they load).
|
|
139
|
+
var _34 = (0, react_1.useState)(density), densityState = _34[0], setDensityState = _34[1];
|
|
140
|
+
// Grouping is chosen by the user in Table Settings > Group and persisted to
|
|
141
|
+
// preferences (`json.groupBy`); there is no `groupBy` prop.
|
|
142
|
+
var _35 = (0, react_1.useState)(undefined), groupByState = _35[0], setGroupByState = _35[1];
|
|
143
|
+
// Grouped "Load more" accumulates pages here so loading more ADDS rows to the
|
|
144
|
+
// groups (server pagination replaces `data` each fetch). Reset on fresh loads
|
|
145
|
+
// (search / filter / sort / page-size). Only used in grouped + groupLoadMore mode.
|
|
146
|
+
var _36 = (0, react_1.useState)([]), accumulatedRows = _36[0], setAccumulatedRows = _36[1];
|
|
147
|
+
var pendingLoadMoreRef = (0, react_1.useRef)(false);
|
|
148
|
+
// Pages loaded so far (1 = the initial page). The next page is derived from this
|
|
149
|
+
// counter — NOT from the deduped row count — so overlapping rows across pages
|
|
150
|
+
// (e.g. pinned rows that repeat on every page) don't stall the page index.
|
|
151
|
+
var loadedPagesRef = (0, react_1.useRef)(1);
|
|
152
|
+
(0, react_1.useEffect)(function () {
|
|
153
|
+
if (!groupLoadMore)
|
|
154
|
+
return;
|
|
155
|
+
setAccumulatedRows(function (prev) {
|
|
156
|
+
if (prev.length === 0) {
|
|
157
|
+
loadedPagesRef.current = 1;
|
|
158
|
+
return tableData.slice();
|
|
159
|
+
}
|
|
160
|
+
var accIds = new Set(prev.map(function (r) { return r.id; }));
|
|
161
|
+
if (pendingLoadMoreRef.current) {
|
|
162
|
+
// A "Load more" is in flight. The parent may re-emit the SAME page (new
|
|
163
|
+
// array reference) on intermediate re-renders before the next page arrives,
|
|
164
|
+
// so only append + consume the flag once genuinely new rows show up.
|
|
165
|
+
var newRows = tableData.filter(function (r) { return !accIds.has(r.id); });
|
|
166
|
+
if (newRows.length === 0)
|
|
167
|
+
return prev; // same page re-emitted — keep waiting
|
|
168
|
+
pendingLoadMoreRef.current = false;
|
|
169
|
+
return __spreadArray(__spreadArray([], prev, true), newRows, true);
|
|
170
|
+
}
|
|
171
|
+
// Not a load-more: a re-emit of already-loaded rows keeps the accumulation
|
|
172
|
+
// (the parent re-renders the current page often). Genuinely new rows
|
|
173
|
+
// (search / filter / sort / page-size / reload) reset it.
|
|
174
|
+
var allKnown = tableData.length > 0 && tableData.every(function (r) { return accIds.has(r.id); });
|
|
175
|
+
if (allKnown)
|
|
176
|
+
return prev;
|
|
177
|
+
loadedPagesRef.current = 1; // fresh data set
|
|
178
|
+
return tableData.slice();
|
|
179
|
+
});
|
|
180
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
181
|
+
}, [tableData, groupLoadMore]);
|
|
182
|
+
// Page-size change restarts the accumulation (the page boundaries change), so the
|
|
183
|
+
// next "Load more" requests page 2 of the NEW size, not a stale page index.
|
|
184
|
+
var rowsPerPageMountedRef = (0, react_1.useRef)(false);
|
|
185
|
+
(0, react_1.useEffect)(function () {
|
|
186
|
+
if (!rowsPerPageMountedRef.current) {
|
|
187
|
+
rowsPerPageMountedRef.current = true;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
pendingLoadMoreRef.current = false;
|
|
191
|
+
loadedPagesRef.current = 1;
|
|
192
|
+
setAccumulatedRows(tableData); // current page at the new size (not empty)
|
|
193
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
|
+
}, [rowsPerPage]);
|
|
195
|
+
(0, react_1.useEffect)(function () {
|
|
196
|
+
if (tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.density)
|
|
197
|
+
setDensityState(tablePreferences.density);
|
|
198
|
+
}, [tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.density]);
|
|
199
|
+
(0, react_1.useEffect)(function () {
|
|
200
|
+
if (tablePreferences && "groupBy" in tablePreferences) {
|
|
201
|
+
var saved = tablePreferences.groupBy;
|
|
202
|
+
setGroupByState(saved === null || saved === undefined || saved === "" ? undefined : saved);
|
|
203
|
+
}
|
|
204
|
+
}, [tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.groupBy]);
|
|
205
|
+
var handleDensityChange = function (d) {
|
|
206
|
+
setDensityState(d);
|
|
207
|
+
savePreferences === null || savePreferences === void 0 ? void 0 : savePreferences(__assign(__assign({}, tablePreferences), { columns: columnsList, groupBy: groupByState !== null && groupByState !== void 0 ? groupByState : null, density: d }));
|
|
208
|
+
};
|
|
209
|
+
// Settings "Save": persist columns + group (+ current density) in ONE write so
|
|
210
|
+
// they don't clobber each other, and apply them locally.
|
|
211
|
+
var handleSettingsSave = function (cols, group) {
|
|
212
|
+
setGroupByState(group);
|
|
213
|
+
handleColumnPreferences(cols, { density: densityState, groupBy: group !== null && group !== void 0 ? group : null });
|
|
214
|
+
};
|
|
116
215
|
var _filteredData = (0, react_1.useMemo)(function () {
|
|
117
216
|
return (0, table_1.searchAndSortData)(filteredData, columnsSearch);
|
|
118
217
|
}, [columnsSearch, filteredData]);
|
|
218
|
+
// --- Monday-style grouping. Active whenever the user has picked a group column
|
|
219
|
+
// (in Settings > Group). When active, the numbered pager / infinite scroll are
|
|
220
|
+
// hidden and the body renders colored, collapsible groups over the loaded rows.
|
|
221
|
+
// `groupLoadMore` adds a "Load more" button on top to fetch more into the groups. ---
|
|
222
|
+
var isGrouped = !!groupByState;
|
|
223
|
+
// Infinite scroll (server mode, not grouped): load more on scroll-near-bottom.
|
|
224
|
+
var canInfinite = infiniteScroll && !isGrouped;
|
|
225
|
+
// Grouped "Load more": the accumulated pages back the grouped board so loading
|
|
226
|
+
// more grows the groups instead of replacing them.
|
|
227
|
+
var loadMoreBase = isGrouped && groupLoadMore ? accumulatedRows : tableData;
|
|
228
|
+
var hasMoreEffective = typeof hasMore === "boolean"
|
|
229
|
+
? hasMore
|
|
230
|
+
: isServerPagination
|
|
231
|
+
? loadMoreBase.length < totalRecords
|
|
232
|
+
: false;
|
|
233
|
+
var canGroupLoadMore = isGrouped && groupLoadMore && hasMoreEffective;
|
|
234
|
+
var groupPalette = (0, react_1.useMemo)(function () { return (0, table_1.buildTablePalette)(theme); }, [theme]);
|
|
235
|
+
var groupedSource = (0, react_1.useMemo)(function () {
|
|
236
|
+
if (!isGrouped)
|
|
237
|
+
return [];
|
|
238
|
+
var src = groupLoadMore ? accumulatedRows : tableData;
|
|
239
|
+
return (0, table_1.searchAndSortData)((0, table_1.SortMultiColumnData)(src, columnsSort), columnsSearch);
|
|
240
|
+
}, [isGrouped, groupLoadMore, accumulatedRows, tableData, columnsSort, columnsSearch]);
|
|
241
|
+
var renderGroups = (0, react_1.useMemo)(function () {
|
|
242
|
+
if (!isGrouped)
|
|
243
|
+
return undefined;
|
|
244
|
+
return (0, table_1.groupRows)(groupedSource, groupByState).map(function (g) { return (__assign(__assign({}, g), { color: (0, table_1.pickTableColor)(g.value, groupPalette, groupColors === null || groupColors === void 0 ? void 0 : groupColors[g.value]) })); });
|
|
245
|
+
}, [isGrouped, groupedSource, groupByState, groupPalette, groupColors]);
|
|
119
246
|
var onPaginationRef = (0, react_1.useRef)(onPagination);
|
|
120
247
|
onPaginationRef.current = onPagination;
|
|
121
248
|
var prevPageRef = (0, react_1.useRef)(currentPage);
|
|
@@ -142,12 +269,35 @@ function Table(_a) {
|
|
|
142
269
|
prevPageRef.current = currentPage;
|
|
143
270
|
}
|
|
144
271
|
}, [currentPage, rowsPerPage]);
|
|
272
|
+
// Grouped "Load more": request the next chunk; parent appends it to `data` and
|
|
273
|
+
// the table re-groups so new rows land in their respective groups.
|
|
274
|
+
var handleGroupLoadMore = function () {
|
|
275
|
+
var _a;
|
|
276
|
+
if (isLoadingMore || isTableLoading || !hasMoreEffective)
|
|
277
|
+
return;
|
|
278
|
+
// Must request the SAME page size the data was loaded with — a page-count model
|
|
279
|
+
// breaks if pages have different sizes (e.g. page size 100 but a 20-row chunk
|
|
280
|
+
// re-requests already-loaded records). `loadMoreChunkSize` is only a last-resort
|
|
281
|
+
// fallback and is otherwise ignored.
|
|
282
|
+
var chunk = rowsPerPage || loadMoreChunkSize || 20;
|
|
283
|
+
// Advance by page COUNT (not by deduped row count) so overlapping/pinned rows
|
|
284
|
+
// across pages don't keep us stuck on the same page.
|
|
285
|
+
var nextPage = loadedPagesRef.current + 1;
|
|
286
|
+
loadedPagesRef.current = nextPage;
|
|
287
|
+
var lastRecord = loadMoreBase.length > 0 ? loadMoreBase[loadMoreBase.length - 1] : undefined;
|
|
288
|
+
pendingLoadMoreRef.current = true;
|
|
289
|
+
(_a = onPaginationRef.current) === null || _a === void 0 ? void 0 : _a.call(onPaginationRef, nextPage, chunk, lastRecord, "next");
|
|
290
|
+
};
|
|
291
|
+
var groupLoadMoreCaption = totalRecords > 0 ? "Showing ".concat(loadMoreBase.length, " of ").concat(totalRecords) : undefined;
|
|
145
292
|
var tablePaginationText = (0, react_1.useMemo)(function () { return isServerPagination
|
|
146
293
|
? "".concat(startRow + 1, " - ").concat(Math.min(startRow + rowsPerPage, totalRecords), " of ").concat(totalRecords)
|
|
147
294
|
: "".concat(startRow + 1, " - ").concat(endRow > tableData.length ? tableData.length : endRow, " of ").concat(tableData.length); }, [startRow, rowsPerPage, totalRecords, endRow, tableData.length]);
|
|
148
295
|
var controlsHeight = 45;
|
|
149
296
|
var estimatedRowHeight = 45;
|
|
150
|
-
|
|
297
|
+
// In grouped mode the rendered rows come from the full grouped source, not the
|
|
298
|
+
// paged slice — base the height on that so a 1-result search isn't clipped.
|
|
299
|
+
var actualRows = isGrouped ? groupedSource.length : _filteredData.length;
|
|
300
|
+
var isEmptyState = !isTableLoading && actualRows === 0;
|
|
151
301
|
var loadingRowsCount = typeof loadingSkeletonRows === "number" ? Math.max(1, loadingSkeletonRows) : 4;
|
|
152
302
|
var minRows = typeof minVisibleRows === "number"
|
|
153
303
|
? Math.max(0, minVisibleRows)
|
|
@@ -171,13 +321,46 @@ function Table(_a) {
|
|
|
171
321
|
return function () { return window.removeEventListener("resize", compute); };
|
|
172
322
|
}, [autoFitViewport]);
|
|
173
323
|
var heightRowsCount = isTableLoading ? loadingRowsCount : visibleRowsCount;
|
|
174
|
-
var isCompactRows = heightRowsCount <= 1 && !(filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar);
|
|
175
|
-
var rowsHeight =
|
|
324
|
+
var isCompactRows = heightRowsCount <= 1 && !(filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) && !isGrouped && !isEmptyState;
|
|
325
|
+
var rowsHeight = heightRowsCount * estimatedRowHeight + estimatedRowHeight;
|
|
326
|
+
if (isGrouped)
|
|
327
|
+
rowsHeight += ((_c = renderGroups === null || renderGroups === void 0 ? void 0 : renderGroups.length) !== null && _c !== void 0 ? _c : 1) * 42; // group header rows
|
|
328
|
+
if (isEmptyState)
|
|
329
|
+
rowsHeight = Math.max(rowsHeight, 200); // room for the empty state
|
|
176
330
|
var dynamicMaxH = Math.min(500, rowsHeight);
|
|
177
331
|
var fittedMaxH = autoFitViewport ? Math.min(dynamicMaxH, viewportAvailableH) : dynamicMaxH;
|
|
178
332
|
var tableMaxH = typeof tableMaxHeight === "number" ? tableMaxHeight : (isCompactRows ? rowsHeight + 8 : fittedMaxH);
|
|
179
333
|
var isCompactHeader = (0, react_2.useBreakpointValue)({ base: true, md: true, lg: false });
|
|
180
334
|
var compactScrollbarPadding = isCompactRows ? 4 : 0;
|
|
335
|
+
// Infinite scroll: reuse onPagination("next") when scrolled near the bottom.
|
|
336
|
+
var infiniteRef = (0, react_1.useRef)({ isLoadingMore: isLoadingMore, isTableLoading: isTableLoading, hasMore: hasMore, rowsPerPage: rowsPerPage, dataLen: tableData.length, lastRecord: tableData[tableData.length - 1], totalRecords: totalRecords, isServerPagination: isServerPagination });
|
|
337
|
+
infiniteRef.current = { isLoadingMore: isLoadingMore, isTableLoading: isTableLoading, hasMore: hasMore, rowsPerPage: rowsPerPage, dataLen: tableData.length, lastRecord: tableData[tableData.length - 1], totalRecords: totalRecords, isServerPagination: isServerPagination };
|
|
338
|
+
(0, react_1.useEffect)(function () {
|
|
339
|
+
if (!canInfinite)
|
|
340
|
+
return;
|
|
341
|
+
var el = tableContainerRef.current;
|
|
342
|
+
if (!el)
|
|
343
|
+
return;
|
|
344
|
+
var onScroll = function () {
|
|
345
|
+
var _a;
|
|
346
|
+
var s = infiniteRef.current;
|
|
347
|
+
if (s.isLoadingMore || s.isTableLoading)
|
|
348
|
+
return;
|
|
349
|
+
var more = typeof s.hasMore === "boolean"
|
|
350
|
+
? s.hasMore
|
|
351
|
+
: s.isServerPagination
|
|
352
|
+
? s.dataLen < s.totalRecords
|
|
353
|
+
: false;
|
|
354
|
+
if (!more)
|
|
355
|
+
return;
|
|
356
|
+
if (el.scrollHeight - el.scrollTop - el.clientHeight < 160) {
|
|
357
|
+
var nextPage = Math.floor(s.dataLen / (s.rowsPerPage || 1)) + 1;
|
|
358
|
+
(_a = onPaginationRef.current) === null || _a === void 0 ? void 0 : _a.call(onPaginationRef, nextPage, s.rowsPerPage, s.lastRecord, "next");
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
362
|
+
return function () { return el.removeEventListener("scroll", onScroll); };
|
|
363
|
+
}, [canInfinite]);
|
|
181
364
|
var sidebarActiveCount = (0, react_1.useMemo)(function () {
|
|
182
365
|
if (!(filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected))
|
|
183
366
|
return 0;
|
|
@@ -188,22 +371,22 @@ function Table(_a) {
|
|
|
188
371
|
return acc + (Array.isArray(items) ? items.length : 0);
|
|
189
372
|
}, 0);
|
|
190
373
|
}, [filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected]);
|
|
191
|
-
return (react_1.default.createElement(react_2.Box, { bg: (
|
|
374
|
+
return (react_1.default.createElement(react_2.Box, { bg: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.background) === null || _e === void 0 ? void 0 : _e[50], border: "0.063rem solid ".concat((_f = theme.colors.border) === null || _f === void 0 ? void 0 : _f[500]), borderRadius: 3 },
|
|
192
375
|
filterSidebar && filterMode === "modal" && (react_1.default.createElement(react_2.Modal, { isOpen: isFilterModalOpen, onClose: onFilterModalClose, size: "4xl", scrollBehavior: "inside" },
|
|
193
376
|
react_1.default.createElement(react_2.ModalOverlay, null),
|
|
194
377
|
react_1.default.createElement(react_2.ModalContent, { my: 0, top: "10%", position: "fixed", left: "auto", right: "auto" },
|
|
195
378
|
react_1.default.createElement(react_2.ModalCloseButton, { size: "sm" }),
|
|
196
379
|
react_1.default.createElement(react_2.ModalBody, { p: 0 },
|
|
197
|
-
react_1.default.createElement(LeftFilterPane_1.default, { theme: theme, sections: (
|
|
380
|
+
react_1.default.createElement(LeftFilterPane_1.default, { theme: theme, sections: (_g = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _g !== void 0 ? _g : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: function (sel) { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply) === null || _a === void 0 ? void 0 : _a.call(filterSidebar, sel); onFilterModalClose(); }, onClear: function () { var _a; (_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler) === null || _a === void 0 ? void 0 : _a.call(filterSidebar); }, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }))))),
|
|
198
381
|
react_1.default.createElement(react_2.Flex, { align: "start" },
|
|
199
|
-
filterMode === "sidebar" && (react_1.default.createElement(MotionBox, { initial: { width: 0 }, animate: { width: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? 180 : 0 }, transition: { type: "tween", duration: 0.5 }, overflow: "hidden", flexShrink: 0, borderRight: "1px solid", borderColor: (
|
|
200
|
-
react_1.default.createElement(LeftFilterPane_1.default, { height: controlsHeight + tableMaxH, theme: theme, sections: (
|
|
382
|
+
filterMode === "sidebar" && (react_1.default.createElement(MotionBox, { initial: { width: 0 }, animate: { width: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? 180 : 0 }, transition: { type: "tween", duration: 0.5 }, overflow: "hidden", flexShrink: 0, borderRight: "1px solid", borderColor: (_h = theme.colors.border) === null || _h === void 0 ? void 0 : _h[500], style: { height: controlsHeight + tableMaxH }, minHeight: (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isFilterSidebar) ? "32rem" : "auto" },
|
|
383
|
+
react_1.default.createElement(LeftFilterPane_1.default, { height: controlsHeight + tableMaxH, theme: theme, sections: (_j = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.sidebarOptions) !== null && _j !== void 0 ? _j : [], selected: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected, onApply: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply, onClear: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler, isApplyLoading: filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.isApplyLoading, filterMode: filterMode }))),
|
|
201
384
|
react_1.default.createElement(react_2.Box, { flex: "1", minW: 0 },
|
|
202
|
-
react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 0, height: controlsHeight, gap:
|
|
385
|
+
react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 0, height: controlsHeight, gap: 3, flexWrap: "nowrap", bg: (_l = (_k = theme.colors) === null || _k === void 0 ? void 0 : _k.background) === null || _l === void 0 ? void 0 : _l[50], borderBottom: "0.063rem solid ".concat((_m = theme.colors.border) === null || _m === void 0 ? void 0 : _m[500]) },
|
|
203
386
|
filterSidebar && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
204
387
|
react_1.default.createElement(react_2.Box, { position: "relative", display: "inline-block" },
|
|
205
|
-
react_1.default.createElement(react_3.Icon, { as: lucide_react_1.Filter, transform: "scaleX(-1)", cursor: "pointer", boxSize: 4, color: sidebarActiveCount > 0 ? (
|
|
206
|
-
sidebarActiveCount > 0 && (react_1.default.createElement(react_2.Box, { position: "absolute", top: "-6px", right: "-10px", bg: (
|
|
388
|
+
react_1.default.createElement(react_3.Icon, { as: lucide_react_1.Filter, transform: "scaleX(-1)", cursor: "pointer", boxSize: 4, color: sidebarActiveCount > 0 ? (_p = (_o = theme.colors) === null || _o === void 0 ? void 0 : _o.primary) === null || _p === void 0 ? void 0 : _p[500] : (_r = (_q = theme.colors) === null || _q === void 0 ? void 0 : _q.text) === null || _r === void 0 ? void 0 : _r[500], onClick: filterMode === "modal" ? onFilterModalOpen : filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.filterSidebarToggle }),
|
|
389
|
+
sidebarActiveCount > 0 && (react_1.default.createElement(react_2.Box, { position: "absolute", top: "-6px", right: "-10px", bg: (_t = (_s = theme.colors) === null || _s === void 0 ? void 0 : _s.primary) === null || _t === void 0 ? void 0 : _t[500], color: "white", borderRadius: "full", p: "1px", cursor: "pointer", onClick: function (e) {
|
|
207
390
|
var _a;
|
|
208
391
|
e.stopPropagation();
|
|
209
392
|
if (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler) {
|
|
@@ -212,23 +395,26 @@ function Table(_a) {
|
|
|
212
395
|
else {
|
|
213
396
|
(_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply) === null || _a === void 0 ? void 0 : _a.call(filterSidebar, {});
|
|
214
397
|
}
|
|
215
|
-
}, _hover: { bg: (
|
|
398
|
+
}, _hover: { bg: (_v = (_u = theme.colors) === null || _u === void 0 ? void 0 : _u.red) === null || _v === void 0 ? void 0 : _v[600] }, display: "flex", alignItems: "center", justifyContent: "center", zIndex: 2 },
|
|
216
399
|
react_1.default.createElement(lucide_react_1.X, { size: 10, strokeWidth: 3 })))),
|
|
217
400
|
react_1.default.createElement(Divider_1.default, null))),
|
|
218
401
|
react_1.default.createElement(TableSearch_1.default, { onSearch: onGlobalSearch }),
|
|
219
402
|
isTableSettings && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
220
403
|
react_1.default.createElement(Divider_1.default, null),
|
|
221
|
-
react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return
|
|
404
|
+
react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols, group) { return handleSettingsSave(cols, group); }, tableSettings: tableSettings, density: densityState, onDensityChange: handleDensityChange, groupBy: groupByState }))),
|
|
222
405
|
headerActions && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
223
406
|
react_1.default.createElement(Divider_1.default, null),
|
|
224
407
|
react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))),
|
|
225
408
|
react_1.default.createElement(ActiveFilters_1.default, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }),
|
|
226
409
|
react_1.default.createElement(react_2.Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2 },
|
|
227
|
-
|
|
410
|
+
canGroupLoadMore && loadMorePosition === "top" && (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto" },
|
|
411
|
+
groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_x = (_w = theme.colors) === null || _w === void 0 ? void 0 : _w.text) === null || _x === void 0 ? void 0 : _x[500], whiteSpace: "nowrap" }, groupLoadMoreCaption)),
|
|
412
|
+
react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))),
|
|
413
|
+
(isPagination || isServerPagination) && !isGrouped && !canInfinite && !isCompactHeader && (react_1.default.createElement(react_2.Box, { flex: "0 0 auto" },
|
|
228
414
|
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 }))),
|
|
229
|
-
(isPagination || isServerPagination) && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
|
|
415
|
+
(isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
|
|
230
416
|
react_1.default.createElement(react_2.PopoverTrigger, null,
|
|
231
|
-
react_1.default.createElement(react_2.IconButton, { "aria-label": "More", size: "sm", variant: "ghost", icon: react_1.default.createElement(lucide_react_1.EllipsisVertical, { size: 18, color: (
|
|
417
|
+
react_1.default.createElement(react_2.IconButton, { "aria-label": "More", size: "sm", variant: "ghost", icon: react_1.default.createElement(lucide_react_1.EllipsisVertical, { size: 18, color: (_z = (_y = theme.colors) === null || _y === void 0 ? void 0 : _y.text) === null || _z === void 0 ? void 0 : _z[500] }) })),
|
|
232
418
|
react_1.default.createElement(react_2.PopoverContent, { maxW: "22rem", p: 2, overflow: "hidden" },
|
|
233
419
|
react_1.default.createElement(react_2.PopoverBody, { p: 0 },
|
|
234
420
|
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 }))))))),
|
|
@@ -259,7 +445,11 @@ function Table(_a) {
|
|
|
259
445
|
} },
|
|
260
446
|
react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", minW: "100%", className: "table_wrapper", sx: {
|
|
261
447
|
width: "100%",
|
|
262
|
-
|
|
448
|
+
// `separate` (not `collapse`) so sticky header cells paint an opaque
|
|
449
|
+
// background over their borders — collapsed borders bleed scrolling
|
|
450
|
+
// content through the seams.
|
|
451
|
+
borderCollapse: "separate",
|
|
452
|
+
borderSpacing: 0,
|
|
263
453
|
"th .resize-handle": {
|
|
264
454
|
position: "absolute",
|
|
265
455
|
top: 0,
|
|
@@ -271,12 +461,18 @@ function Table(_a) {
|
|
|
271
461
|
zIndex: 999,
|
|
272
462
|
},
|
|
273
463
|
} },
|
|
274
|
-
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 4 },
|
|
275
|
-
react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (
|
|
464
|
+
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 4, bg: (_2 = (_1 = (_0 = theme.colors.table) === null || _0 === void 0 ? void 0 : _0.hover) === null || _1 === void 0 ? void 0 : _1[200]) !== null && _2 !== void 0 ? _2 : (_3 = theme.colors.secondary) === null || _3 === void 0 ? void 0 : _3[50] },
|
|
465
|
+
react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_4 = theme.colors) === null || _4 === void 0 ? void 0 : _4.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_5 = theme.colors) === null || _5 === void 0 ? void 0 : _5.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: tableData.length !== 0 && selection.length === tableData.length
|
|
276
466
|
? true
|
|
277
467
|
: selection.length === 0
|
|
278
468
|
? false
|
|
279
469
|
: "indeterminate", isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting })),
|
|
280
470
|
react_1.default.createElement(react_3.Tbody, null,
|
|
281
|
-
react_1.default.createElement(TableBody_1.default, { data: _filteredData, columns: columnsList, startRow: startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (
|
|
471
|
+
react_1.default.createElement(TableBody_1.default, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_6 = theme.colors) === null || _6 === void 0 ? void 0 : _6.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }))),
|
|
472
|
+
canInfinite && isLoadingMore && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", py: 3, gap: 2 },
|
|
473
|
+
react_1.default.createElement(react_2.Spinner, { size: "sm", color: (_8 = (_7 = theme.colors) === null || _7 === void 0 ? void 0 : _7.primary) === null || _8 === void 0 ? void 0 : _8[500] }),
|
|
474
|
+
react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_10 = (_9 = theme.colors) === null || _9 === void 0 ? void 0 : _9.text) === null || _10 === void 0 ? void 0 : _10[500] }, "Loading more\u2026")))),
|
|
475
|
+
canGroupLoadMore && loadMorePosition === "bottom" && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: "0.063rem solid ".concat((_11 = theme.colors.border) === null || _11 === void 0 ? void 0 : _11[500]) },
|
|
476
|
+
groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_13 = (_12 = theme.colors) === null || _12 === void 0 ? void 0 : _12.text) === null || _13 === void 0 ? void 0 : _13[500] }, groupLoadMoreCaption)),
|
|
477
|
+
react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText })))))));
|
|
282
478
|
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
1
|
+
import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from "react";
|
|
2
2
|
import { FilterSidebarProps } from "../FilterSidebar/FilterSidebar";
|
|
3
|
+
export type TableDensity = "compact" | "normal" | "comfortable";
|
|
4
|
+
export type TableEmptyState = {
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
};
|
|
3
9
|
export type TableProps = {
|
|
4
10
|
data: DataObject[];
|
|
5
11
|
columns: TableHeaderProps[];
|
|
12
|
+
groupColors?: Record<string | number, string>;
|
|
13
|
+
onAddItem?: (groupValue: string | number) => void;
|
|
14
|
+
density?: TableDensity;
|
|
15
|
+
stripe?: boolean;
|
|
16
|
+
emptyState?: TableEmptyState | ReactNode;
|
|
6
17
|
handleExportChange?: (value: string) => void | undefined;
|
|
7
18
|
exportOptions?: ExportOption[];
|
|
8
19
|
exportLabel?: string;
|
|
@@ -21,6 +32,15 @@ export type TableProps = {
|
|
|
21
32
|
onRowClick?: (row: DataObject, header: Record<string | number, string | number>) => void;
|
|
22
33
|
isActionFreeze?: boolean;
|
|
23
34
|
paginationMode?: "client" | "server";
|
|
35
|
+
infiniteScroll?: boolean;
|
|
36
|
+
hasMore?: boolean;
|
|
37
|
+
isLoadingMore?: boolean;
|
|
38
|
+
groupLoadMore?: boolean;
|
|
39
|
+
loadMoreText?: string;
|
|
40
|
+
loadMorePosition?: "top" | "bottom";
|
|
41
|
+
/** @deprecated Ignored — load more always uses the current page size (`noOfRowsPerPage`)
|
|
42
|
+
* so page boundaries stay consistent. Kept only for backward compatibility. */
|
|
43
|
+
loadMoreChunkSize?: number;
|
|
24
44
|
noOfRowsPerPage?: number;
|
|
25
45
|
totalRecords?: number;
|
|
26
46
|
onPagination?: (page: number, noOfRecords: number, record: DataObject | undefined, direction: "next" | "prev" | "first" | "last") => void;
|
|
@@ -88,8 +108,13 @@ export type TableHeaderProps = {
|
|
|
88
108
|
isSearch?: boolean;
|
|
89
109
|
isFreeze?: boolean;
|
|
90
110
|
isHidden?: boolean;
|
|
111
|
+
type?: "status";
|
|
112
|
+
statusColors?: Record<string, string>;
|
|
113
|
+
columnType?: TableColumnType;
|
|
91
114
|
node?: (data: DataObject) => JSX.Element | string | number | undefined;
|
|
92
115
|
};
|
|
116
|
+
/** Known field data-types (open-ended via the trailing string for forward-compat). */
|
|
117
|
+
export type TableColumnType = "text" | "singleline" | "multiLine" | "description" | "email" | "phone" | "website" | "number" | "integer" | "decimal" | "dropdown" | "multiSelectDropdown" | "user" | "date" | "date_time" | "time" | "not_assigned" | (string & {});
|
|
93
118
|
export type ExportOption = {
|
|
94
119
|
label: string;
|
|
95
120
|
id: string;
|
|
@@ -116,7 +141,7 @@ export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "
|
|
|
116
141
|
columnsSearch: Record<string, string>;
|
|
117
142
|
isSelecting?: boolean;
|
|
118
143
|
};
|
|
119
|
-
export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "data" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "loadingSkeletonRows" | "onRowClick" | "isActionFreeze"> & {
|
|
144
|
+
export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "data" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "loadingSkeletonRows" | "onRowClick" | "isActionFreeze" | "density" | "stripe" | "emptyState"> & {
|
|
120
145
|
startRow: number;
|
|
121
146
|
endRow: number;
|
|
122
147
|
columnWidths: number[];
|
|
@@ -125,6 +150,21 @@ export type TableBodyPageProps = Pick<TableProps, "columns" | "isCheckbox" | "da
|
|
|
125
150
|
isContent: boolean;
|
|
126
151
|
isLink: boolean;
|
|
127
152
|
scrollContainerRef?: MutableRefObject<HTMLDivElement | null>;
|
|
153
|
+
/** Optional per-row id → accent color (Monday group stripe). */
|
|
154
|
+
accentColors?: Record<string | number, string>;
|
|
155
|
+
/** When provided, the body renders as a grouped (Monday) board instead of a flat list. */
|
|
156
|
+
groups?: TableRenderGroup[];
|
|
157
|
+
onAddItem?: (groupValue: string | number) => void;
|
|
158
|
+
};
|
|
159
|
+
export type TableRenderGroup = {
|
|
160
|
+
value: string | number;
|
|
161
|
+
label: string;
|
|
162
|
+
color: {
|
|
163
|
+
solid: string;
|
|
164
|
+
soft: string;
|
|
165
|
+
text: string;
|
|
166
|
+
};
|
|
167
|
+
rows: DataObject[];
|
|
128
168
|
};
|
|
129
169
|
export type TableFiltersProps = {
|
|
130
170
|
header: DataObject;
|
|
@@ -6,7 +6,7 @@ type TableRowActions = {
|
|
|
6
6
|
actions?: () => ReactNode;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
};
|
|
9
|
-
declare const TableActions: ({ row }: {
|
|
9
|
+
declare const TableActions: React.MemoExoticComponent<({ row }: {
|
|
10
10
|
row?: TableRowActions;
|
|
11
|
-
}) => React.JSX.Element | null
|
|
11
|
+
}) => React.JSX.Element | null>;
|
|
12
12
|
export default TableActions;
|
|
@@ -37,7 +37,7 @@ var react_1 = __importStar(require("react"));
|
|
|
37
37
|
var react_2 = require("@chakra-ui/react");
|
|
38
38
|
var lucide_react_1 = require("lucide-react");
|
|
39
39
|
var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
|
|
40
|
-
var TableActions = function (_a) {
|
|
40
|
+
var TableActions = react_1.default.memo(function (_a) {
|
|
41
41
|
var _b, _c, _d;
|
|
42
42
|
var row = _a.row;
|
|
43
43
|
var _e = (0, react_1.useState)(false), isOpen = _e[0], setIsOpen = _e[1];
|
|
@@ -76,7 +76,7 @@ var TableActions = function (_a) {
|
|
|
76
76
|
react_1.default.createElement("div", { ref: ref },
|
|
77
77
|
react_1.default.createElement(react_2.PopoverTrigger, null,
|
|
78
78
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "Actions", color: "black", icon: react_1.default.createElement(lucide_react_1.EllipsisVertical, { size: 17 }), size: "sm", p: 0, variant: "ghost", _hover: { transform: "scale(1.2)" }, onClick: function () { return (isOpen ? handleClose() : handleOpen()); } })),
|
|
79
|
-
react_1.default.createElement(react_2.Portal, null,
|
|
79
|
+
isOpen && (react_1.default.createElement(react_2.Portal, null,
|
|
80
80
|
react_1.default.createElement(react_2.PopoverContent, { w: "auto", minW: "100px", boxShadow: "lg", p: 0, zIndex: 999 },
|
|
81
81
|
react_1.default.createElement(react_2.PopoverBody, { p: 0, m: 0 },
|
|
82
82
|
react_1.default.createElement(react_2.VStack, { align: "stretch", spacing: 1, p: 0, m: 0 },
|
|
@@ -102,6 +102,7 @@ var TableActions = function (_a) {
|
|
|
102
102
|
react_1.default.createElement(lucide_react_1.Trash2, { size: 17 }),
|
|
103
103
|
" Delete")),
|
|
104
104
|
row.actions && ((_d = row === null || row === void 0 ? void 0 : row.actions) === null || _d === void 0 ? void 0 : _d.call(row)),
|
|
105
|
-
!row.onLink && !row.onEdit && !row.onDelete && (react_1.default.createElement(react_2.Button, { size: "sm", variant: "ghost", isDisabled: true, justifyContent: "center" }, "No actions")))))))));
|
|
106
|
-
};
|
|
105
|
+
!row.onLink && !row.onEdit && !row.onDelete && (react_1.default.createElement(react_2.Button, { size: "sm", variant: "ghost", isDisabled: true, justifyContent: "center" }, "No actions"))))))))));
|
|
106
|
+
});
|
|
107
|
+
TableActions.displayName = "TableActions";
|
|
107
108
|
exports.default = TableActions;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableBodyPageProps } from "../TableProps";
|
|
3
|
-
declare const
|
|
3
|
+
export declare const DENSITY_CONFIG: Record<string, {
|
|
4
|
+
height: number;
|
|
5
|
+
py: string;
|
|
6
|
+
}>;
|
|
7
|
+
declare const TableBody: ({ data, isCheckbox, columns, startRow, columnWidths, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, selections, isLoading, onRowClick, isContent, isLink, isActionFreeze, loadingSkeletonRows, scrollContainerRef, density, accentColors, groups, onAddItem, emptyState, }: TableBodyPageProps) => React.JSX.Element;
|
|
4
8
|
export default TableBody;
|