fixed bugs with selection and time input

This commit is contained in:
dcore94 2023-02-06 12:08:33 +01:00
parent 23f77df4b8
commit 8ba61ffe36
1 changed files with 11 additions and 11 deletions

View File

@ -29,7 +29,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
}else if(this.#input.schema.format === "date"){
return "date"
}else if(this.#input.schema.format === "time"){
return "type"
return "time"
}else if(this.#input.schema.format === "dateTime"){
return "dateTime"
}
@ -37,7 +37,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
}
isSelectedFormat(fmt){
return this.#input.schema.format === fmt ? 'selected="selected"' : ""
return this.#input.schema.format === fmt
}
render(input, i){
@ -93,13 +93,13 @@ class CCPInputWidgetEditorController extends HTMLElement{
<div class="form-field" title="Format">
<label>Format</label>
<select value="${this.#input.schema.format}" name="format" class="form-control">
<option value="none" selected="${this.isSelectedFormat('none')}">None</option>
<option value="date" selected="${this.isSelectedFormat('date')}">Date</option>
<option value="time" selected="${this.isSelectedFormat('time')}">Time</option>
<option value="dateTime" selected="${this.isSelectedFormat('dateTime')}">Date time</option>
<option value="code" selected="${this.isSelectedFormat('code')}">Code</option>
<option value="file" selected="${this.isSelectedFormat('file')}"}>File</option>
<option value="secret" selected="${this.isSelectedFormat('secret')}">Secret</option>
<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>
<option value="dateTime" ${this.isSelectedFormat('dateTime') ? "selected" : ""}>Date time</option>
<option value="code" ${this.isSelectedFormat('code') ? "selected" : ""}>Code</option>
<option value="file" ${this.isSelectedFormat('file') ? "selected" : ""}>File</option>
<option value="secret" ${this.isSelectedFormat('secret') ? "selected" : ""}>Secret</option>
</select>
</div>
</div>
@ -119,7 +119,7 @@ class CCPInputWidgetEditorController extends HTMLElement{
<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"/>
<span style="user-select:none;position:relative;top:-1.6rem;float:right;cursor:pointer" name="password_toggle" class="${this.isSelectedFormat('secret') === '' ? 'd-none' : 'inline'}">&#128065;</span>
<span style="user-select:none;position:relative;top:-1.6rem;float:right;cursor:pointer" name="password_toggle" class="${this.isSelectedFormat('secret') ? 'inline' : 'd-none'}">&#128065;</span>
</div>
</div>
</div>
@ -195,4 +195,4 @@ class CCPInputWidgetEditorController extends HTMLElement{
}
}
window.customElements.define('d4s-ccp-input-editor', CCPInputWidgetEditorController);
window.customElements.define('d4s-ccp-input-editor', CCPInputWidgetEditorController);