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
|
@@ -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
|
-
(
|
|
71
|
-
|
|
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
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
);
|