funuicss 3.3.4 → 3.3.5
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.d.ts +6 -1
- package/ui/table/Table.js +39 -23
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.5",
|
|
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.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ type TableProps = {
|
|
|
22
22
|
body?: React.ReactNode;
|
|
23
23
|
height?: number;
|
|
24
24
|
pageSize?: number;
|
|
25
|
+
emptyResponse?: {
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
title?: React.ReactNode;
|
|
28
|
+
subtitle: React.ReactNode;
|
|
29
|
+
};
|
|
25
30
|
customColumns?: {
|
|
26
31
|
title: string;
|
|
27
32
|
render: (data: any) => React.ReactNode;
|
|
@@ -31,5 +36,5 @@ type TableProps = {
|
|
|
31
36
|
};
|
|
32
37
|
export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
|
|
33
38
|
customColumns, filterableFields, // New prop
|
|
34
|
-
...rest }: TableProps): React.JSX.Element;
|
|
39
|
+
emptyResponse, ...rest }: TableProps): React.JSX.Element;
|
|
35
40
|
export {};
|
package/ui/table/Table.js
CHANGED
|
@@ -55,6 +55,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
57
|
};
|
|
58
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
59
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
60
|
+
if (ar || !(i in from)) {
|
|
61
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
62
|
+
ar[i] = from[i];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
66
|
+
};
|
|
58
67
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
68
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
69
|
};
|
|
@@ -73,11 +82,13 @@ var Circle_1 = __importDefault(require("../specials/Circle"));
|
|
|
73
82
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
74
83
|
var react_easy_export_1 = require("react-easy-export");
|
|
75
84
|
var View_1 = __importDefault(require("../view/View"));
|
|
85
|
+
var ScrollInView_1 = __importDefault(require("../ScrollInView/ScrollInView"));
|
|
86
|
+
var Select_1 = __importDefault(require("../select/Select"));
|
|
76
87
|
function Table(_a) {
|
|
77
88
|
var _b, _c;
|
|
78
89
|
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
90
|
customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
|
|
80
|
-
rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields"]);
|
|
91
|
+
emptyResponse = _a.emptyResponse, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse"]);
|
|
81
92
|
// Check if data is null or undefined before accessing its properties
|
|
82
93
|
// Replace this in your component
|
|
83
94
|
var _f = (0, react_1.useState)(''), search = _f[0], setSearch = _f[1];
|
|
@@ -177,26 +188,31 @@ function Table(_a) {
|
|
|
177
188
|
data && filterableFields ?
|
|
178
189
|
React.createElement("div", { className: "col width-200-max" },
|
|
179
190
|
React.createElement(RowFlex_1.default, { gap: 0.7 },
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
selectedField && (React.createElement(
|
|
188
|
-
if (e
|
|
191
|
+
React.createElement(Select_1.default, { value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
|
|
192
|
+
{ text: '🔍 Filter', value: '' },
|
|
193
|
+
{ text: 'All*', value: '' }
|
|
194
|
+
], (filterableFields || []).map(function (field) { return ({
|
|
195
|
+
text: field,
|
|
196
|
+
value: field
|
|
197
|
+
}); }), true) }),
|
|
198
|
+
selectedField && (React.createElement(Select_1.default, { funcss: "width-200-max", value: selectedValue || '', onChange: function (e) {
|
|
199
|
+
if (e === 'clear_all') {
|
|
189
200
|
setSelectedField('');
|
|
190
201
|
}
|
|
191
202
|
else {
|
|
192
|
-
handleValueChange(e
|
|
203
|
+
handleValueChange(e);
|
|
193
204
|
handleChangePage(1);
|
|
194
205
|
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
}, options: __spreadArray(__spreadArray([
|
|
207
|
+
{ text: 'All*', value: '' }
|
|
208
|
+
], uniqueValues
|
|
209
|
+
.filter(Boolean) // remove null/undefined/empty
|
|
210
|
+
.map(function (item) { return ({
|
|
211
|
+
text: item.toString(),
|
|
212
|
+
value: item
|
|
213
|
+
}); }), true), [
|
|
214
|
+
{ text: 'Clear', value: 'clear_all' }
|
|
215
|
+
], false) }))))
|
|
200
216
|
: '',
|
|
201
217
|
React.createElement(React.Fragment, null,
|
|
202
218
|
React.createElement(RowFlex_1.default, { gap: 0.5 },
|
|
@@ -227,13 +243,13 @@ function Table(_a) {
|
|
|
227
243
|
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function () { return (React.createElement(Row_1.default, { funcss: 'skeleton' })); }),
|
|
228
244
|
children ? children : ''),
|
|
229
245
|
(filteredData.length === 0 && !isLoading) &&
|
|
230
|
-
React.createElement(
|
|
231
|
-
React.createElement(
|
|
232
|
-
React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
246
|
+
React.createElement(ScrollInView_1.default, null,
|
|
247
|
+
React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center center' },
|
|
248
|
+
React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.icon) || React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),
|
|
249
|
+
React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.title) ||
|
|
250
|
+
React.createElement(Text_1.default, { text: "No Record Found!", size: 'xl' })),
|
|
251
|
+
React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.subtitle) ||
|
|
252
|
+
React.createElement(Text_1.default, { text: "You can try reloading the page or check your query" }))))),
|
|
237
253
|
data &&
|
|
238
254
|
React.createElement(React.Fragment, null, pageSize &&
|
|
239
255
|
React.createElement(React.Fragment, null, filteredData.length > pageSize &&
|