diff --git a/assets/js/common/ComposedFilter/ComposedFilter.jsx b/assets/js/common/ComposedFilter/ComposedFilter.jsx index 7a5f05f034..4dfb1ff995 100644 --- a/assets/js/common/ComposedFilter/ComposedFilter.jsx +++ b/assets/js/common/ComposedFilter/ComposedFilter.jsx @@ -32,12 +32,14 @@ const renderFilter = (key, { type, ...filterProps }, value, onChange) => { * @param {Object} props.value - Key/value pairs of selected filters, where key is the filter key * @param {Function} props.onChange - Function to call when the composed value changes. If autoApply is true, this function is called on every filter change * @param {Boolean} props.autoApply - If true, onChange is called on every filter change; otherwise, an apply button is shown + * @param {ReactNode} props.children - Additional elements to display after the filters */ function ComposedFilter({ filters = [], onChange, value: initialValue = {}, autoApply, + children, }) { const [value, setValue] = useState(initialValue); const [isChanged, setIsChanged] = useState(false); @@ -56,13 +58,14 @@ function ComposedFilter({ }, [JSON.stringify(initialValue)]); return ( - <> +
{filters .map(({ key, ...rest }) => [key, rest, value[key], onFilterChange(key)]) .map((args) => renderFilter(...args))} {!autoApply && ( -
+
+ {children}
)} - +
); } diff --git a/assets/js/common/DateFilter/DateFilter.jsx b/assets/js/common/DateFilter/DateFilter.jsx index 5e4ce57c34..43b07a3520 100644 --- a/assets/js/common/DateFilter/DateFilter.jsx +++ b/assets/js/common/DateFilter/DateFilter.jsx @@ -110,6 +110,7 @@ function DateTimeInput({ value, onChange }) { * @param {string} props.value - The selected id of the selected option. It accepted either a string or an array with the id as the first element. * @param {boolean} props.prefilled - Whether to include pre-configured options in the options list. Default is true. * @param {function} props.onChange - The callback function to be called when the value of the date filter changes. It will provide a couple with the selected id and the actual date. + * @param {string} props.className - CSS classes to be applied to the component. */ function DateFilter({ options = [], @@ -117,6 +118,7 @@ function DateFilter({ value, prefilled = true, onChange, + className, }) { const ref = useRef(); const [open, setOpen] = useState(false); @@ -132,8 +134,8 @@ function DateFilter({ const text = renderOptionItem(selectedOption, `Filter ${title}...`); return ( -
-
+
+
{selectedOption && ( + +