@codezee/sixtify-brahma 0.2.126 → 0.2.128

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.
Files changed (117) hide show
  1. package/package.json +1 -1
  2. package/packages/shared-components/dist/ActionButtons/FormActionButton.d.ts +16 -0
  3. package/packages/shared-components/dist/ActionButtons/FormActionButton.d.ts.map +1 -0
  4. package/packages/shared-components/dist/ActionButtons/FormActionButton.js +41 -0
  5. package/packages/shared-components/dist/ActionButtons/index.d.ts +1 -0
  6. package/packages/shared-components/dist/ActionButtons/index.d.ts.map +1 -1
  7. package/packages/shared-components/dist/ActionButtons/index.js +1 -0
  8. package/packages/shared-components/dist/ActionButtons/types.d.ts +3 -2
  9. package/packages/shared-components/dist/ActionButtons/types.d.ts.map +1 -1
  10. package/packages/shared-components/dist/AgGrid/ActionCell/ActionCell.d.ts +2 -1
  11. package/packages/shared-components/dist/AgGrid/ActionCell/ActionCell.d.ts.map +1 -1
  12. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.d.ts +2 -1
  13. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  14. package/packages/shared-components/dist/Button/Button.d.ts +2 -1
  15. package/packages/shared-components/dist/Button/Button.d.ts.map +1 -1
  16. package/packages/shared-components/dist/Button/SplitButton.d.ts +3 -2
  17. package/packages/shared-components/dist/Button/SplitButton.d.ts.map +1 -1
  18. package/packages/shared-components/dist/Chips/FilterPill.d.ts +2 -1
  19. package/packages/shared-components/dist/Chips/FilterPill.d.ts.map +1 -1
  20. package/packages/shared-components/dist/Chips/FilterPill.js +2 -2
  21. package/packages/shared-components/dist/ColumnArranger/ColumnArrangerDialog.d.ts +2 -1
  22. package/packages/shared-components/dist/ColumnArranger/ColumnArrangerDialog.d.ts.map +1 -1
  23. package/packages/shared-components/dist/Dialog/BottomDialog.d.ts +2 -1
  24. package/packages/shared-components/dist/Dialog/BottomDialog.d.ts.map +1 -1
  25. package/packages/shared-components/dist/Dialog/BottomDialog.js +1 -1
  26. package/packages/shared-components/dist/Dialog/DeleteDialog.d.ts +3 -2
  27. package/packages/shared-components/dist/Dialog/DeleteDialog.d.ts.map +1 -1
  28. package/packages/shared-components/dist/Dialog/DeleteDialog.js +1 -1
  29. package/packages/shared-components/dist/Dialog/SaveDialog.d.ts +3 -2
  30. package/packages/shared-components/dist/Dialog/SaveDialog.d.ts.map +1 -1
  31. package/packages/shared-components/dist/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.d.ts +2 -1
  32. package/packages/shared-components/dist/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.d.ts.map +1 -1
  33. package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts +2 -1
  34. package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts.map +1 -1
  35. package/packages/shared-components/dist/FilterList/FilterListV2.d.ts +2 -1
  36. package/packages/shared-components/dist/FilterList/FilterListV2.d.ts.map +1 -1
  37. package/packages/shared-components/dist/FilterList/FilterPopup.d.ts +3 -2
  38. package/packages/shared-components/dist/FilterList/FilterPopup.d.ts.map +1 -1
  39. package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts +4 -3
  40. package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts.map +1 -1
  41. package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.d.ts +2 -1
  42. package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.d.ts.map +1 -1
  43. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.d.ts.map +1 -1
  44. package/packages/shared-components/dist/FormFields/FileUpload/Dialogs/FilePreview.d.ts +4 -3
  45. package/packages/shared-components/dist/FormFields/FileUpload/Dialogs/FilePreview.d.ts.map +1 -1
  46. package/packages/shared-components/dist/FormFields/FileUpload/Dialogs/ViewFilePreviewDialog.d.ts +2 -1
  47. package/packages/shared-components/dist/FormFields/FileUpload/Dialogs/ViewFilePreviewDialog.d.ts.map +1 -1
  48. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.d.ts +2 -1
  49. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.d.ts.map +1 -1
  50. package/packages/shared-components/dist/FormFields/ImageUpload/PhotoCaptureDialog.d.ts +2 -1
  51. package/packages/shared-components/dist/FormFields/ImageUpload/PhotoCaptureDialog.d.ts.map +1 -1
  52. package/packages/shared-components/dist/FormFields/Select/Select.d.ts +2 -1
  53. package/packages/shared-components/dist/FormFields/Select/Select.d.ts.map +1 -1
  54. package/packages/shared-components/dist/PrintDownloadAction/PrintDownloadActions.d.ts +2 -1
  55. package/packages/shared-components/dist/PrintDownloadAction/PrintDownloadActions.d.ts.map +1 -1
  56. package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts +2 -1
  57. package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map +1 -1
  58. package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.js +11 -13
  59. package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/VirtualCheckboxList.d.ts.map +1 -1
  60. package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/VirtualCheckboxList.js +37 -6
  61. package/packages/shared-components/dist/SmartGrid/Components/FilterStatusPanel.d.ts +9 -0
  62. package/packages/shared-components/dist/SmartGrid/Components/FilterStatusPanel.d.ts.map +1 -0
  63. package/packages/shared-components/dist/SmartGrid/Components/FilterStatusPanel.js +69 -0
  64. package/packages/shared-components/dist/SmartGrid/Components/HeaderCell.d.ts +2 -1
  65. package/packages/shared-components/dist/SmartGrid/Components/HeaderCell.d.ts.map +1 -1
  66. package/packages/shared-components/dist/SmartGrid/Components/HeaderCell.js +4 -4
  67. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/DateRangeInput.d.ts +8 -0
  68. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/DateRangeInput.d.ts.map +1 -0
  69. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/DateRangeInput.js +127 -0
  70. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/StyleDateRangeWrapper.d.ts +6 -0
  71. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/StyleDateRangeWrapper.d.ts.map +1 -0
  72. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DateRangeInput/StyleDateRangeWrapper.js +120 -0
  73. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DebouncedInput.d.ts.map +1 -1
  74. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/DebouncedInput.js +1 -21
  75. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/GetRenderInputs.d.ts +2 -1
  76. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/GetRenderInputs.d.ts.map +1 -1
  77. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/GetRenderInputs.js +21 -10
  78. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.d.ts +2 -1
  79. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.d.ts.map +1 -1
  80. package/packages/shared-components/dist/SmartGrid/Components/SearchFilterRow/SearchFilterRow.js +2 -2
  81. package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.d.ts +0 -1
  82. package/packages/shared-components/dist/SmartGrid/Components/TableRowComponent.d.ts.map +1 -1
  83. package/packages/shared-components/dist/SmartGrid/SmartGrid.d.ts.map +1 -1
  84. package/packages/shared-components/dist/SmartGrid/SmartGrid.js +24 -6
  85. package/packages/shared-components/dist/SmartGrid/context/CellSelectionContext.d.ts +4 -3
  86. package/packages/shared-components/dist/SmartGrid/context/CellSelectionContext.d.ts.map +1 -1
  87. package/packages/shared-components/dist/SmartGrid/hooks/useCopyToClipboard.d.ts +2 -1
  88. package/packages/shared-components/dist/SmartGrid/hooks/useCopyToClipboard.d.ts.map +1 -1
  89. package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.d.ts.map +1 -1
  90. package/packages/shared-components/dist/SmartGrid/hooks/useGetColumnWidth.js +24 -8
  91. package/packages/shared-components/dist/SmartGrid/hooks/useGetFacetedFilter.d.ts +1 -0
  92. package/packages/shared-components/dist/SmartGrid/hooks/useGetFacetedFilter.d.ts.map +1 -1
  93. package/packages/shared-components/dist/SmartGrid/hooks/useGetFacetedFilter.js +46 -6
  94. package/packages/shared-components/dist/SmartGrid/hooks/useGetRowSelection.d.ts +2 -1
  95. package/packages/shared-components/dist/SmartGrid/hooks/useGetRowSelection.d.ts.map +1 -1
  96. package/packages/shared-components/dist/SmartGrid/hooks/useGetRowSelection.js +56 -7
  97. package/packages/shared-components/dist/SmartGrid/hooks/useTableState.d.ts.map +1 -1
  98. package/packages/shared-components/dist/SmartGrid/hooks/useTableState.js +2 -1
  99. package/packages/shared-components/dist/SmartGrid/types/index.d.ts +3 -1
  100. package/packages/shared-components/dist/SmartGrid/types/index.d.ts.map +1 -1
  101. package/packages/shared-components/dist/TabBar/TabsMenus.d.ts +3 -2
  102. package/packages/shared-components/dist/TabBar/TabsMenus.d.ts.map +1 -1
  103. package/packages/shared-components/dist/Toast/Toast.d.ts +2 -1
  104. package/packages/shared-components/dist/Toast/Toast.d.ts.map +1 -1
  105. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.d.ts +2 -1
  106. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.d.ts.map +1 -1
  107. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.js +1 -1
  108. package/packages/shared-components/dist/utils/hooks/useDialogActions.d.ts +2 -1
  109. package/packages/shared-components/dist/utils/hooks/useDialogActions.d.ts.map +1 -1
  110. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.d.ts +2 -1
  111. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.d.ts.map +1 -1
  112. package/packages/shared-components/dist/utils/index.d.ts +1 -0
  113. package/packages/shared-components/dist/utils/index.d.ts.map +1 -1
  114. package/packages/shared-components/dist/utils/index.js +1 -0
  115. package/packages/shared-components/dist/utils/types.d.ts +2 -0
  116. package/packages/shared-components/dist/utils/types.d.ts.map +1 -0
  117. package/packages/shared-components/dist/utils/types.js +2 -0
