tabulify 1.0.24 → 1.0.26
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.css +1 -1
- package/dist/index.cjs.js +70 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +71 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/SortIcon/IconCartDown.d.ts +2 -0
- package/dist/types/components/SortIcon/IconCartUp.d.ts +2 -0
- package/dist/types/components/SortIcon/index.d.ts +7 -0
- package/dist/types/components/Table/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +16 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container:after,.tabulify-container:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{overflow-wrap:break-word;padding:16px;position:relative}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
1
|
+
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{align-items:center;display:flex;justify-content:space-between;overflow-wrap:break-word;padding:16px;position:relative}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
package/dist/index.cjs.js
CHANGED
@@ -5,6 +5,34 @@ var React = require('react');
|
|
5
5
|
var getUniqueId = function (prefix) {
|
6
6
|
return "".concat(prefix !== null && prefix !== void 0 ? prefix : 'id', "-").concat(Date.now(), "-").concat(Math.random().toString(36).substring(2, 9));
|
7
7
|
};
|
8
|
+
var cx = function (classNames) {
|
9
|
+
return classNames.filter(function (i) { return i; }).join(' ');
|
10
|
+
};
|
11
|
+
var sortData = function (_a) {
|
12
|
+
var dataSource = _a.dataSource, sortBy = _a.sortBy, _b = _a.sortOrder, sortOrder = _b === void 0 ? 'asc' : _b;
|
13
|
+
if (!sortBy || !sortOrder)
|
14
|
+
return dataSource;
|
15
|
+
return dataSource.sort(function (a, b) {
|
16
|
+
var aValue = a[sortBy];
|
17
|
+
var bValue = b[sortBy];
|
18
|
+
// Handle null or undefined values
|
19
|
+
if (aValue == null)
|
20
|
+
return 1; // Push `null` or `undefined` to the end
|
21
|
+
if (bValue == null)
|
22
|
+
return -1;
|
23
|
+
// Handle numbers
|
24
|
+
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
25
|
+
return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;
|
26
|
+
}
|
27
|
+
// Handle strings
|
28
|
+
if (typeof aValue === 'string' && typeof bValue === 'string') {
|
29
|
+
var comparison = aValue.localeCompare(bValue);
|
30
|
+
return sortOrder === 'asc' ? comparison : -comparison;
|
31
|
+
}
|
32
|
+
// Default to no change for unsupported types
|
33
|
+
return 0;
|
34
|
+
});
|
35
|
+
};
|
8
36
|
|
9
37
|
/******************************************************************************
|
10
38
|
Copyright (c) Microsoft Corporation.
|
@@ -44,28 +72,40 @@ var Pagination = function (_a) {
|
|
44
72
|
return (React.createElement("div", { className: "tabulify-pagination" }, __spreadArray([], Array(totalPages), true).map(function (_, i) { return (React.createElement("button", { key: i, className: currentPage === i + 1 ? 'active' : '', onClick: function () { return onPageChange(i + 1); } }, i + 1)); })));
|
45
73
|
};
|
46
74
|
|
75
|
+
var IconCartDown = function () {
|
76
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-down", "data-testid": "sort-asc" },
|
77
|
+
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
78
|
+
React.createElement("path", { d: "M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z" })));
|
79
|
+
};
|
80
|
+
|
81
|
+
var IconCartUp = function () {
|
82
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-up", "data-testid": "sort-desc" },
|
83
|
+
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
84
|
+
React.createElement("path", { d: "M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z" })));
|
85
|
+
};
|
86
|
+
|
87
|
+
var SortIcon = function (_a) {
|
88
|
+
var sortOrder = _a.sortOrder;
|
89
|
+
if (sortOrder === 'asc')
|
90
|
+
return React.createElement(IconCartDown, null);
|
91
|
+
return React.createElement(IconCartUp, null);
|
92
|
+
};
|
93
|
+
|
47
94
|
// Table Component
|
48
95
|
var Table = function (_a) {
|
49
|
-
var columns = _a.columns, dataSource = _a.dataSource, rowSelection = _a.rowSelection, pagination = _a.pagination, dataIndex = _a.dataIndex, className = _a.className, width = _a.width, testId = _a.testId, onRowClick = _a.onRowClick;
|
96
|
+
var columns = _a.columns, dataSource = _a.dataSource, rowSelection = _a.rowSelection, pagination = _a.pagination, dataIndex = _a.dataIndex, className = _a.className, width = _a.width, testId = _a.testId, sort = _a.sort, onRowClick = _a.onRowClick;
|
50
97
|
var containerRef = React.useRef(null);
|
51
98
|
var _b = React.useState(false), isScrolledToEnd = _b[0], setIsScrolledToEnd = _b[1];
|
52
99
|
var _c = React.useState(false), isScrollStarted = _c[0], setIsScrollStarted = _c[1];
|
53
|
-
var _d = React.useState(false), hasScroll = _d[0], setHasScroll = _d[1];
|
54
100
|
var handleScroll = function () {
|
55
101
|
var container = containerRef.current;
|
56
102
|
if (container) {
|
57
103
|
var isAtEnd = container.scrollLeft + container.clientWidth >= container.scrollWidth;
|
58
|
-
console.log('DEBUG', {
|
59
|
-
width: container.scrollWidth,
|
60
|
-
cw: container.clientWidth,
|
61
|
-
left: container.scrollLeft,
|
62
|
-
});
|
63
104
|
setIsScrollStarted(container.scrollLeft > 0);
|
64
105
|
setIsScrolledToEnd(isAtEnd);
|
65
|
-
setHasScroll(container.scrollWidth >= container.clientWidth);
|
66
106
|
}
|
67
107
|
};
|
68
|
-
var
|
108
|
+
var _d = React.useState((pagination === null || pagination === void 0 ? void 0 : pagination.current) || 1), currentPage = _d[0], setCurrentPage = _d[1];
|
69
109
|
var pageSize = (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || dataSource.length;
|
70
110
|
// Handle pagination
|
71
111
|
var handlePageChange = function (page) {
|
@@ -73,20 +113,16 @@ var Table = function (_a) {
|
|
73
113
|
setCurrentPage(page);
|
74
114
|
(_a = pagination === null || pagination === void 0 ? void 0 : pagination.onChange) === null || _a === void 0 ? void 0 : _a.call(pagination, page);
|
75
115
|
};
|
116
|
+
// Sorted Data
|
117
|
+
var sortedData = sortData({
|
118
|
+
dataSource: dataSource,
|
119
|
+
sortBy: sort.sortBy,
|
120
|
+
sortOrder: sort.sortOrder,
|
121
|
+
});
|
76
122
|
// Paginate data
|
77
123
|
var paginatedData = pagination
|
78
|
-
?
|
79
|
-
:
|
80
|
-
var containerClassNames = React.useMemo(function () {
|
81
|
-
var classes = ['tabulify-container'];
|
82
|
-
if (hasScroll)
|
83
|
-
classes.push('has-scroll');
|
84
|
-
if (isScrolledToEnd)
|
85
|
-
classes.push('hide-right-shadow');
|
86
|
-
if (!isScrollStarted)
|
87
|
-
classes.push('hide-left-shadow');
|
88
|
-
return classes.join(' ');
|
89
|
-
}, [hasScroll, isScrolledToEnd, isScrollStarted]);
|
124
|
+
? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
125
|
+
: sortedData;
|
90
126
|
React.useEffect(function () {
|
91
127
|
var container = containerRef.current;
|
92
128
|
if (container) {
|
@@ -95,13 +131,23 @@ var Table = function (_a) {
|
|
95
131
|
}, []);
|
96
132
|
return (React.createElement("div", { className: className, "data-testid": testId },
|
97
133
|
React.createElement("div", { className: "tabulify-wrapper" },
|
98
|
-
React.createElement("div", { className:
|
134
|
+
React.createElement("div", { className: cx([
|
135
|
+
'tabulify-container',
|
136
|
+
width && 'has-scroll',
|
137
|
+
isScrolledToEnd && 'hide-right-shadow',
|
138
|
+
!isScrollStarted && 'hide-left-shadow',
|
139
|
+
]), ref: containerRef, onScroll: handleScroll },
|
99
140
|
React.createElement("table", { className: "tabulify-table", style: { width: width !== null && width !== void 0 ? width : '100%' } },
|
100
141
|
React.createElement("thead", { className: "tabulify-head" },
|
101
142
|
React.createElement("tr", null,
|
102
143
|
rowSelection && React.createElement("th", null),
|
103
|
-
columns.map(function (column) { return (React.createElement("th", { className:
|
104
|
-
|
144
|
+
columns.map(function (column) { return (React.createElement("th", { className: cx([
|
145
|
+
'tabulify-cell',
|
146
|
+
Boolean(sort) && 'has-hover',
|
147
|
+
]), key: getUniqueId(column.key), "data-testid": "table-head-th-".concat(String(column.key)), onClick: function () { return sort === null || sort === void 0 ? void 0 : sort.onSort(column.key); } },
|
148
|
+
React.createElement("div", null, column.title),
|
149
|
+
(sort === null || sort === void 0 ? void 0 : sort.sortBy) === column.key && (React.createElement(SortIcon, { sortOrder: sort.sortOrder })))); }))),
|
150
|
+
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), className: cx([Boolean(onRowClick) && 'has-hover']), "data-id": String(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))))),
|
105
151
|
pagination && (React.createElement("div", { className: "tabulify-pagination-wrapper" },
|
106
152
|
React.createElement(Pagination, { currentPage: currentPage, onPageChange: handlePageChange, pageSize: pageSize, total: pagination.total })))));
|
107
153
|
};
|
package/dist/index.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["export const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { getUniqueId } from '../../utils';\nimport Pagination from '../Pagination';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n const [hasScroll, setHasScroll] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n\n console.log('DEBUG', {\n width: container.scrollWidth,\n cw: container.clientWidth,\n left: container.scrollLeft,\n });\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n setHasScroll(container.scrollWidth >= container.clientWidth);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Paginate data\n const paginatedData = pagination\n ? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : dataSource;\n\n const containerClassNames = useMemo(() => {\n const classes = ['tabulify-container'];\n if (hasScroll) classes.push('has-scroll');\n if (isScrolledToEnd) classes.push('hide-right-shadow');\n if (!isScrollStarted) classes.push('hide-left-shadow');\n\n return classes.join(' ');\n }, [hasScroll, isScrolledToEnd, isScrollStarted]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={containerClassNames}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.title}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={Boolean(onRowClick) ? 'has-hover' : ''}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":["useRef","useState","useMemo","useEffect"],"mappings":";;;;AAAO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;;ACDjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAqMA;AACO,SAAS,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;AAC9C,IAAI,IAAI,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AACzF,QAAQ,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE;AAChC,Y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SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort.sortBy,\n sortOrder: sort.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div>{column.title}</div>\n {sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":["useRef","useState","useEffect"],"mappings":";;;;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;AAE1E,IAAM,EAAE,GAAG,UAAC,UAAgC,EAAA;AACjD,IAAA,OAAA,UAAU,CAAC,MAAM,CAAC,UAAC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EAAA,EAAI,SAAS,EAAC,eAAe,EAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EACvD,EAAA,MAAM,CAAC,MAAM,IACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAEhD,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,EAAG,CAAA,MAAA,CAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAI,CAC/B,CACE,EACN,EAAA,CAAC,CACC,EACN,EAAA,CAAC,CACI,CACF,CACJ,CACF;AACL,QAAA,UAAU,KACT,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
package/dist/index.esm.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container:after,.tabulify-container:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{overflow-wrap:break-word;padding:16px;position:relative}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
1
|
+
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{align-items:center;display:flex;justify-content:space-between;overflow-wrap:break-word;padding:16px;position:relative}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
package/dist/index.esm.js
CHANGED
@@ -1,8 +1,36 @@
|
|
1
|
-
import React, { useRef, useState,
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
2
2
|
|
3
3
|
var getUniqueId = function (prefix) {
|
4
4
|
return "".concat(prefix !== null && prefix !== void 0 ? prefix : 'id', "-").concat(Date.now(), "-").concat(Math.random().toString(36).substring(2, 9));
|
5
5
|
};
|
6
|
+
var cx = function (classNames) {
|
7
|
+
return classNames.filter(function (i) { return i; }).join(' ');
|
8
|
+
};
|
9
|
+
var sortData = function (_a) {
|
10
|
+
var dataSource = _a.dataSource, sortBy = _a.sortBy, _b = _a.sortOrder, sortOrder = _b === void 0 ? 'asc' : _b;
|
11
|
+
if (!sortBy || !sortOrder)
|
12
|
+
return dataSource;
|
13
|
+
return dataSource.sort(function (a, b) {
|
14
|
+
var aValue = a[sortBy];
|
15
|
+
var bValue = b[sortBy];
|
16
|
+
// Handle null or undefined values
|
17
|
+
if (aValue == null)
|
18
|
+
return 1; // Push `null` or `undefined` to the end
|
19
|
+
if (bValue == null)
|
20
|
+
return -1;
|
21
|
+
// Handle numbers
|
22
|
+
if (typeof aValue === 'number' && typeof bValue === 'number') {
|
23
|
+
return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;
|
24
|
+
}
|
25
|
+
// Handle strings
|
26
|
+
if (typeof aValue === 'string' && typeof bValue === 'string') {
|
27
|
+
var comparison = aValue.localeCompare(bValue);
|
28
|
+
return sortOrder === 'asc' ? comparison : -comparison;
|
29
|
+
}
|
30
|
+
// Default to no change for unsupported types
|
31
|
+
return 0;
|
32
|
+
});
|
33
|
+
};
|
6
34
|
|
7
35
|
/******************************************************************************
|
8
36
|
Copyright (c) Microsoft Corporation.
|
@@ -42,28 +70,40 @@ var Pagination = function (_a) {
|
|
42
70
|
return (React.createElement("div", { className: "tabulify-pagination" }, __spreadArray([], Array(totalPages), true).map(function (_, i) { return (React.createElement("button", { key: i, className: currentPage === i + 1 ? 'active' : '', onClick: function () { return onPageChange(i + 1); } }, i + 1)); })));
|
43
71
|
};
|
44
72
|
|
73
|
+
var IconCartDown = function () {
|
74
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-down", "data-testid": "sort-asc" },
|
75
|
+
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
76
|
+
React.createElement("path", { d: "M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z" })));
|
77
|
+
};
|
78
|
+
|
79
|
+
var IconCartUp = function () {
|
80
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-up", "data-testid": "sort-desc" },
|
81
|
+
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
82
|
+
React.createElement("path", { d: "M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z" })));
|
83
|
+
};
|
84
|
+
|
85
|
+
var SortIcon = function (_a) {
|
86
|
+
var sortOrder = _a.sortOrder;
|
87
|
+
if (sortOrder === 'asc')
|
88
|
+
return React.createElement(IconCartDown, null);
|
89
|
+
return React.createElement(IconCartUp, null);
|
90
|
+
};
|
91
|
+
|
45
92
|
// Table Component
|
46
93
|
var Table = function (_a) {
|
47
|
-
var columns = _a.columns, dataSource = _a.dataSource, rowSelection = _a.rowSelection, pagination = _a.pagination, dataIndex = _a.dataIndex, className = _a.className, width = _a.width, testId = _a.testId, onRowClick = _a.onRowClick;
|
94
|
+
var columns = _a.columns, dataSource = _a.dataSource, rowSelection = _a.rowSelection, pagination = _a.pagination, dataIndex = _a.dataIndex, className = _a.className, width = _a.width, testId = _a.testId, sort = _a.sort, onRowClick = _a.onRowClick;
|
48
95
|
var containerRef = useRef(null);
|
49
96
|
var _b = useState(false), isScrolledToEnd = _b[0], setIsScrolledToEnd = _b[1];
|
50
97
|
var _c = useState(false), isScrollStarted = _c[0], setIsScrollStarted = _c[1];
|
51
|
-
var _d = useState(false), hasScroll = _d[0], setHasScroll = _d[1];
|
52
98
|
var handleScroll = function () {
|
53
99
|
var container = containerRef.current;
|
54
100
|
if (container) {
|
55
101
|
var isAtEnd = container.scrollLeft + container.clientWidth >= container.scrollWidth;
|
56
|
-
console.log('DEBUG', {
|
57
|
-
width: container.scrollWidth,
|
58
|
-
cw: container.clientWidth,
|
59
|
-
left: container.scrollLeft,
|
60
|
-
});
|
61
102
|
setIsScrollStarted(container.scrollLeft > 0);
|
62
103
|
setIsScrolledToEnd(isAtEnd);
|
63
|
-
setHasScroll(container.scrollWidth >= container.clientWidth);
|
64
104
|
}
|
65
105
|
};
|
66
|
-
var
|
106
|
+
var _d = useState((pagination === null || pagination === void 0 ? void 0 : pagination.current) || 1), currentPage = _d[0], setCurrentPage = _d[1];
|
67
107
|
var pageSize = (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || dataSource.length;
|
68
108
|
// Handle pagination
|
69
109
|
var handlePageChange = function (page) {
|
@@ -71,20 +111,16 @@ var Table = function (_a) {
|
|
71
111
|
setCurrentPage(page);
|
72
112
|
(_a = pagination === null || pagination === void 0 ? void 0 : pagination.onChange) === null || _a === void 0 ? void 0 : _a.call(pagination, page);
|
73
113
|
};
|
114
|
+
// Sorted Data
|
115
|
+
var sortedData = sortData({
|
116
|
+
dataSource: dataSource,
|
117
|
+
sortBy: sort.sortBy,
|
118
|
+
sortOrder: sort.sortOrder,
|
119
|
+
});
|
74
120
|
// Paginate data
|
75
121
|
var paginatedData = pagination
|
76
|
-
?
|
77
|
-
:
|
78
|
-
var containerClassNames = useMemo(function () {
|
79
|
-
var classes = ['tabulify-container'];
|
80
|
-
if (hasScroll)
|
81
|
-
classes.push('has-scroll');
|
82
|
-
if (isScrolledToEnd)
|
83
|
-
classes.push('hide-right-shadow');
|
84
|
-
if (!isScrollStarted)
|
85
|
-
classes.push('hide-left-shadow');
|
86
|
-
return classes.join(' ');
|
87
|
-
}, [hasScroll, isScrolledToEnd, isScrollStarted]);
|
122
|
+
? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
123
|
+
: sortedData;
|
88
124
|
useEffect(function () {
|
89
125
|
var container = containerRef.current;
|
90
126
|
if (container) {
|
@@ -93,13 +129,23 @@ var Table = function (_a) {
|
|
93
129
|
}, []);
|
94
130
|
return (React.createElement("div", { className: className, "data-testid": testId },
|
95
131
|
React.createElement("div", { className: "tabulify-wrapper" },
|
96
|
-
React.createElement("div", { className:
|
132
|
+
React.createElement("div", { className: cx([
|
133
|
+
'tabulify-container',
|
134
|
+
width && 'has-scroll',
|
135
|
+
isScrolledToEnd && 'hide-right-shadow',
|
136
|
+
!isScrollStarted && 'hide-left-shadow',
|
137
|
+
]), ref: containerRef, onScroll: handleScroll },
|
97
138
|
React.createElement("table", { className: "tabulify-table", style: { width: width !== null && width !== void 0 ? width : '100%' } },
|
98
139
|
React.createElement("thead", { className: "tabulify-head" },
|
99
140
|
React.createElement("tr", null,
|
100
141
|
rowSelection && React.createElement("th", null),
|
101
|
-
columns.map(function (column) { return (React.createElement("th", { className:
|
102
|
-
|
142
|
+
columns.map(function (column) { return (React.createElement("th", { className: cx([
|
143
|
+
'tabulify-cell',
|
144
|
+
Boolean(sort) && 'has-hover',
|
145
|
+
]), key: getUniqueId(column.key), "data-testid": "table-head-th-".concat(String(column.key)), onClick: function () { return sort === null || sort === void 0 ? void 0 : sort.onSort(column.key); } },
|
146
|
+
React.createElement("div", null, column.title),
|
147
|
+
(sort === null || sort === void 0 ? void 0 : sort.sortBy) === column.key && (React.createElement(SortIcon, { sortOrder: sort.sortOrder })))); }))),
|
148
|
+
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), className: cx([Boolean(onRowClick) && 'has-hover']), "data-id": String(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))))),
|
103
149
|
pagination && (React.createElement("div", { className: "tabulify-pagination-wrapper" },
|
104
150
|
React.createElement(Pagination, { currentPage: currentPage, onPageChange: handlePageChange, pageSize: pageSize, total: pagination.total })))));
|
105
151
|
};
|
package/dist/index.esm.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["export const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { getUniqueId } from '../../utils';\nimport Pagination from '../Pagination';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n const [hasScroll, setHasScroll] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n\n console.log('DEBUG', {\n width: container.scrollWidth,\n cw: container.clientWidth,\n left: container.scrollLeft,\n });\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n setHasScroll(container.scrollWidth >= container.clientWidth);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Paginate data\n const paginatedData = pagination\n ? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : dataSource;\n\n const containerClassNames = useMemo(() => {\n const classes = ['tabulify-container'];\n if (hasScroll) classes.push('has-scroll');\n if (isScrolledToEnd) classes.push('hide-right-shadow');\n if (!isScrollStarted) classes.push('hide-left-shadow');\n\n return classes.join(' ');\n }, [hasScroll, isScrolledToEnd, isScrollStarted]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={containerClassNames}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.title}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={Boolean(onRowClick) ? 'has-hover' : ''}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":[],"mappings":";;AAAO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;;ACDjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAEhD,KAAG,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,CAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAI,CAC/B,CACE,IACN,CAAC,CACC,IACN,CAAC,CACI,CACF,CACJ,CACF;AACL,QAAA,UAAU,KACT,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort.sortBy,\n sortOrder: sort.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div>{column.title}</div>\n {sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":[],"mappings":";;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAA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AM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAClC,OAAO,EAAE,YAAM,EAAA,OAAA,UAAU,KAAA,IAAA,IAAV,UAAU,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAV,UAAU,CAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAA/B,EAA+B,EAE7C,EAAA,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAK,EAAA,QACvB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,eAAe,EAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EACvD,EAAA,MAAM,CAAC,MAAM,IACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAEhD,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,EAAG,CAAA,MAAA,CAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAI,CAC/B,CACE,EACN,EAAA,CAAC,CACC,EACN,EAAA,CAAC,CACI,CACF,CACJ,CACF;AACL,QAAA,UAAU,KACT,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { TableProps } from '../../types';
|
3
|
-
declare const Table: <T>({ columns, dataSource, rowSelection, pagination, dataIndex, className, width, testId, onRowClick, }: TableProps<T>) => React.JSX.Element;
|
3
|
+
declare const Table: <T>({ columns, dataSource, rowSelection, pagination, dataIndex, className, width, testId, sort, onRowClick, }: TableProps<T>) => React.JSX.Element;
|
4
4
|
export default Table;
|
@@ -1,4 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
export type SortOrder = 'asc' | 'desc';
|
3
|
+
type SortableKeys<T> = {
|
4
|
+
[K in keyof T]: T[K] extends number | string | null ? K : never;
|
5
|
+
}[keyof T];
|
2
6
|
export interface Column<T, K extends keyof T = keyof T> {
|
3
7
|
title: string;
|
4
8
|
key: K;
|
@@ -16,14 +20,26 @@ export interface Pagination {
|
|
16
20
|
current?: number;
|
17
21
|
onChange?: (page: number) => void;
|
18
22
|
}
|
23
|
+
export interface Sort<T> {
|
24
|
+
sortBy: SortableKeys<T>;
|
25
|
+
sortOrder: SortOrder;
|
26
|
+
onSort: (sortBy: keyof T) => void;
|
27
|
+
}
|
28
|
+
export interface SortOptions<T> {
|
29
|
+
dataSource: T[];
|
30
|
+
sortBy?: SortableKeys<T>;
|
31
|
+
sortOrder?: SortOrder;
|
32
|
+
}
|
19
33
|
export interface TableProps<T> {
|
20
34
|
columns: Column<T>[];
|
21
35
|
dataSource: T[];
|
22
36
|
dataIndex: keyof T;
|
23
37
|
rowSelection?: RowSelection<T>;
|
24
38
|
pagination?: Pagination;
|
39
|
+
sort?: Sort<T>;
|
25
40
|
className?: string;
|
26
41
|
width?: string;
|
27
42
|
testId?: string;
|
28
43
|
onRowClick?: (id: T[keyof T]) => void;
|
29
44
|
}
|
45
|
+
export {};
|