pixelize-design-library 2.3.5 → 2.3.7
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.
|
@@ -43,6 +43,42 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
+
function step(op) {
|
|
60
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
+
switch (op[0]) {
|
|
65
|
+
case 0: case 1: t = op; break;
|
|
66
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
+
default:
|
|
70
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
+
if (t[2]) _.ops.pop();
|
|
75
|
+
_.trys.pop(); continue;
|
|
76
|
+
}
|
|
77
|
+
op = body.call(thisArg, _);
|
|
78
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
46
82
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
47
83
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
48
84
|
if (ar || !(i in from)) {
|
|
@@ -79,6 +115,7 @@ var ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
|
|
|
79
115
|
var lucide_react_1 = require("lucide-react");
|
|
80
116
|
var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
|
|
81
117
|
function Table(_a) {
|
|
118
|
+
var _this = this;
|
|
82
119
|
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, _14, _15, _16;
|
|
83
120
|
var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _17 = _a.isCheckbox, isCheckbox = _17 === void 0 ? false : _17, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _18 = _a.noBorders, noBorders = _18 === void 0 ? false : _18, _19 = _a.isPagination, isPagination = _19 === void 0 ? true : _19, onRowClick = _a.onRowClick, selections = _a.selections, _20 = _a.isActionFreeze, isActionFreeze = _20 === void 0 ? true : _20, _21 = _a.preferences, preferences = _21 === void 0 ? {
|
|
84
121
|
url: "",
|
|
@@ -111,16 +148,17 @@ function Table(_a) {
|
|
|
111
148
|
authToken: preferences.token,
|
|
112
149
|
orgId: preferences.orgId,
|
|
113
150
|
}).savePreferences;
|
|
151
|
+
var _36 = (0, react_1.useState)(false), isRefreshing = _36[0], setIsRefreshing = _36[1];
|
|
114
152
|
var isTableLoading = (0, react_1.useMemo)(function () {
|
|
115
|
-
return loading || isLoading;
|
|
116
|
-
}, [loading, isLoading]);
|
|
153
|
+
return loading || isLoading || isRefreshing;
|
|
154
|
+
}, [loading, isLoading, isRefreshing]);
|
|
117
155
|
var tablePreferences = (0, react_1.useMemo)(function () {
|
|
118
156
|
if (tablePreferencesData === null || tablePreferencesData === void 0 ? void 0 : tablePreferencesData.length) {
|
|
119
157
|
return tablePreferencesData[0].json;
|
|
120
158
|
}
|
|
121
159
|
return {};
|
|
122
160
|
}, [tablePreferencesData]);
|
|
123
|
-
var
|
|
161
|
+
var _37 = (0, useTable_1.default)({
|
|
124
162
|
tableBorderColor: tableBorderColor,
|
|
125
163
|
data: data,
|
|
126
164
|
isPagination: isPagination,
|
|
@@ -134,17 +172,17 @@ function Table(_a) {
|
|
|
134
172
|
isServerPagination: isServerPagination,
|
|
135
173
|
onNoOfRowsPerPageChange: onNoOfRowsPerPageChange,
|
|
136
174
|
defaultVisibleColumns: defaultVisibleColumns,
|
|
137
|
-
}), tableData =
|
|
175
|
+
}), tableData = _37.tableData, isContent = _37.isContent, isLink = _37.isLink, headerRefs = _37.headerRefs, columnWidths = _37.columnWidths, handleSort = _37.handleSort, handleCheckbox = _37.handleCheckbox, filteredData = _37.filteredData, startRow = _37.startRow, endRow = _37.endRow, selection = _37.selection, columnsSort = _37.columnsSort, currentPage = _37.currentPage, pages = _37.pages, rowsPerPage = _37.rowsPerPage, handlePageSizeChange = _37.handlePageSizeChange, setCurrentPage = _37.setCurrentPage, columnsList = _37.columnsList, handleColumnPreferences = _37.handleColumnPreferences, isSelecting = _37.isSelecting, selectAllRowsRef = _37.selectAllRowsRef;
|
|
138
176
|
// Density + grouping are managed here so the Table Settings tabs can change +
|
|
139
177
|
// persist them (seeded from the prop / saved preferences when they load).
|
|
140
|
-
var
|
|
178
|
+
var _38 = (0, react_1.useState)(density), densityState = _38[0], setDensityState = _38[1];
|
|
141
179
|
// Grouping is chosen by the user in Table Settings > Group and persisted to
|
|
142
180
|
// preferences (`json.groupBy`); there is no `groupBy` prop.
|
|
143
|
-
var
|
|
181
|
+
var _39 = (0, react_1.useState)(undefined), groupByState = _39[0], setGroupByState = _39[1];
|
|
144
182
|
// Grouped "Load more" accumulates pages here so loading more ADDS rows to the
|
|
145
183
|
// groups (server pagination replaces `data` each fetch). Reset on fresh loads
|
|
146
184
|
// (search / filter / sort / page-size). Only used in grouped + groupLoadMore mode.
|
|
147
|
-
var
|
|
185
|
+
var _40 = (0, react_1.useState)([]), accumulatedRows = _40[0], setAccumulatedRows = _40[1];
|
|
148
186
|
var pendingLoadMoreRef = (0, react_1.useRef)(false);
|
|
149
187
|
// Pages loaded so far (1 = the initial page). The next page is derived from this
|
|
150
188
|
// counter — NOT from the deduped row count — so overlapping rows across pages
|
|
@@ -396,118 +434,143 @@ function Table(_a) {
|
|
|
396
434
|
return acc + (Array.isArray(items) ? items.length : 0);
|
|
397
435
|
}, 0);
|
|
398
436
|
}, [filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.selected]);
|
|
399
|
-
return (react_1.default.createElement(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
react_1.default.createElement(react_2.
|
|
403
|
-
react_1.default.createElement(react_2.
|
|
404
|
-
react_1.default.createElement(react_2.
|
|
405
|
-
react_1.default.createElement(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
react_1.default.createElement(
|
|
432
|
-
react_1.default.createElement(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
react_1.default.createElement(
|
|
436
|
-
react_1.default.createElement(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
react_1.default.createElement(
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
437
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
438
|
+
react_1.default.createElement("style", null, "\n @keyframes pixelize-table-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "),
|
|
439
|
+
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 },
|
|
440
|
+
filterSidebar && filterMode === "modal" && (react_1.default.createElement(react_2.Modal, { isOpen: isFilterModalOpen, onClose: onFilterModalClose, size: "4xl", scrollBehavior: "inside" },
|
|
441
|
+
react_1.default.createElement(react_2.ModalOverlay, null),
|
|
442
|
+
react_1.default.createElement(react_2.ModalContent, { my: 0, top: "10%", position: "fixed", left: "auto", right: "auto" },
|
|
443
|
+
react_1.default.createElement(react_2.ModalCloseButton, { size: "sm" }),
|
|
444
|
+
react_1.default.createElement(react_2.ModalBody, { p: 0 },
|
|
445
|
+
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 }))))),
|
|
446
|
+
react_1.default.createElement(react_2.Flex, { align: "start" },
|
|
447
|
+
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" },
|
|
448
|
+
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 }))),
|
|
449
|
+
react_1.default.createElement(react_2.Box, { flex: "1", minW: 0 },
|
|
450
|
+
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]) },
|
|
451
|
+
filterSidebar && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
452
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Filter", placement: "top" },
|
|
453
|
+
react_1.default.createElement(react_2.Box, { position: "relative", display: "inline-block" },
|
|
454
|
+
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, _hover: {
|
|
455
|
+
color: (_t = (_s = theme.colors) === null || _s === void 0 ? void 0 : _s.primary) === null || _t === void 0 ? void 0 : _t[500],
|
|
456
|
+
} }),
|
|
457
|
+
sidebarActiveCount > 0 && (react_1.default.createElement(react_2.Box, { position: "absolute", top: "-6px", right: "-10px", bg: (_v = (_u = theme.colors) === null || _u === void 0 ? void 0 : _u.primary) === null || _v === void 0 ? void 0 : _v[500], color: "white", borderRadius: "full", p: "1px", cursor: "pointer", onClick: function (e) {
|
|
458
|
+
var _a;
|
|
459
|
+
e.stopPropagation();
|
|
460
|
+
if (filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onClearAllHandler) {
|
|
461
|
+
filterSidebar.onClearAllHandler();
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
(_a = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.onApply) === null || _a === void 0 ? void 0 : _a.call(filterSidebar, {});
|
|
465
|
+
}
|
|
466
|
+
}, _hover: { bg: (_x = (_w = theme.colors) === null || _w === void 0 ? void 0 : _w.red) === null || _x === void 0 ? void 0 : _x[600] }, display: "flex", alignItems: "center", justifyContent: "center", zIndex: 2 },
|
|
467
|
+
react_1.default.createElement(lucide_react_1.X, { size: 10, strokeWidth: 3 }))))),
|
|
468
|
+
react_1.default.createElement(Divider_1.default, null))),
|
|
469
|
+
react_1.default.createElement(TableSearch_1.default, { onSearch: onGlobalSearch }),
|
|
470
|
+
isTableSettings && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
471
|
+
react_1.default.createElement(Divider_1.default, null),
|
|
472
|
+
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 }))),
|
|
473
|
+
onRefresh && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
474
|
+
react_1.default.createElement(Divider_1.default, null),
|
|
475
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Refresh", placement: "top" },
|
|
476
|
+
react_1.default.createElement(react_2.Box, { display: "flex", justifyContent: "flex-end", cursor: "pointer", transition: "all 0.2s ease", color: theme.colors.text[500], _hover: {
|
|
477
|
+
color: theme.colors.primary[500],
|
|
478
|
+
transform: "scale(1.1)"
|
|
479
|
+
}, onClick: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
480
|
+
return __generator(this, function (_a) {
|
|
481
|
+
switch (_a.label) {
|
|
482
|
+
case 0:
|
|
483
|
+
if (!!isRefreshing) return [3 /*break*/, 4];
|
|
484
|
+
setIsRefreshing(true);
|
|
485
|
+
_a.label = 1;
|
|
486
|
+
case 1:
|
|
487
|
+
_a.trys.push([1, , 3, 4]);
|
|
488
|
+
return [4 /*yield*/, onRefresh()];
|
|
489
|
+
case 2:
|
|
490
|
+
_a.sent();
|
|
491
|
+
return [3 /*break*/, 4];
|
|
492
|
+
case 3:
|
|
493
|
+
setIsRefreshing(false);
|
|
494
|
+
return [7 /*endfinally*/];
|
|
495
|
+
case 4: return [2 /*return*/];
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
}); }, style: {
|
|
499
|
+
animation: isRefreshing
|
|
500
|
+
? "pixelize-table-spin 1s linear infinite"
|
|
501
|
+
: "none"
|
|
502
|
+
} },
|
|
503
|
+
react_1.default.createElement(lucide_react_1.RefreshCw, { size: 16 }))))),
|
|
504
|
+
headerActions && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
505
|
+
react_1.default.createElement(Divider_1.default, null),
|
|
506
|
+
react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))),
|
|
507
|
+
react_1.default.createElement(ActiveFilters_1.default, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }),
|
|
508
|
+
react_1.default.createElement(react_2.Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2 },
|
|
509
|
+
groupLoadMoreActive && loadMorePosition === "top" && (groupLoadMoreCaption || canGroupLoadMore) && (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto" },
|
|
510
|
+
groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_z = (_y = theme.colors) === null || _y === void 0 ? void 0 : _y.text) === null || _z === void 0 ? void 0 : _z[500], whiteSpace: "nowrap" }, groupLoadMoreCaption)),
|
|
511
|
+
canGroupLoadMore && (react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText })))),
|
|
512
|
+
(isPagination || isServerPagination) && !isGrouped && !canInfinite && !isCompactHeader && (react_1.default.createElement("div", null,
|
|
513
|
+
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 }))),
|
|
514
|
+
(isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
|
|
515
|
+
react_1.default.createElement(react_2.PopoverTrigger, null,
|
|
516
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Pagination", placement: "top" },
|
|
517
|
+
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: (_1 = (_0 = theme.colors) === null || _0 === void 0 ? void 0 : _0.text) === null || _1 === void 0 ? void 0 : _1[500], _hover: {
|
|
518
|
+
color: (_3 = (_2 = theme.colors) === null || _2 === void 0 ? void 0 : _2.primary) === null || _3 === void 0 ? void 0 : _3[500]
|
|
519
|
+
} }))),
|
|
520
|
+
react_1.default.createElement(react_2.PopoverContent, { maxW: "22rem", p: 2, overflow: "hidden" },
|
|
521
|
+
react_1.default.createElement(react_2.PopoverBody, { p: 0 },
|
|
522
|
+
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 }))))))),
|
|
523
|
+
react_1.default.createElement(react_2.TableContainer, { ref: tableContainerRef, position: "relative", h: isTableLoading ? tableMaxH : undefined, maxH: !isTableLoading ? tableMaxH : undefined, pb: isTableLoading ? 0 : compactScrollbarPadding, overflowY: isCompactRows ? "hidden" : "auto", overflowX: "auto", sx: {
|
|
524
|
+
'&::-webkit-scrollbar': {
|
|
525
|
+
width: '6px',
|
|
526
|
+
height: isCompactRows ? '0px' : '6px',
|
|
527
|
+
},
|
|
528
|
+
'&:hover::-webkit-scrollbar': {
|
|
529
|
+
height: '6px',
|
|
530
|
+
},
|
|
531
|
+
'&::-webkit-scrollbar-track': {
|
|
532
|
+
background: theme.colors.gray[100],
|
|
533
|
+
borderRadius: '3px',
|
|
534
|
+
},
|
|
535
|
+
'&::-webkit-scrollbar-thumb': {
|
|
536
|
+
background: theme.colors.gray[400],
|
|
537
|
+
borderRadius: '3px',
|
|
538
|
+
},
|
|
539
|
+
'&::-webkit-scrollbar-thumb:hover': {
|
|
540
|
+
background: theme.colors.gray[500],
|
|
541
|
+
},
|
|
542
|
+
scrollbarWidth: isCompactRows ? 'none' : 'thin',
|
|
543
|
+
'&:hover': {
|
|
544
|
+
scrollbarWidth: 'thin',
|
|
501
545
|
},
|
|
546
|
+
scrollbarColor: "".concat(theme.colors.gray[400], " ").concat(theme.colors.gray[100]),
|
|
502
547
|
} },
|
|
503
|
-
react_1.default.createElement(react_3.
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
548
|
+
react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", minW: "100%", className: "table_wrapper", sx: {
|
|
549
|
+
width: "100%",
|
|
550
|
+
// `separate` (not `collapse`) so sticky header cells paint an opaque
|
|
551
|
+
// background over their borders — collapsed borders bleed scrolling
|
|
552
|
+
// content through the seams.
|
|
553
|
+
borderCollapse: "separate",
|
|
554
|
+
borderSpacing: 0,
|
|
555
|
+
"th .resize-handle": {
|
|
556
|
+
position: "absolute",
|
|
557
|
+
top: 0,
|
|
558
|
+
right: 0,
|
|
559
|
+
width: "8px",
|
|
560
|
+
height: "100%",
|
|
561
|
+
cursor: "col-resize",
|
|
562
|
+
backgroundColor: "transparent",
|
|
563
|
+
zIndex: 999,
|
|
564
|
+
},
|
|
565
|
+
} },
|
|
566
|
+
react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 4, bg: (_6 = (_5 = (_4 = theme.colors.table) === null || _4 === void 0 ? void 0 : _4.hover) === null || _5 === void 0 ? void 0 : _5[200]) !== null && _6 !== void 0 ? _6 : (_7 = theme.colors.secondary) === null || _7 === void 0 ? void 0 : _7[50] },
|
|
567
|
+
react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_8 = theme.colors) === null || _8 === void 0 ? void 0 : _8.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting })),
|
|
568
|
+
react_1.default.createElement(react_3.Tbody, null,
|
|
569
|
+
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 : (_9 = theme.colors) === null || _9 === void 0 ? void 0 : _9.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }))),
|
|
570
|
+
canInfinite && isLoadingMore && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", py: 3, gap: 2 },
|
|
571
|
+
react_1.default.createElement(react_2.Spinner, { size: "sm", color: (_11 = (_10 = theme.colors) === null || _10 === void 0 ? void 0 : _10.primary) === null || _11 === void 0 ? void 0 : _11[500] }),
|
|
572
|
+
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] }, "Loading more\u2026")))),
|
|
573
|
+
groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: "0.063rem solid ".concat((_14 = theme.colors.border) === null || _14 === void 0 ? void 0 : _14[500]) },
|
|
574
|
+
groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_16 = (_15 = theme.colors) === null || _15 === void 0 ? void 0 : _15.text) === null || _16 === void 0 ? void 0 : _16[500] }, groupLoadMoreCaption)),
|
|
575
|
+
canGroupLoadMore && (react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText })))))))));
|
|
513
576
|
}
|
|
@@ -59,19 +59,19 @@ var Pagination = react_1.default.memo(function (_a) {
|
|
|
59
59
|
!paginationSelectOptions && dataLength < 100 ? react_1.default.createElement("option", { value: 0 }) : null,
|
|
60
60
|
computedOptions.map(function (size, index) { return (react_1.default.createElement("option", { key: index, value: size }, String(size))); }))),
|
|
61
61
|
dataLength > 0 && (react_1.default.createElement(react_2.Flex, { w: "100%" },
|
|
62
|
-
react_1.default.createElement(ToolTip_1.default, { label: "First", placement: "top"
|
|
62
|
+
react_1.default.createElement(ToolTip_1.default, { label: "First", placement: "top" },
|
|
63
63
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: function () { return setCurrentPage(0); }, _hover: !isLeftDisabled ? { color: theme.colors.primary[500] } : {} },
|
|
64
64
|
react_1.default.createElement(lucide_react_1.ChevronsLeft, null))),
|
|
65
|
-
react_1.default.createElement(ToolTip_1.default, { label: "Previous", placement: "top"
|
|
65
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Previous", placement: "top" },
|
|
66
66
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: function () { return currentPage > 0 && setCurrentPage(currentPage - 1); }, _hover: !isLeftDisabled ? { color: theme.colors.primary[500] } : {} },
|
|
67
67
|
react_1.default.createElement(lucide_react_1.ChevronLeft, null))),
|
|
68
68
|
react_1.default.createElement(react_2.Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500] }, paginationText),
|
|
69
|
-
react_1.default.createElement(ToolTip_1.default, { label: "Next", placement: "top"
|
|
69
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Next", placement: "top" },
|
|
70
70
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: function () {
|
|
71
71
|
return currentPage < pages - 1 && setCurrentPage(currentPage + 1);
|
|
72
72
|
}, _hover: !isRightDisabled ? { color: theme.colors.primary[500] } : {} },
|
|
73
73
|
react_1.default.createElement(lucide_react_1.ChevronRight, null))),
|
|
74
|
-
react_1.default.createElement(ToolTip_1.default, { label: "Last", placement: "top"
|
|
74
|
+
react_1.default.createElement(ToolTip_1.default, { label: "Last", placement: "top" },
|
|
75
75
|
react_1.default.createElement(react_2.IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: function () { return setCurrentPage(pages - 1); }, _hover: !isRightDisabled ? { color: theme.colors.primary[500] } : {} },
|
|
76
76
|
react_1.default.createElement(lucide_react_1.ChevronsRight, null)))))));
|
|
77
77
|
});
|
|
@@ -65,7 +65,7 @@ var TableSearch = function (_a) {
|
|
|
65
65
|
handleDebounce(value);
|
|
66
66
|
};
|
|
67
67
|
return (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: "2" },
|
|
68
|
-
!showInput && (react_1.default.createElement(ToolTip_1.default, { label: "Search", placement: "top"
|
|
68
|
+
!showInput && (react_1.default.createElement(ToolTip_1.default, { label: "Search", placement: "top" },
|
|
69
69
|
react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Search, transform: "scaleX(-1)", cursor: "pointer", boxSize: 5, color: (_b = colors === null || colors === void 0 ? void 0 : colors.text) === null || _b === void 0 ? void 0 : _b[500], onClick: handleSearchClick, _hover: { color: (_c = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _c === void 0 ? void 0 : _c[500] } }))),
|
|
70
70
|
showInput ? (react_1.default.createElement(react_2.InputGroup, { maxW: "12.5rem", transition: "all 0.3s ease" },
|
|
71
71
|
react_1.default.createElement(react_2.Input, { placeholder: "Search...", value: query, onChange: handleInputChange, size: "sm", borderRadius: "md", borderColor: (_d = colors === null || colors === void 0 ? void 0 : colors.border) === null || _d === void 0 ? void 0 : _d[500], _focus: { borderColor: (_e = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _e === void 0 ? void 0 : _e[500] }, autoFocus: true }),
|
|
@@ -104,7 +104,7 @@ var TableSettings = function (_a) {
|
|
|
104
104
|
_hover: { color: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.text) === null || _e === void 0 ? void 0 : _e[600] },
|
|
105
105
|
};
|
|
106
106
|
return (react_2.default.createElement(react_1.Box, null,
|
|
107
|
-
react_2.default.createElement(ToolTip_1.default, { label: "Table Settings", placement: "top"
|
|
107
|
+
react_2.default.createElement(ToolTip_1.default, { label: "Table Settings", placement: "top" },
|
|
108
108
|
react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "flex-end", cursor: "pointer", transition: "all 0.2s ease", color: (_g = (_f = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _f === void 0 ? void 0 : _f.text) === null || _g === void 0 ? void 0 : _g[500], _hover: {
|
|
109
109
|
transform: "scale(1.1)",
|
|
110
110
|
color: (_j = (_h = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _h === void 0 ? void 0 : _h.primary) === null || _j === void 0 ? void 0 : _j[500]
|