@@ -1,42 +1,22 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.DebouncedInput = void 0;
7
4
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const Close_1 = __importDefault(require("@mui/icons-material/Close"));
9
5
  const material_1 = require("@mui/material");
10
6
  const react_1 = require("react");
11
7
  const usehooks_ts_1 = require("usehooks-ts");
12
8
  const DebouncedInput = ({ debounce = 500, inputFontSize = "14px", inputHeight = "10px", onChange, type = "text", value: initialValue, ...props }) => {
13
9
  const [value, setValue] = (0, react_1.useState)(initialValue);
14
10
  const [debouncedValue] = (0, usehooks_ts_1.useDebounceValue)(value, debounce);
15
- // Sync local state when initialValue changes from parent
16
11
  (0, react_1.useEffect)(() => {
17
12
  setValue(initialValue);
18
13
  }, [initialValue]);
19
- // Call onChange when debounced value changes
20
14
  (0, react_1.useEffect)(() => {
21
15
  if (debouncedValue !== initialValue) {
22
16
  onChange(debouncedValue);
23
17
  }
24
18
  }, [debouncedValue, initialValue]);
25
- // useCallback is used here to memoize the handleClear function
26
- // This prevents unnecessary re-renders of child components (like IconButton)
27
- // that depend on this function, improving performance
28
- const handleClear = (0, react_1.useCallback)((e) => {
29
- e.preventDefault();
30
- setValue("");
31
- }, [onChange]);
32
- return ((0, jsx_runtime_1.jsx)(material_1.TextField, { ...props, type: type, value: value, onChange: (e) => setValue(e.target.value), placeholder: type === "date" ? "dd/mm/yyyy" : "Search..", InputProps: {
33
- endAdornment: type === "date" && value ? ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: { mr: -3 }, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: handleClear, sx: {
34
- p: 0.2,
35
- position: "absolute",
36
- right: 30,
37
- zIndex: 1,
38
- }, children: (0, jsx_runtime_1.jsx)(Close_1.default, { fontSize: "small" }) }) })) : undefined,
39
- }, sx: {
19
+ return ((0, jsx_runtime_1.jsx)(material_1.TextField, { ...props, type: type, value: value, onChange: (e) => setValue(e.target.value), placeholder: "Search..", sx: {
40
20
  "& .MuiInputAdornment-root": {
41
21
  margin: 0,
42
22
  },
@@ -3,7 +3,8 @@ type GetRenderInputsProps<T> = {
3
3
  filterVariant?: "smartTextFilter" | "smartNumberFilter" | "smartDateFilter" | "smartSelectFilter";
4
4
  header: Header<T, unknown>;
5
5
  headerDyanmicWidth: number;
6
+ resetAllFilters: boolean;
6
7
  };
7
- export declare const GetRenderInputs: <T>({ filterVariant, header, headerDyanmicWidth, }: GetRenderInputsProps<T>) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const GetRenderInputs: <T>({ filterVariant, header, headerDyanmicWidth, resetAllFilters, }: GetRenderInputsProps<T>) => import("react/jsx-runtime").JSX.Element | null;
8
9
  export {};
9
10
  //# sourceMappingURL=GetRenderInputs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GetRenderInputs.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/SearchFilterRow/GetRenderInputs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpD,KAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,aAAa,CAAC,EACV,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,gDAIjC,oBAAoB,CAAC,CAAC,CAAC,mDAyGzB,CAAC"}
1
+ {"version":3,"file":"GetRenderInputs.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/SearchFilterRow/GetRenderInputs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAMpD,KAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,aAAa,CAAC,EACV,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,iEAKjC,oBAAoB,CAAC,CAAC,CAAC,mDA0HzB,CAAC"}
@@ -3,17 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetRenderInputs = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
+ const DateRangeInput_1 = require("./DateRangeInput/DateRangeInput");
6
7
  const DebouncedInput_1 = require("./DebouncedInput");
7
- const GetRenderInputs = ({ filterVariant, header, headerDyanmicWidth, }) => {
8
+ const GetRenderInputs = ({ filterVariant, header, headerDyanmicWidth, resetAllFilters, }) => {
8
9
  const { columnDef, getFilterValue, setFilterValue } = header.column;
9
10
  const { facetedFilter, filterParams, filterVariant: hasFilterVariant, } = columnDef;
10
11
  const isCombinedFilter = facetedFilter && hasFilterVariant;
11
- const filterValue = (getFilterValue() ??
12
- (isCombinedFilter ? { facets: [], search: "" } : ""));
12
+ const rawFilterValue = getFilterValue();
13
+ const combinedFilterValue = isCombinedFilter
14
+ ? (rawFilterValue ?? { facets: [], search: "" })
15
+ : undefined;
13
16
  const updateCombinedFilter = (updates) => {
14
17
  if (isCombinedFilter) {
15
18
  setFilterValue({
16
- ...filterValue,
19
+ ...combinedFilterValue,
17
20
  ...updates,
18
21
  });
19
22
  }
@@ -21,17 +24,23 @@ const GetRenderInputs = ({ filterVariant, header, headerDyanmicWidth, }) => {
21
24
  const commonInputStyle = { width: headerDyanmicWidth - 20 };
22
25
  const commonSelectStyle = { width: headerDyanmicWidth - 10 };
23
26
  const getValue = () => isCombinedFilter
24
- ? (filterValue.search ?? "")
25
- : filterValue;
27
+ ? (combinedFilterValue?.search ?? "")
28
+ : // eslint-disable-next-line sonarjs/no-nested-conditional
29
+ typeof rawFilterValue === "string"
30
+ ? rawFilterValue
31
+ : "";
26
32
  const setValue = (value) => isCombinedFilter
27
33
  ? updateCombinedFilter({ search: value })
28
34
  : setFilterValue(value);
29
- const renderDebouncedInput = (type) => ((0, jsx_runtime_1.jsx)(DebouncedInput_1.DebouncedInput, { onChange: (value) => setValue(value), type: type, value: getValue(), style: commonInputStyle }));
35
+ const renderDebouncedInput = (type) => ((0, jsx_runtime_1.jsx)(DebouncedInput_1.DebouncedInput, { onChange: (value) => setValue(resetAllFilters ? "" : value), type: type, value: resetAllFilters ? "" : getValue(), style: commonInputStyle }));
30
36
  const renderSelectInput = () => {
31
37
  const options = filterParams?.filterOptions ?? [];
32
38
  const value = isCombinedFilter
33
- ? filterValue.search
34
- : filterValue;
39
+ ? (combinedFilterValue?.search ?? "")
40
+ : // eslint-disable-next-line sonarjs/no-nested-conditional
41
+ typeof rawFilterValue === "string"
42
+ ? rawFilterValue
43
+ : "";
35
44
  const selected = options.find((opt) => opt.value === value) || null;
36
45
  const handleChange = (_, newValue) => setValue(newValue ? newValue.value : "");
37
46
  return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { options: options, getOptionLabel: (option) => option.label || "", value: selected, onChange: handleChange, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, variant: "outlined", placeholder: "All", sx: {
@@ -50,7 +59,9 @@ const GetRenderInputs = ({ filterVariant, header, headerDyanmicWidth, }) => {
50
59
  case "smartNumberFilter":
51
60
  return renderDebouncedInput("number");
52
61
  case "smartDateFilter":
53
- return renderDebouncedInput("date");
62
+ return ((0, jsx_runtime_1.jsx)(DateRangeInput_1.DateRangeInput, { width: commonInputStyle.width, initialValue: Array.isArray(rawFilterValue)
63
+ ? rawFilterValue
64
+ : undefined, onApply: (dates) => setFilterValue(dates) }));
54
65
  case "smartSelectFilter":
55
66
  return renderSelectInput();
56
67
  default:
@@ -1,7 +1,8 @@
1
1
  import type { Header } from "@tanstack/react-table";
2
2
  type SearchFilterRowProps<T> = {
3
3
  header: Header<T, unknown>;
4
+ resetAllFilters: boolean;
4
5
  };
5
- export declare const SearchFilterRow: <T>({ header }: SearchFilterRowProps<T>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const SearchFilterRow: <T>({ header, resetAllFilters, }: SearchFilterRowProps<T>) => import("react/jsx-runtime").JSX.Element;
6
7
  export {};
7
8
  //# sourceMappingURL=SearchFilterRow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchFilterRow.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/SearchFilterRow/SearchFilterRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpD,KAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,YAAY,oBAAoB,CAAC,CAAC,CAAC,4CA+CtE,CAAC"}
1
+ {"version":3,"file":"SearchFilterRow.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/SearchFilterRow/SearchFilterRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpD,KAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,8BAGjC,oBAAoB,CAAC,CAAC,CAAC,4CAgDzB,CAAC"}
@@ -4,7 +4,7 @@ exports.SearchFilterRow = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const GetRenderInputs_1 = require("./GetRenderInputs");
7
- const SearchFilterRow = ({ header }) => {
7
+ const SearchFilterRow = ({ header, resetAllFilters, }) => {
8
8
  const theme = (0, material_1.useTheme)();
9
9
  const { iron, slate } = theme.palette.app.color;
10
10
  const headerDyanmicWidth = header.column.getIsPinned()
@@ -29,6 +29,6 @@ const SearchFilterRow = ({ header }) => {
29
29
  textAlign: "left",
30
30
  width: headerDyanmicWidth,
31
31
  zIndex: header.column.getIsPinned() ? 3 : 0,
32
- }, children: filterVariant ? ((0, jsx_runtime_1.jsx)(GetRenderInputs_1.GetRenderInputs, { filterVariant: filterVariant, header: header, headerDyanmicWidth: headerDyanmicWidth })) : ("-") }));
32
+ }, children: filterVariant ? ((0, jsx_runtime_1.jsx)(GetRenderInputs_1.GetRenderInputs, { filterVariant: filterVariant, header: header, headerDyanmicWidth: headerDyanmicWidth, resetAllFilters: resetAllFilters })) : ("-") }));
33
33
  };
34
34
  exports.SearchFilterRow = SearchFilterRow;
@@ -12,7 +12,6 @@ type TableRowComponentProps<T> = {
12
12
  isSummaryRow?: boolean;
13
13
  row: Row<T>;
14
14
  rowHeight: number;
15
- rowSelection?: boolean;
16
15
  summaryData?: SummaryRecord<T>;
17
16
  virtualRow: VirtualItem;
18
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TableRowComponent.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/TableRowComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAO3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/B,UAAU,EAAE,WAAW,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAG,4GAUnC,sBAAsB,CAAC,CAAC,CAAC,4CAkP3B,CAAC"}
1
+ {"version":3,"file":"TableRowComponent.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/Components/TableRowComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAO3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/B,UAAU,EAAE,WAAW,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAG,4GAUnC,sBAAsB,CAAC,CAAC,CAAC,4CAkP3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SmartGrid.d.ts","sourceRoot":"","sources":["../../src/SmartGrid/SmartGrid.tsx"],"names":[],"mappings":"AAIA,OAAO,KAMN,MAAM,OAAO,CAAC;AAcf,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAC;AA6BjB,KAAK,aAAa,GAAG,KAAK,CAAC,yBAAyB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GAC3E,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAErE,eAAO,MAAM,SAAS,EAuTjB,aAAa,CAAC"}
1
+ {"version":3,"file":"SmartGrid.d.ts","sourceRoot":"","sources":["../../src/SmartGrid/SmartGrid.tsx"],"names":[],"mappings":"AAIA,OAAO,KAON,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAC;AA6BjB,KAAK,aAAa,GAAG,KAAK,CAAC,yBAAyB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GAC3E,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAErE,eAAO,MAAM,SAAS,EAwVjB,aAAa,CAAC"}
@@ -7,6 +7,7 @@ const react_virtual_1 = require("@tanstack/react-virtual");
7
7
  const react_1 = require("react");
8
8
  const CircularLoader_1 = require("./Components/CircularLoader");
9
9
  const DataNotFound_1 = require("./Components/DataNotFound");
10
+ const FilterStatusPanel_1 = require("./Components/FilterStatusPanel");
10
11
  const HeaderCell_1 = require("./Components/HeaderCell");
11
12
  const SearchFilterRow_1 = require("./Components/SearchFilterRow/SearchFilterRow");
12
13
  const TableFooterComponent_1 = require("./Components/TableFooterComponent/TableFooterComponent");
@@ -26,14 +27,16 @@ const calculateGroupSummary = (groupRow, globalSummary, dynamicSummaryConfig) =>
26
27
  }
27
28
  return globalSummary ? globalSummary : {};
28
29
  };
29
- exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], emptyMessage = "No data found", enableCellSelection = false, exportActions = [], exportData = false, height = "calc(100vh - 130px)", loading = false, rowHeight = 38, rowSelection = false, totalCount = 0, ...props }, ref) => {
30
+ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], dynamicRowSelection = () => true, emptyMessage = "No data found", enableCellSelection = false, exportActions = [], exportData = false, height = "calc(100vh - 130px)", loading = false, rowHeight = 38, rowSelection = false, totalCount = 0, ...props }, ref) => {
30
31
  const theme = (0, material_1.useTheme)();
31
32
  const { butterflyBlue } = theme.palette.app.color;
33
+ const [resetAllFilters, setResetAllFilters] = (0, react_1.useState)(false);
32
34
  const containerRef = (0, react_1.useRef)(null);
33
35
  const headerRef = (0, react_1.useRef)(null);
34
36
  const { columns: propsColumns, data, dynamicSummaryConfig, summary, } = props;
35
37
  const { columns } = (0, useGetRowSelection_1.useGetRowSelection)({
36
38
  defaultColumn: propsColumns,
39
+ dynamicRowSelection,
37
40
  rowSelection,
38
41
  });
39
42
  const { table } = (0, useTableState_1.useTableState)({
@@ -112,6 +115,17 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], emptyMessag
112
115
  return hasFilterVariant || (hasFacetedFilter && !isCombinedFilter);
113
116
  }));
114
117
  }, [columns]);
