nillud-data-table 1.2.4 → 1.2.6

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/dist/index.d.ts CHANGED
@@ -10,7 +10,8 @@ type Column = {
10
10
  width?: number;
11
11
  autoinc?: boolean;
12
12
  formatter?: (cell: string, row: TableElement) => ReactElement;
13
- exportCustomCell?: (cell: string, row: TableElement) => string;
13
+ headerFormatter?: (cell: string) => ReactElement;
14
+ exportCustomCell?: (title: string, row: TableElement) => string;
14
15
  headerFilter?: (headerValue: string, rowValue: string) => boolean;
15
16
  sortable?: boolean;
16
17
  filterable?: boolean;
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ var Column = ({ column, getSortField, sortBy, getFilters, filters }) => {
37
37
  };
38
38
  return /* @__PURE__ */ jsxs("div", { className: "ndt-column", children: [
39
39
  /* @__PURE__ */ jsxs("div", { className: "ndt-column-head", children: [
40
- /* @__PURE__ */ jsx3("span", { children: column.title }),
40
+ column.headerFormatter ? column.headerFormatter(column.title) : /* @__PURE__ */ jsx3("span", { children: column.title }),
41
41
  typeof column.autoinc === "undefined" && (typeof column.sortable === "undefined" || column.sortable) && /* @__PURE__ */ jsx3("div", { className: "ndt-sorter", onClick: toggleSort, children: currentSort === "asc" ? /* @__PURE__ */ jsx3(SortDown_default, {}) : currentSort === "desc" ? /* @__PURE__ */ jsx3(SortUp_default, {}) : /* @__PURE__ */ jsx3(SortDown_default, {}) })
42
42
  ] }),
43
43
  /* @__PURE__ */ jsx3("div", { className: "ndt-column-footer", children: typeof column.autoinc === "undefined" && (typeof column.filterable === "undefined" || column.filterable) && /* @__PURE__ */ jsx3(
@@ -477,10 +477,10 @@ var DataTable = forwardRef(({
477
477
  return processedData.slice(start, start + paginationSize);
478
478
  }, [processedData, paginationPage, paginationSize]);
479
479
  useEffect2(() => {
480
- if (!isInitialLoad) {
481
- setPaginationPage(0);
482
- }
483
- }, [filters, sortBy, isInitialLoad]);
480
+ if (Object.values(filters).some((value) => {
481
+ return value !== null && value !== void 0 && value !== "";
482
+ })) setPaginationPage(0);
483
+ }, [filters]);
484
484
  useDebouncedEffect(() => {
485
485
  localStorage.setItem(`${tableName}-filters`, JSON.stringify(filters));
486
486
  }, [filters, tableName], 500);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nillud-data-table",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",