fixed readonly which was missing and made readonly ccpimage fields

This commit is contained in:
dcore94 2023-06-07 18:02:17 +02:00
parent 1a349662ef
commit 466b427367
1 changed files with 16 additions and 7 deletions

View File

@ -72,20 +72,20 @@ class CCPInputWidgetEditorController extends HTMLElement{
<div class="row mb-3">
<div class="col">
<div class="form-field" title="Title">
<input name="title" class="form-control" placeholder="title" value="${this.#input.title}" required="required"/>
<input name="title" class="form-control" placeholder="title" value="${this.#input.title}" required="required" ${ input.id !== 'ccpimage' ? 'readonly : ''}/>
</div>
</div>
</div>
<div class="mb-3">
<div class="form-field" title="description">
<input name="description" class="form-control" placeholder="description" value="${this.#input.description}" required="required"/>
<input name="description" class="form-control" placeholder="description" value="${this.#input.description}" required="required" ${ input.id !== 'ccpimage' ? 'readonly : ''}/>
</div>
</div>
<div class="row mb-3">
<div class="col-3">
<div class="form-field" title="Type">
<label>Type</label>
<select name="type" class="form-control" placeholder="type" value="${this.#input.schema.type}">
<select name="type" class="form-control" placeholder="type" value="${this.#input.schema.type}" ${ input.id !== 'ccpimage' ? 'readonly : ''}>
<option value="string">String</option>
<option value="enum">Enum</option>
</select>
@ -94,13 +94,13 @@ class CCPInputWidgetEditorController extends HTMLElement{
<div class="col">
<div class="form-field" title="Minimum">
<label>Min</label>
<input value="${this.#input.minOccurs}" type="number" min="0" step="1" name="minOccurs" value="${this.#input.minOccurs}" required="required" class="form-control" placeholder="minOccurs"/>
<input value="${this.#input.minOccurs}" type="number" min="0" step="1" name="minOccurs" value="${this.#input.minOccurs}" required="required" class="form-control" placeholder="minOccurs" ${ input.id !== 'ccpimage' ? 'readonly : ''}/>
</div>
</div>
<div class="col">
<div class="form-field" title="Maximum">
<label>Max</label>
<input value="${this.#input.maxOccurs}" type="number" min="0" step="1" name="maxOccurs" value="${this.#input.maxOccurs}" required="required" class="form-control" placeholder="maxOccurs"/>
<input value="${this.#input.maxOccurs}" type="number" min="0" step="1" name="maxOccurs" value="${this.#input.maxOccurs}" required="required" class="form-control" placeholder="maxOccurs" ${ input.id !== 'ccpimage' ? 'readonly : ''}/>
</div>
</div>
</div>
@ -108,7 +108,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
<div class="col-3">
<div class="form-field" title="Format">
<label>Format</label>
<select value="${this.#input.schema.format}" name="format" class="form-control">
<select value="${this.#input.schema.format}" name="format" class="form-control" ${ input.id !== 'ccpimage' ? 'readonly : ''}>
<option value="none" ${this.isSelectedFormat('none') ? "selected" : ""}>None</option>
<option value="date" ${this.isSelectedFormat('date') ? "selected" : ""}>Date</option>
<option value="time" ${this.isSelectedFormat('time') ? "selected" : ""}>Time</option>
@ -122,7 +122,13 @@ class CCPInputWidgetEditorController extends HTMLElement{
<div class="col" title="Mime type">
<label>Mime</label>
<div class="form-field">
<input value="${this.#input.schema.contentMediaType}" name="contentMediaType" class="form-control" placeholder="mime"/>
<input value="${this.#input.schema.contentMediaType}" name="contentMediaType" class="form-control" placeholder="mime" ${ input.id !== 'ccpimage' ? 'readonly : ''}/>
</div>
</div>
<div class="col" title="Read only">
<label>Read only</label>
<div class="form-field">
<input type="checkbox" value="${this.#input.schema.readOnly}" name="readonly" class="form-check-input">
</div>
</div>
</div>
@ -195,6 +201,9 @@ class CCPInputWidgetEditorController extends HTMLElement{
else if(ename === "default"){
this.#input.schema.default = val
}
else if(ename === "readonly"){
this.#input.schema.readOnly = ev.target.checked
}
else if(ename === "type"){
this.#type = ev.target.value
if(this.#type === "enum"){