118
+ const clearAllFilters = () => {
119
+ table.setColumnFilters([]);
120
+ table.resetColumnFilters();
121
+ getHeaderGroups()
122
+ .flatMap((group) => group.headers)
123
+ .forEach((header) => header.column.setFilterValue(undefined));
124
+ setResetAllFilters(true);
125
+ setTimeout(() => {
126
+ setResetAllFilters(false);
127
+ }, 100);
128
+ };
115
129
  return ((0, jsx_runtime_1.jsxs)(CellSelectionContext_1.CellSelectionProvider, { value: {
116
130
  ...cellSelection,
117
131
  enabled: enableCellSelection,
@@ -151,11 +165,15 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], emptyMessag
151
165
  zIndex: 10,
152
166
  }, children: getHeaderGroups().map((headerGroup) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [headerGroup.headers
153
167
  .filter((h) => h.column.getIsPinned() === "left")
154
- .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading }, header.id))), headerGroup.headers
168
+ .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id))), headerGroup.headers
155
169
  .filter((h) => !h.column.getIsPinned())
156
- .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading }, header.id))), headerGroup.headers
170
+ .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id))), headerGroup.headers
157
171
  .filter((h) => h.column.getIsPinned() === "right")
158
- .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading }, header.id)))] }, headerGroup.id), enableSecondRowFilter && !loading && ((0, jsx_runtime_1.jsx)("tr", { children: headerGroup.headers.map((header) => ((0, jsx_runtime_1.jsx)(SearchFilterRow_1.SearchFilterRow, { header: header }, header.id))) }))] }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)("tbody", { style: {
172
+ .map((header) => ((0, jsx_runtime_1.jsx)(HeaderCell_1.HeaderCell, { header: header, loading: loading, resetAllFilters: resetAllFilters }, header.id)))] }, headerGroup.id), enableSecondRowFilter &&
173
+ headerGroup.depth ===
174
+ table.getHeaderGroups().length - 1 &&
175
+ !loading && ((0, jsx_runtime_1.jsx)("tr", { children: headerGroup.headers.map((header) => header.subHeaders.length === 0 ? ((0, jsx_runtime_1.jsx)(SearchFilterRow_1.SearchFilterRow, { header: header, resetAllFilters: resetAllFilters }, header.id)) : ((0, jsx_runtime_1.jsx)("th", {}, header.id) // empty cell under grouped headers
176
+ )) }))] }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)("tbody", { style: {
159
177
  filter: loading ? "blur(2px)" : "none",
160
178
  height: `${rowVirtualizer.getTotalSize()}px`,
161
179
  position: "relative",
@@ -166,7 +184,7 @@ exports.SmartGrid = (0, react_1.forwardRef)(({ defaultGrouping = [], emptyMessag
166
184
  return null;
167
185
  }
168
186
  const { groupId, isSummary, row, summaryData } = enhancedRow;
169
- return ((0, jsx_runtime_1.jsx)(TableRowComponent_1.TableRowComponent, { columnWidths: columnWidths, row: row, index: virtualRow.index, virtualRow: virtualRow, rowHeight: rowHeight, rowSelection: rowSelection, isSummaryRow: isSummary, summaryData: summaryData, exportData: exportData, exportActions: exportActions }, `table-row-${virtualRow.index}-${isSummary ? "summary" : "normal"}-${groupId}`));
170
- }) }), !loading && summary && ((0, jsx_runtime_1.jsx)(TableFooterComponent_1.TableFooterComponent, { table: table, summary: summary }))] }) }), rowSelection && getSelectedRowModel().rows.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { style: { fontSize: "14px" }, children: ["Selected Rows: ", getSelectedRowModel().rows.length] })), loading && (0, jsx_runtime_1.jsx)(CircularLoader_1.CircularLoader, {}), !rows.length && !loading && (0, jsx_runtime_1.jsx)(DataNotFound_1.DataNotFound, { message: emptyMessage })] })] }));
187
+ return ((0, jsx_runtime_1.jsx)(TableRowComponent_1.TableRowComponent, { columnWidths: columnWidths, row: row, index: virtualRow.index, virtualRow: virtualRow, rowHeight: rowHeight, isSummaryRow: isSummary, summaryData: summaryData, exportData: exportData, exportActions: exportActions }, `table-row-${virtualRow.index}-${isSummary ? "summary" : "normal"}-${groupId}`));
188
+ }) }), !loading && summary && ((0, jsx_runtime_1.jsx)(TableFooterComponent_1.TableFooterComponent, { table: table, summary: summary }))] }) }), rowSelection && getSelectedRowModel().rows.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { style: { fontSize: "14px" }, children: ["Selected Rows: ", getSelectedRowModel().rows.length] })), (0, jsx_runtime_1.jsx)(FilterStatusPanel_1.FilterStatusPanel, { table: table, clearAllFilters: clearAllFilters }), loading && (0, jsx_runtime_1.jsx)(CircularLoader_1.CircularLoader, {}), !rows.length && !loading && (0, jsx_runtime_1.jsx)(DataNotFound_1.DataNotFound, { message: emptyMessage })] })] }));
171
189
  });
