rez-table-listing-mui 2.0.11 → 2.0.12

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": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
@@ -27,6 +27,10 @@ const FormMultiSelect = ({
27
27
  }) => {
28
28
  const options = dropdownData[filter.filter_attribute] || [];
29
29
 
30
+ // 🔑 single source of truth
31
+ const getOptionValue = (item: DropdownOption) =>
32
+ isFlatJson ? item.label : item.value;
33
+
30
34
  return (
31
35
  <Controller
32
36
  name={`${filter?.filter_attribute_name}.value`}
@@ -65,26 +69,30 @@ const FormMultiSelect = ({
65
69
  const filtered = Array.isArray(selected)
66
70
  ? selected.filter(Boolean)
67
71
  : [];
72
+
68
73
  return filtered
69
- .map(
70
- (val) =>
71
- options.find((item) => item.value === val)?.label || val
72
- )
74
+ .map((val) => {
75
+ const match = options.find(
76
+ (item) => getOptionValue(item) === val
77
+ );
78
+ return match?.label || val;
79
+ })
73
80
  .join(", ");
74
81
  }}
75
82
  >
76
- {options?.map((item, idx) => (
77
- <MenuItem
78
- key={idx}
79
- value={isFlatJson ? item.label : item.value}
80
- >
81
- <Checkbox
82
- checked={cleanedValue.includes(item.value)}
83
- sx={{ marginRight: 1 }}
84
- />
85
- {item.label}
86
- </MenuItem>
87
- ))}
83
+ {options.map((item, idx) => {
84
+ const optionValue = getOptionValue(item);
85
+
86
+ return (
87
+ <MenuItem key={idx} value={optionValue}>
88
+ <Checkbox
89
+ checked={cleanedValue.includes(optionValue)}
90
+ sx={{ marginRight: 1 }}
91
+ />
92
+ {item.label}
93
+ </MenuItem>
94
+ );
95
+ })}
88
96
  </Select>
89
97
  </FormControl>
90
98
  );