class CCPOutputWidgetEditorController extends HTMLElement { #output = null #index = null #type = null #messages = { "en" : { "output_id_help" : "The Id of the output. This has to be unique accross all the outputs the method", "output_delete_help" : "Delete this output", "output_title_help" : "Title of the output. This is how the output will appear in forms.", "output_description_help" : "A description for this output", "min_occurs_help" : "Minimum cardinality", "max_occurs_help" : "Msximum cardinality", "mimetype_help" : "Set MIME type of expected output", "file_path" : "Path to file", "file_path_help" : "Define the path to the file holding the output. This documents the location of the output in the zip archive returned by the execution. Paths in the execution runtime instead are infrastructure dependant." } } #delete_icon = ` ` getLabel(key, localehint){ const locale = localehint ? localehint : navigator.language const actlocale = this.#messages[locale] ? locale : "en" const msg = this.#messages[actlocale][key] return msg == null || msg == undefined ? key : this.#messages[actlocale][key] } constructor(){ super() } connectedCallback(controller){ } get index(){ return this.#index } render(output, i){ this.#index = i this.#output = output this.#type = output.schema.enum ? "enum" : "string" this.innerHTML = `
${this.renderMetadata()}
` this.addEventListener("input", ev=>{ const val = ev.target.value const ename = ev.target.getAttribute("name") if(ename === "id"){ this.#output.id = val } else if(ename === "title"){ this.#output.title = val } else if(ename === "description"){ this.#output.description = val } else if(ename === "minOccurs"){ this.#output.minOccurs = val } else if(ename === "maxOccurs"){ this.#output.maxOccurs = val } else if(ename === "contentMediaType"){ this.#output.schema.contentMediaType = val } else if(ename === "href"){ this.#output.metadata[0].href = val this.#output.metadata[0].title = val } }) } renderMetadata(output){ if(this.#output.metadata && this.#output.metadata.length > 0){ return `
` }else return "" } } window.customElements.define('d4s-ccp-output-editor', CCPOutputWidgetEditorController);