corrected several minor flaws
This commit is contained in:
parent
d76d744e48
commit
b4cc3f40b3
|
@ -31,7 +31,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
|
|||
}else if(this.#input.schema.format === "time"){
|
||||
return "time"
|
||||
}else if(this.#input.schema.format === "dateTime"){
|
||||
return "dateTime"
|
||||
return "datetime-local"
|
||||
}
|
||||
return "text"
|
||||
}
|
||||
|
@ -40,12 +40,24 @@ class CCPInputWidgetEditorController extends HTMLElement{
|
|||
return this.#input.schema.format === fmt
|
||||
}
|
||||
|
||||
render(input, i){
|
||||
renderDefaultByType(){
|
||||
if(this.#input.schema.format === "code"){
|
||||
return `
|
||||
<textarea rows="5" name="default" class="form-control" placeholder="default">${this.#input.schema.default}</textarea>
|
||||
`
|
||||
} else {
|
||||
return `
|
||||
<input type="${this.computeDefaultInputType()}" value="${this.#input.schema.default}" name="default" class="form-control" placeholder="default"/>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
render(input, i, reopen){
|
||||
this.#index = i
|
||||
this.#input = input
|
||||
this.#type = input.schema.enum ? "enum" : "string"
|
||||
this.innerHTML = `
|
||||
<details>
|
||||
<details ${ reopen ? 'open' : ''}>
|
||||
<summary class="mb-3">
|
||||
<input class="form-control" style="width:auto;display:inline" required="required" name="id" value="${this.#input.id}" title="Id of input"/>
|
||||
<button data-index="${this.#index}" name="delete-input" title="Delete" class="btn btn-danger ccp-toolbar-button">
|
||||
|
@ -118,7 +130,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
|
|||
</div>
|
||||
<div name="input-default" class="mb-3">
|
||||
<div class="form-field" title="Default value">
|
||||
<input type="${this.computeDefaultInputType()}" value="${this.#input.schema.default}" name="default" class="form-control" placeholder="default"/>
|
||||
${this.renderDefaultByType()}
|
||||
<span style="user-select:none;position:relative;top:-1.6rem;float:right;cursor:pointer" name="password_toggle" class="${this.isSelectedFormat('secret') ? 'inline' : 'd-none'}">👁</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -154,7 +166,8 @@ class CCPInputWidgetEditorController extends HTMLElement{
|
|||
}
|
||||
else if(ename === "format"){
|
||||
this.#input.schema.format = val
|
||||
this.querySelector("div[name=input-default] span[name=password_toggle]").classList.add("d-none")
|
||||
this.render(this.#input, this.#index, true)
|
||||
/*this.querySelector("div[name=input-default] span[name=password_toggle]").classList.add("d-none")
|
||||
this.querySelector("div[name=input-default] input[name=default]").type = ""
|
||||
if(this.#input.schema.format === "secret"){
|
||||
this.querySelector("div[name=input-default] input[name=default]").type = "password"
|
||||
|
@ -167,7 +180,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
|
|||
this.querySelector("div[name=input-default] input[name=default]").type = "dateTime"
|
||||
}else if(this.#input.schema.format === "file"){
|
||||
this.querySelector("div[name=input-default] input[name=default]").type = "file"
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if(ename === "contentMediaType"){
|
||||
this.#input.schema.contentMediaType = val
|
||||
|
|
Loading…
Reference in New Issue