Include the 'clear' button only for non-required fields

This commit is contained in:
Jeremy Stretch 2025-03-20 14:13:18 -04:00
parent d332a0c0d7
commit 9c180c9f75
3 changed files with 7 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@ -5,11 +5,13 @@ interface PluginConfig {
export function getPlugins(element: HTMLSelectElement): object { export function getPlugins(element: HTMLSelectElement): object {
const plugins: PluginConfig = {}; const plugins: PluginConfig = {};
// Enable "clear all" button // Enable "clear all" button for non-required fields
plugins.clear_button = { if (!element.required) {
html: (data: Dict) => plugins.clear_button = {
`<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`, html: (data: Dict) =>
}; `<i class="mdi mdi-close-circle ${data.className}" title="${data.title}"></i>`,
};
}
// Enable individual "remove" buttons for items on multi-select fields // Enable individual "remove" buttons for items on multi-select fields
if (element.hasAttribute('multiple')) { if (element.hasAttribute('multiple')) {