import {Controller} from "@hotwired/stimulus";
import "tom-select/dist/css/tom-select.bootstrap5.css";
import '../../css/components/tom-select_extensions.css';
import TomSelect from "tom-select";
import {marked} from "marked";
export default class extends Controller {
_tomSelect;
connect() {
let settings = {
allowEmptyOption: true,
searchField: "name",
valueField: "id",
render: {
item: (data, escape) => {
return '' + "" + escape(data.name) + '';
},
option: (data, escape) => {
let tmp = '
' + marked.parseInline(data.description) + '
' + '' + escape(data.category); if (data.footprint) { //If footprint is defined for the part show it next to the category tmp += ' ' + escape(data.footprint); } return tmp + '
' + '