/* import Component from 'formiojs/components/_classes/component/Component'; import componentEditForm from 'formiojs/components/_classes/component/Component.form'; import Components from 'formiojs/components/Components'; */ let Components = Formio.Components let Component = Formio.Components.components.component; let componentEditForm = Formio.Components.components.component.editForm class SpecButton extends Component { static schema(...extend) { return Component.schema({ label: 'SpecButton', key: 'specbutton', type: 'specbutton' }, ...extend); } static get builderInfo() { return { title: 'SpecButton', group: 'basic', icon: 'user', documentation: 'http://help.form.io/userguide/#textfield', weight: 120, schema: SpecButton.schema() }; } get defaultSchema() { return SpecButton.schema(); } get inputInfo() { const info = super.elementInfo(); info.type = 'input'; info.attr.type = 'text'; return info; } render(container) { return super.render(super.renderTemplate('button', { input: { type: 'button', attr: { class: 'btn btn-md btn btn-outline-info' }, content: `<img src=${'https://i.stack.imgur.com/6M513.png'} style="max-width: 35px; border-radius: 50px"/> Cliccami` }, })); } //this.component.customConfiguration.url?this.component.customConfiguration.url: attach(element) { this.loadRefs(element, { button: 'single', buttonMessageContainer: 'single', buttonMessage: 'single' }); const superAttach = super.attach(element); this.attachButton(); return superAttach; } onClick(event) { alert("Questo รจ un bottone custom") } attachButton() { this.addEventListener(this.refs.button, 'click', this.onClick.bind(this)); } } // Use the table component edit form. SpecButton.editForm = componentEditForm; // Register the component to the Formio.Components registry. Components.addComponent('specbutton', SpecButton);