172
190
  exports.SmartGrid.displayName = "SmartGrid";
@@ -1,15 +1,16 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { CellSelectionState } from "../types";
3
+ import type { OnAction } from "../../utils/types";
3
4
  type CellSelectionContextType = {
4
- clearCellSelection: () => void;
5
+ clearCellSelection: OnAction;
5
6
  enabled: boolean;
6
- endCellSelection: () => void;
7
+ endCellSelection: OnAction;
7
8
  getCellSelectionData: () => string[][];
8
9
  isCellSelected: (rowId: string, columnId: string) => boolean;
9
10
  isCopyFlashing: boolean;
10
11
  selectionState: CellSelectionState;
11
12
  startCellSelection: (rowId: string, columnId: string, isShiftClick?: boolean) => void;
12
- triggerCopyFlash: () => void;
13
+ triggerCopyFlash: OnAction;
13
14
  updateCellSelection: (rowId: string, columnId: string) => void;
14
15
  };
15
16
  type CellSelectionProviderProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"CellSelectionContext.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/context/CellSelectionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,KAAK,wBAAwB,GAAG;IAC9B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,oBAAoB,EAAE,MAAM,MAAM,EAAE,EAAE,CAAC;IACvC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7D,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,kBAAkB,CAAC;IACnC,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,OAAO,KACnB,IAAI,CAAC;IACV,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE,CAAC;AAMF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,sBAGnC,0BAA0B,4CAM5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,wBAU1C,CAAC"}
