preline
preline copied to clipboard
ComboBox - New methods + bullet proofing
This PR proposes few additions to the ComboBox.
I have tested this with SvelteKit and wrapped the Combox as a Svelte Component with full events and multiple instances of the component on the same page fetching data from difference sources so many copies/instances work seemlessly.
Few fixes/improvements:
- Constructor does not rely on
window.$hsComboBoxCollectionbeing initialised. Thus users for bundlers (vite etc) don't have to load all ofpreline.js. - Fixed an error about invalid nullish statement
- Fetching and rendering items is now bit more bullet proof, ensures that the returned response is iterable.
Additions to the CombBox:
apiSearchQueryTransformerto allow transforming query beforefetch. This is required in case some APIs use more advanced filtering DSL such as Google's AIP-160 for examplefilter=prefix('name', 'sh') OR contains('lastName', 'sh')etc.selectedItem()returns elemnent that was selectedselectedValue()returns the value.selectedAttr(attr)returns the custom attribute.
Few other changes to the package.json (required dependencies added, deprecated type definitions replaced with updated packages), few scripts/watch/commands and generation scripts added.
Don't have full context on design choices so some things might seem absurd and I am here to revise as per your feedback FYI @jahaganiev and @olegpix