rez-table-listing-mui 1.2.8 → 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.8",
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",
@@ -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,6 +172,7 @@ 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} />
@@ -199,7 +187,6 @@ const AttributesFilter = ({
199
187
  {selectedAttributeOptions
200
188
  ?.filter((option) => {
201
189
  if (!searchTerm) return true;
202
-
203
190
  return option.label
204
191
  .toLowerCase()
205
192
  .includes(searchTerm.toLowerCase());
@@ -213,7 +200,7 @@ const AttributesFilter = ({
213
200
  control={
214
201
  <Radio
215
202
  checked={isSelected}
216
- onClick={() => handleMultiRadioToggle(option.value)}
203
+ onChange={() => handleSingleRadioSelect(option.value)}
217
204
  />
218
205
  }
219
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
@@ -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
 
@@ -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