This commit is contained in:
Lars Westermann 2019-06-13 01:58:58 +02:00
parent 0cb890de07
commit 99bfacbaf0
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
8 changed files with 100 additions and 83 deletions

View file

@ -71,7 +71,7 @@ fun initRoomConstraints() {
for (e in child.children.iterator()) {
if (e is HTMLInputElement && e.name.contains("-day-")) {
val input = InputView.wrap(e)
val input = InputView.wrap(InputType.NUMBER, e)
updateDateView(child, input.value.toIntOrNull() ?: 0)
input.valueProperty.onChange {

View file

@ -100,11 +100,14 @@ fun initWorkGroupConstraints() {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.TEXT).apply {
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-only-before-time-day-${index}"
placeholder = "Tag (optional)"
min = -1337.0
max = 1337.0
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
valueProperty.onChange {
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
@ -126,11 +129,14 @@ fun initWorkGroupConstraints() {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.TEXT).apply {
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-only-after-time-day-${index}"
placeholder = "Tag (optional)"
min = -1337.0
max = 1337.0
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
valueProperty.onChange {
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
@ -152,11 +158,14 @@ fun initWorkGroupConstraints() {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.TEXT).apply {
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-exact-time-day-${index}"
placeholder = "Tag (optional)"
min = -1337.0
max = 1337.0
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
valueProperty.onChange {
updateDateView(this@wrap.html, value.toIntOrNull() ?: 0)
@ -281,7 +290,7 @@ fun initWorkGroupConstraints() {
for (e in child.children.iterator()) {
if (e is HTMLInputElement && e.name.contains("-day-")) {
val input = InputView.wrap(e)
val input = InputView.wrap(InputType.NUMBER, e)
updateDateView(child, input.value.toIntOrNull() ?: 0)
input.valueProperty.onChange {

View file

@ -8,6 +8,7 @@ import de.westermann.kobserve.list.observableListOf
import de.westermann.kobserve.list.sortObservable
import de.westermann.kwebview.View
import de.westermann.kwebview.components.Button
import de.westermann.kwebview.components.InputType
import de.westermann.kwebview.components.InputView
import de.westermann.kwebview.components.ListView
import de.westermann.kwebview.extra.listFactory
@ -24,7 +25,7 @@ class CalendarEdit(
Button.wrap(document.getElementById("calendar-edit-button") as HTMLButtonElement)
val search =
InputView.wrap(view.querySelector(".calendar-edit-search input") as HTMLInputElement)
InputView.wrap(InputType.SEARCH, view.querySelector(".calendar-edit-search input") as HTMLInputElement)
val listView = ListView.wrap<CalendarWorkGroup>(
view.querySelector(".calendar-edit-list") as HTMLElement

View file

@ -2,6 +2,7 @@ package de.kif.frontend.views.table
import de.kif.frontend.launch
import de.kif.frontend.repository.TrackRepository
import de.westermann.kwebview.components.InputType
import de.westermann.kwebview.components.InputView
import de.westermann.kwebview.iterator
import org.w3c.dom.HTMLFormElement
@ -30,7 +31,7 @@ fun initTableLayout() {
}.toList()
val input = form.getElementsByTagName("input")[0] as HTMLInputElement
val search = InputView.wrap(input)
val search = InputView.wrap(InputType.SEARCH, input)
search.valueProperty.onChange {
for (row in list) {
row.search(search.value)

View file

@ -111,7 +111,7 @@ class InputView(
}
companion object {
fun wrap(view: HTMLInputElement) = InputView(InputType.SEARCH, view.value, view)
fun wrap(type: InputType, view: HTMLInputElement) = InputView(type, view.value, view)
}
}

View file

@ -176,6 +176,7 @@ form {
.input-group {
display: flex;
position: relative;
.form-btn {
height: 2.5rem;
@ -215,6 +216,6 @@ form {
line-height: 2.5rem;
margin-left: 1rem;
width: 100%;
top: 2.3rem;
top: 0;
}
}