funuicss 3.3.1 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/table/Table.js +7 -7
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.4",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/table/Table.js
CHANGED
|
@@ -75,20 +75,20 @@ var react_easy_export_1 = require("react-easy-export");
|
|
|
75
75
|
var View_1 = __importDefault(require("../view/View"));
|
|
76
76
|
function Table(_a) {
|
|
77
77
|
var _b, _c;
|
|
78
|
-
var children = _a.children, funcss = _a.funcss, bordered = _a.bordered, noStripped = _a.noStripped, hoverable = _a.hoverable, title = _a.title, showTotal = _a.showTotal, light = _a.light, dark = _a.dark, head = _a.head, body = _a.body, data = _a.data,
|
|
78
|
+
var children = _a.children, funcss = _a.funcss, bordered = _a.bordered, noStripped = _a.noStripped, hoverable = _a.hoverable, title = _a.title, showTotal = _a.showTotal, light = _a.light, dark = _a.dark, head = _a.head, body = _a.body, data = _a.data, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, right = _a.right, hideExport = _a.hideExport, height = _a.height, _e = _a.pageSize, pageSize = _e === void 0 ? data ? 10 : 0 : _e, // Default page size,
|
|
79
79
|
customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
|
|
80
80
|
rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields"]);
|
|
81
81
|
// Check if data is null or undefined before accessing its properties
|
|
82
82
|
// Replace this in your component
|
|
83
|
-
var
|
|
84
|
-
var
|
|
83
|
+
var _f = (0, react_1.useState)(''), search = _f[0], setSearch = _f[1];
|
|
84
|
+
var _g = (0, react_1.useState)(1), currentPage = _g[0], setCurrentPage = _g[1];
|
|
85
85
|
// Determine the total number of pages based on data length and page size
|
|
86
86
|
var totalPages = data ? Math.ceil((((_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.length) || 0) / pageSize) : 0;
|
|
87
87
|
// Calculate start and end indices for data pagination
|
|
88
88
|
var startIndex = data ? (currentPage - 1) * pageSize : 0;
|
|
89
89
|
var endIndex = data ? Math.min(startIndex + pageSize, ((_c = data === null || data === void 0 ? void 0 : data.data) === null || _c === void 0 ? void 0 : _c.length) || 0) : 0;
|
|
90
|
-
var
|
|
91
|
-
var
|
|
90
|
+
var _h = (0, react_1.useState)(null), selectedField = _h[0], setSelectedField = _h[1];
|
|
91
|
+
var _j = (0, react_1.useState)(null), selectedValue = _j[0], setSelectedValue = _j[1];
|
|
92
92
|
// Enhanced filter logic:
|
|
93
93
|
var normalize = function (val) { return val === null || val === void 0 ? void 0 : val.toString().toLowerCase().trim(); };
|
|
94
94
|
var matchesSearch = function (item) {
|
|
@@ -226,8 +226,8 @@ function Table(_a) {
|
|
|
226
226
|
isLoading &&
|
|
227
227
|
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function () { return (React.createElement(Row_1.default, { funcss: 'skeleton' })); }),
|
|
228
228
|
children ? children : ''),
|
|
229
|
-
(
|
|
230
|
-
React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center' },
|
|
229
|
+
(filteredData.length === 0 && !isLoading) &&
|
|
230
|
+
React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center center' },
|
|
231
231
|
React.createElement("div", null,
|
|
232
232
|
React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),
|
|
233
233
|
React.createElement("div", null,
|