added setValue method
This commit is contained in:
parent
2a32bd5f63
commit
8d525c829b
|
@ -26,6 +26,10 @@ class CCPInputWidgetController extends HTMLElement {
|
||||||
get value(){
|
get value(){
|
||||||
return this.#renderer.getValue(this)
|
return this.#renderer.getValue(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set value(v){
|
||||||
|
return this.#renderer.setValue(this, v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('d4s-ccp-input', CCPInputWidgetController);
|
window.customElements.define('d4s-ccp-input', CCPInputWidgetController);
|
||||||
|
|
||||||
|
@ -125,6 +129,10 @@ class SimpleInputRenderer extends Renderer{
|
||||||
return parent.querySelector("input").value
|
return parent.querySelector("input").value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("input").value = v
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let required = this.required ? 'required="required"' : ""
|
let required = this.required ? 'required="required"' : ""
|
||||||
let readonly = this.readOnly ? 'readonly="readOnly"' : ""
|
let readonly = this.readOnly ? 'readonly="readOnly"' : ""
|
||||||
|
@ -188,6 +196,10 @@ class FileInputRenderer extends Renderer{
|
||||||
return this.#content
|
return this.#content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("input").value = v
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let required = this.required ? 'required="required"' : ""
|
let required = this.required ? 'required="required"' : ""
|
||||||
let readonly = this.readOnly ? 'readonly="readOnly"' : ""
|
let readonly = this.readOnly ? 'readonly="readOnly"' : ""
|
||||||
|
@ -216,6 +228,10 @@ class SecretInputRenderer extends Renderer{
|
||||||
return parent.querySelector("input").value
|
return parent.querySelector("input").value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("input").value = v
|
||||||
|
}
|
||||||
|
|
||||||
connectedCallback(controller){
|
connectedCallback(controller){
|
||||||
controller.addEventListener("click", ev=>{
|
controller.addEventListener("click", ev=>{
|
||||||
const ename = ev.target.getAttribute("name")
|
const ename = ev.target.getAttribute("name")
|
||||||
|
@ -256,6 +272,10 @@ class DateTimeInputRenderer extends Renderer{
|
||||||
return parent.querySelector("input").value
|
return parent.querySelector("input").value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("input").value = v
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let required = this.required ? 'required="required"' : ""
|
let required = this.required ? 'required="required"' : ""
|
||||||
let readonly = this.schema.readOnly ? 'readonly="readOnly"' : ""
|
let readonly = this.schema.readOnly ? 'readonly="readOnly"' : ""
|
||||||
|
@ -285,6 +305,10 @@ class EnumInputRenderer extends Renderer{
|
||||||
return parent.querySelector("select").value
|
return parent.querySelector("select").value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("select").value = v
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let options = this.schema.enum.map(e => {
|
let options = this.schema.enum.map(e => {
|
||||||
return e === this.schema.default ?
|
return e === this.schema.default ?
|
||||||
|
@ -321,6 +345,10 @@ class CodeInputRenderer extends Renderer{
|
||||||
return parent.querySelector("textarea").textContent
|
return parent.querySelector("textarea").textContent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(parent, v){
|
||||||
|
parent.querySelector("textarea").textContent = v
|
||||||
|
}
|
||||||
|
|
||||||
connectedCallback(controller){
|
connectedCallback(controller){
|
||||||
/*const ta = controller.querySelector("textarea")
|
/*const ta = controller.querySelector("textarea")
|
||||||
const opts = {
|
const opts = {
|
||||||
|
|
Loading…
Reference in New Issue