rez-table-listing-mui 1.2.7 → 1.2.9

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,6 +1,6 @@
1
1
  {
2
2
  "name": "rez-table-listing-mui",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
package/rollup.config.js CHANGED
@@ -15,12 +15,12 @@ export default [
15
15
  {
16
16
  file: packageJson.main,
17
17
  format: "cjs",
18
- sourmap: true,
18
+ sourcemap: true,
19
19
  },
20
20
  {
21
21
  file: packageJson.module,
22
22
  format: "esm",
23
- sourmap: true,
23
+ sourcemap: true,
24
24
  },
25
25
  ],
26
26
  plugins: [
@@ -80,7 +80,11 @@ const ConfirmModal: React.FC<ConfirmModalProps> = ({
80
80
  return (
81
81
  <Dialog
82
82
  open={open}
83
- onClose={handleClose}
83
+ onClose={(event, reason) => {
84
+ if (reason !== "backdropClick" && reason !== "escapeKeyDown") {
85
+ handleClose();
86
+ }
87
+ }}
84
88
  maxWidth={maxWidth}
85
89
  fullWidth={fullWidth}
86
90
  PaperProps={{
@@ -26,7 +26,7 @@ const AttributesFilter = ({
26
26
 
27
27
  const selectedAttribute = filterMaster?.attributes?.selected;
28
28
 
29
- // Get the current filter value(s) to determine selected options
29
+ // Get the current filter value (single selection)
30
30
  const currentFilterValue = useMemo(() => {
31
31
  if (!selectedAttribute) return [];
32
32
 
@@ -61,7 +61,7 @@ const AttributesFilter = ({
61
61
  );
62
62
  };
63
63
 
64
- const handleMultiRadioToggle = (value: string) => {
64
+ const handleSingleRadioSelect = (value: string) => {
65
65
  const selectedAttr = filterMaster?.attributes.selected;
66
66
  if (!selectedAttr) return;
67
67
 
@@ -70,27 +70,13 @@ const AttributesFilter = ({
70
70
  );
71
71
  if (!matchingColumn) return;
72
72
 
73
- const existingFilter = filters.find(
74
- (f) => f.filter_attribute === matchingColumn.attribute_key
75
- );
76
-
77
- const currentValues: string[] = Array.isArray(existingFilter?.filter_value)
78
- ? existingFilter.filter_value
79
- : [];
80
-
81
- const isAlreadySelected = currentValues.includes(value);
82
-
83
- const updatedValues = isAlreadySelected
84
- ? currentValues.filter((v) => v !== value)
85
- : [...currentValues, value];
86
-
87
73
  const defaultOperator =
88
74
  columnsData.operation_list[matchingColumn.data_type]?.[0]?.value || "in";
89
75
 
90
76
  const newFilter = {
91
77
  filter_attribute: matchingColumn.attribute_key,
92
78
  filter_operator: defaultOperator,
93
- filter_value: updatedValues,
79
+ filter_value: [value], // single selection
94
80
  };
95
81
 
96
82
  setFilters((prevFilters) => {
@@ -113,7 +99,7 @@ const AttributesFilter = ({
113
99
  ...prev,
114
100
  attributes: {
115
101
  ...prev.attributes,
116
- radio: updatedValues,
102
+ radio: [value],
117
103
  },
118
104
  activeFilterTabIndex: tabValue as number,
119
105
  };
@@ -137,6 +123,7 @@ const AttributesFilter = ({
137
123
  }}
138
124
  className="attributes-filter-component-wrapper"
139
125
  >
126
+ {/* Attribute Select Dropdown */}
140
127
  <FormControl fullWidth size="small">
141
128
  <Select
142
129
  value={selectedAttribute || ""}
@@ -185,18 +172,21 @@ const AttributesFilter = ({
185
172
  </Select>
186
173
  </FormControl>
187
174
 
175
+ {/* Search and Single Radio Options */}
188
176
  <Box>
189
177
  {selectedAttribute && (
190
178
  <CustomSearch value={searchTerm} onChange={setSearchTerm} />
191
179
  )}
192
180
 
193
181
  {dropdownData && (
194
- <Box sx={{ mt: 2 }}>
182
+ <Box
183
+ className="attributes-filter-list"
184
+ sx={{ mt: 2, overflow: "auto", maxHeight: "calc(100dvh - 300px)" }}
185
+ >
195
186
  <FormControl>
196
187
  {selectedAttributeOptions
197
188
  ?.filter((option) => {
198
189
  if (!searchTerm) return true;
199
-
200
190
  return option.label
201
191
  .toLowerCase()
202
192
  .includes(searchTerm.toLowerCase());
@@ -210,7 +200,7 @@ const AttributesFilter = ({
210
200
  control={
211
201
  <Radio
212
202
  checked={isSelected}
213
- onClick={() => handleMultiRadioToggle(option.value)}
203
+ onChange={() => handleSingleRadioSelect(option.value)}
214
204
  />
215
205
  }
216
206
  label={option.label}
@@ -153,7 +153,11 @@ const FilterForm = ({
153
153
  }, []);
154
154
 
155
155
  return (
156
- <form>
156
+ <form
157
+ onSubmit={(e) => {
158
+ e.preventDefault(); // 🔥 This prevents the page from reloading
159
+ }}
160
+ >
157
161
  <Box sx={editMode ? filterFormStyles.formEditModeStyle : {}}>
158
162
  {editMode && (
159
163
  <Box
@@ -11,7 +11,10 @@ interface TableSearchProps {
11
11
  onChange: (value: string) => void;
12
12
  }
13
13
 
14
- const TableSearch = ({ value, onChange }: TableSearchProps): JSX.Element => {
14
+ export const TableSearch = ({
15
+ value,
16
+ onChange,
17
+ }: TableSearchProps): JSX.Element => {
15
18
  const [showSearchInput, setShowSearchInput] = useState(false);
16
19
  const [localValue, setLocalValue] = useState(value);
17
20
  const searchContainerRef = useRef<HTMLDivElement>(null);
@@ -115,5 +118,3 @@ const TableSearch = ({ value, onChange }: TableSearchProps): JSX.Element => {
115
118
  </Box>
116
119
  );
117
120
  };
118
-
119
- export default TableSearch;
@@ -39,7 +39,7 @@ export function TableTabs({
39
39
  // Normalize tab_value to uppercase for display + logic
40
40
  const normalizedTabs = useMemo(() => {
41
41
  return tabsData
42
- ?.filter((tab) => tab.tab_value)
42
+ ?.filter((tab) => tab.tab_value !== null)
43
43
  ?.map((tab) => ({
44
44
  ...tab,
45
45
  tab_value: tab.tab_value?.toUpperCase(),
@@ -73,7 +73,7 @@ export function TableTabs({
73
73
  value={selectedTab}
74
74
  onChange={(_, newValue) => handleTabClick(newValue)}
75
75
  variant="scrollable"
76
- scrollButtons={false}
76
+ scrollButtons="auto"
77
77
  slotProps={{ indicator: { sx: { display: "none" } } }}
78
78
  sx={tableTabsStyles.tabs}
79
79
  >
@@ -16,7 +16,7 @@ import { useFullscreenPopoverContainer } from "../../libs/hooks/useFullScreen";
16
16
  import SortPopover from "../sorting-modal.tsx";
17
17
  import ColumnToggle from "../column-visibility-modal/index.tsx";
18
18
  import { CraftTableOptionsProps } from "../../types/table-options.ts";
19
- import TableSearch from "../search/index.tsx";
19
+ import { TableSearch } from "../search/index.tsx";
20
20
 
21
21
  interface TopbarProps<T> {
22
22
  table: Table<T>;
@@ -199,9 +199,7 @@ function Topbar<T>({
199
199
  title="Filter"
200
200
  onClick={onFilterButtonClick && onFilterButtonClick}
201
201
  >
202
- <FilterationIcon
203
- color={tableStates.filters.length ? "#1C1B1F" : "#888"}
204
- />
202
+ <FilterationIcon color="#1C1B1F" />
205
203
  </div>
206
204
  )}
207
205
 
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export { useCraftTableFilterSettings } from "./libs/hooks/useCraftTableFilterSet
4
4
  export { TableTabs as CraftTableTabs } from "./components/tabs";
5
5
  export { TableFilter as CraftTableFilter } from "./components/filter";
6
6
  export { QuickFilterSettings as CraftTableSettings } from "./components/table-settings";
7
+ export { TableSearch as CraftTableSearch } from "./components/search";
7
8
 
8
9
  export * from "./types/table";
9
10
  export * from "./types/table-options";
@@ -77,8 +77,8 @@ export function customDebounce<T extends (...args: any[]) => any>(
77
77
  }
78
78
 
79
79
  //ENTITY TYPE
80
- const ENVIRONMENT = "adm_dev";
81
- export const ENTITY_TYPE = "ROL";
80
+ const ENVIRONMENT = "uat";
81
+ export const ENTITY_TYPE = "NTM";
82
82
 
83
83
  const environments = {
84
84
  adm_dev: "http://localhost:4010/api",
@@ -86,7 +86,7 @@ const environments = {
86
86
  uat: "http://13.200.182.92:4010/api",
87
87
  };
88
88
 
89
- const getBaseUrl = () => environments[ENVIRONMENT]
89
+ const getBaseUrl = () => environments[ENVIRONMENT];
90
90
 
91
91
  // uat http://13.200.182.92:4010/api
92
92
  // local http://localhost:4010/api
File without changes