1
+ {"version":3,"file":"CellSelectionContext.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/context/CellSelectionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,KAAK,wBAAwB,GAAG;IAC9B,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,oBAAoB,EAAE,MAAM,MAAM,EAAE,EAAE,CAAC;IACvC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7D,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,kBAAkB,CAAC;IACnC,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,OAAO,KACnB,IAAI,CAAC;IACV,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE,CAAC;AAMF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,sBAGnC,0BAA0B,4CAM5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,wBAU1C,CAAC"}
@@ -1,8 +1,9 @@
1
+ import type { OnAction } from "../../utils/types";
1
2
  type UseCopyToClipboardArgs = {
2
3
  enabled: boolean;
3
4
  getCellSelectionData: () => string[][];
4
5
  hasSelection: boolean;
5
- triggerCopyFlash: () => void;
6
+ triggerCopyFlash: OnAction;
6
7
  };
7
8
  export declare const useCopyToClipboard: ({ enabled, getCellSelectionData, hasSelection, triggerCopyFlash, }: UseCopyToClipboardArgs) => {
8
9
  copyToClipboard: (data: string[][]) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,MAAM,EAAE,EAAE,CAAC;IACvC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,oEAKhC,sBAAsB;4BAER,MAAM,EAAE,EAAE;CA8F1B,CAAC"}
1
+ {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useCopyToClipboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,MAAM,EAAE,EAAE,CAAC;IACvC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,QAAQ,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,oEAKhC,sBAAsB;4BAER,MAAM,EAAE,EAAE;CA8F1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGetColumnWidth.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetColumnWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACpD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,gCAIlC,sBAAsB,CAAC,CAAC,CAAC;;CA+C3B,CAAC"}
1
+ {"version":3,"file":"useGetColumnWidth.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetColumnWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACpD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,gCAIlC,sBAAsB,CAAC,CAAC,CAAC;;CAkE3B,CAAC"}
@@ -9,16 +9,32 @@ const useGetColumnWidth = ({ columns, headerRef, table, }) => {
9
9
  const rowDataLength = getRowModel().rows.length;
10
10
  const updateColumnWidths = (0, react_1.useCallback)(() => {
11
11
  if (headerRef.current) {
12
- const headerCells = headerRef.current.querySelectorAll("th");
13
- const widths = Array.from(headerCells).map((cell) => {
14
- const columnId = cell.getAttribute("data-column-id");
15
- const columnDef = columnId ? getColumn(columnId)?.columnDef : null;
16
- return cell.getBoundingClientRect().width ?? columnDef?.size ?? 50;
17
- });
18
- setColumnWidths(widths);
12
+ const headerRows = headerRef.current.querySelectorAll("tr");
13
+ const lastHeaderRow = headerRows[headerRows.length - 1];
14
+ if (lastHeaderRow) {
15
+ const headerCells = lastHeaderRow.querySelectorAll("th");
16
+ const widths = Array.from(headerCells).map((cell) => {
17
+ const columnId = cell.getAttribute("data-column-id");
18
+ const columnDef = columnId ? getColumn(columnId)?.columnDef : null;
19
+ return cell.getBoundingClientRect().width ?? columnDef?.size ?? 50;
20
+ });
21
+ setColumnWidths(widths);
22
+ }
19
23
  }
20
24
  else {
21
- setColumnWidths(columns.map((col) => col.size ?? 50));
25
+ const flatColumns = [];
26
+ const flattenColumns = (cols) => {
27
+ cols.forEach((col) => {
28
+ if ("columns" in col && col.columns) {
29
+ flattenColumns(col.columns);
30
+ }
31
+ else {
32
+ flatColumns.push(col);
33
+ }
34
+ });
35
+ };
36
+ flattenColumns(columns);
37
+ setColumnWidths(flatColumns.map((col) => col.size ?? 150));
22
38
  }
23
39
  }, [headerRef, table, columns]);
24
40
  (0, react_1.useEffect)(() => {
@@ -5,6 +5,7 @@ type UseGetFacetedFilterProps<T> = {
5
5
  };
6
6
  export declare const useGetFacetedFilter: <T>({ columns, }: UseGetFacetedFilterProps<T>) => {
7
7
  combinedFilter: FilterFn<T>;
8
+ dateRangeFilter: FilterFn<T>;
8
9
  includesSome: FilterFn<T>;
9
10
  processedColumns: AppColumnDef<T>[];
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useGetFacetedFilter.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetFacetedFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,UAAU,CAAC;AAE7D,KAAK,wBAAwB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,cAEpC,wBAAwB,CAAC,CAAC,CAAC;;;;CA4F7B,CAAC"}
1
+ {"version":3,"file":"useGetFacetedFilter.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetFacetedFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,UAAU,CAAC;AAE7D,KAAK,wBAAwB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,cAEpC,wBAAwB,CAAC,CAAC,CAAC;;;;;CA4J7B,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useGetFacetedFilter = void 0;
4
4
  const react_1 = require("react");
5
+ const date_fns_1 = require("date-fns");
5
6
  const useGetFacetedFilter = ({ columns, }) => {
6
7
  const includesSome = (row, columnId, filterValue) => {
7
8
  if (!filterValue ||
@@ -21,17 +22,14 @@ const useGetFacetedFilter = ({ columns, }) => {
21
22
  }
22
23
  const cellValue = row.getValue(columnId);
23
24
  const cellValueStr = cellValue != null ? String(cellValue) : "";
24
- // Handle combined filter object
25
25
  if (typeof filterValue === "object" && !Array.isArray(filterValue)) {
26
26
  const combinedFilterValue = filterValue;
27
27
  const { facets, search } = combinedFilterValue;
28
28
  let matches = true;
29
- // Check search filter
30
29
  if (search && search.trim() !== "") {
31
30
  matches =
32
31
  matches && cellValueStr.toLowerCase().includes(search.toLowerCase());
33
32
  }
34
- // Check facets filter
35
33
  if (facets && facets.length > 0) {
36
34
  matches =
37
35
  matches &&
@@ -39,23 +37,65 @@ const useGetFacetedFilter = ({ columns, }) => {
39
37
  }
40
38
  return matches;
41
39
  }
42
- // Fallback to original logic for backward compatibility
43
40
  if (Array.isArray(filterValue)) {
44
41
  return filterValue.some((filterVal) => String(filterVal) === cellValueStr);
45
42
  }
46
43
  return String(filterValue) === cellValueStr;
47
44
  };
45
+ const parseToDate = (value) => {
46
+ if (value instanceof Date) {
47
+ return value;
48
+ }
49
+ if (typeof value === "string") {
50
+ const parsed = (0, date_fns_1.parseISO)(value);
51
+ if ((0, date_fns_1.isValid)(parsed)) {
52
+ return parsed;
53
+ }
54
+ }
55
+ return null;
56
+ };
57
+ const dateRangeFilter = (row, columnId, filterValue) => {
58
+ if (!Array.isArray(filterValue) || filterValue.length === 0) {
59
+ return true;
60
+ }
61
+ const [startValue, endValue] = filterValue;
62
+ const startDate = parseToDate(startValue);
63
+ const endDate = parseToDate(endValue ?? startValue);
64
+ if (!startDate || !endDate) {
65
+ return true;
66
+ }
67
+ const normalizedStart = new Date(startDate);
68
+ normalizedStart.setHours(0, 0, 0, 0);
69
+ const normalizedEnd = new Date(endDate);
70
+ normalizedEnd.setHours(23, 59, 59, 999);
71
+ const cellValue = row.getValue(columnId);
72
+ const cellDate = parseToDate(cellValue);
73
+ if (!cellDate) {
74
+ const cellString = cellValue != null ? String(cellValue) : "";
75
+ const startString = String(startValue ?? "");
76
+ const endString = typeof endValue === "string" && endValue ? endValue : startString;
77
+ return cellString >= startString && cellString <= endString;
78
+ }
79
+ const cellTime = new Date(cellDate).getTime();
80
+ return (cellTime >= normalizedStart.getTime() &&
81
+ cellTime <= normalizedEnd.getTime());
82
+ };
48
83
  const processedColumns = (0, react_1.useMemo)(() => {
49
84
  return columns.map((col) => {
50
85
  const appCol = col;
51
86
  const { facetedFilter, filterVariant } = appCol;
52
- // If column has both facetedFilter and filterVariant, use combined filter
53
87
  if (facetedFilter && filterVariant) {
54
88
  return {
55
89
  ...col,
56
90
  filterFn: "combinedFilter",
57
91
  };
58
92
  }
93
+ if (filterVariant === "smartDateFilter") {
94
+ return {
95
+ ...col,
96
+ filterFn: "dateRangeFilter",
97
+ };
98
+ }
59
99
  // If only faceted filter, use includesSome
60
100
  if (facetedFilter) {
61
101
  return {
@@ -66,6 +106,6 @@ const useGetFacetedFilter = ({ columns, }) => {
66
106
  return col;
67
107
  });
68
108
  }, [columns]);
69
- return { combinedFilter, includesSome, processedColumns };
109
+ return { combinedFilter, dateRangeFilter, includesSome, processedColumns };
70
110
  };
71
111
  exports.useGetFacetedFilter = useGetFacetedFilter;
@@ -1,9 +1,10 @@
1
1
  import type { AppColumnDef } from "../types";
2
2
  type UseGetRowSelectionProps<T> = {
3
3
  defaultColumn: AppColumnDef<T>[];
4
+ dynamicRowSelection?: (rowNode: T) => boolean;
4
5
  rowSelection: boolean;
5
6
  };
6
- export declare const useGetRowSelection: <T>({ defaultColumn, rowSelection, }: UseGetRowSelectionProps<T>) => {
7
+ export declare const useGetRowSelection: <T>({ defaultColumn, dynamicRowSelection, rowSelection, }: UseGetRowSelectionProps<T>) => {
7
8
  columns: AppColumnDef<T>[];
8
9
  };
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useGetRowSelection.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetRowSelection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,uBAAuB,CAAC,CAAC,IAAI;IAChC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAG,kCAGpC,uBAAuB,CAAC,CAAC,CAAC;;CAsD5B,CAAC"}
1
+ {"version":3,"file":"useGetRowSelection.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useGetRowSelection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,uBAAuB,CAAC,CAAC,IAAI;IAChC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;IAC9C,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAG,uDAIpC,uBAAuB,CAAC,CAAC,CAAC;;CA8H5B,CAAC"}
@@ -4,12 +4,55 @@ exports.useGetRowSelection = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const IndeterminateCheckbox_1 = require("../Components/IndeterminateCheckbox");
7
- const useGetRowSelection = ({ defaultColumn, rowSelection, }) => {
8
- // useCallback ensures the cell/header renderers are stable across renders,
9
- // preventing unnecessary re-renders of table rows and headers
10
- const renderSelectionCell = (0, react_1.useCallback)((info) => ((0, jsx_runtime_1.jsx)(IndeterminateCheckbox_1.IndeterminateCheckbox, { checked: info.row.getIsSelected(), disabled: !info.row.getCanSelect(), indeterminate: info.row.getIsSomeSelected(), onChange: info.row.getToggleSelectedHandler() })), []);
11
- // Memoized header renderer to avoid recreating function on each render
12
- const renderSelectionHeader = (0, react_1.useCallback)((info) => ((0, jsx_runtime_1.jsx)(IndeterminateCheckbox_1.IndeterminateCheckbox, { checked: info.table.getIsAllRowsSelected(), indeterminate: info.table.getIsSomeRowsSelected(), onChange: info.table.getToggleAllRowsSelectedHandler() })), []);
7
+ const useGetRowSelection = ({ defaultColumn, dynamicRowSelection, rowSelection, }) => {
8
+ const renderSelectionCell = (0, react_1.useCallback)((info) => {
9
+ const isSelectable = dynamicRowSelection
10
+ ? dynamicRowSelection(info.row.original)
11
+ : true;
12
+ if (!isSelectable) {
13
+ return null;
14
+ }
15
+ return ((0, jsx_runtime_1.jsx)(IndeterminateCheckbox_1.IndeterminateCheckbox, { checked: info.row.getIsSelected(), disabled: !info.row.getCanSelect(), indeterminate: info.row.getIsSomeSelected(), onChange: info.row.getToggleSelectedHandler() }));
16
+ }, [dynamicRowSelection]);
17
+ const renderSelectionHeader = (0, react_1.useCallback)((info) => {
18
+ if (!dynamicRowSelection) {
19
+ return ((0, jsx_runtime_1.jsx)(IndeterminateCheckbox_1.IndeterminateCheckbox, { checked: info.table.getIsAllRowsSelected(), indeterminate: info.table.getIsSomeRowsSelected(), onChange: info.table.getToggleAllRowsSelectedHandler() }));
20
+ }
21
+ const handleToggleAll = (e) => {
22
+ const { checked } = e.target;
23
+ const rows = info.table.getRowModel().rows;
24
+ info.table.setRowSelection((old) => {
25
+ const newSelection = { ...old };
26
+ // eslint-disable-next-line sonarjs/no-nested-functions
27
+ rows.forEach((row) => {
28
+ if (dynamicRowSelection(row.original)) {
29
+ if (checked) {
30
+ newSelection[row.id] = true;
31
+ }
32
+ else {
33
+ delete newSelection[row.id];
34
+ }
35
+ }
36
+ });
37
+ return newSelection;
38
+ });
39
+ };
40
+ const rows = info.table.getRowModel().rows;
41
+ const rowSelection = info.table.getState().rowSelection;
42
+ let selectableCount = 0;
43
+ let selectedCount = 0;
44
+ for (const row of rows) {
45
+ if (dynamicRowSelection(row.original)) {
46
+ selectableCount++;
47
+ if (rowSelection[row.id]) {
48
+ selectedCount++;
49
+ }
50
+ }
51
+ }
52
+ const allSelected = selectableCount > 0 && selectedCount === selectableCount;
53
+ const someSelected = selectedCount > 0 && selectedCount < selectableCount;
54
+ return ((0, jsx_runtime_1.jsx)(IndeterminateCheckbox_1.IndeterminateCheckbox, { checked: allSelected, indeterminate: someSelected, disabled: selectableCount === 0, onChange: handleToggleAll }));
55
+ }, [dynamicRowSelection]);
13
56
  const dynamicColumns = (0, react_1.useMemo)(() => {
14
57
  return defaultColumn.map((col) => {
15
58
  if (col.filterVariant === "smartNumberFilter" && !col.filterFn) {
@@ -24,13 +67,19 @@ const useGetRowSelection = ({ defaultColumn, rowSelection, }) => {
24
67
  }
25
68
  const selectionColumn = {
26
69
  cell: renderSelectionCell,
70
+ enableSorting: false,
27
71
  header: renderSelectionHeader,
28
72
  id: "select",
29
73
  maxSize: 30,
30
74
  minSize: 30,
31
75
  };
32
76
  return [selectionColumn, ...dynamicColumns];
33
- }, [defaultColumn, rowSelection, renderSelectionCell, renderSelectionHeader]);
77
+ }, [
78
+ dynamicColumns,
79
+ rowSelection,
80
+ renderSelectionCell,
81
+ renderSelectionHeader,
82
+ ]);
34
83
  return { columns };
35
84
  };
36
85
  exports.useGetRowSelection = useGetRowSelection;
@@ -1 +1 @@
1
- {"version":3,"file":"useTableState.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useTableState.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,OAAO,cAAc,CAAC,CAAC,CAAC;;CAgFxD,CAAC"}
1
+ {"version":3,"file":"useTableState.d.ts","sourceRoot":"","sources":["../../../src/SmartGrid/hooks/useTableState.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,OAAO,cAAc,CAAC,CAAC,CAAC;;CAiFxD,CAAC"}
@@ -7,7 +7,7 @@ const useGetFacetedFilter_1 = require("./useGetFacetedFilter");
7
7
  const useGetPinningColumns_1 = require("./useGetPinningColumns");
8
8
  const useTableState = (props) => {
9
9
  const { columns, data } = props;
10
- const { combinedFilter, includesSome, processedColumns } = (0, useGetFacetedFilter_1.useGetFacetedFilter)({
10
+ const { combinedFilter, dateRangeFilter, includesSome, processedColumns } = (0, useGetFacetedFilter_1.useGetFacetedFilter)({
11
11
  columns,
12
12
  });
13
13
  const [sorting, setSorting] = (0, react_1.useState)([]);
@@ -34,6 +34,7 @@ const useTableState = (props) => {
34
34
  enableSorting,
35
35
  filterFns: {
36
36
  combinedFilter,
37
+ dateRangeFilter,
37
38
  includesSome,
38
39
  },
39
40
  getCoreRowModel: (0, react_table_1.getCoreRowModel)(),