mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 01:49:05 +02:00
Improved select controls and added remove_buttons to multiple select inputs
This commit is contained in:
parent
79da0518c2
commit
f6a2467eae
2 changed files with 9 additions and 1 deletions
|
@ -40,7 +40,7 @@ export default class extends Controller {
|
|||
|
||||
|
||||
let settings = {
|
||||
plugins: [],
|
||||
plugins: ["clear_button"],
|
||||
allowEmptyOption: true,
|
||||
selectOnTab: true,
|
||||
maxOptions: null,
|
||||
|
@ -54,6 +54,12 @@ export default class extends Controller {
|
|||
//Load the drag_drop plugin if the select is ordered
|
||||
if (this.element.dataset.orderedValue) {
|
||||
settings.plugins.push('drag_drop');
|
||||
settings.plugins.push("caret_position");
|
||||
}
|
||||
|
||||
//If multiple items can be selected, enable the remove_button plugin
|
||||
if (this.element.multiple) {
|
||||
settings.plugins.push('remove_button');
|
||||
}
|
||||
|
||||
this._tomSelect = new TomSelect(this.element, settings);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
import {Controller} from "@hotwired/stimulus";
|
||||
import TomSelect from "tom-select";
|
||||
|
||||
// TODO: Merge with select_controller.js
|
||||
|
||||
export default class extends Controller {
|
||||
_tomSelect;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue