feat(form): Add clearable functionality to Select component
This commit introduces a new `clearable` prop to the `Select` component, allowing users to easily reset its value. When the `clearable` prop is set to true, a clear button (an 'X' icon) is displayed when an option is selected. Clicking this button resets the select input to its initial placeholder state and triggers an optional `onClear` callback. To support this, the component's internal state management was refactored to control the input's value. Additionally, the `AdminListFilters` component has been updated to: - Utilize the new clearable select for the status filter. - Consolidate multiple search fields (email, username, full_name) into a single generic "search" input. - Add explicit "Reset" and "Apply" buttons for better filter management.
This commit is contained in:
@@ -98,3 +98,15 @@ export function parseWithSchema<T>(
|
||||
throw new Error(`ERROR caught in ${errorContext}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteEmptyKeys = (obj: Record<string, any>) => {
|
||||
const newObj = { ...obj };
|
||||
for (const key in newObj) {
|
||||
if (Object.prototype.hasOwnProperty.call(newObj, key)) {
|
||||
if (!newObj[key]) {
|
||||
delete newObj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user