funuicss 3.3.6 → 3.3.8

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.6",
2
+ "version": "3.3.8",
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",
@@ -17,6 +17,7 @@ type TableProps = {
17
17
  "titles": string[];
18
18
  "funcss": string[];
19
19
  };
20
+ filterOnchange?: (filter?: any, value?: any, totals?: number) => {};
20
21
  head?: React.ReactNode;
21
22
  right?: React.ReactNode;
22
23
  body?: React.ReactNode;
@@ -36,5 +37,5 @@ type TableProps = {
36
37
  };
37
38
  export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
38
39
  customColumns, filterableFields, // New prop
39
- emptyResponse, ...rest }: TableProps): React.JSX.Element;
40
+ emptyResponse, filterOnchange, ...rest }: TableProps): React.JSX.Element;
40
41
  export {};
package/ui/table/Table.js CHANGED
@@ -88,7 +88,7 @@ function Table(_a) {
88
88
  var _b, _c;
89
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,
90
90
  customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
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"]);
91
+ emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse", "filterOnchange"]);
92
92
  // Check if data is null or undefined before accessing its properties
93
93
  // Replace this in your component
94
94
  var _f = (0, react_1.useState)(''), search = _f[0], setSearch = _f[1];
@@ -167,6 +167,11 @@ function Table(_a) {
167
167
  var uniqueValues = selectedField
168
168
  ? Array.from(new Set(dataArray.map(function (item) { return getNestedValue(item, selectedField); })))
169
169
  : [];
170
+ React.useEffect(function () {
171
+ if (filterOnchange) {
172
+ filterOnchange(selectedField, selectedValue, filteredData.length);
173
+ }
174
+ }, [selectedField, selectedValue]);
170
175
  return (React.createElement("div", { className: "".concat(funcss ? funcss : '', " roundEdge") },
171
176
  data &&
172
177
  React.createElement("div", { className: "padding bb" },
@@ -189,14 +194,14 @@ function Table(_a) {
189
194
  React.createElement("div", { className: "col width-200-max" },
190
195
  React.createElement(RowFlex_1.default, { gap: 0.7 },
191
196
  !selectedField &&
192
- React.createElement(Select_1.default, { value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
197
+ React.createElement(Select_1.default, { searchable: true, value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
193
198
  { text: '🔍 Filter', value: '' },
194
199
  { text: 'All*', value: '' }
195
200
  ], (filterableFields || []).map(function (field) { return ({
196
201
  text: field,
197
202
  value: field
198
203
  }); }), true) }),
199
- selectedField && (React.createElement(Select_1.default, { funcss: "width-200-max", value: selectedValue || '', onChange: function (e) {
204
+ selectedField && (React.createElement(Select_1.default, { searchable: true, funcss: "width-200-max", value: selectedValue || '', onChange: function (e) {
200
205
  if (e === 'clear_all') {
201
206
  setSelectedField('');
202
207
  }
@@ -243,7 +248,7 @@ function Table(_a) {
243
248
  isLoading &&
244
249
  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function () { return (React.createElement(Row_1.default, { funcss: 'skeleton' })); }),
245
250
  children ? children : ''),
246
- (filteredData.length === 0 && !isLoading) &&
251
+ (filteredData.length === 0 && !isLoading && !children) &&
247
252
  React.createElement(ScrollInView_1.default, null,
248
253
  React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center center' },
249
254
  React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.icon) || React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),