Bug 41151

Summary: Vue Additional Fields UX Improvements
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Staff interfaceAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: david, gmcharlt, matt.blenkinsop, michaela.sieber, oleonard, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38262    
Bug Blocks:    
Attachments: Bug 41151: Modernize clear button UX in additional fields
Bug 41151: Improve additional fields display alignment and formatting
Bug 41151: Display multi-value additional fields as lists in datatables
Updated table display
Updated input view
Updated display view
Bug 41151: Modernize clear button UX in additional fields
Bug 41151: Improve additional fields display alignment and formatting
Bug 41151: Display multi-value additional fields as lists in datatables
Bug 41151: Modernize clear button UX in additional fields
Bug 41151: Improve additional fields display alignment and formatting
Bug 41151: Display multi-value additional fields as lists in datatables
Bug 41151: Preserve multi-value formatting in datatable exports
Bug 41151: Add optional clear button to standard input components
Bug 41151: Wire clearable prop through FormElement to input components
Bug 41151: Replace FontAwesome icons with SVG and improve input styling

Description Martin Renvoize (ashimema) 2025-10-31 07:43:20 UTC
The additional fields input UI's could do with some improvements as noted in bug 38262.

To summarise:
1) Spacing between 'Clear' and 'New' buttons on input fields needs work
2) When viewing repeatable, searchable fields in display tables we use a comma separated list instead of field per line.
3) When viewing fields in details display the alignment of the addiional field labels and container is inconsistent

I'd go further on point one and ask why we need 'Clear' as a distinct element as it's inconsistent with the 'normal' field entry input boxes.  I think I'd prefer to try and make additional fields as consistent as possible with normal input fields, perhaps embedding a 'x' clear check within the far right of input fields to give that 'Clear' functionality accross both additional field and normal field inputs.
Comment 1 Martin Renvoize (ashimema) 2025-10-31 11:44:22 UTC Comment hidden (obsolete)
Comment 2 Martin Renvoize (ashimema) 2025-10-31 11:44:24 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize (ashimema) 2025-10-31 11:44:26 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2025-10-31 11:49:00 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2025-10-31 11:49:47 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize (ashimema) 2025-10-31 11:50:14 UTC Comment hidden (obsolete)
Comment 7 David Nind 2025-10-31 12:42:04 UTC Comment hidden (obsolete)
Comment 8 David Nind 2025-10-31 12:42:07 UTC Comment hidden (obsolete)
Comment 9 David Nind 2025-10-31 12:42:11 UTC Comment hidden (obsolete)
Comment 10 David Nind 2025-10-31 12:44:59 UTC
Fantastic work Martin!

These changes make adding, editing, and viewing the additional fields for Vue enabled modules much more consistent and usable.

Testing notes (using KTD):

1. Apply patches (and dependencies)
2. Rebuild the JavaScript (yarn js:build or yarn build(?))
3. Restart everything: restart_all
4. Define some additional fields for vendors (Administration > Additional parameters > Additional fields > Acquisitions > E-resource management > Vendors (aqbooksellers:vendor)). Create a combination of additional fields:
  . Single field
  . Repeatable field
  . Field using authorized values (YES_NO)
  . Repeatable field using authorized values (YES_NO)
  . Searchable
  . Repeatable and searchable
5. Define some additional fields for ERM agreements (Administration > Additional parameters > Additional fields > Acquisitions > Vendors > Agreements (erm_agreements))
  . Single field
  . Repeatable field
  . Field using authorized values (YES_NO)
  . Repeatable field using authorized values (YES_NO)
  . Searchable
  . Repeatable and searchable
6. Test additional fields for the ERM module:
   . Enable the ERM module (ERMModule system preference)
   . Create an agreement and add some additional fields
   . View the agreement with the additional fields
   . View the list of agreements
7. Test additional fields for vendors:
   . Create a new vendor and add some additional fields (Acquisitions > + New vendor)
   . View the vendor information with additional fields
   . View the list of vendors
Comment 11 Michaela Sieber 2025-10-31 13:00:54 UTC
I like it ! 
There is only one thing I noticed when exporting a result list:

if you have an additional field that is repeatable it is displayed now as a list with bullets. 
But if you do an export (excel or csv) the values are all in one cell without separators. 
In the past the values were separated with a comma+space
Comment 12 Martin Renvoize (ashimema) 2025-11-01 14:12:30 UTC Comment hidden (obsolete)
Comment 13 Martin Renvoize (ashimema) 2025-11-01 14:12:33 UTC Comment hidden (obsolete)
Comment 14 Martin Renvoize (ashimema) 2025-11-01 14:12:35 UTC Comment hidden (obsolete)
Comment 15 Martin Renvoize (ashimema) 2025-11-01 14:12:38 UTC Comment hidden (obsolete)
Comment 16 Martin Renvoize (ashimema) 2025-11-01 14:14:35 UTC
Thankyou so much for the thorough testing and great spot finding the export issue Michaela, hopefully my additional patch resolves that too now :)
Comment 17 Martin Renvoize (ashimema) 2025-11-01 14:47:41 UTC
Created attachment 188878 [details] [review]
Bug 41151: Add optional clear button to standard input components

This patch enhances the core input components (InputText, InputNumber,
and TextArea) with optional clear button functionality, providing a
consistent UX across both standard fields and additional fields.

Changes:
- Added optional 'clearable' prop (default: true) to all three components
- Implemented clear button with identical styling to additional fields
- Clear button only appears when field has content
- Can be disabled per-field with clearable: false if needed

The clear button:
- Appears as a small 'x' icon on the right side of the input
- Only shows when the field contains a value
- Uses consistent styling and behavior across all input types
- Includes proper ARIA labels for accessibility
- Has hover and focus states for better UX

Usage (enabled by default):
  <InputText v-model="myValue" />
  <InputNumber v-model="myNumber" />
  <TextArea v-model="myText" />

To disable for specific fields:
  <InputText :clearable="false" v-model="myValue" />

This provides developers with a simple, modern clear button UX by
default across all form inputs, ensuring consistency throughout the
entire application.
Comment 18 Martin Renvoize (ashimema) 2025-11-01 14:47:44 UTC
Created attachment 188879 [details] [review]
Bug 41151: Wire clearable prop through FormElement to input components

This patch enables the clearable functionality in forms that use the
BaseResource/FormElement pattern by passing the clearable attribute
from field definitions through to the underlying input components.

Changes:
- Updated FormElement to pass clearable prop to InputText
- Updated FormElement to pass clearable prop to InputNumber
- Updated FormElement to pass clearable prop to TextArea

The logic only passes clearable when explicitly defined in the field
configuration, allowing the component's default (true) to apply when
not specified. This means:

- Fields without clearable attribute: clear button enabled (default)
- Fields with clearable: false: clear button disabled
- Fields with clearable: true: clear button explicitly enabled

All text, number, and textarea fields in BaseResource forms (like
agreements, packages, titles, etc.) now automatically get the clear
button UX unless explicitly disabled.

Example to disable for a specific field:
  {
    name: "my_field",
    type: "text",
    label: $__("My Field"),
    clearable: false,  // Disable clear button for this field
  }

This completes the clear button UX implementation across all form
input patterns in the application.
Comment 19 Martin Renvoize (ashimema) 2025-11-01 14:47:47 UTC
Created attachment 188880 [details] [review]
Bug 41151: Replace FontAwesome icons with SVG and improve input styling

This patch updates all clear buttons with two improvements:

1. Replaced FontAwesome icons with cleaner SVG X icon from vue-select
2. Updated input padding to match Select2/vue-select styling

Changes:
- Replaced <i class="fa fa-times"></i> with SVG in InputText
- Replaced <i class="fa fa-times"></i> with SVG in InputNumber
- Replaced <i class="fa fa-times"></i> with SVG in TextArea
- Replaced <i class="fa fa-times"></i> with SVG in AdditionalFieldsEntry
- Updated CSS from .clear-button i to .clear-button svg
- Added title attribute for better tooltip support
- Updated input padding from just "padding-right: 2rem" to full padding
  specification: "padding: 0.375rem 2rem 0.375rem 0.75rem"
- Added line-height: 1.5 to match Select2 styling

The SVG icon:
- Is the same 10x10 SVG used in vue-select components
- Uses currentColor via fill for proper color inheritance
- Maintains the same hover/focus color transitions (#999 → #333)
- Provides a cleaner, more professional appearance

The improved padding:
- Matches the vertical and horizontal spacing of Select2 dropdowns
- Makes text inputs less "squashed" and more spacious
- Creates visual consistency across all form controls
- Uses Bootstrap's standard input padding (0.375rem vertical, 0.75rem horizontal)

This creates visual consistency between clear buttons and padding across
all input types and the existing Select2/vue-select components.
Comment 20 Martin Renvoize (ashimema) 2025-11-01 14:48:56 UTC
I've added a few more follow-ups to add the clear functionality on to the standard inputs now too.. more consistency accross the board,